You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/01/06 19:27:19 UTC
svn commit: r896599 [27/30] - in /directory/apacheds/trunk: ./
avl-partition/ avl-partition/src/ avl-partition/src/main/
avl-partition/src/main/java/ avl-partition/src/main/java/org/
avl-partition/src/main/java/org/apache/ avl-partition/src/main/java/o...
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsIT.java Wed Jan 6 18:26:43 2010
@@ -20,28 +20,21 @@
package org.apache.directory.server.ssl;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.security.KeyStore;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
-import java.util.Set;
-import javax.naming.AuthenticationNotSupportedException;
import javax.naming.Context;
-import javax.naming.NameNotFoundException;
import javax.naming.NamingEnumeration;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.InitialLdapContext;
@@ -51,15 +44,14 @@
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
+import org.apache.directory.server.annotations.CreateLdapServer;
+import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.annotations.CreateDS;
import org.apache.directory.server.core.entry.ClonedServerEntry;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.integ.Level;
-import org.apache.directory.server.core.integ.annotations.CleanupLevel;
-import org.apache.directory.server.core.security.TlsKeyGenerator;
-import org.apache.directory.server.integ.ServerIntegrationUtils;
-import org.apache.directory.server.integ.SiRunner;
-import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.server.ldap.handlers.extended.StartTlsHandler;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.junit.After;
import org.junit.Before;
@@ -69,12 +61,6 @@
import org.slf4j.LoggerFactory;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-
/**
* Test case to verify proper operation of confidentiality requirements as
* specified in https://issues.apache.org/jira/browse/DIRSERVER-1189.
@@ -86,9 +72,17 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev: 639006 $
*/
-@RunWith ( SiRunner.class )
-@CleanupLevel ( Level.SUITE )
-public class StartTlsIT
+@RunWith ( FrameworkRunner.class )
+@CreateDS( allowAnonAccess=true, name="StartTlsIT-class")
+@CreateLdapServer (
+ transports =
+ {
+ @CreateTransport( protocol = "LDAP" ),
+ @CreateTransport( protocol = "LDAPS" )
+ },
+ extendedOpHandlers={ StartTlsHandler.class }
+ )
+public class StartTlsIT extends AbstractLdapTestUnit
{
private static final Logger LOG = LoggerFactory.getLogger( StartTlsIT.class );
private static final String[] CERT_IDS = new String[] { "userCertificate" };
@@ -97,7 +91,6 @@
private File ksFile;
- public static LdapServer ldapServer;
boolean oldConfidentialityRequiredValue;
@@ -120,7 +113,6 @@
}
ksFile = File.createTempFile( "testStore", "ks" );
-
CoreSession session = ldapServer.getDirectoryService().getAdminSession();
ClonedServerEntry entry = session.lookup( new LdapDN( "uid=admin,ou=system" ), CERT_IDS );
byte[] userCertificate = entry.get( CERT_IDS[0] ).getBytes();
@@ -155,149 +147,6 @@
}
- private LdapContext getSecuredContext() throws Exception
- {
- System.setProperty ( "javax.net.ssl.trustStore", ksFile.getAbsolutePath() );
- System.setProperty ( "javax.net.ssl.keyStore", ksFile.getAbsolutePath() );
- System.setProperty ( "javax.net.ssl.keyStorePassword", "changeit" );
- LOG.debug( "testStartTls() test starting ... " );
-
- // Set up environment for creating initial context
- Hashtable<String, Object> env = new Hashtable<String,Object>();
- env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
-
- // Must use the name of the server that is found in its certificate?
- env.put( Context.PROVIDER_URL, "ldap://localhost:" + ldapServer.getPort() );
-
- // Create initial context
- LOG.debug( "About to get initial context" );
- LdapContext ctx = new InitialLdapContext( env, null );
-
- // Start TLS
- LOG.debug( "About send startTls extended operation" );
- StartTlsResponse tls = ( StartTlsResponse ) ctx.extendedOperation( new StartTlsRequest() );
- LOG.debug( "Extended operation issued" );
- tls.setHostnameVerifier( new HostnameVerifier() {
- public boolean verify( String hostname, SSLSession session )
- {
- return true;
- }
- } );
- LOG.debug( "TLS negotion about to begin" );
- tls.negotiate();
- return ctx;
- }
-
-
- /**
- * Checks to make sure insecure binds fail while secure binds succeed.
- */
- @Test
- public void testConfidentiality() throws Exception
- {
- ldapServer.setConfidentialityRequired( true );
-
- // -------------------------------------------------------------------
- // Unsecured bind should fail
- // -------------------------------------------------------------------
-
- try
- {
- ServerIntegrationUtils.getWiredContext( ldapServer );
- fail( "Should not get here due to violation of confidentiality requirements" );
- }
- catch( AuthenticationNotSupportedException e )
- {
- }
-
- // -------------------------------------------------------------------
- // get anonymous connection with StartTLS (no bind request sent)
- // -------------------------------------------------------------------
-
- LdapContext ctx = getSecuredContext();
- assertNotNull( ctx );
-
- // -------------------------------------------------------------------
- // upgrade connection via bind request (same physical connection - TLS)
- // -------------------------------------------------------------------
-
- ctx.addToEnvironment( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
- ctx.addToEnvironment( Context.SECURITY_CREDENTIALS, "secret" );
- ctx.addToEnvironment( Context.SECURITY_AUTHENTICATION, "simple" );
- ctx.reconnect( null );
-
- // -------------------------------------------------------------------
- // do a search and confirm
- // -------------------------------------------------------------------
-
- NamingEnumeration<SearchResult> results = ctx.search( "ou=system", "(objectClass=*)", new SearchControls() );
- Set<String> names = new HashSet<String>();
- while( results.hasMore() )
- {
- names.add( results.next().getName() );
- }
- results.close();
- assertTrue( names.contains( "prefNodeName=sysPrefRoot" ) );
- assertTrue( names.contains( "ou=users" ) );
- assertTrue( names.contains( "ou=configuration" ) );
- assertTrue( names.contains( "uid=admin" ) );
- assertTrue( names.contains( "ou=groups" ) );
-
- // -------------------------------------------------------------------
- // do add and confirm
- // -------------------------------------------------------------------
-
- Attributes attrs = new BasicAttributes( "objectClass", "person", true );
- attrs.put( "sn", "foo" );
- attrs.put( "cn", "foo bar" );
- ctx.createSubcontext( "cn=foo bar,ou=system", attrs );
- assertNotNull( ctx.lookup( "cn=foo bar,ou=system" ) );
-
- // -------------------------------------------------------------------
- // do modify and confirm
- // -------------------------------------------------------------------
-
- ModificationItem[] mods = new ModificationItem[] {
- new ModificationItem( DirContext.ADD_ATTRIBUTE, new BasicAttribute( "cn", "fbar" ) )
- };
- ctx.modifyAttributes( "cn=foo bar,ou=system", mods );
- Attributes reread = ( Attributes ) ctx.getAttributes( "cn=foo bar,ou=system" );
- assertTrue( reread.get( "cn" ).contains( "fbar" ) );
-
- // -------------------------------------------------------------------
- // do rename and confirm
- // -------------------------------------------------------------------
-
- ctx.rename( "cn=foo bar,ou=system", "cn=fbar,ou=system" );
- try
- {
- ctx.getAttributes( "cn=foo bar,ou=system" );
- fail( "old name of renamed entry should not be found" );
- }
- catch ( NameNotFoundException e )
- {
- }
- reread = ( Attributes ) ctx.getAttributes( "cn=fbar,ou=system" );
- assertTrue( reread.get( "cn" ).contains( "fbar" ) );
-
- // -------------------------------------------------------------------
- // do delete and confirm
- // -------------------------------------------------------------------
-
- ctx.destroySubcontext( "cn=fbar,ou=system" );
- try
- {
- ctx.getAttributes( "cn=fbar,ou=system" );
- fail( "deleted entry should not be found" );
- }
- catch ( NameNotFoundException e )
- {
- }
-
- ctx.close();
- }
-
-
private void search( int ii, LdapContext securedContext ) throws Exception
{
SearchControls controls = new SearchControls();
@@ -392,69 +241,4 @@
ctx.close();
}
}
-
- /**
- * Test for DIRSERVER-1373.
- */
- @Test
- public void testUpdateCertificate() throws Exception
- {
- // create a secure connection
- Hashtable<String, String> env = new Hashtable<String, String>();
- env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" );
- env.put( "java.naming.provider.url", "ldap://localhost:" + ldapServer.getPort() );
- env.put( "java.naming.security.principal", "uid=admin,ou=system" );
- env.put( "java.naming.security.credentials", "secret" );
- env.put( "java.naming.security.authentication", "simple" );
- LdapContext ctx = new InitialLdapContext( env, null );
- StartTlsResponse tls = ( StartTlsResponse ) ctx.extendedOperation( new StartTlsRequest() );
- tls.setHostnameVerifier( new HostnameVerifier() {
- public boolean verify( String hostname, SSLSession session )
- {
- return true;
- }
- } );
- tls.negotiate( BogusSSLContextFactory.getInstance( false ).getSocketFactory() );
-
- // create a new certificate
- String newIssuerDN = "cn=new_issuer_dn";
- String newSubjectDN = "cn=new_subject_dn";
- ServerEntry entry = ldapServer.getDirectoryService().getAdminSession().lookup(
- new LdapDN( "uid=admin,ou=system" ) );
- TlsKeyGenerator.addKeyPair( entry, newIssuerDN, newSubjectDN, "RSA" );
-
- // now update the certificate (over the wire)
- ModificationItem[] mods = new ModificationItem[3];
- mods[0] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(
- TlsKeyGenerator.PRIVATE_KEY_AT, entry.get( TlsKeyGenerator.PRIVATE_KEY_AT ).getBytes() ) );
- mods[1] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(
- TlsKeyGenerator.PUBLIC_KEY_AT, entry.get( TlsKeyGenerator.PUBLIC_KEY_AT ).getBytes() ) );
- mods[2] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(
- TlsKeyGenerator.USER_CERTIFICATE_AT, entry.get( TlsKeyGenerator.USER_CERTIFICATE_AT ).getBytes() ) );
- ctx.modifyAttributes( "uid=admin,ou=system", mods );
- ctx.close();
-
- ldapServer.reloadSslContext();
-
- // create a new secure connection
- ctx = new InitialLdapContext( env, null );
- tls = ( StartTlsResponse ) ctx.extendedOperation( new StartTlsRequest() );
- tls.setHostnameVerifier( new HostnameVerifier() {
- public boolean verify( String hostname, SSLSession session )
- {
- return true;
- }
- } );
- tls.negotiate( BogusSSLContextFactory.getInstance( false ).getSocketFactory() );
-
- // check the received certificate, it must contain the updated server certificate
- X509Certificate[] lastReceivedServerCertificates = BogusTrustManagerFactory.lastReceivedServerCertificates;
- assertNotNull( lastReceivedServerCertificates );
- assertEquals( 1, lastReceivedServerCertificates.length );
- String issuerDN = lastReceivedServerCertificates[0].getIssuerDN().getName();
- String subjectDN = lastReceivedServerCertificates[0].getSubjectDN().getName();
- assertEquals( "Expected the new certificate with the new issuer", newIssuerDN.toLowerCase(), issuerDN.toLowerCase() );
- assertEquals( "Expected the new certificate with the new subject", newSubjectDN.toLowerCase(), subjectDN.toLowerCase() );
- }
-
}
Modified: directory/apacheds/trunk/server-integ/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/resources/log4j.properties?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/resources/log4j.properties (original)
+++ directory/apacheds/trunk/server-integ/src/test/resources/log4j.properties Wed Jan 6 18:26:43 2010
@@ -19,14 +19,3 @@
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
-log4j.logger.org.apache.directory.server.core.integ=ERROR
-
-#log4j.logger.org.apache.directory.server.integ=DEBUG
-#log4j.logger.org.apache.directory.server=DEBUG
-#log4j.logger.org.apache.directory.server.core=ERROR
-#log4j.logger.org.apache.directory.shared=DEBUG
-#log4j.logger.org.apache.directory.server.schema=ERROR
-#log4j.logger.org.apache.directory.server.referral.ReferralIT=DEBUG
-#log4j.logger.org.apache.directory.server.operations=DEBUG
-#log4j.logger.org.apache.directory.shared.asn1.ber=WARN
-#log4j.logger.org.apache.directory.shared.ldap.codec=WARN
Modified: directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java (original)
+++ directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java Wed Jan 6 18:26:43 2010
@@ -20,6 +20,14 @@
package org.apache.directory.server.configuration;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.naming.NamingException;
+
import org.apache.commons.lang.StringUtils;
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.constants.ServerDNConstants;
@@ -30,7 +38,6 @@
import org.apache.directory.server.ldap.LdapServer;
import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
import org.apache.directory.server.protocol.shared.store.LdifLoadFilter;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.util.StringTools;
@@ -38,13 +45,6 @@
import org.slf4j.LoggerFactory;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-
/**
* Apache Directory Server top level.
*
@@ -80,7 +80,7 @@
* @param directoryService
* @param ldapServer
*/
- public ApacheDS( LdapServer ldapServer )
+ public ApacheDS( LdapServer ldapServer ) throws Exception
{
LOG.info( "Starting the Apache Directory Server" );
@@ -343,8 +343,7 @@
LdapDN dn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN );
// Must normalize the dn or - IllegalStateException!
- AttributeTypeRegistry reg = directoryService.getRegistries().getAttributeTypeRegistry();
- dn.normalize( reg.getNormalizerMapping() );
+ dn.normalize( directoryService.getSchemaManager().getNormalizerMapping() );
ensureLdifFileBase();
Modified: directory/apacheds/trunk/server-jndi/src/test/java/org/apache/directory/server/configuration/ApacheDSTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-jndi/src/test/java/org/apache/directory/server/configuration/ApacheDSTest.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/server-jndi/src/test/java/org/apache/directory/server/configuration/ApacheDSTest.java (original)
+++ directory/apacheds/trunk/server-jndi/src/test/java/org/apache/directory/server/configuration/ApacheDSTest.java Wed Jan 6 18:26:43 2010
@@ -20,11 +20,10 @@
package org.apache.directory.server.configuration;
+import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import junit.framework.TestCase;
-
/**
* TODO ApacheDSTest.
@@ -32,11 +31,12 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class ApacheDSTest extends TestCase
+public class ApacheDSTest
{
private static final Logger LOG = LoggerFactory.getLogger( ApacheDSTest.class );
+ @Test
public void testBogus()
{
System.out.println( "TODO: Fix this the real test case and delete me!" );
Modified: directory/apacheds/trunk/server-tools/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-tools/pom.xml?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/server-tools/pom.xml (original)
+++ directory/apacheds/trunk/server-tools/pom.xml Wed Jan 6 18:26:43 2010
@@ -30,7 +30,7 @@
<name>ApacheDS Server Tools</name>
<description>
- Contained within this executable jar are various commandline utilities
+ Contained within this executable jar are various command line utilities
for apacheds.
</description>
@@ -45,13 +45,13 @@
<dependency>
<groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-bootstrap-partition</artifactId>
+ <artifactId>apacheds-server-jndi</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-server-jndi</artifactId>
+ <artifactId>apacheds-jdbm-partition</artifactId>
<version>${pom.version}</version>
</dependency>
@@ -110,6 +110,18 @@
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.directory.shared</groupId>
+ <artifactId>shared-ldap-schema</artifactId>
+ <version>${org.apache.directory.shared.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.directory.shared</groupId>
+ <artifactId>shared-ldap-schema-manager</artifactId>
+ <version>${org.apache.directory.shared.version}</version>
+ </dependency>
</dependencies>
<build>
@@ -135,4 +147,4 @@
</resource>
</resources>
</build>
-</project>
\ No newline at end of file
+</project>
Modified: directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ApachedsTools.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ApachedsTools.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ApachedsTools.java (original)
+++ directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ApachedsTools.java Wed Jan 6 18:26:43 2010
@@ -25,6 +25,7 @@
import java.util.Properties;
import org.apache.commons.cli.CommandLine;
+import org.apache.directory.daemon.InstanceLayout;
/**
@@ -92,17 +93,10 @@
cmd.setDebugEnabled( cmdline.hasOption( 'd' ) );
cmd.setVerboseEnabled( cmdline.hasOption( 'v' ) );
cmd.setVersion( tools.getProductVersion() );
+
if ( cmdline.getOptionValue( 'i' ) != null )
{
cmd.setLayout( cmdline.getOptionValue( 'i' ) );
-// if ( !cmd.isQuietEnabled() )
-// {
-// System.out.println( "loading settings from: " + cmd.getLayout().getConfigurationFile() );
-// }
-// ApplicationContext factory = null;
-// URL configUrl = cmd.getLayout().getConfigurationFile().toURL();
-// factory = new FileSystemXmlApplicationContext( configUrl.toString() );
-// cmd.setApacheDS( ( ApacheDS ) factory.getBean( "apacheDS" ) );
}
else if ( cmdline.hasOption( 'c' ) )
{
@@ -112,7 +106,7 @@
if ( cmdline.getOptionValue( 'z' ) != null )
{
- cmd.setInstanceLayout( new InstanceLayout( new File( cmdline.getOptionValue( 'z' ) ) ) );
+ cmd.setInstanceLayout( new InstanceLayout( cmd.getLayout(), new File( cmdline.getOptionValue( 'z' ) ) ) );
}
cmd.execute( cmdline );
Modified: directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java (original)
+++ directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java Wed Jan 6 18:26:43 2010
@@ -22,7 +22,6 @@
import java.io.File;
import java.io.FileWriter;
-import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
@@ -40,38 +39,25 @@
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
-import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.DefaultDirectoryService;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmMasterTable;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
-import org.apache.directory.server.core.schema.PartitionSchemaLoader;
-import org.apache.directory.server.schema.SerializableComparator;
-import org.apache.directory.server.schema.bootstrap.ApacheSchema;
-import org.apache.directory.server.schema.bootstrap.ApachemetaSchema;
-import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
-import org.apache.directory.server.schema.bootstrap.CoreSchema;
-import org.apache.directory.server.schema.bootstrap.Schema;
-import org.apache.directory.server.schema.bootstrap.SystemSchema;
-import org.apache.directory.server.schema.bootstrap.partition.DbFileListing;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.server.schema.registries.DefaultOidRegistry;
-import org.apache.directory.server.schema.registries.DefaultRegistries;
-import org.apache.directory.server.schema.registries.OidRegistry;
-import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.server.xdbm.Index;
import org.apache.directory.server.xdbm.Tuple;
import org.apache.directory.shared.ldap.MultiException;
import org.apache.directory.shared.ldap.cursor.Cursor;
import org.apache.directory.shared.ldap.exception.LdapConfigurationException;
-import org.apache.directory.shared.ldap.exception.LdapNamingException;
import org.apache.directory.shared.ldap.ldif.LdifUtils;
-import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.UsageEnum;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor;
+import org.apache.directory.shared.ldap.schema.loader.ldif.LdifSchemaLoader;
+import org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManager;
import org.apache.directory.shared.ldap.util.Base64;
+import org.apache.directory.shared.ldap.util.ExceptionUtils;
/**
@@ -82,8 +68,7 @@
*/
public class DumpCommand extends ToolCommand
{
- private Registries bootstrapRegistries = new DefaultRegistries( "bootstrap", new BootstrapSchemaLoader(),
- new DefaultOidRegistry() );
+ private SchemaManager schemaManager;
private Set<String> exclusions = new HashSet<String>();
private boolean includeOperational = false;
@@ -94,28 +79,41 @@
}
- private Registries loadRegistries() throws Exception
+ private SchemaManager loadSchemaManager() throws Exception
{
// --------------------------------------------------------------------
// Load the bootstrap schemas to start up the schema partition
// --------------------------------------------------------------------
// setup temporary loader and temp registry
- BootstrapSchemaLoader loader = new BootstrapSchemaLoader();
- OidRegistry oidRegistry = new DefaultOidRegistry();
- final Registries registries = new DefaultRegistries( "bootstrap", loader, oidRegistry );
-
- // load essential bootstrap schemas
- Set<Schema> bootstrapSchemas = new HashSet<Schema>();
- bootstrapSchemas.add( new ApachemetaSchema() );
- bootstrapSchemas.add( new ApacheSchema() );
- bootstrapSchemas.add( new CoreSchema() );
- bootstrapSchemas.add( new SystemSchema() );
- loader.loadWithDependencies( bootstrapSchemas, registries );
+ String workingDirectory = System.getProperty( "workingDirectory" );
- // run referential integrity tests
- List<Throwable> errors = registries.checkRefInteg();
+ if ( workingDirectory == null )
+ {
+ String path = DumpCommand.class.getResource( "" ).getPath();
+ int targetPos = path.indexOf( "target" );
+ workingDirectory = path.substring( 0, targetPos + 6 );
+ }
+
+ File schemaRepository = new File( workingDirectory, "schema" );
+ SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
+ extractor.extractOrCopy();
+ LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
+ schemaManager = new DefaultSchemaManager( loader );
+ schemaManager.loadAllEnabled();
+
+ List<Throwable> errors = schemaManager.getErrors();
+
+ if ( errors.size() != 0 )
+ {
+ throw new Exception( "Schema load failed : " + ExceptionUtils.printErrors( errors ) );
+ }
+
+ schemaManager.loadWithDeps( "collective" );
+
+ errors = schemaManager.getErrors();
+
if ( !errors.isEmpty() )
{
MultiException e = new MultiException();
@@ -127,14 +125,12 @@
throw e;
}
- SerializableComparator.setRegistry( registries.getComparatorRegistry() );
-
// --------------------------------------------------------------------
// Initialize schema partition or bomb out if we cannot find it on disk
// --------------------------------------------------------------------
// If not present then we need to abort
- File schemaDirectory = new File( getLayout().getPartitionsDirectory(), "schema" );
+ File schemaDirectory = new File( getInstanceLayout().getPartitionsDir(), "schema" );
if ( !schemaDirectory.exists() )
{
@@ -142,50 +138,23 @@
+ "the installation layout could not be found:\n\t" + schemaDirectory );
}
- JdbmPartition schemaPartition = new JdbmPartition();
- schemaPartition.setId( "schema" );
- schemaPartition.setCacheSize( 1000 );
-
- DbFileListing listing;
-
- try
- {
- listing = new DbFileListing();
- }
- catch ( IOException e )
- {
- throw new LdapNamingException( "Got IOException while trying to read DBFileListing: " + e.getMessage(),
- ResultCodeEnum.OTHER );
- }
-
- Set<Index<?,ServerEntry>> indexedAttributes = new HashSet<Index<?,ServerEntry>>();
-
- for ( String attributeId : listing.getIndexedAttributes() )
- {
- indexedAttributes.add( new JdbmIndex( attributeId ) );
- }
-
- schemaPartition.setIndexedAttributes( indexedAttributes );
- schemaPartition.setSuffix( ServerDNConstants.OU_SCHEMA_DN );
-
DirectoryService directoryService = new DefaultDirectoryService();
- schemaPartition.init( directoryService );
+ //schemaPartition.init( directoryService );
// --------------------------------------------------------------------
// Initialize schema subsystem and reset registries
// --------------------------------------------------------------------
- PartitionSchemaLoader schemaLoader = new PartitionSchemaLoader( schemaPartition, registries );
- Registries globalRegistries = new DefaultRegistries( "global", schemaLoader, oidRegistry );
- schemaLoader.loadEnabled( globalRegistries );
- SerializableComparator.setRegistry( globalRegistries.getComparatorRegistry() );
- return globalRegistries;
+// PartitionSchemaLoader schemaLoader = new PartitionSchemaLoader( schemaPartition, registries );
+// schemaLoader.loadEnabled( globalRegistries );
+// SerializableComparator.setRegistry( globalRegistries.getComparatorRegistry() );
+ return schemaManager;
}
public void execute( CommandLine cmdline ) throws Exception
{
getLayout().verifyInstallation();
- bootstrapRegistries = loadRegistries();
+ schemaManager = loadSchemaManager();
includeOperational = cmdline.hasOption( 'o' );
String[] partitions = cmdline.getOptionValues( 'p' );
@@ -196,11 +165,9 @@
if ( excludedAttributes != null )
{
- AttributeTypeRegistry registry = bootstrapRegistries.getAttributeTypeRegistry();
-
for ( String attributeType:excludedAttributes)
{
- AttributeType type = registry.lookup( attributeType );
+ AttributeType type = schemaManager.lookupAttributeTypeRegistry( attributeType );
exclusions.add( type.getName() );
}
}
@@ -216,7 +183,7 @@
for ( String partition:partitions )
{
- File partitionDirectory = new File( getLayout().getPartitionsDirectory(), partition );
+ File partitionDirectory = new File( getInstanceLayout().getPartitionsDir(), partition );
out.println( "\n\n" );
dump( partitionDirectory, out );
}
@@ -241,14 +208,14 @@
base.disableTransactions();
CacheRecordManager recMan = new CacheRecordManager( base, new MRU( 1000 ) );
- JdbmMasterTable<ServerEntry> master = new JdbmMasterTable<ServerEntry>( recMan, bootstrapRegistries );
- AttributeType attributeType = bootstrapRegistries.getAttributeTypeRegistry().lookup( "apacheUpdn" );
+ JdbmMasterTable<ServerEntry> master = new JdbmMasterTable<ServerEntry>( recMan, schemaManager );
+ AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( "apacheUpdn" );
JdbmIndex idIndex = new JdbmIndex();
idIndex.setAttributeId( attributeType.getName() );
idIndex.setWkDirPath( partitionDirectory );
idIndex.setCacheSize( 1000 );
idIndex.setNumDupLimit( 1000 );
- idIndex.init( attributeType, partitionDirectory );
+ idIndex.init( schemaManager, attributeType, partitionDirectory );
out.println( "#---------------------" );
Cursor<Tuple<Long,ServerEntry>> list = master.cursor();
@@ -293,14 +260,13 @@
private void filterAttributes( String dn, Attributes entry ) throws Exception
{
List<String> toRemove = new ArrayList<String>();
- AttributeTypeRegistry registry = bootstrapRegistries.getAttributeTypeRegistry();
NamingEnumeration<? extends Attribute> attrs = entry.getAll();
while ( attrs.hasMore() )
{
Attribute attr = attrs.next();
- if ( !registry.hasAttributeType( attr.getID() ) )
+ if ( !schemaManager.getAttributeTypeRegistry().contains( attr.getID() ) )
{
if ( !isQuietEnabled() )
{
@@ -310,7 +276,7 @@
continue;
}
- AttributeType type = registry.lookup( attr.getID() );
+ AttributeType type = schemaManager.lookupAttributeTypeRegistry( attr.getID() );
boolean isOperational = type.getUsage() != UsageEnum.USER_APPLICATIONS;
if ( exclusions.contains( attr.getID() ) || ( isOperational && ( !includeOperational ) ) )
Modified: directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java (original)
+++ directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java Wed Jan 6 18:26:43 2010
@@ -219,7 +219,7 @@
{
AddRequestCodec addRequest = new AddRequestCodec();
- String dn = ldifEntry.getDn().getUpName();
+ String dn = ldifEntry.getDn().getName();
if ( isDebugEnabled() )
{
@@ -292,7 +292,7 @@
{
DelRequestCodec delRequest = new DelRequestCodec();
- String dn = entry.getDn().getUpName();
+ String dn = entry.getDn().getName();
if ( isDebugEnabled() )
{
@@ -351,7 +351,7 @@
{
ModifyDNRequestCodec modifyDNRequest = new ModifyDNRequestCodec();
- String dn = entry.getDn().getUpName();
+ String dn = entry.getDn().getName();
if ( isDebugEnabled() )
{
@@ -415,7 +415,7 @@
{
ModifyRequestCodec modifyRequest = new ModifyRequestCodec();
- String dn = entry.getDn().getUpName();
+ String dn = entry.getDn().getName();
if ( isDebugEnabled() )
{
@@ -720,6 +720,8 @@
System.out.println( "Done!" );
System.out.println( nbMod + " entries changed in " + ( ( t1 - t0 ) / 1000 ) + " seconds" );
}
+
+ ldifReader.close();
// Logout to the server
unbind( messageId++ );
Modified: directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/IndexCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/IndexCommand.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/IndexCommand.java (original)
+++ directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/IndexCommand.java Wed Jan 6 18:26:43 2010
@@ -36,19 +36,12 @@
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmMasterTable;
-import org.apache.directory.server.schema.SerializableComparator;
-import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
-import org.apache.directory.server.schema.registries.DefaultOidRegistry;
-import org.apache.directory.server.schema.registries.DefaultRegistries;
-import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.server.xdbm.Tuple;
-import org.apache.directory.server.xdbm.tools.IndexDialog;
import org.apache.directory.server.xdbm.tools.IndexUtils;
import org.apache.directory.shared.ldap.cursor.Cursor;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
/**
@@ -59,8 +52,7 @@
*/
public class IndexCommand extends ToolCommand
{
- private Registries bootstrapRegistries = new DefaultRegistries( "bootstrap", new BootstrapSchemaLoader(),
- new DefaultOidRegistry() );
+ private SchemaManager schemaManager;
private DirectoryService directoryService;
@@ -70,8 +62,7 @@
}
- @SuppressWarnings("unchecked")
- private Registries loadRegistries() throws Exception
+ private SchemaManager loadSchemaManager() throws Exception
{
// --------------------------------------------------------------------
// Load the bootstrap schemas to start up the schema partition
@@ -80,17 +71,16 @@
directoryService.setWorkingDirectory( getInstanceLayout().getPartitionsDir() );
directoryService.startup();
- Registries globalRegistries = directoryService.getRegistries();//registries;//
- SerializableComparator.setRegistry( globalRegistries.getComparatorRegistry() );
+ SchemaManager schemaManager = directoryService.getSchemaManager();
- return globalRegistries;
+ return schemaManager;
}
public void execute( CommandLine cmdline ) throws Exception
{
// getLayout().verifyInstallation();
- bootstrapRegistries = loadRegistries();
+ schemaManager = loadSchemaManager();
String[] partitions = cmdline.getOptionValues( 'p' );
String attribute = cmdline.getOptionValue( 'a' );
@@ -98,7 +88,7 @@
for ( int ii = 0; ii < partitions.length; ii++ )
{
- File partitionDirectory = partitionDirectory = new File( getInstanceLayout().getPartitionsDir(), partitions[ii] );
+ File partitionDirectory = new File( getInstanceLayout().getPartitionsDir(), partitions[ii] );
File indexDir = null;
if( indexDirPath != null )
@@ -106,7 +96,7 @@
indexDir = new File( indexDirPath );
}
- AttributeType attrType = bootstrapRegistries.getAttributeTypeRegistry().lookup( attribute );
+ AttributeType attrType = schemaManager.lookupAttributeTypeRegistry( attribute );
System.out.println( "building index for attribute type: " + attrType + ", of the partition: " + partitions[ii] );
if( indexDir != null )
@@ -135,7 +125,7 @@
base.disableTransactions();
CacheRecordManager recMan = new CacheRecordManager( base, new MRU( 1000 ) );
- JdbmMasterTable<ServerEntry> master = new JdbmMasterTable<ServerEntry>( recMan, bootstrapRegistries );
+ JdbmMasterTable<ServerEntry> master = new JdbmMasterTable<ServerEntry>( recMan, schemaManager );
JdbmIndex index = new JdbmIndex();
index.setAttributeId( attributeType.getName() );
index.setCacheSize( JdbmIndex.DEFAULT_INDEX_CACHE_SIZE );
@@ -147,7 +137,7 @@
}
index.setWkDirPath( indexDirectory );
- index.init( attributeType, indexDirectory );
+ index.init( schemaManager, attributeType, indexDirectory );
IndexUtils.printContents( index );
@@ -157,7 +147,7 @@
existenceIdx.setNumDupLimit( JdbmIndex.DEFAULT_DUPLICATE_LIMIT );
existenceIdx.setWkDirPath( partitionDirectory );
- existenceIdx.init( bootstrapRegistries.getAttributeTypeRegistry().lookup( ApacheSchemaConstants.APACHE_EXISTENCE_AT_OID ), partitionDirectory );
+ existenceIdx.init( schemaManager, schemaManager.lookupAttributeTypeRegistry( ApacheSchemaConstants.APACHE_EXISTENCE_AT_OID ), partitionDirectory );
Cursor<Tuple<Long,ServerEntry>> list = master.cursor();
Modified: directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ToolCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ToolCommand.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ToolCommand.java (original)
+++ directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ToolCommand.java Wed Jan 6 18:26:43 2010
@@ -24,7 +24,8 @@
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;
-import org.apache.directory.daemon.InstallationLayout;
+import org.apache.directory.daemon.InstallLayout;
+import org.apache.directory.daemon.InstanceLayout;
import org.apache.directory.server.configuration.ApacheDS;
@@ -41,7 +42,7 @@
private boolean verboseEnabled = false;
private boolean quietEnabled = false;
private String version;
- private InstallationLayout layout;
+ private InstallLayout layout;
private ApacheDS apacheDS;
private InstanceLayout instanceLayout;
@@ -66,17 +67,17 @@
public void setLayout( File installationDirectory )
{
- this.layout = new InstallationLayout( installationDirectory );
+ this.layout = new InstallLayout( installationDirectory );
}
public void setLayout( String installationPath )
{
- this.layout = new InstallationLayout( installationPath );
+ this.layout = new InstallLayout( new File( installationPath ) );
}
- public void setLayout( InstallationLayout layout )
+ public void setLayout( InstallLayout layout )
{
this.layout = layout;
}
@@ -94,7 +95,7 @@
}
- public InstallationLayout getLayout()
+ public InstallLayout getLayout()
{
return layout;
}
Modified: directory/apacheds/trunk/server-xml/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-xml/pom.xml?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/server-xml/pom.xml (original)
+++ directory/apacheds/trunk/server-xml/pom.xml Wed Jan 6 18:26:43 2010
@@ -58,32 +58,31 @@
</dependency>
<dependency>
<groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-protocol-kerberos</artifactId>
+ <artifactId>apacheds-jdbm-partition</artifactId>
<version>${pom.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-protocol-dns</artifactId>
+ <artifactId>apacheds-protocol-kerberos</artifactId>
<version>${pom.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-protocol-ldap</artifactId>
+ <artifactId>apacheds-protocol-dns</artifactId>
<version>${pom.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-protocol-ntp</artifactId>
+ <artifactId>apacheds-protocol-ldap</artifactId>
<version>${pom.version}</version>
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-bootstrap-partition</artifactId>
+ <artifactId>apacheds-protocol-ntp</artifactId>
<version>${pom.version}</version>
<scope>test</scope>
</dependency>
Modified: directory/apacheds/trunk/server-xml/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-xml/src/test/resources/log4j.properties?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/server-xml/src/test/resources/log4j.properties (original)
+++ directory/apacheds/trunk/server-xml/src/test/resources/log4j.properties Wed Jan 6 18:26:43 2010
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#############################################################################
-log4j.rootCategory=ERROR, stdout
+log4j.rootCategory=OFF, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
Propchange: directory/apacheds/trunk/syncrepl/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jan 6 18:26:43 2010
@@ -1,4 +1,16 @@
target
-.classpath
-.project
+.clover
+.wtpmodules
.settings
+.deployables
+apache.org
+.metadata
+*.md5
+*.log
+*.iml
+*.ipr
+*.iws
+.project
+.classpath
+nbproject
+schema
Modified: directory/apacheds/trunk/syncrepl/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/syncrepl/pom.xml?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/syncrepl/pom.xml (original)
+++ directory/apacheds/trunk/syncrepl/pom.xml Wed Jan 6 18:26:43 2010
@@ -124,19 +124,6 @@
</dependency>
<dependency>
- <groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-core-shared</artifactId>
- <version>${pom.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-bootstrap-partition</artifactId>
- <version>${pom.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>opensymphony</groupId>
<artifactId>quartz</artifactId>
</dependency>
Propchange: directory/apacheds/trunk/test-framework/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jan 6 18:26:43 2010
@@ -0,0 +1,7 @@
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
Propchange: directory/apacheds/trunk/test-framework/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Wed Jan 6 18:26:43 2010
@@ -0,0 +1,3 @@
+/directory/apacheds/branches/apacheds-replication/apacheds-test-framework:749790-764110
+/directory/apacheds/branches/apacheds-replication/test-framework:749790-764110
+/directory/apacheds/branches/apacheds-schema/test-framework:806623-896441
Modified: directory/apacheds/trunk/utils/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/utils/pom.xml?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/utils/pom.xml (original)
+++ directory/apacheds/trunk/utils/pom.xml Wed Jan 6 18:26:43 2010
@@ -43,12 +43,6 @@
<dependency>
<groupId>${pom.groupId}</groupId>
- <artifactId>apacheds-core-shared</artifactId>
- <version>${pom.version}</version>
- </dependency>
-
- <dependency>
- <groupId>${pom.groupId}</groupId>
<artifactId>apacheds-core-entry</artifactId>
<version>${pom.version}</version>
</dependency>
Modified: directory/apacheds/trunk/utils/src/main/java/org/apache/directory/server/utils/AttributesFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/utils/src/main/java/org/apache/directory/server/utils/AttributesFactory.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/utils/src/main/java/org/apache/directory/server/utils/AttributesFactory.java (original)
+++ directory/apacheds/trunk/utils/src/main/java/org/apache/directory/server/utils/AttributesFactory.java Wed Jan 6 18:26:43 2010
@@ -20,29 +20,30 @@
package org.apache.directory.server.utils;
-import java.util.Comparator;
+import java.util.List;
import javax.naming.NamingException;
-import org.apache.directory.server.constants.MetaSchemaConstants;
import org.apache.directory.server.core.entry.DefaultServerAttribute;
import org.apache.directory.server.core.entry.DefaultServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.schema.bootstrap.Schema;
-import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.DITContentRule;
import org.apache.directory.shared.ldap.schema.DITStructureRule;
+import org.apache.directory.shared.ldap.schema.LdapComparator;
+import org.apache.directory.shared.ldap.schema.LdapSyntax;
import org.apache.directory.shared.ldap.schema.MatchingRule;
import org.apache.directory.shared.ldap.schema.MatchingRuleUse;
import org.apache.directory.shared.ldap.schema.NameForm;
import org.apache.directory.shared.ldap.schema.Normalizer;
import org.apache.directory.shared.ldap.schema.ObjectClass;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.SchemaObject;
-import org.apache.directory.shared.ldap.schema.Syntax;
import org.apache.directory.shared.ldap.schema.SyntaxChecker;
+import org.apache.directory.shared.ldap.schema.registries.Schema;
import org.apache.directory.shared.ldap.util.DateUtils;
@@ -55,48 +56,48 @@
*/
public class AttributesFactory
{
- public ServerEntry getAttributes( SchemaObject obj, Schema schema, Registries registries ) throws NamingException
+ public ServerEntry getAttributes( SchemaObject obj, Schema schema, SchemaManager schemaManager ) throws NamingException
{
- if ( obj instanceof Syntax )
+ if ( obj instanceof LdapSyntax )
{
- return getAttributes( ( Syntax ) obj, schema, registries );
+ return getAttributes( ( LdapSyntax ) obj, schema, schemaManager );
}
else if ( obj instanceof MatchingRule )
{
- return getAttributes( ( MatchingRule ) obj, schema, registries );
+ return getAttributes( ( MatchingRule ) obj, schema, schemaManager );
}
else if ( obj instanceof AttributeType )
{
- return getAttributes( ( AttributeType ) obj, schema, registries );
+ return getAttributes( ( AttributeType ) obj, schema, schemaManager );
}
else if ( obj instanceof ObjectClass )
{
- return getAttributes( ( ObjectClass ) obj, schema, registries );
+ return getAttributes( ( ObjectClass ) obj, schema, schemaManager );
}
else if ( obj instanceof MatchingRuleUse )
{
- return getAttributes( ( MatchingRuleUse ) obj, schema, registries );
+ return getAttributes( ( MatchingRuleUse ) obj, schema, schemaManager );
}
else if ( obj instanceof DITStructureRule )
{
- return getAttributes( ( DITStructureRule ) obj, schema, registries );
+ return getAttributes( ( DITStructureRule ) obj, schema, schemaManager );
}
else if ( obj instanceof DITContentRule )
{
- return getAttributes( ( DITContentRule ) obj, schema, registries );
+ return getAttributes( ( DITContentRule ) obj, schema, schemaManager );
}
else if ( obj instanceof NameForm )
{
- return getAttributes( ( NameForm ) obj, schema, registries );
+ return getAttributes( ( NameForm ) obj, schema, schemaManager );
}
throw new IllegalArgumentException( "Unknown SchemaObject type: " + obj.getClass() );
}
- public ServerEntry getAttributes( Schema schema, Registries registries ) throws NamingException
+ public ServerEntry getAttributes( Schema schema, SchemaManager schemaManager ) throws NamingException
{
- ServerEntry entry = new DefaultServerEntry( registries );
+ ServerEntry entry = new DefaultServerEntry( schemaManager );
entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_SCHEMA_OC );
entry.put( SchemaConstants.CN_AT, schema.getSchemaName() );
@@ -112,7 +113,7 @@
if ( dependencies != null && dependencies.length > 0 )
{
- EntryAttribute attr = new DefaultServerAttribute( registries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_DEPENDENCIES_AT ) );
+ EntryAttribute attr = new DefaultServerAttribute( schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_DEPENDENCIES_AT ) );
for ( String dependency:dependencies )
{
@@ -126,12 +127,12 @@
}
- public ServerEntry getAttributes( SyntaxChecker syntaxChecker, Schema schema, Registries registries )
+ public ServerEntry getAttributes( SyntaxChecker syntaxChecker, Schema schema, SchemaManager schemaManager )
{
- ServerEntry entry = new DefaultServerEntry( registries );
+ ServerEntry entry = new DefaultServerEntry( schemaManager );
entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_SYNTAX_CHECKER_OC );
- entry.put( MetaSchemaConstants.M_OID_AT, syntaxChecker.getSyntaxOid() );
+ entry.put( MetaSchemaConstants.M_OID_AT, syntaxChecker.getOid() );
entry.put( MetaSchemaConstants.M_FQCN_AT, syntaxChecker.getClass().getName() );
entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
@@ -140,23 +141,23 @@
}
- public ServerEntry getAttributes( Syntax syntax, Schema schema, Registries registries ) throws NamingException
+ public ServerEntry getAttributes( LdapSyntax syntax, Schema schema, SchemaManager schemaManager ) throws NamingException
{
- ServerEntry entry = new DefaultServerEntry( registries );
+ ServerEntry entry = new DefaultServerEntry( schemaManager );
entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_SYNTAX_OC );
entry.put( MetaSchemaConstants.X_HUMAN_READABLE_AT, getBoolean( syntax.isHumanReadable() ) );
entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
- injectCommon( syntax, entry, registries );
+ injectCommon( syntax, entry, schemaManager );
return entry;
}
- public ServerEntry getAttributes( String oid, Normalizer normalizer, Schema schema, Registries registries )
+ public ServerEntry getAttributes( String oid, Normalizer normalizer, Schema schema, SchemaManager schemaManager )
{
- ServerEntry entry = new DefaultServerEntry( registries );
+ ServerEntry entry = new DefaultServerEntry( schemaManager );
entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_NORMALIZER_OC );
entry.put( MetaSchemaConstants.M_OID_AT, oid );
@@ -167,9 +168,9 @@
}
- public ServerEntry getAttributes( String oid, Comparator comparator, Schema schema, Registries registries )
+ public ServerEntry getAttributes( String oid, LdapComparator<? super Object> comparator, Schema schema, SchemaManager schemaManager )
{
- ServerEntry entry = new DefaultServerEntry( registries );
+ ServerEntry entry = new DefaultServerEntry( schemaManager );
entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_COMPARATOR_OC );
entry.put( MetaSchemaConstants.M_OID_AT, oid );
@@ -186,22 +187,22 @@
* @return Attributes
* @throws NamingException
*/
- public ServerEntry getAttributes( MatchingRule matchingRule, Schema schema, Registries registries ) throws NamingException
+ public ServerEntry getAttributes( MatchingRule matchingRule, Schema schema, SchemaManager schemaManager ) throws NamingException
{
- ServerEntry entry = new DefaultServerEntry( registries );
+ ServerEntry entry = new DefaultServerEntry( schemaManager );
entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_MATCHING_RULE_OC );
- entry.put( MetaSchemaConstants.M_SYNTAX_AT, matchingRule.getSyntax().getOid() );
+ entry.put( MetaSchemaConstants.M_SYNTAX_AT, matchingRule.getSyntaxOid() );
entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
- injectCommon( matchingRule, entry, registries );
+ injectCommon( matchingRule, entry, schemaManager );
return entry;
}
- public ServerEntry getAttributes( MatchingRuleUse matchingRuleUse, Schema schema, Registries registries )
+ public ServerEntry getAttributes( MatchingRuleUse matchingRuleUse, Schema schema, SchemaManager schemaManager )
{
- ServerEntry entry = new DefaultServerEntry( registries );
+ ServerEntry entry = new DefaultServerEntry( schemaManager );
entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, "" );
entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
@@ -210,9 +211,9 @@
}
- public ServerEntry getAttributes( DITStructureRule dITStructureRule, Schema schema, Registries registries )
+ public ServerEntry getAttributes( DITStructureRule dITStructureRule, Schema schema, SchemaManager schemaManager )
{
- ServerEntry entry = new DefaultServerEntry( registries );
+ ServerEntry entry = new DefaultServerEntry( schemaManager );
entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, "" );
entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
@@ -221,9 +222,9 @@
}
- public ServerEntry getAttributes( DITContentRule dITContentRule, Schema schema, Registries registries )
+ public ServerEntry getAttributes( DITContentRule dITContentRule, Schema schema, SchemaManager schemaManager )
{
- ServerEntry entry = new DefaultServerEntry( registries );
+ ServerEntry entry = new DefaultServerEntry( schemaManager );
entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, "" );
entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
@@ -232,9 +233,9 @@
}
- public ServerEntry getAttributes( NameForm nameForm, Schema schema, Registries registries )
+ public ServerEntry getAttributes( NameForm nameForm, Schema schema, SchemaManager schemaManager )
{
- ServerEntry entry = new DefaultServerEntry( registries );
+ ServerEntry entry = new DefaultServerEntry( schemaManager );
entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, "" );
entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
@@ -261,70 +262,41 @@
* @return Attributes
* @throws NamingException
*/
- public ServerEntry getAttributes( AttributeType attributeType, Schema schema, Registries registries ) throws NamingException
+ public ServerEntry getAttributes( AttributeType attributeType, Schema schema, SchemaManager schemaManager ) throws NamingException
{
- ServerEntry entry = new DefaultServerEntry( registries );
+ ServerEntry entry = new DefaultServerEntry( schemaManager );
entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC );
- entry.put( MetaSchemaConstants.M_SYNTAX_AT, attributeType.getSyntax().getOid() );
+ entry.put( MetaSchemaConstants.M_SYNTAX_AT, attributeType.getSyntaxOid() );
entry.put( MetaSchemaConstants.M_COLLECTIVE_AT, getBoolean( attributeType.isCollective() ) );
- entry.put( MetaSchemaConstants.M_NO_USER_MODIFICATION_AT, getBoolean( ! attributeType.isCanUserModify() ) );
- entry.put( MetaSchemaConstants.M_SINGLE_VALUE_AT, getBoolean( attributeType.isSingleValue() ) );
+ entry.put( MetaSchemaConstants.M_NO_USER_MODIFICATION_AT, getBoolean( ! attributeType.isUserModifiable() ) );
+ entry.put( MetaSchemaConstants.M_SINGLE_VALUE_AT, getBoolean( attributeType.isSingleValued() ) );
entry.put( MetaSchemaConstants.M_USAGE_AT, attributeType.getUsage().toString() );
entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
- injectCommon( attributeType, entry, registries );
+ injectCommon( attributeType, entry, schemaManager );
- AttributeType superior = attributeType.getSuperior();
+ String superiorOid = attributeType.getSuperiorOid();
- if ( superior != null )
+ if ( superiorOid != null )
{
- // use name if we can for clarity
- String sup = superior.getName();
-
- if ( sup == null )
- {
- sup = superior.getOid();
- }
-
- entry.put( MetaSchemaConstants.M_SUP_ATTRIBUTE_TYPE_AT, sup );
+ entry.put( MetaSchemaConstants.M_SUP_ATTRIBUTE_TYPE_AT, superiorOid );
}
- if ( attributeType.getEquality() != null )
+ if ( attributeType.getEqualityOid() != null )
{
- String equality = attributeType.getEquality().getName();
-
- if ( equality == null )
- {
- equality = attributeType.getEquality().getOid();
- }
-
- entry.put( MetaSchemaConstants.M_EQUALITY_AT, equality );
+ entry.put( MetaSchemaConstants.M_EQUALITY_AT, attributeType.getEqualityOid() );
}
- if ( attributeType.getSubstr() != null )
+ if ( attributeType.getSubstringOid() != null )
{
- String substr = attributeType.getSubstr().getName();
-
- if ( substr == null )
- {
- substr = attributeType.getSubstr().getOid();
- }
-
- entry.put( MetaSchemaConstants.M_SUBSTR_AT, substr );
+ entry.put( MetaSchemaConstants.M_SUBSTR_AT, attributeType.getSubstringOid() );
}
- if ( attributeType.getOrdering() != null )
+ if ( attributeType.getOrderingOid() != null )
{
- String ordering = attributeType.getOrdering().getName();
-
- if ( ordering == null )
- {
- ordering = attributeType.getOrdering().getOid();
- }
-
- entry.put( MetaSchemaConstants.M_ORDERING_AT, ordering );
+ entry.put( MetaSchemaConstants.M_ORDERING_AT, attributeType.getOrderingOid() );
}
return entry;
@@ -350,54 +322,51 @@
* @return the attributes of the metaSchema entry representing the objectClass
* @throws NamingException if there are any problems
*/
- public ServerEntry getAttributes( ObjectClass objectClass, Schema schema, Registries registries ) throws NamingException
+ public ServerEntry getAttributes( ObjectClass objectClass, Schema schema, SchemaManager schemaManager ) throws NamingException
{
- ServerEntry entry = new DefaultServerEntry( registries );
+ ServerEntry entry = new DefaultServerEntry( schemaManager );
entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_OBJECT_CLASS_OC );
entry.put( MetaSchemaConstants.M_TYPE_OBJECT_CLASS_AT, objectClass.getType().toString() );
entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
- injectCommon( objectClass, entry, registries );
+ injectCommon( objectClass, entry, schemaManager );
// handle the superior objectClasses
- if ( objectClass.getSuperClasses() != null && objectClass.getSuperClasses().length != 0 )
+ if ( objectClass.getSuperiorOids() != null && objectClass.getSuperiorOids().size() != 0 )
{
- EntryAttribute attr = new DefaultServerAttribute( registries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_SUP_OBJECT_CLASS_AT ) );
- ObjectClass[] superClasses = objectClass.getSuperClasses();
+ EntryAttribute attr = new DefaultServerAttribute( schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_SUP_OBJECT_CLASS_AT ) );
- for ( ObjectClass superClass:superClasses )
+ for ( String superior:objectClass.getSuperiorOids() )
{
- attr.add( getNameOrNumericoid( superClass ) );
+ attr.add( superior );
}
entry.put( attr );
}
// add the must list
- if ( objectClass.getMustList() != null && objectClass.getMustList().length != 0 )
+ if ( objectClass.getMustAttributeTypeOids() != null && objectClass.getMustAttributeTypeOids().size() != 0 )
{
- EntryAttribute attr = new DefaultServerAttribute( registries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_MUST_AT ) );
- AttributeType[] mustList = objectClass.getMustList();
+ EntryAttribute attr = new DefaultServerAttribute( schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_MUST_AT ) );
- for ( AttributeType attributeType:mustList )
+ for ( String mustOid :objectClass.getMustAttributeTypeOids() )
{
- attr.add( getNameOrNumericoid( attributeType ) );
+ attr.add( mustOid );
}
entry.put( attr );
}
// add the may list
- if ( objectClass.getMayList() != null && objectClass.getMayList().length != 0 )
+ if ( objectClass.getMayAttributeTypeOids() != null && objectClass.getMayAttributeTypeOids().size() != 0 )
{
- EntryAttribute attr = new DefaultServerAttribute( registries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_MAY_AT ) );
- AttributeType[] mayList = objectClass.getMayList();
+ EntryAttribute attr = new DefaultServerAttribute( schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_MAY_AT ) );
- for ( AttributeType attributeType:mayList )
+ for ( String mayOid :objectClass.getMayAttributeTypeOids() )
{
- attr.add( getNameOrNumericoid( attributeType ) );
+ attr.add( mayOid );
}
entry.put( attr );
@@ -405,23 +374,11 @@
return entry;
}
-
-
- private final String getNameOrNumericoid( SchemaObject object )
- {
- // first try to use user friendly name if we can
- if ( object.getName() != null )
- {
- return object.getName();
- }
-
- return object.getOid();
- }
- private final void injectCommon( SchemaObject object, ServerEntry entry, Registries registries ) throws NamingException
+ private final void injectCommon( SchemaObject object, ServerEntry entry, SchemaManager schemaManager ) throws NamingException
{
- injectNames( object.getNamesRef(), entry, registries );
+ injectNames( object.getNames(), entry, schemaManager );
entry.put( MetaSchemaConstants.M_OBSOLETE_AT, getBoolean( object.isObsolete() ) );
entry.put( MetaSchemaConstants.M_OID_AT, object.getOid() );
@@ -432,14 +389,14 @@
}
- private final void injectNames( String[] names, ServerEntry entry, Registries registries ) throws NamingException
+ private final void injectNames( List<String> names, ServerEntry entry, SchemaManager schemaManager ) throws NamingException
{
- if ( names == null || names.length == 0 )
+ if ( ( names == null ) || ( names.size() == 0 ) )
{
return;
}
- EntryAttribute attr = new DefaultServerAttribute( registries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_NAME_AT ) );
+ EntryAttribute attr = new DefaultServerAttribute( schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_NAME_AT ) );
for ( String name:names )
{
Modified: directory/apacheds/trunk/xbean-spring/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xbean-spring/pom.xml?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xbean-spring/pom.xml (original)
+++ directory/apacheds/trunk/xbean-spring/pom.xml Wed Jan 6 18:26:43 2010
@@ -77,6 +77,14 @@
<dependency>
<groupId>org.apache.directory.server</groupId>
+ <artifactId>apacheds-jdbm-partition</artifactId>
+ <version>${pom.version}</version>
+ <classifier>sources</classifier>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-protocol-changepw</artifactId>
<version>${pom.version}</version>
<classifier>sources</classifier>
Modified: directory/apacheds/trunk/xdbm-base/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/pom.xml?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/pom.xml (original)
+++ directory/apacheds/trunk/xdbm-base/pom.xml Wed Jan 6 18:26:43 2010
@@ -35,21 +35,17 @@
</description>
<dependencies>
- <dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>apacheds-schema-registries</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.directory.shared</groupId>
- <version>${org.apache.directory.shared.version}</version>
- <artifactId>shared-cursor</artifactId>
- </dependency>
- <dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>apacheds-core-entry</artifactId>
- <version>${pom.version}</version>
- </dependency>
+ <dependency>
+ <groupId>org.apache.directory.shared</groupId>
+ <version>${org.apache.directory.shared.version}</version>
+ <artifactId>shared-cursor</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>apacheds-core-entry</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultTupleComparator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultTupleComparator.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultTupleComparator.java (original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultTupleComparator.java Wed Jan 6 18:26:43 2010
@@ -19,7 +19,7 @@
package org.apache.directory.server.core.partition.impl.btree;
-import org.apache.directory.server.schema.SerializableComparator;
+import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
/**
Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ForwardIndexComparator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ForwardIndexComparator.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ForwardIndexComparator.java (original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ForwardIndexComparator.java Wed Jan 6 18:26:43 2010
@@ -20,7 +20,7 @@
package org.apache.directory.server.core.partition.impl.btree;
-import org.apache.directory.server.schema.SerializableComparator;
+import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
/**
Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/KeyOnlyComparator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/KeyOnlyComparator.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/KeyOnlyComparator.java (original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/KeyOnlyComparator.java Wed Jan 6 18:26:43 2010
@@ -22,7 +22,7 @@
import java.io.Serializable;
-import org.apache.directory.server.schema.SerializableComparator;
+import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
/**
Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/LongComparator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/LongComparator.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/LongComparator.java (original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/LongComparator.java Wed Jan 6 18:26:43 2010
@@ -19,7 +19,7 @@
package org.apache.directory.server.core.partition.impl.btree;
-import org.apache.directory.server.schema.SerializableComparator;
+import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
/**
Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ReverseIndexComparator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ReverseIndexComparator.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ReverseIndexComparator.java (original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ReverseIndexComparator.java Wed Jan 6 18:26:43 2010
@@ -20,7 +20,7 @@
package org.apache.directory.server.core.partition.impl.btree;
-import org.apache.directory.server.schema.SerializableComparator;
+import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
/**
Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleComparator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleComparator.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleComparator.java (original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleComparator.java Wed Jan 6 18:26:43 2010
@@ -22,7 +22,7 @@
import java.io.Serializable;
-import org.apache.directory.server.schema.SerializableComparator;
+import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
/**
Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java (original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java Wed Jan 6 18:26:43 2010
@@ -20,17 +20,17 @@
package org.apache.directory.server.xdbm;
-import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.name.Rdn;
-import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.Modification;
-
import java.io.File;
-import java.util.Set;
import java.util.Iterator;
import java.util.List;
+import java.util.Set;
+
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.Rdn;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
/**
@@ -163,11 +163,11 @@
/**
* Initialize the JDBM storage system.
*
- * @param registries the schema registries
- * @throws Exception on failure to lookup elements in registries
+ * @param schemaManager the schema schemaManager
+ * @throws Exception on failure to lookup elements in schemaManager
* @throws Exception on failure to create database files
*/
- void init( Registries registries ) throws Exception;
+ void init( SchemaManager schemaManager ) throws Exception;
/**
@@ -519,5 +519,5 @@
void move( LdapDN oldChildDn, LdapDN newParentDn ) throws Exception;
- void initRegistries( Registries registries );
+ void initSchemaManager( SchemaManager schemaManager );
}
Modified: directory/apacheds/trunk/xdbm-search/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/pom.xml?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/pom.xml (original)
+++ directory/apacheds/trunk/xdbm-search/pom.xml Wed Jan 6 18:26:43 2010
@@ -58,16 +58,17 @@
</dependency>
<dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>apacheds-schema-bootstrap</artifactId>
- <version>${pom.version}</version>
+ <groupId>org.apache.directory.shared</groupId>
+ <artifactId>shared-ldap-schema</artifactId>
+ <version>${org.apache.directory.shared.version}</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>apacheds-schema-extras</artifactId>
- <version>${pom.version}</version>
+ <groupId>org.apache.directory.shared</groupId>
+ <artifactId>shared-ldap-schema-manager</artifactId>
+ <version>${org.apache.directory.shared.version}</version>
+ <scope>test</scope>
</dependency>
</dependencies>
Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java Wed Jan 6 18:26:43 2010
@@ -20,6 +20,11 @@
package org.apache.directory.server.xdbm.search.impl;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.server.xdbm.AbstractIndexCursor;
import org.apache.directory.server.xdbm.IndexCursor;
@@ -28,8 +33,6 @@
import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
import org.apache.directory.shared.ldap.filter.ExprNode;
-import java.util.*;
-
/**
* A Cursor returning candidates satisfying a logical conjunction expression.
@@ -192,6 +195,7 @@
List<Evaluator<? extends ExprNode,ServerEntry>> optimized =
new ArrayList<Evaluator<? extends ExprNode,ServerEntry>>( unoptimized.size() );
optimized.addAll( unoptimized );
+
Collections.sort( optimized, new Comparator<Evaluator<?,ServerEntry>>()
{
public int compare( Evaluator<?, ServerEntry> e1, Evaluator<?, ServerEntry> e2 )