directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r579416 - in /directory/shared/trunk: ./ ldap-jndi/ ldap-jndi/src/ ldap-jndi/src/main/ ldap-jndi/src/main/java/ ldap-jndi/src/main/java/org/ ldap-jndi/src/main/java/org/apache/ ldap-jndi/src/main/java/org/apache/directory/ ldap-jndi/src/mai...
Date Tue, 25 Sep 2007 23:59:53 GMT
Author: akarasulu
Date: Tue Sep 25 16:59:52 2007
New Revision: 579416

URL: http://svn.apache.org/viewvc?rev=579416&view=rev
Log:
adding module for jndi specific utilities

Added:
    directory/shared/trunk/ldap-jndi/   (with props)
    directory/shared/trunk/ldap-jndi/pom.xml
    directory/shared/trunk/ldap-jndi/src/
    directory/shared/trunk/ldap-jndi/src/main/
    directory/shared/trunk/ldap-jndi/src/main/java/
    directory/shared/trunk/ldap-jndi/src/main/java/org/
    directory/shared/trunk/ldap-jndi/src/main/java/org/apache/
    directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/
    directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/
    directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/
    directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/
    directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/UniversalContextFactory.java
  (with props)
    directory/shared/trunk/ldap-jndi/src/main/resources/
    directory/shared/trunk/ldap-jndi/src/main/resources/META-INF/
    directory/shared/trunk/ldap-jndi/src/test/
    directory/shared/trunk/ldap-jndi/src/test/java/
Modified:
    directory/shared/trunk/pom.xml

Propchange: directory/shared/trunk/ldap-jndi/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Sep 25 16:59:52 2007
@@ -0,0 +1,18 @@
+target
+.deployables
+.wtpmodules
+.settings
+*.iml
+*.ber
+*.log
+.classpath
+.project
+*.iws
+*.ipr
+.clover
+.metadata
+classes
+bin
+build
+.fbprefs
+nbproject

Added: directory/shared/trunk/ldap-jndi/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-jndi/pom.xml?rev=579416&view=auto
==============================================================================
--- directory/shared/trunk/ldap-jndi/pom.xml (added)
+++ directory/shared/trunk/ldap-jndi/pom.xml Tue Sep 25 16:59:52 2007
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<!-- $Rev:  $ $Date:  $ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.directory.shared</groupId>
+    <artifactId>shared-parent</artifactId>
+    <version>0.9.8-SNAPSHOT</version>
+  </parent>
+  <artifactId>shared-ldap-jndi</artifactId>
+  <name>Apache Directory JNDI Shared</name>
+  <packaging>jar</packaging>  
+
+  <description>
+    Shared libraries for client side JNDI handling that may be used 
+    both in the server and in studio.
+  </description>
+  
+  <distributionManagement>
+    <site>
+      <id>apacheds.websites</id>
+      <url>scp://minotaur.apache.org/www/directory.apache.org/newsite/subprojects/jndi-shared/</url>
+    </site>
+  </distributionManagement>
+
+</project>
+

Added: directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/UniversalContextFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/UniversalContextFactory.java?rev=579416&view=auto
==============================================================================
--- directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/UniversalContextFactory.java
(added)
+++ directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/UniversalContextFactory.java
Tue Sep 25 16:59:52 2007
@@ -0,0 +1,86 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.jndi;
+
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.spi.InitialContextFactory;
+
+
+/**
+ * A context factory that delegates calls to the underlying JNDI 
+ * implementation of the JVM.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class UniversalContextFactory implements InitialContextFactory
+{
+    private static final String SUN_ICF_FQCN = "com.sun.jndi.ldap.LdapCtxFactory";
+    private static final String IBM_ICF_FQCN = "com.ibm.jndi.LDAPCtxFactory";
+    private static final String BEA_ICF_FQCN = SUN_ICF_FQCN;  // JRocket might use SUN classes
+    private static final String ICF_FQCN;
+    
+    
+    static
+    {
+        // -------------------------------------------------------------------
+        // for lack of a better approach we're just checking the JVM here and 
+        // setting the ICF_FQCN based on that using a bunch of conditional tests
+        // -------------------------------------------------------------------
+        
+        String jvmVendor = System.getProperty( "java.vm.vendor" );
+        
+        if ( jvmVendor.equalsIgnoreCase( "SUN Microsystems, Inc." ) )
+        {
+            ICF_FQCN = SUN_ICF_FQCN;
+        }
+        else if ( jvmVendor.equalsIgnoreCase( "BEA Systems, Inc." ) )
+        {
+            ICF_FQCN = BEA_ICF_FQCN;
+        }
+        else if ( jvmVendor.equalsIgnoreCase( "IBM, Inc." ) )
+        {
+            ICF_FQCN = IBM_ICF_FQCN;
+        }
+        else
+        {
+            ICF_FQCN = "Unknown";
+        }
+    }
+    
+    
+    private final InitialContextFactory factory;
+    
+    
+    public UniversalContextFactory() throws InstantiationException, IllegalAccessException,
ClassNotFoundException
+    {
+        factory = ( InitialContextFactory ) Class.forName( ICF_FQCN ).newInstance();
+    }
+    
+    
+    public Context getInitialContext( Hashtable<?, ?> env ) throws NamingException
+    {
+        return factory.getInitialContext( env );
+    }
+}

Propchange: directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/UniversalContextFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: directory/shared/trunk/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/trunk/pom.xml?rev=579416&r1=579415&r2=579416&view=diff
==============================================================================
--- directory/shared/trunk/pom.xml (original)
+++ directory/shared/trunk/pom.xml Tue Sep 25 16:59:52 2007
@@ -32,6 +32,7 @@
   <modules>
     <module>asn1</module>
     <module>ldap</module>
+    <module>ldap-jndi</module>
     <module>ldap-constants</module>
     <module>asn1-codec</module>
     <module>convert</module>



Mime
View raw message