Examples of PooledConnection


Examples of anvil.database.PooledConnection

  }

 
  private Object fetchChildren(boolean isTribe)
  {
    PooledConnection connImpl = null;
    DirContext ctx = null;
    ArrayList result = new ArrayList();
 
    try {
      connImpl = realm.getConnection();
      ctx = (DirContext)connImpl.getConnection();
 
      if (isRoot) {
        NamingEnumeration enu = ctx.list(isTribe? "ou=groups" : "ou=users");
 
        while (enu.hasMore()) {
View Full Code Here

Examples of anvil.database.PooledConnection

  private synchronized boolean attach(String dn, Object res) throws OperationFailedException
  {
    if (isRoot) {
      throw new OperationFailedException("Attach operation isn't allowed for synthetic root tribe!");
    }
    PooledConnection connImpl = null;
    DirContext ctx = null;
 
    try {
      connImpl = realm.getConnection();
      ctx = (DirContext)connImpl.getConnection();
 
      //check that this tribe isn't a member of the tribe being attached
      if (res instanceof LDAPTribe) {
        LDAPTribe parentCand = (LDAPTribe)res;
        String parentFail = parentCand.containsName(ctx, parentCand.fetchMembers(ctx), this.dn);
View Full Code Here

Examples of anvil.database.PooledConnection

  private synchronized boolean detach(String dn) throws OperationFailedException
  {
    if (isRoot) {
      throw new OperationFailedException("Detach operation isn't allowed for synthetic root tribe!");
    }
    PooledConnection connImpl = null;
    DirContext ctx = null;
 
    try {
      connImpl = realm.getConnection();
      ctx = (DirContext)connImpl.getConnection();
 
      Attribute currMembers = fetchMembers(ctx);
      String result = containsName(ctx, currMembers, dn);
      if (result != null) {
        currMembers.remove(result);
View Full Code Here

Examples of anvil.database.PooledConnection

  }


  public void remove() throws OperationFailedException
  {
    PooledConnection connImpl = null;
    DirContext ctx = null;
 
    try {
      connImpl = realm.getConnection();
      ctx = (DirContext)connImpl.getConnection();
 
      ctx.unbind(dn);
 
    } catch (NameNotFoundException e) {
      throw new OperationFailedException("Tribe '"+name+"' not found!");
View Full Code Here

Examples of anvil.database.PooledConnection

  public static final Any SUBTREE_SCOPE = Any.create(SearchControls.SUBTREE_SCOPE);
 
 
  private static final PooledConnection acquireConnection(Context context, String ckey)
  {
    PooledConnection connImpl = null;
    javax.naming.Context ctx = null;

    try {

      ConnectionManager manager = context.address().getZone().getManagerFor(ckey);
      connImpl = manager.acquire(ckey);
      return connImpl;

    } catch (CannotReturnPooledConnectionException e) {
      throw context.AcquireError(e.getMessage());
     
    } catch (NoConnectionPoolException e) {
      throw context.AcquireError("No such connection pool: " + ckey);
     
    } catch (Exception e) {
      if (ctx != null) {
        try {
          ctx.close();
        } catch (Exception e2) {
        }
      }
      connImpl.release();
      throw context.exception(e);
    }
  }
View Full Code Here

Examples of anvil.database.PooledConnection

  /// @synopsis NamingContext acquire(string poolName)
  /// @param poolName Configured pool name
  public static final Object[] p_acquire = { null, "key"};
  public static final Any acquire(Context context, String ckey)
  {
    PooledConnection connImpl = acquireConnection(context, ckey);
    if (connImpl == null) {
      return Any.NULL;
    } else {
      return new AnyNamingContext(connImpl);
    }
View Full Code Here

Examples of anvil.database.PooledConnection

  /// @synopsis Connection acquireConnection(string name)
  /// @throws AcquireError
  public static final Object[] p_acquireConnection = { null, "*name", null };
  public Any m_acquireConnection(Context context, String name)
  {
    PooledConnection connection = null;
    try {
      if (_conf.getType() == Configurable.POOL) {
        connection = _conf.getParent().acquireConnection(((PoolPreferences)_conf).getName());
      } else if (_conf instanceof Zone) {
        if (name == null) {
View Full Code Here

Examples of javax.sql.PooledConnection

    private Connection getConnectionNow() throws SQLException {
        if (isDisposed) {
            throw new IllegalStateException("Connection pool has been disposed.");
        }
        PooledConnection pc;
        if (!recycledConnections.isEmpty()) {
            pc = recycledConnections.remove(recycledConnections.size() - 1);
        } else {
            pc = dataSource.getPooledConnection();
        }
        Connection conn = pc.getConnection();
        activeConnections++;
        pc.addConnectionEventListener(this);
        return conn;
    }
View Full Code Here

Examples of javax.sql.PooledConnection

    /**
     * INTERNAL
     */
    public void connectionClosed(ConnectionEvent event) {
        PooledConnection pc = (PooledConnection) event.getSource();
        pc.removeConnectionEventListener(this);
        recycleConnection(pc);
    }
View Full Code Here

Examples of javax.sql.PooledConnection

     *
     * @throws SQLException
     */
    public Connection getConnection() throws SQLException {

        PooledConnection pooledConnection = null;

        synchronized (this) {
            if (!initialized) {
                if (initialSize > maxPoolSize) {
                    throw new SQLException("Initial size of " + initialSize
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.