[ 
https://issues.apache.org/jira/browse/DIRSTUDIO-182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Seelmann resolved DIRSTUDIO-182.
---------------------------------------

    Resolution: Fixed

Fixed here:
  http://svn.apache.org/viewvc?rev=691723&view=rev

o Added preference for the JNDI LDAP context factory to use
o Added auto-detection for Sun and ApacheHarmony factories

Another question: To detect which context factory is available I used the 
following code. It works but I wonder if there's a better way to find out which 
class is available in the class loader?
-------------------------------------------------------------
    public String getDefaultLdapContextFactory()
    {
        String defaultLdapContextFactory = "";

        try
        {
            String sun = "com.sun.jndi.ldap.LdapCtxFactory";
            Class.forName( sun );
            defaultLdapContextFactory = sun;
        }
        catch ( ClassNotFoundException e )
        {
        }
        try
        {
            String apache = 
"org.apache.harmony.jndi.provider.ldap.LdapContextFactory";
            Class.forName( apache );
            defaultLdapContextFactory = apache;
        }
        catch ( ClassNotFoundException e )
        {
        }

        return defaultLdapContextFactory;
    }
-------------------------------------------------------------

> [Ldap][studio] Use property file to designate ldap context factory etc. 
> instead of hard code 
> ---------------------------------------------------------------------------------------------
>
>                 Key: DIRSTUDIO-182
>                 URL: https://issues.apache.org/jira/browse/DIRSTUDIO-182
>             Project: Directory Studio
>          Issue Type: Improvement
>          Components: studio-connection
>            Reporter: spark shen
>            Assignee: Stefan Seelmann
>             Fix For: 1.3.0
>
>
> In the current studio implementation. Connections classes such as 
> JndiConnectionContext hard code ldap environment variables: 
> public void connect( String host, int port, boolean useLdaps, boolean 
> useStartTLS, Control[] connCtls,
>         ExtendedProgressMonitor monitor ) throws NamingException
>     {
>         this.environment = new Hashtable<String, String>();
>         this.environment.put( Context.INITIAL_CONTEXT_FACTORY, " 
> com.sun.jndi.ldap.LdapCtxFactory" ); //$NON-NLS-1$
>         this.environment.put( "java.naming.ldap.version", "3" ); 
> //$NON-NLS-1$ //$NON-NLS-2$
>        // more logic here......
>     }
> Using a jndi.properties file would make the service provider configurable. An 
> advice is to use a preference dialog to enter the right provider.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to