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 2008/05/01 02:06:46 UTC
svn commit: r652410 [12/14] - in /directory: apacheds/branches/bigbang/
apacheds/branches/bigbang/apacheds-jdbm/
apacheds/branches/bigbang/apacheds-jdbm/src/
apacheds/branches/bigbang/apacheds-jdbm/src/etc/
apacheds/branches/bigbang/apacheds-jdbm/src/e...
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java Wed Apr 30 17:06:41 2008
@@ -22,7 +22,6 @@
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.ServerAttribute;
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.entry.ServerSearchResult;
import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
@@ -42,6 +41,7 @@
import org.apache.directory.shared.ldap.schema.OidNormalizer;
import org.apache.directory.shared.ldap.trigger.TriggerSpecification;
import org.apache.directory.shared.ldap.trigger.TriggerSpecificationParser;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -113,7 +113,8 @@
{
String suffix = suffixes.next();
LdapDN baseDn = new LdapDN( suffix );
- ExprNode filter = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, ApacheSchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC );
+ ExprNode filter = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT,
+ new ClientStringValue( ApacheSchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC ) );
SearchControls ctls = new SearchControls();
ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
NamingEnumeration<ServerSearchResult> results =
@@ -121,7 +122,7 @@
while ( results.hasMore() )
{
- ServerSearchResult result = results.next();
+ ServerSearchResult result = results.next();
LdapDN subentryDn = result.getDn();
ServerEntry resultEntry = result.getServerEntry();
EntryAttribute triggerSpec = resultEntry.get( PRESCRIPTIVE_TRIGGER_ATTR );
Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributesSerializerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributesSerializerTest.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributesSerializerTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/AttributesSerializerTest.java Wed Apr 30 17:06:41 2008
@@ -31,7 +31,7 @@
/**
- * Tests the {@link AttributeSerializer}.
+ * Tests the {@link EntryAttributeSerializer}.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableDupsBTreeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableDupsBTreeTest.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableDupsBTreeTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableDupsBTreeTest.java Wed Apr 30 17:06:41 2008
@@ -624,16 +624,6 @@
}
-// private void printTuples( NamingEnumeration tuples ) throws NamingException
-// {
-// while ( tuples.hasMore() )
-// {
-// Tuple tuple = ( Tuple ) tuples.next();
-// System.out.println( "(" + tuple.getKey() + ", " + tuple.getValue() + ")" );
-// }
-// }
-
-
class ArrayNE extends ArrayEnumeration implements NamingEnumeration
{
public ArrayNE( Object[] array )
Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableDupsTreeSetTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableDupsTreeSetTest.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableDupsTreeSetTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableDupsTreeSetTest.java Wed Apr 30 17:06:41 2008
@@ -626,16 +626,6 @@
}
-// private void printTuples( NamingEnumeration tuples ) throws NamingException
-// {
-// while ( tuples.hasMore() )
-// {
-// Tuple tuple = ( Tuple ) tuples.next();
-// System.out.println( "(" + tuple.getKey() + ", " + tuple.getValue() + ")" );
-// }
-// }
-
-
class ArrayNE extends ArrayEnumeration implements NamingEnumeration
{
public ArrayNE( Object[] array )
Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java Wed Apr 30 17:06:41 2008
@@ -161,7 +161,7 @@
Schema schema = schemas.get( "mozilla" );
assertNotNull( schema );
assertEquals( schema.getSchemaName(), "mozilla" );
- assertTrue( schema.isDisabled() );
+ //assertTrue( schema.isDisabled() );
assertEquals( schema.getOwner(), "uid=admin,ou=system" );
schema = null;
@@ -175,14 +175,14 @@
schema = schemas.get( "apachedns" );
assertNotNull( schema );
assertEquals( schema.getSchemaName(), "apachedns" );
- assertTrue( schema.isDisabled() );
+ //assertTrue( schema.isDisabled() );
assertEquals( schema.getOwner(), "uid=admin,ou=system" );
schema = null;
schema = schemas.get( "autofs" );
assertNotNull( schema );
assertEquals( schema.getSchemaName(), "autofs" );
- assertTrue( schema.isDisabled() );
+ //assertTrue( schema.isDisabled() );
assertEquals( schema.getOwner(), "uid=admin,ou=system" );
schema = null;
@@ -203,14 +203,14 @@
schema = schemas.get( "krb5kdc" );
assertNotNull( schema );
assertEquals( schema.getSchemaName(), "krb5kdc" );
- assertTrue( schema.isDisabled() );
+ //assertTrue( schema.isDisabled() );
assertEquals( schema.getOwner(), "uid=admin,ou=system" );
schema = null;
schema = schemas.get( "samba" );
assertNotNull( schema );
assertEquals( schema.getSchemaName(), "samba" );
- assertTrue( schema.isDisabled() );
+ //assertTrue( schema.isDisabled() );
assertEquals( schema.getOwner(), "uid=admin,ou=system" );
schema = null;
@@ -231,21 +231,21 @@
schema = schemas.get( "dhcp" );
assertNotNull( schema );
assertEquals( schema.getSchemaName(), "dhcp" );
- assertTrue( schema.isDisabled() );
+ //assertTrue( schema.isDisabled() );
assertEquals( schema.getOwner(), "uid=admin,ou=system" );
schema = null;
schema = schemas.get( "corba" );
assertNotNull( schema );
assertEquals( schema.getSchemaName(), "corba" );
- assertTrue( schema.isDisabled() );
+ //assertTrue( schema.isDisabled() );
assertEquals( schema.getOwner(), "uid=admin,ou=system" );
schema = null;
schema = schemas.get( "nis" );
assertNotNull( schema );
assertEquals( schema.getSchemaName(), "nis" );
- assertTrue( schema.isDisabled() );
+ //assertTrue( schema.isDisabled() );
assertEquals( schema.getOwner(), "uid=admin,ou=system" );
schema = null;
Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java Wed Apr 30 17:06:41 2008
@@ -30,6 +30,7 @@
import org.apache.directory.server.core.subtree.RefinementLeafEvaluator;
import org.apache.directory.server.schema.registries.OidRegistry;
import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
import org.apache.directory.shared.ldap.filter.EqualityNode;
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.filter.FilterParser;
@@ -121,7 +122,7 @@
try
{
- assertFalse( evaluator.evaluate( new EqualityNode( "", "" ), null ) );
+ assertFalse( evaluator.evaluate( new EqualityNode( "", new ClientStringValue( "" ) ), null ) );
fail( "should never get here due to an IAE" );
}
catch ( IllegalArgumentException iae )
@@ -130,7 +131,7 @@
try
{
- assertFalse( evaluator.evaluate( new EqualityNode( "", "" ), new DefaultServerAttribute( "cn", CN ) ) );
+ assertFalse( evaluator.evaluate( new EqualityNode( "", new ClientStringValue( "" ) ), new DefaultServerAttribute( "cn", CN ) ) );
fail( "should never get here due to an IAE" );
}
catch ( IllegalArgumentException iae )
@@ -145,17 +146,17 @@
// positive test
objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
- assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
+ assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "person" ) ), objectClasses ) );
objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person", "blah" );
- assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
+ assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "person" ) ), objectClasses ) );
// negative tests
objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
- assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "blah" ), objectClasses ) );
+ assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "blah" ) ), objectClasses ) );
objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "blah" );
- assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
+ assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "person" ) ), objectClasses ) );
}
@@ -164,17 +165,17 @@
ServerAttribute objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
// positive test
- assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.6" ), objectClasses ) );
+ assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "2.5.6.6" ) ), objectClasses ) );
objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person", "blah" );
- assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.6" ), objectClasses ) );
+ assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "2.5.6.6" ) ), objectClasses ) );
// negative tests
objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
- assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.5" ), objectClasses ) );
+ assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "2.5.6.5" ) ), objectClasses ) );
objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "blah" );
- assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.5" ), objectClasses ) );
+ assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "2.5.6.5" ) ), objectClasses ) );
}
Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java Wed Apr 30 17:06:41 2008
@@ -29,6 +29,7 @@
import org.apache.directory.server.core.subtree.RefinementLeafEvaluator;
import org.apache.directory.server.schema.registries.OidRegistry;
import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
import org.apache.directory.shared.ldap.filter.EqualityNode;
import org.apache.directory.shared.ldap.filter.GreaterEqNode;
import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -113,7 +114,7 @@
try
{
- assertFalse( evaluator.evaluate( new GreaterEqNode( "", "" ), objectClasses ) );
+ assertFalse( evaluator.evaluate( new GreaterEqNode( "", new ClientStringValue( "" ) ), objectClasses ) );
fail( "should never get here due to an NE" );
}
catch ( NamingException ne )
@@ -122,7 +123,7 @@
try
{
- assertFalse( evaluator.evaluate( new EqualityNode( "", "" ), objectClasses ) );
+ assertFalse( evaluator.evaluate( new EqualityNode( "", new ClientStringValue( "" ) ), objectClasses ) );
fail( "should never get here due to an NE" );
}
catch ( NamingException ne )
@@ -131,7 +132,7 @@
try
{
- assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "" ), objectClasses ) );
+ assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "" ) ), objectClasses ) );
fail( "should never get here due to an IAE" );
}
catch ( IllegalArgumentException iae )
@@ -141,7 +142,7 @@
try
{
objectClasses = new DefaultServerAttribute( "cn", OBJECT_CLASS );
- assertFalse( evaluator.evaluate( new EqualityNode( "cn", "" ), objectClasses ) );
+ assertFalse( evaluator.evaluate( new EqualityNode( "cn", new ClientStringValue( "" ) ), objectClasses ) );
fail( "should never get here due to an IAE" );
}
catch ( NamingException ne )
@@ -155,19 +156,19 @@
{
// positive test
ServerAttribute objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
- assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
+ assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "person" ) ), objectClasses ) );
objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS );
objectClasses.add( "person" );
objectClasses.add( "blah" );
- assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
+ assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "person" ) ), objectClasses ) );
// negative tests
objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
- assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "blah" ), objectClasses ) );
+ assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "blah" ) ), objectClasses ) );
objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "blah" );
- assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
+ assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "person" ) ), objectClasses ) );
}
@@ -176,18 +177,18 @@
ServerAttribute objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
// positive test
- assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.6" ), objectClasses ) );
+ assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "2.5.6.6" ) ), objectClasses ) );
objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS );
objectClasses.add( "person" );
objectClasses.add( "blah" );
- assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.6" ), objectClasses ) );
+ assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "2.5.6.6" ) ), objectClasses ) );
// negative tests
objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
- assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.5" ), objectClasses ) );
+ assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "2.5.6.5" ) ), objectClasses ) );
objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "blah" );
- assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.5" ), objectClasses ) );
+ assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new ClientStringValue( "2.5.6.5" ) ), objectClasses ) );
}
}
Modified: directory/apacheds/branches/bigbang/jdbm-store/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/pom.xml?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/pom.xml (original)
+++ directory/apacheds/branches/bigbang/jdbm-store/pom.xml Wed Apr 30 17:06:41 2008
@@ -48,8 +48,9 @@
</dependency>
<dependency>
- <groupId>jdbm</groupId>
- <artifactId>jdbm</artifactId>
+ <groupId>${pom.groupId}</groupId>
+ <version>${pom.version}</version>
+ <artifactId>apacheds-jdbm</artifactId>
</dependency>
<dependency>
Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Wed Apr 30 17:06:41 2008
@@ -29,6 +29,7 @@
import org.apache.directory.server.core.partition.impl.btree.IndexEnumeration;
import org.apache.directory.server.core.partition.impl.btree.Tuple;
import org.apache.directory.server.schema.SerializableComparator;
+import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.util.AttributeUtils;
import org.apache.directory.shared.ldap.util.SynchronizedLRUMap;
@@ -62,7 +63,6 @@
/** the key used for the reverse btree name */
public static final String REVERSE_BTREE = "_reverse";
-
/** the attribute type resolved for this JdbmIndex */
private AttributeType attribute;
/**
@@ -122,12 +122,10 @@
* instead with indirection.
*/
-
// ------------------------------------------------------------------------
// C O N S T R U C T O R S
// ------------------------------------------------------------------------
-
public JdbmIndex()
{
initialized = false;
@@ -145,14 +143,13 @@
{
this.keyCache = new SynchronizedLRUMap( cacheSize );
this.attribute = attributeType;
- if ( this.wkDirPath == null )
+ if ( this.wkDirPath == null )
{
this.wkDirPath = wkDirPath;
}
File file = new File( this.wkDirPath.getPath() + File.separator + attribute.getName() );
-
try
{
String path = file.getAbsolutePath();
@@ -188,14 +185,9 @@
* primary keys. A value for an attribute can occur several times in
* different entries so the forward map can have more than one value.
*/
- forward = new JdbmTable(
- attribute.getName() + FORWARD_BTREE,
- true,
- numDupLimit,
- recMan,
- new IndexComparator( comp, true ),
- null, null );
- //LongSerializer.INSTANCE );
+ forward = new JdbmTable( attribute.getName() + FORWARD_BTREE, true, numDupLimit, recMan, new IndexComparator(
+ comp, true ), null, null );
+ //LongSerializer.INSTANCE );
/*
* Now the reverse map stores the primary key into the master table as
@@ -203,14 +195,9 @@
* is single valued according to its specification based on a schema
* then duplicate keys should not be allowed within the reverse table.
*/
- reverse = new JdbmTable(
- attribute.getName() + REVERSE_BTREE,
- !attribute.isSingleValue(),
- numDupLimit,
- recMan,
- new IndexComparator( comp, false ),
- null, //LongSerializer.INSTANCE,
- null);
+ reverse = new JdbmTable( attribute.getName() + REVERSE_BTREE, !attribute.isSingleValue(), numDupLimit, recMan,
+ new IndexComparator( comp, false ), null, //LongSerializer.INSTANCE,
+ null );
}
@@ -227,7 +214,6 @@
// C O N F I G U R A T I O N M E T H O D S
// ------------------------------------------------------------------------
-
/**
* Protects configuration properties from being set after initialization.
*
@@ -238,7 +224,7 @@
if ( initialized )
{
throw new IllegalStateException( "The " + property
- + " property for an index cannot be set after it has been initialized." );
+ + " property for an index cannot be set after it has been initialized." );
}
}
@@ -345,7 +331,6 @@
// Scan Count Methods
// ------------------------------------------------------------------------
-
/**
* @see Index#count()
*/
@@ -377,7 +362,6 @@
// Forward and Reverse Lookups
// ------------------------------------------------------------------------
-
/**
* @see Index#forwardLookup(java.lang.Object)
*/
@@ -400,7 +384,6 @@
// Add/Drop Methods
// ------------------------------------------------------------------------
-
/**
* @see Index#add(Object,Object)
*/
@@ -503,7 +486,6 @@
// Index Listing Operations
// ------------------------------------------------------------------------
-
/**
* @see Index#listReverseIndices(Object)
*/
@@ -562,7 +544,6 @@
// Value Assertion (a.k.a Index Lookup) Methods //
// ------------------------------------------------------------------------
-
/**
* @see Index#hasValue(java.lang.Object,
* Object)
@@ -599,7 +580,6 @@
// Maintenance Methods
// ------------------------------------------------------------------------
-
/**
* @see Index#close()
*/
@@ -651,12 +631,19 @@
{
return attrVal;
}
-
+
Object normalized = keyCache.get( attrVal );
if ( null == normalized )
{
- normalized = attribute.getEquality().getNormalizer().normalize( attrVal );
+ if ( attrVal instanceof Value<?> )
+ {
+ normalized = attribute.getEquality().getNormalizer().normalize( ( ( Value<?> ) attrVal ).get() );
+ }
+ else
+ {
+ normalized = attribute.getEquality().getNormalizer().normalize( attrVal );
+ }
// Double map it so if we use an already normalized
// value we can get back the same normalized value.
Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java (original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java Wed Apr 30 17:06:41 2008
@@ -21,13 +21,16 @@
import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
import jdbm.RecordManager;
import jdbm.helper.LongSerializer;
import jdbm.helper.StringComparator;
+
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntrySerializer;
import org.apache.directory.server.core.partition.impl.btree.MasterTable;
import org.apache.directory.server.schema.SerializableComparator;
+import org.apache.directory.server.schema.registries.Registries;
/**
@@ -50,7 +53,8 @@
if ( o1 == null )
{
throw new IllegalArgumentException( "Argument 'obj1' is null" );
- } else if ( o2 == null )
+ }
+ else if ( o2 == null )
{
throw new IllegalArgumentException( "Argument 'obj2' is null" );
}
@@ -110,9 +114,9 @@
* @param recMan the jdbm record manager
* @throws NamingException if there is an error opening the Db file.
*/
- public JdbmMasterTable( RecordManager recMan ) throws NamingException
+ public JdbmMasterTable( RecordManager recMan, Registries registries ) throws NamingException
{
- super( DBF, recMan, LONG_COMPARATOR, LongSerializer.INSTANCE, new AttributesSerializer() );
+ super( DBF, recMan, LONG_COMPARATOR, LongSerializer.INSTANCE, new ServerEntrySerializer( registries ) );
adminTbl = new JdbmTable( "admin", recMan, STRING_COMPARATOR, null, null );
String seqValue = ( String ) adminTbl.get( SEQPROP_KEY );
@@ -124,44 +128,44 @@
/**
- * Gets the Attributes of an entry from this MasterTable.
+ * Gets the ServerEntry from this MasterTable.
*
- * @param id the BigInteger id of the entry to retrieve.
- * @return the Attributes of the entry with operational attributes and all.
+ * @param id the Long id of the entry to retrieve.
+ * @return the ServerEntry with operational attributes and all.
* @throws NamingException if there is a read error on the underlying Db.
*/
- public Attributes get( Object id ) throws NamingException
+ public ServerEntry get( Object id ) throws NamingException
{
- return ( Attributes ) super.get( id );
+ return ( ServerEntry ) super.get( id );
}
/**
- * Puts the Attributes of an entry into this master table at an index
+ * Puts the ServerEntry into this master table at an index
* specified by id. Used both to create new entries and update existing
* ones.
*
- * @param entry the Attributes of entry w/ operational attributes
- * @param id the BigInteger id of the entry to put
- * @return the Attributes of the entry put
+ * @param entry the ServerEntry w/ operational attributes
+ * @param id the Long id of the entry to put
+ * @return the ServerEntry put
* @throws NamingException if there is a write error on the underlying Db.
*/
- public Attributes put( Attributes entry, Object id ) throws NamingException
+ public ServerEntry put( ServerEntry entry, Object id ) throws NamingException
{
- return ( Attributes ) super.put( id, entry );
+ return ( ServerEntry ) super.put( id, entry );
}
/**
- * Deletes a entry from the master table at an index specified by id.
+ * Deletes a ServerEntry from the master table at an index specified by id.
*
- * @param id the BigInteger id of the entry to delete
+ * @param id the Long id of the entry to delete
* @return the Attributes of the deleted entry
* @throws NamingException if there is a write error on the underlying Db
*/
- public Attributes delete( Object id ) throws NamingException
+ public ServerEntry delete( Object id ) throws NamingException
{
- return ( Attributes ) super.remove( id );
+ return ( ServerEntry ) super.remove( id );
}
@@ -195,13 +199,13 @@
/**
* Get's the next value from this SequenceBDb. This has the side-effect of
- * changing the current sequence values perminantly in memory and on disk.
+ * changing the current sequence values permanently in memory and on disk.
* Master table sequence begins at BigInteger.ONE. The BigInteger.ZERO is
* used for the fictitious parent of the suffix root entry.
*
* @return the current value incremented by one.
* @throws NamingException if the admin table storing sequences cannot be
- * read and writen to.
+ * read and written to.
*/
public Long getNextId() throws NamingException
{
@@ -229,7 +233,7 @@
/**
- * Gets a persistant property stored in the admin table of this MasterTable.
+ * Gets a persistent property stored in the admin table of this MasterTable.
*
* @param property the key of the property to get the value of
* @return the value of the property
@@ -245,7 +249,7 @@
/**
- * Sets a persistant property stored in the admin table of this MasterTable.
+ * Sets a persistent property stored in the admin table of this MasterTable.
*
* @param property the key of the property to set the value of
* @param value the value of the property
@@ -258,5 +262,4 @@
adminTbl.put( property, value );
}
}
-
}
Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java (original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java Wed Apr 30 17:06:41 2008
@@ -25,9 +25,12 @@
import jdbm.recman.BaseRecordManager;
import jdbm.recman.CacheRecordManager;
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
+import org.apache.directory.server.core.entry.DefaultServerEntry;
import org.apache.directory.server.core.entry.ServerAttribute;
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerStringValue;
import org.apache.directory.server.core.partition.Oid;
import org.apache.directory.server.core.partition.impl.btree.Index;
import org.apache.directory.server.core.partition.impl.btree.IndexAssertion;
@@ -44,21 +47,16 @@
import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
import org.apache.directory.shared.ldap.util.NamespaceTools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -77,7 +75,6 @@
/** The default cache size is set to 10 000 objects */
private static final int DEFAULT_CACHE_SIZE = 10000;
-
/** the JDBM record manager used by this database */
private RecordManager recMan;
/** the normalized suffix DN of this backend database */
@@ -111,14 +108,17 @@
private JdbmIndex subAliasIdx;
/** a system index on aliasedObjectName attribute */
private JdbmIndex aliasIdx;
-
+
/** Two static declaration to avoid lookup all over the code */
private static AttributeType OBJECT_CLASS_AT;
private static AttributeType ALIASED_OBJECT_NAME_AT;
-
+
+ /** A pointer on the global registries */
+ private Registries registries;
+
/** A pointer on the AT registry */
private AttributeTypeRegistry attributeTypeRegistry;
-
+
/** A pointer on the OID registry */
private OidRegistry oidRegistry;
@@ -127,20 +127,17 @@
// C O N S T R U C T O R S
// ------------------------------------------------------------------------
-
/**
* Creates a store based on JDBM B+Trees.
*/
- public JdbmStore()
+ public JdbmStore()
{
}
-
// -----------------------------------------------------------------------
// C O N F I G U R A T I O N M E T H O D S
// -----------------------------------------------------------------------
-
private ServerEntry contextEntry;
private String suffixDn;
private boolean enableOptimizer;
@@ -268,8 +265,6 @@
// E N D C O N F I G U R A T I O N M E T H O D S
// -----------------------------------------------------------------------
-
-
/**
* Initialize the JDBM storage system.
*
@@ -277,11 +272,11 @@
* @param attributeTypeRegistry an attributeType specification registry to lookup type specs
* @throws NamingException on failure to create proper database files
*/
- public synchronized void init( OidRegistry oidRegistry, AttributeTypeRegistry attributeTypeRegistry )
- throws NamingException
+ public synchronized void init( Registries registries ) throws NamingException
{
- this.oidRegistry = oidRegistry;
- this.attributeTypeRegistry = attributeTypeRegistry;
+ this.registries = registries;
+ this.oidRegistry = registries.getOidRegistry();
+ this.attributeTypeRegistry = registries.getAttributeTypeRegistry();
OBJECT_CLASS_AT = attributeTypeRegistry.lookup( SchemaConstants.OBJECT_CLASS_AT );
ALIASED_OBJECT_NAME_AT = attributeTypeRegistry.lookup( SchemaConstants.ALIASED_OBJECT_NAME_AT );
@@ -292,7 +287,7 @@
try
{
- // First, check if the file storing the data exists
+ // First, check if the file storing the data exists
String path = workingDirectory.getPath() + File.separator + "master";
BaseRecordManager base = new BaseRecordManager( path );
base.disableTransactions();
@@ -303,15 +298,15 @@
if ( LOG.isDebugEnabled() )
{
- LOG.debug( "Using the default entry cache size of {} for {} partition", cacheSize, name );
+ LOG.debug( "Using the default entry cache size of {} for {} partition", cacheSize, name );
}
}
else
{
- if ( LOG.isDebugEnabled() )
- {
- LOG.debug( "Using the custom configured cache size of {} for {} partition", cacheSize, name );
- }
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( "Using the custom configured cache size of {} for {} partition", cacheSize, name );
+ }
}
// Now, create the entry cache for this partition
@@ -325,7 +320,7 @@
}
// Create the master table (the table wcontaining all the entries)
- master = new JdbmMasterTable( recMan );
+ master = new JdbmMasterTable( recMan, registries );
// -------------------------------------------------------------------
// Initializes the user and system indices
@@ -333,6 +328,9 @@
setupSystemIndices();
setupUserIndices();
+
+ contextEntry.getDn().normalize( attributeTypeRegistry.getNormalizerMapping() );
+
initSuffixEntry3( suffixDn, contextEntry );
// We are done !
@@ -344,7 +342,7 @@
{
if ( systemIndices.size() > 0 )
{
- HashMap<String,JdbmIndex> tmp = new HashMap<String,JdbmIndex>();
+ HashMap<String, JdbmIndex> tmp = new HashMap<String, JdbmIndex>();
for ( JdbmIndex index : systemIndices.values() )
{
String oid = oidRegistry.getOid( index.getAttributeId() );
@@ -416,7 +414,7 @@
{
if ( userIndices != null && userIndices.size() > 0 )
{
- HashMap<String,JdbmIndex> tmp = new HashMap<String,JdbmIndex>();
+ HashMap<String, JdbmIndex> tmp = new HashMap<String, JdbmIndex>();
for ( JdbmIndex index : userIndices.values() )
{
String oid = oidRegistry.getOid( index.getAttributeId() );
@@ -427,7 +425,7 @@
}
else
{
- userIndices = new HashMap<String,JdbmIndex>();
+ userIndices = new HashMap<String, JdbmIndex>();
}
}
@@ -438,20 +436,19 @@
*
* @param suffix the suffix for the store
* @param entry the root entry of the store
- * @throws NamingException on failre to add the root entry
+ * @throws NamingException on failure to add the root entry
*/
protected void initSuffixEntry3( String suffix, ServerEntry entry ) throws NamingException
{
// add entry for context, if it does not exist
- Attributes suffixOnDisk = getSuffixEntry();
-
+ ServerEntry suffixOnDisk = getSuffixEntry();
+
if ( suffixOnDisk == null )
{
LdapDN dn = new LdapDN( suffix );
LdapDN normalizedSuffix = LdapDN.normalize( dn, attributeTypeRegistry.getNormalizerMapping() );
-
- //add( normalizedSuffix, entry );
- add( normalizedSuffix, ServerEntryUtils.toAttributesImpl( entry ) );
+
+ add( normalizedSuffix, entry );
}
}
@@ -506,12 +503,12 @@
array.add( existanceIdx );
}
- for ( JdbmIndex index:array )
+ for ( JdbmIndex index : array )
{
try
{
index.close();
- LOG.debug( "Closed {} index for {} partition.", index.getAttributeId(), suffixDn );
+ LOG.debug( "Closed {} index for {} partition.", index.getAttributeId(), suffixDn );
}
catch ( Throwable t )
{
@@ -522,7 +519,7 @@
try
{
master.close();
- LOG.debug( "Closed master table for {} partition.", suffixDn );
+ LOG.debug( "Closed master table for {} partition.", suffixDn );
}
catch ( Throwable t )
{
@@ -532,7 +529,7 @@
try
{
recMan.close();
- LOG.debug( "Closed record manager for {} partition.", suffixDn );
+ LOG.debug( "Closed record manager for {} partition.", suffixDn );
}
catch ( Throwable t )
{
@@ -578,7 +575,7 @@
array.add( existanceIdx );
// Sync all user defined userIndices
- for ( Index idx:array )
+ for ( Index idx : array )
{
idx.sync();
}
@@ -601,7 +598,6 @@
// I N D E X M E T H O D S
// ------------------------------------------------------------------------
-
public void addIndex( JdbmIndex index ) throws NamingException
{
userIndices.put( index.getAttributeId(), index );
@@ -646,7 +642,7 @@
{
protect( "aliasIndex" );
aliasIdx = index;
- systemIndices.put( index.getAttributeId() , aliasIdx );
+ systemIndices.put( index.getAttributeId(), aliasIdx );
}
@@ -749,7 +745,7 @@
else
{
String name;
-
+
try
{
name = oidRegistry.getPrimaryName( id );
@@ -760,9 +756,8 @@
LOG.error( msg, e );
throw new IndexNotFoundException( msg, id, e );
}
-
- throw new IndexNotFoundException( "A user index on attribute " + id + " ("
- + name + ") does not exist!" );
+
+ throw new IndexNotFoundException( "A user index on attribute " + id + " (" + name + ") does not exist!" );
}
}
@@ -779,7 +774,6 @@
throw new IndexNotFoundException( "Failed to identify OID for: " + id, id, e );
}
-
if ( systemIndices.containsKey( id ) )
{
return systemIndices.get( id );
@@ -787,7 +781,7 @@
else
{
String name;
-
+
try
{
name = oidRegistry.getPrimaryName( id );
@@ -798,9 +792,8 @@
LOG.error( msg, e );
throw new IndexNotFoundException( msg, id, e );
}
-
- throw new IndexNotFoundException( "A system index on attribute " + id + " ("
- + name + ") does not exist!" );
+
+ throw new IndexNotFoundException( "A system index on attribute " + id + " (" + name + ") does not exist!" );
}
}
@@ -1026,8 +1019,8 @@
}
}
-
- public void add( LdapDN normName, Attributes entry ) throws NamingException
+
+ public void add( LdapDN normName, ServerEntry entry ) throws NamingException
{
Long id;
Long parentId;
@@ -1041,7 +1034,7 @@
//
LdapDN parentDn = null;
-
+
if ( normName.equals( normSuffix ) )
{
parentId = 0L;
@@ -1059,7 +1052,7 @@
throw new LdapNameNotFoundException( "Id for parent '" + parentDn + "' not found!" );
}
- Attribute objectClass = AttributeUtils.getAttribute( entry, OBJECT_CLASS_AT );
+ EntryAttribute objectClass = entry.get( OBJECT_CLASS_AT );
if ( objectClass == null )
{
@@ -1072,40 +1065,34 @@
if ( objectClass.contains( SchemaConstants.ALIAS_OC ) )
{
- Attribute aliasAttr = AttributeUtils.getAttribute( entry, ALIASED_OBJECT_NAME_AT );
- addAliasIndices( id, normName, ( String ) aliasAttr.get() );
+ EntryAttribute aliasAttr = entry.get( ALIASED_OBJECT_NAME_AT );
+ addAliasIndices( id, normName, aliasAttr.getString() );
}
-
- if ( ! Character.isDigit( normName.toNormName().charAt( 0 ) ) )
+ if ( !Character.isDigit( normName.toNormName().charAt( 0 ) ) )
{
throw new IllegalStateException( "Not a normalized name: " + normName.toNormName() );
}
-
ndnIdx.add( normName.toNormName(), id );
updnIdx.add( normName.getUpName(), id );
hierarchyIdx.add( parentId, id );
// Now work on the user defined userIndices
- NamingEnumeration<String> list = entry.getIDs();
-
- while ( list.hasMore() )
+ for ( EntryAttribute attribute : entry )
{
- String attributeId = list.next();
- String attributeOid = oidRegistry.getOid( attributeId );
+ String attributeOid = ( ( ServerAttribute ) attribute ).getAttributeType().getOid();
if ( hasUserIndexOn( attributeOid ) )
{
Index idx = getUserIndex( attributeOid );
-
+
// here lookup by attributeId is ok since we got attributeId from
// the entry via the enumeration - it's in there as is for sure
- NamingEnumeration<?> values = entry.get( attributeId ).getAll();
- while ( values.hasMore() )
+ for ( Value<?> value : attribute )
{
- idx.add( values.next(), id );
+ idx.add( value.get(), id );
}
// Adds only those attributes that are indexed
@@ -1114,7 +1101,7 @@
}
master.put( entry, id );
-
+
if ( isSyncOnWrite )
{
sync();
@@ -1122,7 +1109,7 @@
}
- public Attributes lookup( Long id ) throws NamingException
+ public ServerEntry lookup( Long id ) throws NamingException
{
return master.get( id );
}
@@ -1130,12 +1117,11 @@
public void delete( Long id ) throws NamingException
{
- Attributes entry = lookup( id );
+ ServerEntry entry = lookup( id );
Long parentId = getParentId( id );
- NamingEnumeration<String> attrs = entry.getIDs();
- Attribute objectClass = AttributeUtils.getAttribute( entry, OBJECT_CLASS_AT );
-
+ EntryAttribute objectClass = entry.get( OBJECT_CLASS_AT );
+
if ( objectClass.contains( SchemaConstants.ALIAS_OC ) )
{
dropAliasIndices( id );
@@ -1151,10 +1137,9 @@
hierarchyIdx.drop( parentId, id );
}
- while ( attrs.hasMore() )
+ for ( EntryAttribute attribute : entry )
{
- String attributeId = attrs.next();
- String attributeOid = oidRegistry.getOid( attributeId );
+ String attributeOid = ( ( ServerAttribute ) attribute ).getAttributeType().getOid();
if ( hasUserIndexOn( attributeOid ) )
{
@@ -1162,11 +1147,9 @@
// here lookup by attributeId is ok since we got attributeId from
// the entry via the enumeration - it's in there as is for sure
- NamingEnumeration<?> values = entry.get( attributeId ).getAll();
-
- while ( values.hasMore() )
+ for ( Value<?> value : attribute )
{
- index.drop( values.next(), id );
+ index.drop( value, id );
}
existanceIdx.drop( attributeOid, id );
@@ -1174,7 +1157,7 @@
}
master.delete( id );
-
+
if ( isSyncOnWrite )
{
sync();
@@ -1199,13 +1182,14 @@
return normSuffix;
}
+
public LdapDN getUpSuffix()
{
return upSuffix;
}
- public Attributes getSuffixEntry() throws NamingException
+ public ServerEntry getSuffixEntry() throws NamingException
{
Long id = getEntryId( normSuffix.toNormName() );
@@ -1230,33 +1214,41 @@
}
- public Attributes getIndices( Long id ) throws NamingException
+ public ServerEntry getIndices( Long id ) throws NamingException
{
- Attributes attributes = new AttributesImpl();
+ ServerEntry attributes = new DefaultServerEntry( registries );
// Get the distinguishedName to id mapping
attributes.put( "_nDn", getEntryDn( id ) );
attributes.put( "_upDn", getEntryUpdn( id ) );
- attributes.put( "_parent", getParentId( id ) );
+ attributes.put( "_parent", getParentId( id ).toString() );
// Get all standard index attribute to value mappings
- for ( Index index:this.userIndices.values() )
+ for ( Index index : this.userIndices.values() )
{
NamingEnumeration<IndexRecord> list = index.listReverseIndices( id );
-
+
while ( list.hasMore() )
{
IndexRecord rec = list.next();
Object val = rec.getIndexKey();
String attrId = index.getAttribute().getName();
- Attribute attr = attributes.get( attrId );
+ EntryAttribute attr = attributes.get( attrId );
if ( attr == null )
{
- attr = new AttributeImpl( attrId );
+ attr = new DefaultServerAttribute( attributeTypeRegistry.lookup( attrId ) );
+ }
+
+ if ( val instanceof String )
+ {
+ attr.add( ( String ) val );
}
-
- attr.add( val );
+ else
+ {
+ attr.add( ( byte[] ) val );
+ }
+
attributes.put( attr );
}
}
@@ -1265,7 +1257,7 @@
// that looks like so 'existance[attribute]' and the value is set to id
NamingEnumeration<IndexRecord> list = existanceIdx.listReverseIndices( id );
StringBuffer val = new StringBuffer();
-
+
while ( list.hasMore() )
{
IndexRecord rec = list.next();
@@ -1274,14 +1266,24 @@
val.append( "]" );
String valStr = val.toString();
- Attribute attr = attributes.get( valStr );
-
+ EntryAttribute attr = attributes.get( valStr );
+
if ( attr == null )
{
- attr = new AttributeImpl( valStr );
+ attr = new DefaultServerAttribute( attributeTypeRegistry.lookup( valStr ) );
+ }
+
+ Object idRec = rec.getEntryId();
+
+ if ( idRec instanceof String )
+ {
+ attr.add( ( String ) idRec );
+ }
+ else
+ {
+ attr.add( ( byte[] ) idRec );
}
-
- attr.add( rec.getEntryId() );
+
attributes.put( attr );
val.setLength( 0 );
}
@@ -1289,13 +1291,24 @@
// Get all parent child mappings for this entry as the parent using the
// key 'child' with many entries following it.
list = hierarchyIdx.listIndices( id );
- Attribute childAttr = new AttributeImpl( "_child" );
+ EntryAttribute childAttr = new DefaultServerAttribute( attributeTypeRegistry.lookup( "_child" ) );
+
attributes.put( childAttr );
-
+
while ( list.hasMore() )
{
IndexRecord rec = ( IndexRecord ) list.next();
- childAttr.add( rec.getEntryId() );
+
+ Object idRec = rec.getEntryId();
+
+ if ( idRec instanceof String )
+ {
+ childAttr.add( ( String ) idRec );
+ }
+ else
+ {
+ childAttr.add( ( byte[] ) idRec );
+ }
}
return attributes;
@@ -1313,10 +1326,10 @@
* @throws NamingException if index alteration or attribute addition
* fails.
*/
- private void add( Long id, Attributes entry, EntryAttribute mods ) throws NamingException
+ private void add( Long id, ServerEntry entry, EntryAttribute mods ) throws NamingException
{
String modsOid = oidRegistry.getOid( mods.getId() );
-
+
if ( hasUserIndexOn( modsOid ) )
{
Index idx = getUserIndex( modsOid );
@@ -1331,17 +1344,10 @@
// add all the values in mods to the same attribute in the entry
AttributeType type = attributeTypeRegistry.lookup( modsOid );
- Attribute entryAttrToAddTo = AttributeUtils.getAttribute( entry, type );
- if ( entryAttrToAddTo == null )
+ for ( Value<?> value : mods )
{
- entryAttrToAddTo = new AttributeImpl( mods.getId() );
- entry.put( entryAttrToAddTo );
- }
-
- for ( Value<?> value:mods )
- {
- entryAttrToAddTo.add( value.get() );
+ entry.add( type, value );
}
if ( modsOid.equals( oidRegistry.getOid( SchemaConstants.ALIASED_OBJECT_NAME_AT ) ) )
@@ -1366,10 +1372,10 @@
* @throws NamingException if index alteration or attribute modification
* fails.
*/
- private void remove( Long id, Attributes entry, EntryAttribute mods ) throws NamingException
+ private void remove( Long id, ServerEntry entry, EntryAttribute mods ) throws NamingException
{
String modsOid = oidRegistry.getOid( mods.getId() );
-
+
if ( hasUserIndexOn( modsOid ) )
{
Index idx = getUserIndex( modsOid );
@@ -1394,21 +1400,28 @@
*/
if ( mods.size() == 0 )
{
- AttributeUtils.removeAttribute( attrType, entry );
+ entry.removeAttributes( attrType );
}
else
{
- Attribute entryAttr = AttributeUtils.getAttribute( entry, attrType );
-
- for ( Value<?> value:mods )
+ EntryAttribute entryAttr = entry.get( attrType );
+
+ for ( Value<?> value : mods )
{
- entryAttr.remove( value.get() );
+ if ( value instanceof ServerStringValue )
+ {
+ entryAttr.remove( ( String ) value.get() );
+ }
+ else
+ {
+ entryAttr.remove( ( byte[] ) value.get() );
+ }
}
// if nothing is left just remove empty attribute
if ( entryAttr.size() == 0 )
{
- entry.remove( entryAttr.getID() );
+ entry.removeAttributes( entryAttr.getId() );
}
}
@@ -1432,10 +1445,10 @@
* @throws NamingException if index alteration or attribute modification
* fails.
*/
- private void replace( Long id, Attributes entry, EntryAttribute mods ) throws NamingException
+ private void replace( Long id, ServerEntry entry, EntryAttribute mods ) throws NamingException
{
String modsOid = oidRegistry.getOid( mods.getId() );
-
+
if ( hasUserIndexOn( modsOid ) )
{
Index idx = getUserIndex( modsOid );
@@ -1455,7 +1468,7 @@
}
String aliasAttributeOid = oidRegistry.getOid( SchemaConstants.ALIASED_OBJECT_NAME_AT );
-
+
if ( modsOid.equals( aliasAttributeOid ) )
{
dropAliasIndices( id );
@@ -1464,11 +1477,12 @@
// replaces old attributes with new modified ones if they exist
if ( mods.size() > 0 )
{
- entry.put( ServerEntryUtils.toAttributeImpl( mods ) );
+ entry.put( mods );
}
- else // removes old attributes if new replacements do not exist
+ else
+ // removes old attributes if new replacements do not exist
{
- entry.remove( mods.getId() );
+ entry.remove( mods );
}
if ( modsOid.equals( aliasAttributeOid ) && mods.size() > 0 )
@@ -1483,34 +1497,34 @@
{
NamingEnumeration<String> attrs;
Long id = getEntryId( dn.toString() );
- Attributes entry = master.get( id );
+ ServerEntry entry = master.get( id );
- for ( AttributeType attributeType:mods.getAttributeTypes() )
+ for ( AttributeType attributeType : mods.getAttributeTypes() )
{
EntryAttribute attr = mods.get( attributeType );
switch ( modOp )
{
- case ADD_ATTRIBUTE :
+ case ADD_ATTRIBUTE:
add( id, entry, attr );
break;
-
- case REMOVE_ATTRIBUTE :
+
+ case REMOVE_ATTRIBUTE:
remove( id, entry, attr );
break;
-
- case REPLACE_ATTRIBUTE :
+
+ case REPLACE_ATTRIBUTE:
replace( id, entry, attr );
-
+
break;
-
+
default:
throw new NamingException( "Unidentified modification operation" );
}
}
master.put( entry, id );
-
+
if ( isSyncOnWrite )
{
sync();
@@ -1521,23 +1535,23 @@
public void modify( LdapDN dn, List<Modification> mods ) throws NamingException
{
Long id = getEntryId( dn.toString() );
- Attributes entry = master.get( id );
+ ServerEntry entry = master.get( id );
for ( Modification mod : mods )
{
- ServerAttribute attrMods = (ServerAttribute)mod.getAttribute();
+ ServerAttribute attrMods = ( ServerAttribute ) mod.getAttribute();
switch ( mod.getOperation() )
{
- case ADD_ATTRIBUTE :
+ case ADD_ATTRIBUTE:
add( id, entry, attrMods );
break;
- case REMOVE_ATTRIBUTE :
- remove(id, entry, attrMods);
+ case REMOVE_ATTRIBUTE:
+ remove( id, entry, attrMods );
break;
- case REPLACE_ATTRIBUTE :
+ case REPLACE_ATTRIBUTE:
replace( id, entry, attrMods );
break;
@@ -1547,7 +1561,7 @@
}
master.put( entry, id );
-
+
if ( isSyncOnWrite )
{
sync();
@@ -1577,8 +1591,8 @@
String newRdnAttr = newRdn.getNormType();
String newRdnValue = ( String ) newRdn.getValue();
Long id = getEntryId( dn.getNormName() );
- Attributes entry = lookup( id );
- LdapDN updn = new LdapDN( getEntryUpdn( id ) );
+ ServerEntry entry = lookup( id );
+ LdapDN updn = entry.getDn();
/*
* H A N D L E N E W R D N
@@ -1590,20 +1604,20 @@
*/
AttributeType newRdnAttrType = attributeTypeRegistry.lookup( newRdn.getNormType() );
- Attribute rdnAttr = AttributeUtils.getAttribute( entry, newRdnAttrType );
-
+ EntryAttribute rdnAttr = entry.get( newRdnAttrType );
+
if ( rdnAttr == null )
{
- rdnAttr = new AttributeImpl( newRdnAttr );
+ rdnAttr = new DefaultServerAttribute( newRdnAttrType );
}
// add the new Rdn value only if it is not already present in the entry
- if ( ! AttributeUtils.containsValue( rdnAttr, newRdnValue, newRdnAttrType ) )
+ if ( !rdnAttr.contains( newRdnValue ) )
{
- rdnAttr.add( newRdn.getUpValue() );
+ rdnAttr.add( ( String ) newRdn.getUpValue() );
}
- entry.put( rdnAttr );
+ //entry.put( rdnAttr );
if ( hasUserIndexOn( newRdn.getNormType() ) )
{
@@ -1636,8 +1650,8 @@
Rdn oldRdn = updn.getRdn();
AttributeType oldRdnAttrType = attributeTypeRegistry.lookup( oldRdn.getNormType() );
- Attribute oldRdnAttr = AttributeUtils.getAttribute( entry, oldRdnAttrType );
- AttributeUtils.removeValue( oldRdnAttr, oldRdn.getUpValue(), oldRdnAttrType );
+ EntryAttribute oldRdnAttr = entry.get( oldRdnAttrType );
+ oldRdnAttr.remove( ( String ) oldRdn.getUpValue() );
if ( hasUserIndexOn( oldRdn.getNormType() ) )
{
@@ -1672,9 +1686,13 @@
// gotta normalize cuz this thang is cloned and not normalized by default
newUpdn.normalize( attributeTypeRegistry.getNormalizerMapping() );
-
+
modifyDn( id, newUpdn, false ); // propagate dn changes
-
+
+ // Update the current entry
+ entry.setDn( newUpdn );
+ master.put( entry, id );
+
if ( isSyncOnWrite )
{
sync();
@@ -1706,7 +1724,7 @@
// Now we can handle the appropriate name userIndices for all cases
ndnIdx.drop( id );
- if ( ! updn.isNormalized() )
+ if ( !updn.isNormalized() )
{
updn.normalize( attributeTypeRegistry.getNormalizerMapping() );
}
@@ -1755,6 +1773,11 @@
rdnDN.normalize( attributeTypeRegistry.getNormalizerMapping() );
childUpdn.add( rdnDN.getRdn() );
+ // Modify the child
+ ServerEntry entry = lookup( childId );
+ entry.setDn( childUpdn );
+ master.put( childId, entry );
+
// Recursively change the names of the children below
modifyDn( childId, childUpdn, isMove );
}
@@ -1766,7 +1789,7 @@
Long childId = getEntryId( oldChildDn.toString() );
rename( oldChildDn, newRdn, deleteOldRdn );
move( oldChildDn, childId, newParentDn );
-
+
if ( isSyncOnWrite )
{
sync();
@@ -1778,7 +1801,7 @@
{
Long childId = getEntryId( oldChildDn.toString() );
move( oldChildDn, childId, newParentDn );
-
+
if ( isSyncOnWrite )
{
sync();
@@ -1853,25 +1876,25 @@
{
public boolean assertCandidate( IndexRecord rec ) throws NamingException
{
- String dn = getEntryDn( (Long)rec.getEntryId() );
+ String dn = getEntryDn( ( Long ) rec.getEntryId() );
return dn.endsWith( movedBase.toString() );
}
};
Long movedBaseId = getEntryId( movedBase.toString() );
-
+
if ( aliasIdx.reverseLookup( movedBaseId ) != null )
{
dropAliasIndices( movedBaseId, movedBase );
}
- NamingEnumeration<IndexRecord> aliases = new IndexAssertionEnumeration( aliasIdx.listIndices( movedBase.toString(), true ),
- isBaseDescendant );
-
+ NamingEnumeration<IndexRecord> aliases = new IndexAssertionEnumeration( aliasIdx.listIndices( movedBase
+ .toString(), true ), isBaseDescendant );
+
while ( aliases.hasMore() )
{
IndexRecord entry = aliases.next();
- dropAliasIndices( (Long)entry.getEntryId(), movedBase );
+ dropAliasIndices( ( Long ) entry.getEntryId(), movedBase );
}
}
Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java (original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java Wed Apr 30 17:06:41 2008
@@ -132,6 +132,7 @@
if ( recId != 0 )
{
bt = BTree.load( recMan, recId );
+ bt.setValueSerializer( valueSerializer );
recId = recMan.getNamedObject( name + SZSUFFIX );
count = ( ( Integer ) recMan.fetch( recId ) ).intValue();
}
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java Wed Apr 30 17:06:41 2008
@@ -48,8 +48,11 @@
{
private static final long serialVersionUID = 2294492811671880570L;
- private final LdapDN normalizedName;
+ /** The entry to add */
private final Attributes entry;
+
+ /** The entry's dn */
+ private final LdapDN dn;
/**
@@ -57,41 +60,34 @@
*
* @param entry an entry
*/
- public AddEntryOperation( CSN csn, LdapDN normalizedName, ServerEntry entry )
+ public AddEntryOperation( CSN csn, ServerEntry entry )
{
super( csn );
- assert normalizedName != null;
assert entry != null;
- this.normalizedName = normalizedName;
this.entry = ServerEntryUtils.toAttributesImpl( entry );
- }
-
-
- public String toString()
- {
- return super.toString() + ": [" + normalizedName + "].new( " + entry + " )";
+ this.dn = entry.getDn();
}
protected void execute0( PartitionNexus nexus, ReplicationStore store, Registries registries )
throws NamingException
{
- if ( !EntryUtil.isEntryUpdatable( registries, nexus, normalizedName, getCSN() ) )
+ if ( !EntryUtil.isEntryUpdatable( registries, nexus, dn, getCSN() ) )
{
return;
}
- EntryUtil.createGlueEntries( registries, nexus, normalizedName, false );
+ EntryUtil.createGlueEntries( registries, nexus, dn, false );
// Replace the entry if an entry with the same name exists.
- if ( nexus.lookup( new LookupOperationContext( registries, normalizedName ) ) != null )
+ if ( nexus.lookup( new LookupOperationContext( registries, dn ) ) != null )
{
- recursiveDelete( nexus, normalizedName, registries );
+ recursiveDelete( nexus, dn, registries );
}
- nexus.add( new AddOperationContext( registries, normalizedName, ServerEntryUtils.toServerEntry( entry, normalizedName, registries ) ) );
+ nexus.add( new AddOperationContext( registries, ServerEntryUtils.toServerEntry( entry, dn, registries ) ) );
}
@@ -109,7 +105,7 @@
while ( ne.hasMore() )
{
- ServerSearchResult sr = ne.next();
+ ServerSearchResult sr = ne.next();
LdapDN dn = sr.getDn();
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
recursiveDelete( nexus, dn, registries );
@@ -117,4 +113,10 @@
nexus.delete( new DeleteOperationContext( registries, normalizedName ) );
}
+
+
+ public String toString()
+ {
+ return super.toString() + ": [" + dn + "].new( " + entry + " )";
+ }
}
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java Wed Apr 30 17:06:41 2008
@@ -136,7 +136,7 @@
// MODIFY operation)
cloneEntry.put( Constants.ENTRY_CSN, csn.toOctetString() );
- return new AddEntryOperation( csn, normalizedName, cloneEntry );
+ return new AddEntryOperation( csn, cloneEntry );
}
@@ -277,7 +277,7 @@
while ( e.hasMore() )
{
- ServerSearchResult sr = e.next();
+ ServerSearchResult sr = e.next();
// Get the name of the old entry
LdapDN oldEntryName = sr.getDn();
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java Wed Apr 30 17:06:41 2008
@@ -130,7 +130,7 @@
entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, SchemaConstants.EXTENSIBLE_OBJECT_OC );
// And add it to the nexus.
- nexus.add( new AddOperationContext( registries, name, entry ) );
+ nexus.add( new AddOperationContext( registries, entry ) );
}
Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java Wed Apr 30 17:06:41 2008
@@ -131,9 +131,7 @@
ctx.getSession().setWriteTimeout( ctx.getConfiguration().getResponseTimeout() );
// Check update vector of the remote peer periodically.
- ctx.getSession().setIdleTime(
- IdleStatus.BOTH_IDLE,
- ctx.getConfiguration().getReplicationInterval());
+ ctx.getSession().setIdleTime( IdleStatus.BOTH_IDLE, ctx.getConfiguration().getReplicationInterval() );
}
@@ -182,8 +180,8 @@
public void messageSent( ReplicationContext ctx, Object message ) throws Exception
{
}
-
-
+
+
/**
* A helper to write a message and schedule that message for expiration.
*
@@ -202,8 +200,8 @@
{
if ( SessionLog.isWarnEnabled( ctx.getSession() ) )
{
- SessionLog.warn( ctx.getSession(), "[Replica-"+ ctx.getConfiguration().getReplicaId()
- +"] Unexpected exception.", cause );
+ SessionLog.warn( ctx.getSession(), "[Replica-" + ctx.getConfiguration().getReplicaId()
+ + "] Unexpected exception.", cause );
}
ctx.getSession().close();
}
@@ -219,8 +217,8 @@
{
if ( message.getResponseCode() != Constants.OK )
{
- SessionLog.warn( ctx.getSession(), "[Replica-"+ ctx.getConfiguration().getReplicaId() +
- "] Login attempt failed: " + message.getResponseCode() );
+ SessionLog.warn( ctx.getSession(), "[Replica-" + ctx.getConfiguration().getReplicaId()
+ + "] Login attempt failed: " + message.getResponseCode() );
ctx.getSession().close();
return;
}
@@ -230,7 +228,7 @@
if ( replica.getId().equals( message.getReplicaId() ) )
{
if ( replica.getAddress().getAddress().equals(
- ( ( InetSocketAddress ) ctx.getSession().getRemoteAddress() ).getAddress() ) )
+ ( ( InetSocketAddress ) ctx.getSession().getRemoteAddress() ).getAddress() ) )
{
ctx.setPeer( replica );
ctx.setState( State.READY );
@@ -238,17 +236,17 @@
}
else
{
- SessionLog.warn( ctx.getSession(), "[Replica-"+ ctx.getConfiguration().getReplicaId()
- + "] Peer address mismatches: "
- + ctx.getSession().getRemoteAddress() + " (expected: " + replica.getAddress() );
+ SessionLog.warn( ctx.getSession(), "[Replica-" + ctx.getConfiguration().getReplicaId()
+ + "] Peer address mismatches: " + ctx.getSession().getRemoteAddress() + " (expected: "
+ + replica.getAddress() );
ctx.getSession().close();
return;
}
}
}
- SessionLog.warn( ctx.getSession(), "[Replica-"+ ctx.getConfiguration().getReplicaId() +
- "] Unknown peer replica ID: " + message.getReplicaId() );
+ SessionLog.warn( ctx.getSession(), "[Replica-" + ctx.getConfiguration().getReplicaId()
+ + "] Unknown peer replica ID: " + message.getReplicaId() );
ctx.getSession().close();
}
@@ -262,27 +260,26 @@
if ( ctx.getState() == State.READY && ctx.getScheduledExpirations() <= 0
&& ctx.getSession().getScheduledWriteRequests() <= 0 )
{
- // Initiate replication process asking update vector.
- if ( SessionLog.isDebugEnabled( ctx.getSession() ) ) {
- SessionLog.debug( ctx.getSession(), "(" +
- ctx.getConfiguration().getReplicaId().getId() + "->" +
- (ctx.getPeer() != null ? ctx.getPeer().getId().getId() : "null") +
- ") Beginning replication. " );
+ // Initiate replication process asking update vector.
+ if ( SessionLog.isDebugEnabled( ctx.getSession() ) )
+ {
+ SessionLog.debug( ctx.getSession(), "(" + ctx.getConfiguration().getReplicaId().getId() + "->"
+ + ( ctx.getPeer() != null ? ctx.getPeer().getId().getId() : "null" ) + ") Beginning replication. " );
}
- ctx.getSession().write( new BeginLogEntriesMessage( ctx.getNextSequence() ) );
- return true;
+ ctx.getSession().write( new BeginLogEntriesMessage( ctx.getNextSequence() ) );
+ return true;
}
else
{
- if ( SessionLog.isDebugEnabled( ctx.getSession() ) ) {
- SessionLog.debug( ctx.getSession(), "(" +
- ctx.getConfiguration().getReplicaId().getId() + "->" +
- (ctx.getPeer() != null ? ctx.getPeer().getId().getId() : "null") +
- ") Couldn't begin replication. State:" + ctx.getState() + ", scheduledExpirations:"
- + ctx.getScheduledExpirations() +
- ", scheduledWriteRequests:" + ctx.getSession().getScheduledWriteRequests() );
+ if ( SessionLog.isDebugEnabled( ctx.getSession() ) )
+ {
+ SessionLog.debug( ctx.getSession(), "(" + ctx.getConfiguration().getReplicaId().getId() + "->"
+ + ( ctx.getPeer() != null ? ctx.getPeer().getId().getId() : "null" )
+ + ") Couldn't begin replication. State:" + ctx.getState() + ", scheduledExpirations:"
+ + ctx.getScheduledExpirations() + ", scheduledWriteRequests:"
+ + ctx.getSession().getScheduledWriteRequests() );
}
- return false;
+ return false;
}
}
@@ -291,8 +288,8 @@
{
if ( message.getResponseCode() != Constants.OK )
{
- SessionLog.warn( ctx.getSession(), "[Replica-"+ ctx.getConfiguration().getReplicaId() +
- "] Remote peer failed to execute a log entry." );
+ SessionLog.warn( ctx.getSession(), "[Replica-" + ctx.getConfiguration().getReplicaId()
+ + "] Remote peer failed to execute a log entry." );
ctx.getSession().close();
}
}
@@ -316,8 +313,8 @@
}
catch ( Exception e )
{
- SessionLog.warn( ctx.getSession(), "[Replica-"+ ctx.getConfiguration().getReplicaId() +
- "] Failed to get update vector.", e );
+ SessionLog.warn( ctx.getSession(), "[Replica-" + ctx.getConfiguration().getReplicaId()
+ + "] Failed to get update vector.", e );
ctx.getSession().close();
return;
}
@@ -327,14 +324,14 @@
{
if ( myPV.size() > 0 && yourUV.size() == 0 )
{
- SessionLog.warn( ctx.getSession(), "[Replica-"+ ctx.getConfiguration().getReplicaId() +
- "] Starting a whole DIT transfer." );
+ SessionLog.warn( ctx.getSession(), "[Replica-" + ctx.getConfiguration().getReplicaId()
+ + "] Starting a whole DIT transfer." );
sendAllEntries( ctx );
}
else
{
- SessionLog.warn( ctx.getSession(), "[Replica-"+ ctx.getConfiguration().getReplicaId() +
- "] Starting a partial replication log transfer." );
+ SessionLog.warn( ctx.getSession(), "[Replica-" + ctx.getConfiguration().getReplicaId()
+ + "] Starting a partial replication log transfer." );
sendReplicationLogs( ctx, myPV, yourUV );
}
}
@@ -351,24 +348,24 @@
ServerEntry rootDSE = ctx.getDirectoryService().getPartitionNexus().getRootDSE( null );
EntryAttribute namingContextsAttr = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT );
-
+
if ( namingContextsAttr == null || namingContextsAttr.size() == 0 )
{
- SessionLog.warn( ctx.getSession(), "[Replica-"+ ctx.getConfiguration().getReplicaId() +
- "] No namingContexts attributes in rootDSE." );
+ SessionLog.warn( ctx.getSession(), "[Replica-" + ctx.getConfiguration().getReplicaId()
+ + "] No namingContexts attributes in rootDSE." );
return;
}
// Iterate all context partitions to send all entries of them.
- for ( Value<?> namingContext:namingContextsAttr )
+ for ( Value<?> namingContext : namingContextsAttr )
{
// Convert attribute value to JNDI name.
LdapDN contextName;
- contextName = new LdapDN( (String)namingContext.get() );
+ contextName = new LdapDN( ( String ) namingContext.get() );
- SessionLog.info( ctx.getSession(), "[Replica-"+ ctx.getConfiguration().getReplicaId() +
- "] Sending entries under '" + contextName + '\'' );
+ SessionLog.info( ctx.getSession(), "[Replica-" + ctx.getConfiguration().getReplicaId()
+ + "] Sending entries under '" + contextName + '\'' );
Map<String, OidNormalizer> mapping = ctx.getDirectoryService().getRegistries().getAttributeTypeRegistry()
.getNormalizerMapping();
@@ -384,19 +381,19 @@
SearchControls ctrl = new SearchControls();
ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE );
NamingEnumeration<ServerSearchResult> e = ctx.getDirectoryService().getPartitionNexus().search(
- new SearchOperationContext( ctx.getDirectoryService().getRegistries(), contextName, AliasDerefMode.DEREF_ALWAYS,
- new PresenceNode( SchemaConstants.OBJECT_CLASS_AT_OID ), ctrl ) );
+ new SearchOperationContext( ctx.getDirectoryService().getRegistries(), contextName,
+ AliasDerefMode.DEREF_ALWAYS, new PresenceNode( SchemaConstants.OBJECT_CLASS_AT_OID ), ctrl ) );
try
{
while ( e.hasMore() )
{
- ServerSearchResult sr = e.next();
- ServerEntry attrs = sr.getServerEntry();
+ ServerSearchResult sr = e.next();
+ ServerEntry attrs = sr.getServerEntry();
// Skip entries without entryCSN attribute.
EntryAttribute entryCSNAttr = attrs.get( org.apache.directory.mitosis.common.Constants.ENTRY_CSN );
-
+
if ( entryCSNAttr == null )
{
continue;
@@ -404,18 +401,18 @@
// Get entryCSN of the entry. Skip if entryCSN value is invalid.
CSN csn;
-
+
try
{
Object val = entryCSNAttr.get();
-
+
if ( val instanceof byte[] )
{
- csn = new DefaultCSN( StringTools.utf8ToString( (byte[])val ) );
+ csn = new DefaultCSN( StringTools.utf8ToString( ( byte[] ) val ) );
}
else
{
- csn = new DefaultCSN( (String)val );
+ csn = new DefaultCSN( ( String ) val );
}
}
catch ( IllegalArgumentException ex )
@@ -426,9 +423,9 @@
// Convert the entry into AddEntryOperation log.
LdapDN dn = sr.getDn();
- dn.normalize( ctx.getDirectoryService().getRegistries()
- .getAttributeTypeRegistry().getNormalizerMapping() );
- Operation op = new AddEntryOperation( csn, dn, attrs );
+ dn.normalize( ctx.getDirectoryService().getRegistries().getAttributeTypeRegistry()
+ .getNormalizerMapping() );
+ Operation op = new AddEntryOperation( csn, attrs );
// Send a LogEntry message for the entry.
writeTimeLimitedMessage( ctx, new LogEntryMessage( ctx.getNextSequence(), op ) );
@@ -451,7 +448,7 @@
if ( yourCSN != null && ( myCSN == null || yourCSN.compareTo( myCSN ) < 0 ) )
{
SessionLog.warn( ctx.getSession(), "Remote update vector (" + yourUV
- + ") is out-of-date. Full replication is required." );
+ + ") is out-of-date. Full replication is required." );
ctx.getSession().close();
return;
}
Modified: directory/apacheds/branches/bigbang/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java Wed Apr 30 17:06:41 2008
@@ -198,7 +198,7 @@
CSN csn = csnFactory.newInstance( REPLICA_ID );
CompositeOperation op1 = new CompositeOperation( csn );
LdapDN ouA = new LdapDN( "ou=a" ).normalize( oids );
- op1.add( new AddEntryOperation( csn, ouA,
+ op1.add( new AddEntryOperation( csn,
new DefaultServerEntry( service.getRegistries(), ouA ) ) );
op1.add( new AddAttributeOperation( csn, ouA,
@@ -215,7 +215,7 @@
csn = csnFactory.newInstance( OTHER_REPLICA_ID );
CompositeOperation op2 = new CompositeOperation( csn );
- op2.add( new AddEntryOperation( csn, ouA,
+ op2.add( new AddEntryOperation( csn,
new DefaultServerEntry( service.getRegistries(), ouA ) ) );
op2.add( new AddAttributeOperation( csn, ouA,
Modified: directory/apacheds/branches/bigbang/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/pom.xml?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/pom.xml (original)
+++ directory/apacheds/branches/bigbang/pom.xml Wed Apr 30 17:06:41 2008
@@ -158,11 +158,11 @@
<version>1.2.14</version>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>jdbm</groupId>
<artifactId>jdbm</artifactId>
<version>1.0</version>
- </dependency>
+ </dependency-->
<dependency>
<groupId>org.apache.velocity</groupId>
@@ -332,6 +332,7 @@
</dependencies>
<modules>
+ <module>apacheds-jdbm</module>
<module>bootstrap-extract</module>
<module>bootstrap-partition</module>
<module>bootstrap-plugin</module>
Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java Wed Apr 30 17:06:41 2008
@@ -108,7 +108,7 @@
if ( partition instanceof BTreePartition )
{
BTreePartition btPartition = ( BTreePartition ) partition;
- PartitionFrame frame = new PartitionFrame( btPartition );
+ PartitionFrame frame = new PartitionFrame( btPartition, service.getRegistries() );
Point pos = getCenteredPosition( frame );
pos.y = launchedWindowCount * 20 + pos.y;
double multiplier = getAspectRatio() * 20.0;