You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2005/09/07 06:26:49 UTC

svn commit: r279243 - in /directory/standalone/trunk/osgi: changepw/ changepw/src/main/java/org/apache/changepw/ dns/ dns/src/main/java/org/apache/dns/ kerberos/ kerberos/src/main/java/org/apache/kerberos/

Author: erodriguez
Date: Tue Sep  6 21:26:40 2005
New Revision: 279243

URL: http://svn.apache.org/viewcvs?rev=279243&view=rev
Log:
Refactored method for getting relative name to remove ldap-common and antlr dependencies in OSGi bundles for Kerberos, Change Password, and DNS.

Modified:
    directory/standalone/trunk/osgi/changepw/project.xml
    directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/Activator.java
    directory/standalone/trunk/osgi/dns/project.xml
    directory/standalone/trunk/osgi/dns/src/main/java/org/apache/dns/Activator.java
    directory/standalone/trunk/osgi/kerberos/project.xml
    directory/standalone/trunk/osgi/kerberos/src/main/java/org/apache/kerberos/Activator.java

Modified: directory/standalone/trunk/osgi/changepw/project.xml
URL: http://svn.apache.org/viewcvs/directory/standalone/trunk/osgi/changepw/project.xml?rev=279243&r1=279242&r2=279243&view=diff
==============================================================================
--- directory/standalone/trunk/osgi/changepw/project.xml (original)
+++ directory/standalone/trunk/osgi/changepw/project.xml Tue Sep  6 21:26:40 2005
@@ -45,25 +45,6 @@
       </properties>
     </dependency>
     <dependency>
-      <!-- bad containment of filter nodes -->
-      <groupId>directory-shared</groupId>
-      <artifactId>ldap-common</artifactId>
-      <version>0.9.2-SNAPSHOT</version>
-      <properties>
-        <osgi.jar.bundle>true</osgi.jar.bundle>
-      </properties>
-    </dependency>
-    <dependency>
-      <!-- bad containment of antlr exceptions -->
-      <groupId>antlr</groupId>
-      <artifactId>antlr</artifactId>
-      <version>2.7.2</version>
-      <url>http://antlr.org/</url>
-      <properties>
-        <osgi.jar.bundle>true</osgi.jar.bundle>
-      </properties>
-    </dependency>
-    <dependency>
       <!-- required to load Configuration base class -->
       <groupId>directory</groupId>
       <artifactId>apacheds-core</artifactId>

Modified: directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/Activator.java
URL: http://svn.apache.org/viewcvs/directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/Activator.java?rev=279243&r1=279242&r2=279243&view=diff
==============================================================================
--- directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/Activator.java (original)
+++ directory/standalone/trunk/osgi/changepw/src/main/java/org/apache/changepw/Activator.java Tue Sep  6 21:26:40 2005
@@ -19,7 +19,9 @@
 
 import java.util.Dictionary;
 import java.util.Hashtable;
+import java.util.Properties;
 
+import javax.naming.CompoundName;
 import javax.naming.Context;
 import javax.naming.Name;
 import javax.naming.NamingException;
@@ -29,7 +31,6 @@
 
 import org.apache.kerberos.store.JndiPrincipalStoreImpl;
 import org.apache.kerberos.store.PrincipalStore;
-import org.apache.ldap.common.name.LdapName;
 import org.apache.mina.registry.ServiceRegistry;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
@@ -183,23 +184,25 @@
 
     private Name getRelativeName( DirContext ctx, String baseDn ) throws BundleException
     {
+        Properties props = new Properties();
+        props.setProperty( "jndi.syntax.direction", "right_to_left" );
+        props.setProperty( "jndi.syntax.separator", "," );
+
         Name searchBaseDn = null;
 
         try
         {
-            LdapName ctxRoot = new LdapName( ctx.getNameInNamespace() );
-            searchBaseDn = new LdapName( baseDn );
+            Name ctxRoot = new CompoundName( ctx.getNameInNamespace(), props );
+            searchBaseDn = new CompoundName( baseDn, props );
 
-            if ( searchBaseDn.startsWith( ctxRoot ) )
+            if ( !searchBaseDn.startsWith( ctxRoot ) )
             {
-                for ( int ii = 0; ii < ctxRoot.size(); ii++ )
-                {
-                    searchBaseDn.remove( 0 );
-                }
+                throw new BundleException( "Invalid search base for Apache profiles." );
             }
-            else
+
+            for ( int ii = 0; ii < ctxRoot.size(); ii++ )
             {
-                throw new BundleException( "Invalid search base for Apache profiles." );
+                searchBaseDn.remove( 0 );
             }
         }
         catch ( NamingException e )

Modified: directory/standalone/trunk/osgi/dns/project.xml
URL: http://svn.apache.org/viewcvs/directory/standalone/trunk/osgi/dns/project.xml?rev=279243&r1=279242&r2=279243&view=diff
==============================================================================
--- directory/standalone/trunk/osgi/dns/project.xml (original)
+++ directory/standalone/trunk/osgi/dns/project.xml Tue Sep  6 21:26:40 2005
@@ -6,7 +6,7 @@
   <currentVersion>0.1.1</currentVersion>
   <properties>
     <osgi.bundle.category>Network Service</osgi.bundle.category>
-    <osgi.import.package>org.apache.ldap.server.jndi,org.apache.ldap.server.configuration,org.osgi.framework,org.apache.mina.registry,org.apache.mina.protocol,org.apache.mina.common,org.osgi.service.cm,org.osgi.util.tracker</osgi.import.package>
+    <osgi.import.package>org.apache.ldap.server.configuration,org.osgi.framework,org.apache.mina.registry,org.apache.mina.protocol,org.apache.mina.common,org.osgi.service.cm,org.osgi.util.tracker</osgi.import.package>
   </properties>
   <package>org.apache.dns</package>
   <shortDescription>Apache DNS Network Service</shortDescription>
@@ -16,25 +16,6 @@
       <groupId>directory-protocols</groupId>
       <artifactId>dns-protocol</artifactId>
       <version>0.3-SNAPSHOT</version>
-      <properties>
-        <osgi.jar.bundle>true</osgi.jar.bundle>
-      </properties>
-    </dependency>
-    <dependency>
-      <!-- bad containment of filter nodes -->
-      <groupId>directory-shared</groupId>
-      <artifactId>ldap-common</artifactId>
-      <version>0.9.3-SNAPSHOT</version>
-      <properties>
-        <osgi.jar.bundle>true</osgi.jar.bundle>
-      </properties>
-    </dependency>
-    <dependency>
-      <!-- bad containment of antlr exceptions -->
-      <groupId>antlr</groupId>
-      <artifactId>antlr</artifactId>
-      <version>2.7.2</version>
-      <url>http://antlr.org/</url>
       <properties>
         <osgi.jar.bundle>true</osgi.jar.bundle>
       </properties>

Modified: directory/standalone/trunk/osgi/dns/src/main/java/org/apache/dns/Activator.java
URL: http://svn.apache.org/viewcvs/directory/standalone/trunk/osgi/dns/src/main/java/org/apache/dns/Activator.java?rev=279243&r1=279242&r2=279243&view=diff
==============================================================================
--- directory/standalone/trunk/osgi/dns/src/main/java/org/apache/dns/Activator.java (original)
+++ directory/standalone/trunk/osgi/dns/src/main/java/org/apache/dns/Activator.java Tue Sep  6 21:26:40 2005
@@ -19,7 +19,9 @@
 
 import java.util.Dictionary;
 import java.util.Hashtable;
+import java.util.Properties;
 
+import javax.naming.CompoundName;
 import javax.naming.Context;
 import javax.naming.Name;
 import javax.naming.NamingException;
@@ -29,8 +31,6 @@
 
 import org.apache.dns.store.JndiRecordStoreImpl;
 import org.apache.dns.store.RecordStore;
-import org.apache.ldap.common.name.LdapName;
-import org.apache.ldap.server.jndi.CoreContextFactory;
 import org.apache.mina.registry.ServiceRegistry;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
@@ -184,23 +184,25 @@
 
     private Name getRelativeName( DirContext ctx, String baseDn ) throws BundleException
     {
+        Properties props = new Properties();
+        props.setProperty( "jndi.syntax.direction", "right_to_left" );
+        props.setProperty( "jndi.syntax.separator", "," );
+
         Name searchBaseDn = null;
 
         try
         {
-            LdapName ctxRoot = new LdapName( ctx.getNameInNamespace() );
-            searchBaseDn = new LdapName( baseDn );
+            Name ctxRoot = new CompoundName( ctx.getNameInNamespace(), props );
+            searchBaseDn = new CompoundName( baseDn, props );
 
-            if ( searchBaseDn.startsWith( ctxRoot ) )
+            if ( !searchBaseDn.startsWith( ctxRoot ) )
             {
-                for ( int ii = 0; ii < ctxRoot.size(); ii++ )
-                {
-                    searchBaseDn.remove( 0 );
-                }
+                throw new BundleException( "Invalid search base for Apache DNS records." );
             }
-            else
+
+            for ( int ii = 0; ii < ctxRoot.size(); ii++ )
             {
-                throw new BundleException( "Invalid search base for Apache DNS records." );
+                searchBaseDn.remove( 0 );
             }
         }
         catch ( NamingException e )
@@ -217,7 +219,7 @@
         env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
         env.put( Context.SECURITY_AUTHENTICATION, "simple" );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
-        env.put( Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName() );
+        env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.ldap.server.jndi.CoreContextFactory" );
 
         env.put( DNS_ENTRY_BASEDN_KEY, "ou=example.com,ou=forward lookup zones,ou=dns,ou=system" );
     }

Modified: directory/standalone/trunk/osgi/kerberos/project.xml
URL: http://svn.apache.org/viewcvs/directory/standalone/trunk/osgi/kerberos/project.xml?rev=279243&r1=279242&r2=279243&view=diff
==============================================================================
--- directory/standalone/trunk/osgi/kerberos/project.xml (original)
+++ directory/standalone/trunk/osgi/kerberos/project.xml Tue Sep  6 21:26:40 2005
@@ -45,25 +45,6 @@
       </properties>
     </dependency>
     <dependency>
-      <!-- bad containment of filter nodes -->
-      <groupId>directory-shared</groupId>
-      <artifactId>ldap-common</artifactId>
-      <version>0.9.2-SNAPSHOT</version>
-      <properties>
-        <osgi.jar.bundle>true</osgi.jar.bundle>
-      </properties>
-    </dependency>
-    <dependency>
-      <!-- bad containment of antlr exceptions -->
-      <groupId>antlr</groupId>
-      <artifactId>antlr</artifactId>
-      <version>2.7.2</version>
-      <url>http://antlr.org/</url>
-      <properties>
-        <osgi.jar.bundle>true</osgi.jar.bundle>
-      </properties>
-    </dependency>
-    <dependency>
       <!-- required to load Configuration base class -->
       <groupId>directory</groupId>
       <artifactId>apacheds-core</artifactId>

Modified: directory/standalone/trunk/osgi/kerberos/src/main/java/org/apache/kerberos/Activator.java
URL: http://svn.apache.org/viewcvs/directory/standalone/trunk/osgi/kerberos/src/main/java/org/apache/kerberos/Activator.java?rev=279243&r1=279242&r2=279243&view=diff
==============================================================================
--- directory/standalone/trunk/osgi/kerberos/src/main/java/org/apache/kerberos/Activator.java (original)
+++ directory/standalone/trunk/osgi/kerberos/src/main/java/org/apache/kerberos/Activator.java Tue Sep  6 21:26:40 2005
@@ -19,7 +19,9 @@
 
 import java.util.Dictionary;
 import java.util.Hashtable;
+import java.util.Properties;
 
+import javax.naming.CompoundName;
 import javax.naming.Context;
 import javax.naming.Name;
 import javax.naming.NamingException;
@@ -29,7 +31,6 @@
 
 import org.apache.kerberos.store.JndiPrincipalStoreImpl;
 import org.apache.kerberos.store.PrincipalStore;
-import org.apache.ldap.common.name.LdapName;
 import org.apache.mina.registry.ServiceRegistry;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
@@ -183,23 +184,25 @@
 
     private Name getRelativeName( DirContext ctx, String baseDn ) throws BundleException
     {
+        Properties props = new Properties();
+        props.setProperty( "jndi.syntax.direction", "right_to_left" );
+        props.setProperty( "jndi.syntax.separator", "," );
+
         Name searchBaseDn = null;
 
         try
         {
-            LdapName ctxRoot = new LdapName( ctx.getNameInNamespace() );
-            searchBaseDn = new LdapName( baseDn );
+            Name ctxRoot = new CompoundName( ctx.getNameInNamespace(), props );
+            searchBaseDn = new CompoundName( baseDn, props );
 
-            if ( searchBaseDn.startsWith( ctxRoot ) )
+            if ( !searchBaseDn.startsWith( ctxRoot ) )
             {
-                for ( int ii = 0; ii < ctxRoot.size(); ii++ )
-                {
-                    searchBaseDn.remove( 0 );
-                }
+                throw new BundleException( "Invalid search base for Apache profiles." );
             }
-            else
+
+            for ( int ii = 0; ii < ctxRoot.size(); ii++ )
             {
-                throw new BundleException( "Invalid search base for Apache profiles." );
+                searchBaseDn.remove( 0 );
             }
         }
         catch ( NamingException e )