Package anvil.database

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


  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

  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

  }


  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

  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

  /// @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

  /// @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

TOP

Related Classes of anvil.database.PooledConnection

Copyright © 2018 www.massapicom. 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.