You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "spark shen (JIRA)" <ji...@apache.org> on 2007/09/05 11:14:33 UTC

[jira] Created: (DIRSTUDIO-182) [Ldap][studio] Use property file to designate ldap context factory etc. instead of hard code

[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


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.


[jira] Resolved: (DIRSTUDIO-182) [Ldap][studio] Use property file to designate ldap context factory etc. instead of hard code

Posted by "Stefan Seelmann (JIRA)" <ji...@apache.org>.
     [ 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.


[jira] Closed: (DIRSTUDIO-182) [Ldap][studio] Use property file to designate ldap context factory etc. instead of hard code

Posted by "Pierre-Arnaud Marcelot (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSTUDIO-182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pierre-Arnaud Marcelot closed DIRSTUDIO-182.
--------------------------------------------


> [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.


[jira] Updated: (DIRSTUDIO-182) [Ldap][studio] Use property file to designate ldap context factory etc. instead of hard code

Posted by "Stefan Seelmann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSTUDIO-182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Seelmann updated DIRSTUDIO-182:
--------------------------------------

    Fix Version/s: 1.3.0
         Assignee: Stefan Seelmann

> [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.