public DirContext getSchema(Name name) throws NamingException {
   if (name.size() == 1) {
     return getSchema(name.get(0));
   } else {
     DirContext ctx = getContinuationDirContext(name);
     try {
       return ctx.getSchema(name.getSuffix(1));
     } finally {
       ctx.close();
     }
   }
 }
示例#2
0
 private void dirContextmethods() {
   System.out.println("Inside dirContextmethods");
   DirContext ctx = LDAPConstants.getLdapContext();
   String baseDN = "OU=Staff,OU=Accounts,O=ibo,DC=adld,DC=ibo,DC=org";
   DirContext schemaname;
   try {
     schemaname = ctx.getSchema(baseDN);
     System.out.println("schemaname-" + schemaname.toString());
   } catch (NamingException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
 public DirContext getSchema(String name) throws NamingException {
   ResolveResult res = getRootURLContext(name, myEnv);
   DirContext ctx = (DirContext) res.getResolvedObj();
   return ctx.getSchema(res.getRemainingName());
 }