Package anvil.server

Examples of anvil.server.OperationFailedException



  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);
        if (parentFail != null) {
          throw new OperationFailedException("Loops not allowed, '"+dn+"' is parent of of '"+this.dn+"'");
        }
      }
     
      Attribute currMembers = fetchMembers(ctx);
      String failer = containsName(ctx, currMembers, dn);
      if (failer == null) {
        currMembers.add(dn);
        Attributes attrs = new BasicAttributes();
        attrs.put(currMembers);
       
        ctx.modifyAttributes(this.dn, DirContext.REPLACE_ATTRIBUTE, attrs);
        return true;
      }
 
    } catch (Exception e) {
      throw new OperationFailedException(e);
     
    } finally {
      LDAPRealm.cleanupContext(connImpl);
    }
    return false;
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);
        Attributes attrs = new BasicAttributes();
        attrs.put(currMembers);
     
        ctx.modifyAttributes(this.dn, DirContext.REPLACE_ATTRIBUTE, attrs);
       
        return true;
      }
 
    } catch (Exception e) {
      throw new OperationFailedException(e);
     
    } finally {
      LDAPRealm.cleanupContext(connImpl);
    }
    return false;
View Full Code Here

     
      //toimiiko jos prefixi� ei ole???
      if (cand.toLowerCase().startsWith("cn")) {
        String res = containsName(ctx, fetchMembers(ctx, candName.getSuffix(candName.size()-2).toString()), dn);
        if (res != null) {
          throw new OperationFailedException("Loops not allowed, '"+dn+"' is already a member of '"+cand+"'");
        }
      }
    }
    return null;
  }
View Full Code Here

      ctx = (DirContext)connImpl.getConnection();
 
      ctx.unbind(dn);
 
    } catch (NameNotFoundException e) {
      throw new OperationFailedException("Tribe '"+name+"' not found!");

    } catch (Exception e) {
      throw new OperationFailedException(e.getMessage());
     
    } finally {
      LDAPRealm.cleanupContext(connImpl);
    }
  }
View Full Code Here

TOP

Related Classes of anvil.server.OperationFailedException

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.