Apache Directory Project - Re: [ldapserver][schema] How to programmatically extract schema information

This is Interesting: Free IT Magazines  
Home > Archive > Apache Directory Project > November 2007 > Re: [ldapserver][schema] How to programmatically extract schema information





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: [ldapserver][schema] How to programmatically extract schema information
Emmanuel Lecharny

2007-11-01, 7:11 am

Spark Shen wrote:
> Hi
>
> I am now using DS server (apacheds-main-0.9.3.jar) for writing test
> cases. But I encounter problems when listing schema.
> Problem Description:
> 1. Construct server context
> configuration = new MutableServerStartupConfiguration();
> configuration.setWorkingDirectory(new File(workingDir));
> cleanWorkingDir(configuration.getWorkingDirectory());
> port = AvailablePortFinder.getNextAvailable(1024);
> configuration.setLdapPort(port);
> // configuration.setShutdownHookEnabled(false);
> serverEnv = new Hashtable<String, Object>(configuration
> .toJndiEnvironment());
>
> serverEnv.put(Context.INITIAL_CONTEXT_FACTORY,
> ServerContextFactory.class.getName());
>
> serverEnv.put(Context.PROVIDER_URL, "");
>
> serverEnv.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
> serverEnv.put(Context.SECURITY_CREDENTIALS , "secret");
> serverEnv.put(Context.SECURITY_AUTHENTICATION, "simple");
> rootDSE = new InitialLdapContext(serverEnv, null);
>
> 2. List schema for this context
>
> DirContext pairs = super.rootDSE.getSchema("");
> NamingEnumeration<NameClassPair> ps =
> pairs.list("objectClasses");
> while(ps.hasMore()) {
> System.out.println(ps.next());
> }
>
> And 'java.lang.UnsupportedOperationException' was thrown. I did not
> find a quick instruction
> on how to list schemas, would anyone give a hand?

What about switching to ADS 1.0.2 instead of a badly outdated 0.9.3
version ?

>
> --
> Spark Shen
> China Software Development Lab, IBM



--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com