* @author Olivier Lamy
* @since 1.4-M4
*/
-@Service( "userConfiguration#archiva" )
+@Service("userConfiguration#archiva")
public class DefaultRedbackRuntimeConfigurationAdmin
implements RedbackRuntimeConfigurationAdmin, UserConfiguration
{
private ArchivaConfiguration archivaConfiguration;
@Inject
- @Named( value = "userConfiguration#redback" )
+ @Named(value = "userConfiguration#redback")
UserConfiguration userConfiguration;
@Inject
- @Named( value = "cache#users" )
+ @Named(value = "cache#users")
private Cache usersCache;
@PostConstruct
ldapConfiguration.getBaseDn() ) );
ldapConfiguration.setContextFactory(
- userConfiguration.getString( UserConfigurationKeys.LDAP_CONTEX_FACTORY, null ) );
+ userConfiguration.getString( UserConfigurationKeys.LDAP_CONTEX_FACTORY,
+ isSunContextFactoryAvailable()
+ ? "com.sun.jndi.ldap.LdapCtxFactory"
+ : "" ) );
ldapConfiguration.setBindDn(
userConfiguration.getConcatenatedList( UserConfigurationKeys.LDAP_BINDDN, null ) );
ldapConfiguration.setPassword(
}
}
+ private boolean isSunContextFactoryAvailable()
+ {
+ try
+ {
+ return Thread.currentThread().getContextClassLoader().loadClass( "com.sun.jndi.ldap.LdapCtxFactory" )
+ != null;
+ }
+ catch ( ClassNotFoundException e )
+ {
+ return false;
+ }
+ }
+
public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
{
return build( archivaConfiguration.getConfiguration().getRedbackRuntimeConfiguration() );