Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 84242 invoked from network); 31 Mar 2008 16:21:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Mar 2008 16:21:37 -0000 Received: (qmail 29068 invoked by uid 500); 31 Mar 2008 16:21:36 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 29008 invoked by uid 500); 31 Mar 2008 16:21:36 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 28997 invoked by uid 99); 31 Mar 2008 16:21:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Mar 2008 09:21:36 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Mar 2008 16:21:02 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id ED3521A9851; Mon, 31 Mar 2008 09:20:53 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r643046 [6/8] - in /directory: apacheds/branches/bigbang/benchmarks/ apacheds/branches/bigbang/core-constants/src/main/java/org/apache/directory/server/constants/ apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/serve... Date: Mon, 31 Mar 2008 16:20:08 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080331162053.ED3521A9851@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java Mon Mar 31 09:19:45 2008 @@ -36,6 +36,7 @@ import org.apache.directory.server.schema.bootstrap.Schema; import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Value; import org.apache.directory.shared.ldap.exception.LdapNamingException; import org.apache.directory.shared.ldap.message.ResultCodeEnum; @@ -124,7 +125,7 @@ if ( entry.get( MetaSchemaConstants.M_DEPENDENCIES_AT ) != null ) { Set depsSet = new HashSet(); - ServerAttribute depsAttr = entry.get( MetaSchemaConstants.M_DEPENDENCIES_AT ); + EntryAttribute depsAttr = entry.get( MetaSchemaConstants.M_DEPENDENCIES_AT ); for ( Value value:depsAttr ) { @@ -138,7 +139,7 @@ } - private SyntaxChecker getSyntaxChecker( String syntaxOid, String className, ServerAttribute bytecode, Registries targetRegistries ) + private SyntaxChecker getSyntaxChecker( String syntaxOid, String className, EntryAttribute bytecode, Registries targetRegistries ) throws NamingException { Class clazz = null; @@ -235,7 +236,7 @@ } - private Comparator getComparator( String className, ServerAttribute bytecode, Registries targetRegistries ) + private Comparator getComparator( String className, EntryAttribute bytecode, Registries targetRegistries ) throws NamingException { Comparator comparator = null; @@ -337,7 +338,7 @@ } - private Normalizer getNormalizer( String className, ServerAttribute bytecode, Registries targetRegistries ) + private Normalizer getNormalizer( String className, EntryAttribute bytecode, Registries targetRegistries ) throws NamingException { Class clazz = null; @@ -578,7 +579,7 @@ } - private String[] getStrings( ServerAttribute attr ) throws NamingException + private String[] getStrings( EntryAttribute attr ) throws NamingException { if ( attr == null ) { @@ -707,7 +708,7 @@ mso.setDescription( entry.get( MetaSchemaConstants.M_DESCRIPTION_AT ).getString() ); } - ServerAttribute names = entry.get( MetaSchemaConstants.M_NAME_AT ); + EntryAttribute names = entry.get( MetaSchemaConstants.M_NAME_AT ); if ( names != null ) { Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Mon Mar 31 09:19:45 2008 @@ -50,6 +50,8 @@ import org.apache.directory.server.schema.registries.OidRegistry; import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.Entry; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Modification; import org.apache.directory.shared.ldap.entry.ModificationOperation; import org.apache.directory.shared.ldap.entry.Value; @@ -809,7 +811,7 @@ * @return true if the objectClass values require the attribute, false otherwise * @throws NamingException if the attribute is not recognized */ - private boolean isRequired( String attrId, ServerAttribute objectClasses ) throws NamingException + private boolean isRequired( String attrId, EntryAttribute objectClasses ) throws NamingException { OidRegistry oidRegistry = registries.getOidRegistry(); ObjectClassRegistry registry = registries.getObjectClassRegistry(); @@ -878,7 +880,7 @@ * @return * @throws NamingException */ - private ServerAttribute getResultantObjectClasses( ModificationOperation modOp, ServerAttribute changes, ServerAttribute existing ) throws NamingException + private EntryAttribute getResultantObjectClasses( ModificationOperation modOp, EntryAttribute changes, EntryAttribute existing ) throws NamingException { if ( ( changes == null ) && ( existing == null ) ) { @@ -927,7 +929,7 @@ } - private boolean getObjectClasses( ServerAttribute objectClasses, List result ) throws NamingException + private boolean getObjectClasses( EntryAttribute objectClasses, List result ) throws NamingException { Set ocSeen = new HashSet(); ObjectClassRegistry registry = registries.getObjectClassRegistry(); @@ -967,7 +969,7 @@ } - private Set getAllMust( ServerAttribute objectClasses ) throws NamingException + private Set getAllMust( EntryAttribute objectClasses ) throws NamingException { Set must = new HashSet(); @@ -992,7 +994,7 @@ return must; } - private Set getAllAllowed( ServerAttribute objectClasses, Set must ) throws NamingException + private Set getAllAllowed( EntryAttribute objectClasses, Set must ) throws NamingException { Set allowed = new HashSet( must ); @@ -1031,7 +1033,7 @@ * @param objectClassAttr the objectClass attribute to modify * @throws NamingException if there are problems */ - private void alterObjectClasses( ServerAttribute objectClassAttr ) throws NamingException + private void alterObjectClasses( EntryAttribute objectClassAttr ) throws NamingException { Set objectClasses = new HashSet(); Set objectClassesUP = new HashSet(); @@ -1214,7 +1216,7 @@ } // Get the objectClass attribute. - ServerAttribute objectClass; + EntryAttribute objectClass; if ( objectClassMod == null ) { @@ -1230,7 +1232,7 @@ { objectClass = getResultantObjectClasses( objectClassMod.getOperation(), - (ServerAttribute)objectClassMod.getAttribute(), + objectClassMod.getAttribute(), entry.get( SchemaConstants.OBJECT_CLASS_AT ) ); } @@ -1261,7 +1263,7 @@ switch ( modOp ) { case ADD_ATTRIBUTE : - ServerAttribute attr = tmpEntry.get( change.getUpId() ); + EntryAttribute attr = tmpEntry.get( change.getUpId() ); if ( attr != null ) { @@ -1313,7 +1315,7 @@ } // Now remove the attribute and all its values - ServerAttribute modified = tmpEntry.remove( change.getUpId() ).get(0); + EntryAttribute modified = tmpEntry.removeAttributes( change.getUpId() ).get(0); // And inject back the values except the ones to remove for ( Value value:change ) @@ -1351,7 +1353,7 @@ if ( attr != null ) { - tmpEntry.remove( change.getUpId() ); + tmpEntry.removeAttributes( change.getUpId() ); } attr = new DefaultServerAttribute( change.getUpId(), attributeType ); @@ -1459,15 +1461,15 @@ private void filterObjectClass( ServerEntry entry ) throws NamingException { List objectClasses = new ArrayList(); - ServerAttribute oc = entry.get( SchemaConstants.OBJECT_CLASS_AT ); + EntryAttribute oc = entry.get( SchemaConstants.OBJECT_CLASS_AT ); if ( oc != null ) { getObjectClasses( oc, objectClasses ); - entry.remove( SchemaConstants.OBJECT_CLASS_AT ); + entry.removeAttributes( SchemaConstants.OBJECT_CLASS_AT ); - ServerAttribute newOc = new DefaultServerAttribute( oc.getAttributeType() ); + ServerAttribute newOc = new DefaultServerAttribute( ((ServerAttribute)oc).getAttributeType() ); for ( ObjectClass currentOC:objectClasses ) { @@ -1486,9 +1488,9 @@ * start converting values of attributes to byte[]s which are not * human readable and those that are in the binaries set */ - for ( ServerAttribute attribute:entry ) + for ( EntryAttribute attribute:entry ) { - if ( !attribute.getAttributeType().getSyntax().isHumanReadable() ) + if ( !((ServerAttribute)attribute).getAttributeType().getSyntax().isHumanReadable() ) { List> binaries = new ArrayList>(); @@ -1498,12 +1500,12 @@ if ( attrValue instanceof String ) { - binaries.add( new ServerBinaryValue( attribute.getAttributeType(), + binaries.add( new ServerBinaryValue( ((ServerAttribute)attribute).getAttributeType(), StringTools.getBytesUtf8( ( String ) attrValue ) ) ); } else { - binaries.add( new ServerBinaryValue( attribute.getAttributeType(), + binaries.add( new ServerBinaryValue( ((ServerAttribute)attribute).getAttributeType(), (byte[])attrValue ) ); } } @@ -1575,7 +1577,7 @@ // 3-1) Except if the extensibleObject ObjectClass is used // 3-2) or if the AttributeType is COLLECTIVE // 4) We also check that for H-R attributes, we have a valid String in the values - ServerAttribute objectClassAttr = entry.get( SchemaConstants.OBJECT_CLASS_AT ); + EntryAttribute objectClassAttr = entry.get( SchemaConstants.OBJECT_CLASS_AT ); // Protect the server against a null objectClassAttr // It can be the case if the user forgot to add it to the entry ... @@ -1644,18 +1646,18 @@ { // Never check the attributes if the extensibleObject objectClass is // declared for this entry - ServerAttribute objectClass = entry.get( SchemaConstants.OBJECT_CLASS_AT ); + EntryAttribute objectClass = entry.get( SchemaConstants.OBJECT_CLASS_AT ); if ( objectClass.contains( SchemaConstants.EXTENSIBLE_OBJECT_OC ) ) { return; } - for ( ServerAttribute attribute:entry ) + for ( EntryAttribute attribute:entry ) { - String attrOid = attribute.getAttributeType().getOid(); + String attrOid = ((ServerAttribute)attribute).getAttributeType().getOid(); - AttributeType attributeType = attribute.getAttributeType(); + AttributeType attributeType = ((ServerAttribute)attribute).getAttributeType(); if ( !attributeType.isCollective() && ( attributeType.getUsage() == UsageEnum.USER_APPLICATIONS ) ) { @@ -1687,9 +1689,9 @@ /** * Checks to see number of values of an attribute conforms to the schema */ - private void assertNumberOfAttributeValuesValid( ServerEntry entry ) throws InvalidAttributeValueException, NamingException + private void assertNumberOfAttributeValuesValid( Entry entry ) throws InvalidAttributeValueException, NamingException { - for ( ServerAttribute attribute:entry ) + for ( EntryAttribute attribute:entry ) { assertNumberOfAttributeValuesValid( attribute ); } @@ -1698,9 +1700,9 @@ /** * Checks to see numbers of values of attributes conforms to the schema */ - private void assertNumberOfAttributeValuesValid( ServerAttribute attribute ) throws InvalidAttributeValueException, NamingException + private void assertNumberOfAttributeValuesValid( EntryAttribute attribute ) throws InvalidAttributeValueException, NamingException { - if ( attribute.size() > 1 && attribute.getAttributeType().isSingleValue() ) + if ( attribute.size() > 1 && ((ServerAttribute)attribute).getAttributeType().isSingleValue() ) { throw new LdapInvalidAttributeValueException( "More than one value has been provided " + "for the single-valued attribute: " + attribute.getUpId(), ResultCodeEnum.CONSTRAINT_VIOLATION ); @@ -1710,12 +1712,12 @@ /** * Checks to see the presence of all required attributes within an entry. */ - private void assertRequiredAttributesPresent( LdapDN dn, ServerEntry entry, Set must ) + private void assertRequiredAttributesPresent( LdapDN dn, Entry entry, Set must ) throws NamingException { - for ( ServerAttribute attribute:entry ) + for ( EntryAttribute attribute:entry ) { - must.remove( attribute.getAttributeType().getOid() ); + must.remove( ((ServerAttribute)attribute).getAttributeType().getOid() ); } if ( must.size() != 0 ) @@ -1802,12 +1804,12 @@ /** * Check the entry attributes syntax, using the syntaxCheckers */ - private void assertSyntaxes( ServerEntry entry ) throws NamingException + private void assertSyntaxes( Entry entry ) throws NamingException { // First, loop on all attributes - for ( ServerAttribute attribute:entry ) + for ( EntryAttribute attribute:entry ) { - AttributeType attributeType = attribute.getAttributeType(); + AttributeType attributeType = ((ServerAttribute)attribute).getAttributeType(); SyntaxChecker syntaxChecker = attributeType.getSyntax().getSyntaxChecker(); if ( syntaxChecker instanceof AcceptAllSyntaxChecker ) @@ -1842,7 +1844,7 @@ * * If this is the case, try to change it to a String value. */ - private boolean checkHumanReadable( ServerAttribute attribute ) throws NamingException + private boolean checkHumanReadable( EntryAttribute attribute ) throws NamingException { boolean isModified = false; @@ -1883,7 +1885,7 @@ * * If this is the case, try to change it to a binary value. */ - private boolean checkNotHumanReadable( ServerAttribute attribute ) throws NamingException + private boolean checkNotHumanReadable( EntryAttribute attribute ) throws NamingException { boolean isModified = false; @@ -1937,9 +1939,9 @@ ServerEntry clonedEntry = null; // Loops on all attributes - for ( ServerAttribute attribute:entry ) + for ( EntryAttribute attribute:entry ) { - AttributeType attributeType = attribute.getAttributeType(); + AttributeType attributeType = ((ServerAttribute)attribute).getAttributeType(); // If the attributeType is H-R, check all of its values if ( attributeType.getSyntax().isHumanReadable() ) Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java Mon Mar 31 09:19:45 2008 @@ -51,6 +51,7 @@ import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.NotImplementedException; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Modification; import org.apache.directory.shared.ldap.entry.ModificationOperation; import org.apache.directory.shared.ldap.entry.Value; @@ -288,7 +289,7 @@ public void add( LdapDN name, ServerEntry entry ) throws NamingException { - ServerAttribute oc = entry.get( objectClassAT ); + EntryAttribute oc = entry.get( objectClassAT ); for ( Value value:oc ) { @@ -337,7 +338,7 @@ public void delete( LdapDN name, ServerEntry entry, boolean doCascadeDelete ) throws NamingException { - ServerAttribute oc = entry.get( objectClassAT ); + EntryAttribute oc = entry.get( objectClassAT ); for ( Value value:oc ) { @@ -386,7 +387,7 @@ public void modify( LdapDN name, ModificationOperation modOp, ServerEntry mods, ServerEntry entry, ServerEntry targetEntry, boolean cascade ) throws NamingException { - ServerAttribute oc = entry.get( objectClassAT ); + EntryAttribute oc = entry.get( objectClassAT ); for ( Value value:oc ) { @@ -415,7 +416,7 @@ public void modify( LdapDN name, List mods, ServerEntry entry, ServerEntry targetEntry, boolean doCascadeModify ) throws NamingException { - ServerAttribute oc = entry.get( objectClassAT ); + EntryAttribute oc = entry.get( objectClassAT ); for ( Value value:oc ) { @@ -446,7 +447,7 @@ public void modifyRn( LdapDN name, Rdn newRdn, boolean deleteOldRn, ServerEntry entry, boolean doCascadeModify ) throws NamingException { - ServerAttribute oc = entry.get( objectClassAT ); + EntryAttribute oc = entry.get( objectClassAT ); for ( Value value:oc ) { @@ -475,7 +476,7 @@ public void replace( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade ) throws NamingException { - ServerAttribute oc = entry.get( objectClassAT ); + EntryAttribute oc = entry.get( objectClassAT ); for ( Value value:oc ) { @@ -504,7 +505,7 @@ public void move( LdapDN oriChildName, LdapDN newParentName, Rdn newRn, boolean deleteOldRn, ServerEntry entry, boolean cascade ) throws NamingException { - ServerAttribute oc = entry.get( objectClassAT ); + EntryAttribute oc = entry.get( objectClassAT ); for ( Value value:oc ) { @@ -659,7 +660,7 @@ * @throws NamingException if there are problems updating the registries and the * schema partition */ - private void modifyRemoveOperation( String opAttrOid, ServerAttribute mods, boolean doCascadeModify ) + private void modifyRemoveOperation( String opAttrOid, EntryAttribute mods, boolean doCascadeModify ) throws NamingException { int index = opAttr2handlerIndex.get( opAttrOid ); @@ -793,7 +794,7 @@ * @throws NamingException if there are problems updating the registries and the * schema partition */ - private void modifyAddOperation( String opAttrOid, ServerAttribute mods, boolean doCascadeModify ) throws NamingException + private void modifyAddOperation( String opAttrOid, EntryAttribute mods, boolean doCascadeModify ) throws NamingException { if ( doCascadeModify ) { @@ -802,6 +803,7 @@ int index = opAttr2handlerIndex.get( opAttrOid ); SchemaChangeHandler handler = opAttr2handlerMap.get( opAttrOid ); + switch( index ) { case( COMPARATOR_INDEX ): Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java Mon Mar 31 09:19:45 2008 @@ -30,7 +30,6 @@ import org.apache.directory.server.constants.MetaSchemaConstants; import org.apache.directory.server.constants.ServerDNConstants; import org.apache.directory.server.core.entry.DefaultServerAttribute; -import org.apache.directory.server.core.entry.ServerAttribute; import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.server.core.entry.ServerModification; import org.apache.directory.server.core.entry.ServerSearchResult; @@ -43,6 +42,7 @@ import org.apache.directory.server.schema.registries.OidRegistry; import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Modification; import org.apache.directory.shared.ldap.filter.AndNode; import org.apache.directory.shared.ldap.filter.BranchNode; @@ -571,7 +571,7 @@ LdapDN dn = new LdapDN( "cn=" + schemaName + ",ou=schema" ); dn.normalize( attrRegistry.getNormalizerMapping() ); ServerEntry entry = partition.lookup( new LookupOperationContext( registries, dn ) ); - ServerAttribute disabledAttr = entry.get( disabledAttributeType ); + EntryAttribute disabledAttr = entry.get( disabledAttributeType ); List mods = new ArrayList( 3 ); if ( disabledAttr == null ) @@ -865,7 +865,7 @@ while( ne.hasMore() ) { ServerSearchResult sr = ne.next(); - ServerAttribute disabled = sr.getServerEntry().get( disabledAttributeType ); + EntryAttribute disabled = sr.getServerEntry().get( disabledAttributeType ); if ( disabled == null ) { Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Mon Mar 31 09:19:45 2008 @@ -29,6 +29,7 @@ import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition; import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.schema.AttributeType; import org.apache.directory.shared.ldap.schema.DITContentRule; @@ -335,7 +336,7 @@ // Add the createTimestamp AttributeType createTimestampAT = registries. getAttributeTypeRegistry().lookup( SchemaConstants.CREATE_TIMESTAMP_AT ); - ServerAttribute createTimestamp = mods.get( createTimestampAT ); + EntryAttribute createTimestamp = mods.get( createTimestampAT ); attrs.put( SchemaConstants.CREATE_TIMESTAMP_AT, createTimestamp.get() ); // Add the creatorsName @@ -344,13 +345,13 @@ // Add the modifyTimestamp AttributeType schemaModifyTimestampAT = registries. getAttributeTypeRegistry().lookup( ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT ); - ServerAttribute schemaModifyTimestamp = mods.get( schemaModifyTimestampAT ); + EntryAttribute schemaModifyTimestamp = mods.get( schemaModifyTimestampAT ); attrs.put( SchemaConstants.MODIFY_TIMESTAMP_AT, schemaModifyTimestamp.get() ); // Add the modifiersName AttributeType schemaModifiersNameAT = registries. getAttributeTypeRegistry().lookup( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT ); - ServerAttribute schemaModifiersName = mods.get( schemaModifiersNameAT ); + EntryAttribute schemaModifiersName = mods.get( schemaModifiersNameAT ); attrs.put( SchemaConstants.MODIFIERS_NAME_AT, schemaModifiersName.get() ); // don't swap out if a request for the subentry is in progress or we @@ -364,7 +365,7 @@ private void addAttribute( ServerEntry attrs, String id ) throws NamingException { - ServerAttribute attr = schemaSubentry.get( id ); + EntryAttribute attr = schemaSubentry.get( id ); if ( attr != null ) { Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/security/TlsKeyGenerator.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/security/TlsKeyGenerator.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/security/TlsKeyGenerator.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/security/TlsKeyGenerator.java Mon Mar 31 09:19:45 2008 @@ -43,9 +43,9 @@ import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; -import org.apache.directory.server.core.entry.ServerAttribute; import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.x509.X509V1CertificateGenerator; import org.slf4j.Logger; @@ -193,7 +193,8 @@ */ public static void addKeyPair( ServerEntry entry ) throws NamingException { - ServerAttribute objectClass = entry.get( SchemaConstants.OBJECT_CLASS_AT ); + EntryAttribute objectClass = entry.get( SchemaConstants.OBJECT_CLASS_AT ); + if ( objectClass == null ) { entry.put( SchemaConstants.OBJECT_CLASS_AT, TLS_KEY_INFO_OC, SchemaConstants.INET_ORG_PERSON_OC ); Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/JavaStoredProcEngine.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/JavaStoredProcEngine.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/JavaStoredProcEngine.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/JavaStoredProcEngine.java Mon Mar 31 09:19:45 2008 @@ -34,6 +34,7 @@ import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.server.core.sp.StoredProcEngine; import org.apache.directory.server.core.sp.StoredProcUtils; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.util.DirectoryClassUtils; @@ -56,7 +57,7 @@ */ public Object invokeProcedure( LdapContext rootCtx, String fullSPName, Object[] spArgs ) throws NamingException { - ServerAttribute javaByteCode = spUnit.get( "javaByteCode" ); + EntryAttribute javaByteCode = spUnit.get( "javaByteCode" ); String spName = StoredProcUtils.extractStoredProcName( fullSPName ); String className = StoredProcUtils.extractStoredProcUnitName( fullSPName ); Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/LdapJavaStoredProcClassLoader.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/LdapJavaStoredProcClassLoader.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/LdapJavaStoredProcClassLoader.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/LdapJavaStoredProcClassLoader.java Mon Mar 31 09:19:45 2008 @@ -23,7 +23,7 @@ import javax.naming.NamingException; -import org.apache.directory.server.core.entry.ServerAttribute; +import org.apache.directory.shared.ldap.entry.EntryAttribute; /** @@ -34,10 +34,10 @@ */ public class LdapJavaStoredProcClassLoader extends ClassLoader { - private ServerAttribute javaByteCodeAttr; + private EntryAttribute javaByteCodeAttr; - public LdapJavaStoredProcClassLoader( ServerAttribute javaByteCodeAttr ) + public LdapJavaStoredProcClassLoader( EntryAttribute javaByteCodeAttr ) { // Critical call to super class constructor. Required for true plumbing of class loaders. super( LdapJavaStoredProcClassLoader.class.getClassLoader() ); Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java Mon Mar 31 09:19:45 2008 @@ -22,6 +22,7 @@ import org.apache.directory.server.core.entry.ServerAttribute; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.filter.AndNode; import org.apache.directory.shared.ldap.filter.BranchNode; import org.apache.directory.shared.ldap.filter.ExprNode; @@ -54,7 +55,7 @@ } - public boolean evaluate( ExprNode node, ServerAttribute objectClasses ) throws NamingException + public boolean evaluate( ExprNode node, EntryAttribute objectClasses ) throws NamingException { if ( node == null ) { @@ -66,7 +67,7 @@ throw new IllegalArgumentException( "objectClasses cannot be null" ); } - if ( !objectClasses.instanceOf( SchemaConstants.OBJECT_CLASS_AT ) ) + if ( !((ServerAttribute)objectClasses).instanceOf( SchemaConstants.OBJECT_CLASS_AT ) ) { throw new IllegalArgumentException( "Attribute objectClasses should be of id 'objectClass'" ); } Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java Mon Mar 31 09:19:45 2008 @@ -23,6 +23,7 @@ import org.apache.directory.server.core.entry.ServerAttribute; import org.apache.directory.server.schema.registries.OidRegistry; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.filter.EqualityNode; import org.apache.directory.shared.ldap.filter.SimpleNode; import org.apache.directory.shared.ldap.util.StringTools; @@ -66,7 +67,7 @@ * if it rejects the entry * @throws NamingException */ - public boolean evaluate( SimpleNode node, ServerAttribute objectClasses ) throws NamingException + public boolean evaluate( SimpleNode node, EntryAttribute objectClasses ) throws NamingException { if ( node == null ) { @@ -88,7 +89,7 @@ throw new IllegalArgumentException( "objectClasses argument cannot be null" ); } - if ( !objectClasses.instanceOf( SchemaConstants.OBJECT_CLASS_AT ) ) + if ( !((ServerAttribute)objectClasses).instanceOf( SchemaConstants.OBJECT_CLASS_AT ) ) { throw new IllegalArgumentException( "objectClasses attribute must be for ID 'objectClass'" ); } @@ -123,7 +124,8 @@ if ( Character.isDigit( value.charAt( 0 ) ) ) { - Iterator list = registry.getNameSet( value ).iterator(); + Iterator list = registry.getNameSet( value ).iterator(); + while ( list.hasNext() ) { String objectClass = ( String ) list.next(); Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Mon Mar 31 09:19:45 2008 @@ -49,6 +49,7 @@ import org.apache.directory.server.schema.registries.OidRegistry; import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Modification; import org.apache.directory.shared.ldap.entry.ModificationOperation; import org.apache.directory.shared.ldap.entry.Value; @@ -203,7 +204,7 @@ { int types = 0; - ServerAttribute oc = subentry.get( SchemaConstants.OBJECT_CLASS_AT ); + EntryAttribute oc = subentry.get( SchemaConstants.OBJECT_CLASS_AT ); if ( oc == null ) { @@ -340,7 +341,7 @@ if ( evaluator.evaluate( ss, apDn, dn, entryAttrs ) ) { - ServerAttribute operational; + EntryAttribute operational; if ( subentry.isAccessControlSubentry() ) { @@ -410,7 +411,7 @@ LdapDN name = addContext.getDn(); ServerEntry entry = addContext.getEntry(); - ServerAttribute objectClasses = entry.get( SchemaConstants.OBJECT_CLASS_AT ); + EntryAttribute objectClasses = entry.get( SchemaConstants.OBJECT_CLASS_AT ); if ( objectClasses.contains( SchemaConstants.SUBENTRY_OC ) ) { @@ -418,7 +419,7 @@ LdapDN apName = ( LdapDN ) name.clone(); apName.remove( name.size() - 1 ); ServerEntry ap = nexus.lookup( new LookupOperationContext( registries, apName ) ); - ServerAttribute administrativeRole = ap.get( "administrativeRole" ); + EntryAttribute administrativeRole = ap.get( "administrativeRole" ); // check that administrativeRole has something valid in it for us if ( administrativeRole == null || administrativeRole.size() <= 0 ) @@ -516,7 +517,7 @@ if ( evaluator.evaluate( ss, apDn, name, entry ) ) { - ServerAttribute operational; + EntryAttribute operational; if ( subentry.isAccessControlSubentry() ) { @@ -591,7 +592,7 @@ { LdapDN name = opContext.getDn(); ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name ) ); - ServerAttribute objectClasses = entry.get( objectClassType ); + EntryAttribute objectClasses = entry.get( objectClassType ); if ( objectClasses.contains( SchemaConstants.SUBENTRY_OC ) ) { @@ -711,7 +712,7 @@ for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS ) { ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE; - ServerAttribute opAttr = entry.get( aSUBENTRY_OPATTRS ); + EntryAttribute opAttr = entry.get( aSUBENTRY_OPATTRS ); if ( opAttr != null ) { @@ -752,7 +753,7 @@ ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name ) ); - ServerAttribute objectClasses = entry.get( objectClassType ); + EntryAttribute objectClasses = entry.get( objectClassType ); if ( objectClasses.contains( SchemaConstants.SUBENTRY_OC ) ) { @@ -828,7 +829,7 @@ ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, oriChildName ) ); - ServerAttribute objectClasses = entry.get( objectClassType ); + EntryAttribute objectClasses = entry.get( objectClassType ); if ( objectClasses.contains( SchemaConstants.SUBENTRY_OC ) ) { @@ -903,7 +904,7 @@ ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, oriChildName ) ); - ServerAttribute objectClasses = entry.get( SchemaConstants.OBJECT_CLASS_AT ); + EntryAttribute objectClasses = entry.get( SchemaConstants.OBJECT_CLASS_AT ); if ( objectClasses.contains( SchemaConstants.SUBENTRY_OC ) ) { @@ -1021,7 +1022,7 @@ ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name ) ); ServerEntry oldEntry = (ServerEntry) entry.clone(); - ServerAttribute objectClasses = entry.get( objectClassType ); + EntryAttribute objectClasses = entry.get( objectClassType ); boolean isSubtreeSpecificationModification = false; Modification subtreeMod = null; @@ -1294,7 +1295,7 @@ for ( String opAttrId : SUBENTRY_OPATTRS ) { - ServerAttribute opAttr = candidate.get( opAttrId ); + EntryAttribute opAttr = candidate.get( opAttrId ); if ( ( opAttr != null ) && opAttr.contains( dn ) ) { @@ -1331,9 +1332,9 @@ for ( AttributeType attributeType:operational.getAttributeTypes() ) { ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE; - ServerAttribute result = new DefaultServerAttribute( attributeType ); - ServerAttribute opAttrAdditions = operational.get( attributeType ); - ServerAttribute opAttrInEntry = entry.get( attributeType ); + EntryAttribute result = new DefaultServerAttribute( attributeType ); + EntryAttribute opAttrAdditions = operational.get( attributeType ); + EntryAttribute opAttrInEntry = entry.get( attributeType ); for ( Value value:opAttrAdditions ) { @@ -1375,7 +1376,7 @@ } // see if we can use objectclass if present - ServerAttribute objectClasses = + EntryAttribute objectClasses = result.getServerEntry().get( SchemaConstants.OBJECT_CLASS_AT ); if ( objectClasses != null ) @@ -1419,7 +1420,7 @@ } // see if we can use objectclass if present - ServerAttribute objectClasses = + EntryAttribute objectClasses = result.getServerEntry().get( SchemaConstants.OBJECT_CLASS_AT); if ( objectClasses != null ) @@ -1472,7 +1473,7 @@ for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS ) { ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE; - ServerAttribute opAttr = oldEntry.get( aSUBENTRY_OPATTRS ); + EntryAttribute opAttr = oldEntry.get( aSUBENTRY_OPATTRS ); if ( opAttr != null ) { Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java Mon Mar 31 09:19:45 2008 @@ -22,7 +22,6 @@ 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.interceptor.BaseInterceptor; import org.apache.directory.server.core.interceptor.InterceptorChain; @@ -46,6 +45,7 @@ import org.apache.directory.server.schema.registries.AttributeTypeRegistry; import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Value; import org.apache.directory.shared.ldap.exception.LdapNamingException; import org.apache.directory.shared.ldap.message.ResultCodeEnum; @@ -140,7 +140,7 @@ entry = proxy.lookup( new LookupOperationContext( registries, parentDn ), PartitionNexusProxy.LOOKUP_BYPASS ); } - ServerAttribute subentries = entry.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ); + EntryAttribute subentries = entry.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ); if ( subentries == null ) { @@ -165,7 +165,7 @@ */ private void addEntryTriggerSpecs( List triggerSpecs, ServerEntry entry ) throws NamingException { - ServerAttribute entryTrigger = entry.get( ENTRY_TRIGGER_ATTR ); + EntryAttribute entryTrigger = entry.get( ENTRY_TRIGGER_ATTR ); if ( entryTrigger == null ) { @@ -462,7 +462,7 @@ SubentryInterceptor subentryInterceptor = ( SubentryInterceptor ) chain.get( SubentryInterceptor.class.getName() ); ServerEntry fakeImportedEntry = subentryInterceptor.getSubentryAttributes( newDN, importedEntry ); - for ( ServerAttribute attribute:importedEntry ) + for ( EntryAttribute attribute:importedEntry ) { fakeImportedEntry.put( attribute ); } @@ -538,7 +538,7 @@ SubentryInterceptor subentryInterceptor = ( SubentryInterceptor ) chain.get( SubentryInterceptor.class.getName() ); ServerEntry fakeImportedEntry = subentryInterceptor.getSubentryAttributes( newDN, importedEntry ); - for ( ServerAttribute attribute:importedEntry ) + for ( EntryAttribute attribute:importedEntry ) { fakeImportedEntry.put( attribute ); } 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=643046&r1=643045&r2=643046&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 Mon Mar 31 09:19:45 2008 @@ -31,6 +31,7 @@ import org.apache.directory.server.schema.registries.AttributeTypeRegistry; import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Modification; import org.apache.directory.shared.ldap.entry.Value; import org.apache.directory.shared.ldap.filter.EqualityNode; @@ -123,7 +124,7 @@ ServerSearchResult result = results.next(); LdapDN subentryDn = result.getDn(); ServerEntry resultEntry = result.getServerEntry(); - ServerAttribute triggerSpec = resultEntry.get( PRESCRIPTIVE_TRIGGER_ATTR ); + EntryAttribute triggerSpec = resultEntry.get( PRESCRIPTIVE_TRIGGER_ATTR ); if ( triggerSpec == null ) { @@ -143,7 +144,7 @@ private boolean hasPrescriptiveTrigger( ServerEntry entry ) throws NamingException { // only do something if the entry contains prescriptiveTrigger - ServerAttribute triggerSpec = entry.get( PRESCRIPTIVE_TRIGGER_ATTR ); + EntryAttribute triggerSpec = entry.get( PRESCRIPTIVE_TRIGGER_ATTR ); return triggerSpec != null; } @@ -152,7 +153,7 @@ public void subentryAdded( LdapDN normName, ServerEntry entry ) throws NamingException { // only do something if the entry contains prescriptiveTrigger - ServerAttribute triggerSpec = entry.get( PRESCRIPTIVE_TRIGGER_ATTR ); + EntryAttribute triggerSpec = entry.get( PRESCRIPTIVE_TRIGGER_ATTR ); if ( triggerSpec == null ) { Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java (original) +++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java Mon Mar 31 09:19:45 2008 @@ -342,7 +342,7 @@ assertEquals( 1, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME, null, null, null, "cn", null, entry, null, null ).size() ); - entry.remove( "cn" ); + entry.removeAttributes( "cn" ); assertEquals( 0, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME, null, null, null, "cn", null, entry, null, null ).size() ); Modified: directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java (original) +++ directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java Mon Mar 31 09:19:45 2008 @@ -69,6 +69,7 @@ import org.apache.directory.server.schema.registries.AttributeTypeRegistry; import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Modification; import org.apache.directory.shared.ldap.entry.ModificationOperation; import org.apache.directory.shared.ldap.entry.Value; @@ -311,7 +312,7 @@ throw new LdapAuthenticationException( "Failed to authenticate user '" + principalDn + "'." ); } - ServerAttribute objectClass = userEntry.get( SchemaConstants.OBJECT_CLASS_AT ); + EntryAttribute objectClass = userEntry.get( SchemaConstants.OBJECT_CLASS_AT ); if ( !objectClass.contains( SchemaConstants.KRB5_PRINCIPAL_OC ) ) { @@ -325,13 +326,13 @@ if ( subContext.getPrincipalName() == null ) { - ServerAttribute principalAttribute = userEntry.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ); + EntryAttribute principalAttribute = userEntry.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ); String principalName = principalAttribute.getString(); subContext.setPrincipalName( principalName ); log.debug( "Found principal '{}' from lookup.", principalName ); } - ServerAttribute keyVersionNumberAttr = userEntry.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ); + EntryAttribute keyVersionNumberAttr = userEntry.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ); if ( keyVersionNumberAttr == null ) { 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=643046&r1=643045&r2=643046&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 Mon Mar 31 09:19:45 2008 @@ -38,6 +38,7 @@ import org.apache.directory.server.schema.registries.OidRegistry; import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Modification; import org.apache.directory.shared.ldap.entry.ModificationOperation; import org.apache.directory.shared.ldap.entry.Value; @@ -1312,7 +1313,7 @@ * @throws NamingException if index alteration or attribute addition * fails. */ - private void add( Long id, Attributes entry, ServerAttribute mods ) throws NamingException + private void add( Long id, Attributes entry, EntryAttribute mods ) throws NamingException { String modsOid = oidRegistry.getOid( mods.getId() ); @@ -1365,7 +1366,7 @@ * @throws NamingException if index alteration or attribute modification * fails. */ - private void remove( Long id, Attributes entry, ServerAttribute mods ) throws NamingException + private void remove( Long id, Attributes entry, EntryAttribute mods ) throws NamingException { String modsOid = oidRegistry.getOid( mods.getId() ); @@ -1431,7 +1432,7 @@ * @throws NamingException if index alteration or attribute modification * fails. */ - private void replace( Long id, Attributes entry, ServerAttribute mods ) throws NamingException + private void replace( Long id, Attributes entry, EntryAttribute mods ) throws NamingException { String modsOid = oidRegistry.getOid( mods.getId() ); @@ -1486,7 +1487,7 @@ for ( AttributeType attributeType:mods.getAttributeTypes() ) { - ServerAttribute attr = mods.get( attributeType ); + EntryAttribute attr = mods.get( attributeType ); switch ( modOp ) { Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java (original) +++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java Mon Mar 31 09:19:45 2008 @@ -23,11 +23,11 @@ import javax.naming.NamingException; import javax.naming.directory.SearchControls; -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.enumeration.SearchResultFilter; import org.apache.directory.server.core.invocation.Invocation; +import org.apache.directory.shared.ldap.entry.EntryAttribute; /** @@ -65,7 +65,7 @@ throws NamingException { ServerEntry entry = result.getServerEntry(); - ServerAttribute deleted = entry.get( ENTRY_DELETED ); + EntryAttribute deleted = entry.get( ENTRY_DELETED ); Object value = deleted == null ? null : deleted.get(); return ( value == null || !"TRUE".equalsIgnoreCase( value.toString() ) ); } 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=643046&r1=643045&r2=643046&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 Mon Mar 31 09:19:45 2008 @@ -39,6 +39,7 @@ import org.apache.directory.server.schema.registries.AttributeTypeRegistry; import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Modification; import org.apache.directory.shared.ldap.entry.ModificationOperation; import org.apache.directory.shared.ldap.filter.PresenceNode; @@ -125,8 +126,8 @@ // Insert 'entryUUID' and 'entryDeleted'. ServerEntry cloneEntry = ( ServerEntry ) entry.clone(); - cloneEntry.remove( Constants.ENTRY_UUID ); - cloneEntry.remove( Constants.ENTRY_DELETED ); + cloneEntry.removeAttributes( Constants.ENTRY_UUID ); + cloneEntry.removeAttributes( Constants.ENTRY_DELETED ); cloneEntry.put( Constants.ENTRY_UUID, uuidFactory.newInstance().toOctetString() ); cloneEntry.put( Constants.ENTRY_DELETED, "FALSE" ); @@ -301,7 +302,7 @@ { // Delete the old RDN attribute value String oldRDNAttributeID = oldName.getRdn().getUpType(); - ServerAttribute oldRDNAttribute = entry.get( oldRDNAttributeID ); + EntryAttribute oldRDNAttribute = entry.get( oldRDNAttributeID ); if ( oldRDNAttribute != null ) { @@ -310,7 +311,7 @@ if ( removed && oldRDNAttribute.size() == 0 ) { // Now an empty attribute, remove it. - entry.remove( oldRDNAttributeID ); + entry.removeAttributes( oldRDNAttributeID ); } } } @@ -318,7 +319,7 @@ // Add the new RDN attribute value. String newRDNAttributeID = newRdn.getUpType(); String newRDNAttributeValue = ( String ) newRdn.getUpValue(); - ServerAttribute newRDNAttribute = entry.get( newRDNAttributeID ); + EntryAttribute newRDNAttribute = entry.get( newRDNAttributeID ); if ( newRDNAttribute != null ) { @@ -366,7 +367,7 @@ if ( nexus.hasEntry( new EntryOperationContext( registries, newEntryName ) ) ) { ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, newEntryName ) ); - ServerAttribute deleted = entry.get( Constants.ENTRY_DELETED ); + EntryAttribute deleted = entry.get( Constants.ENTRY_DELETED ); Object value = deleted == null ? null : deleted.get(); /* 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=643046&r1=643045&r2=643046&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 Mon Mar 31 09:19:45 2008 @@ -24,7 +24,6 @@ import javax.naming.NamingException; 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.interceptor.context.AddOperationContext; import org.apache.directory.server.core.interceptor.context.EntryOperationContext; @@ -32,6 +31,7 @@ import org.apache.directory.server.core.partition.PartitionNexus; import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.util.NamespaceTools; import org.apache.directory.shared.ldap.util.StringTools; @@ -52,7 +52,7 @@ return true; } - ServerAttribute entryCSNAttr = entry.get( Constants.ENTRY_CSN ); + EntryAttribute entryCSNAttr = entry.get( Constants.ENTRY_CSN ); if ( entryCSNAttr == null ) { Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java (original) +++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java Mon Mar 31 09:19:45 2008 @@ -33,7 +33,6 @@ import org.apache.directory.mitosis.service.protocol.handler.ReplicationServerProtocolHandler; import org.apache.directory.mitosis.store.ReplicationStore; 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.enumeration.SearchResultFilteringEnumeration; @@ -56,6 +55,7 @@ import org.apache.directory.server.schema.registries.AttributeTypeRegistry; import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Value; import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException; import org.apache.directory.shared.ldap.filter.ExprNode; @@ -303,7 +303,7 @@ public void purgeAgedData() throws NamingException { ServerEntry rootDSE = nexus.getRootDSE( null ); - ServerAttribute namingContextsAttr = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT ); + EntryAttribute namingContextsAttr = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT ); if ( ( namingContextsAttr == null ) || ( namingContextsAttr.size() == 0 ) ) { 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=643046&r1=643045&r2=643046&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 Mon Mar 31 09:19:45 2008 @@ -42,11 +42,11 @@ import org.apache.directory.mitosis.service.protocol.message.LoginMessage; import org.apache.directory.mitosis.store.ReplicationLogIterator; import org.apache.directory.mitosis.store.ReplicationStore; -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.SearchOperationContext; import org.apache.directory.shared.ldap.constants.SchemaConstants; +import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Value; import org.apache.directory.shared.ldap.filter.PresenceNode; import org.apache.directory.shared.ldap.message.AliasDerefMode; @@ -350,7 +350,7 @@ { ServerEntry rootDSE = ctx.getDirectoryService().getPartitionNexus().getRootDSE( null ); - ServerAttribute namingContextsAttr = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT ); + EntryAttribute namingContextsAttr = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT ); if ( namingContextsAttr == null || namingContextsAttr.size() == 0 ) { @@ -395,7 +395,7 @@ ServerEntry attrs = sr.getServerEntry(); // Skip entries without entryCSN attribute. - ServerAttribute entryCSNAttr = attrs.get( org.apache.directory.mitosis.common.Constants.ENTRY_CSN ); + EntryAttribute entryCSNAttr = attrs.get( org.apache.directory.mitosis.common.Constants.ENTRY_CSN ); if ( entryCSNAttr == null ) { Modified: directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java?rev=643046&r1=643045&r2=643046&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java (original) +++ directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java Mon Mar 31 09:19:45 2008 @@ -43,6 +43,7 @@ import javax.naming.NamingException; import javax.naming.directory.Attributes; import javax.naming.directory.DirContext; + import java.io.File; import java.io.FileFilter; import java.io.IOException; @@ -59,30 +60,47 @@ */ public class ApacheDS { - private static final String WINDOWSFILE_ATTR = "windowsFilePath"; - private static final String UNIXFILE_ATTR = "unixFilePath"; private static final Logger LOG = LoggerFactory.getLogger( ApacheDS.class.getName() ); - private static final String LDIF_FILES_DN = "ou=loadedLdifFiles,ou=configuration,ou=system"; + + /** Default delay between two flushes to the backend */ private static final long DEFAULT_SYNC_PERIOD_MILLIS = 20000; + /** Wainting period between two flushes to the backend */ private long synchPeriodMillis = DEFAULT_SYNC_PERIOD_MILLIS; + /** Directory where are stored the LDIF files to be loaded at startup */ private File ldifDirectory; + private final List ldifFilters = new ArrayList(); + /** The LDAP server protocol handler */ private final LdapServer ldapServer; + + /** The LDAPS server protocol handler */ private final LdapServer ldapsServer; + + /** The directory service */ private final DirectoryService directoryService; + /** + * Creates a new instance of the ApacheDS server + * + * @param directoryService + * @param ldapServer + * @param ldapsServer + */ public ApacheDS( DirectoryService directoryService, LdapServer ldapServer, LdapServer ldapsServer ) { LOG.info( "Starting the Apache Directory Server" ); - this.directoryService = directoryService; - - if ( this.directoryService == null ) + + if ( directoryService == null ) { - directoryService = new DefaultDirectoryService(); + this.directoryService = new DefaultDirectoryService(); + } + else + { + this.directoryService = directoryService; } this.ldapServer = ldapServer; @@ -92,25 +110,44 @@ } + /** + * Start the server : + *
  • initialize the DirectoryService
  • + *
  • start the LDAP server
  • + *
  • start the LDAPS server
  • + * + * @throws NamingException If the server cannot be started + * @throws IOException If an IO error occured while reading some file + */ public void startup() throws NamingException, IOException { - + LOG.debug( "Starting the server" ); + + // Start the directory service if not started yet if ( ! directoryService.isStarted() ) { + LOG.debug( "1. Starting the DirectoryService" ); directoryService.startup(); } + // Load the LDIF files - if any - into the server loadLdifs(); + // Start the LDAP server if ( ldapServer != null && ! ldapServer.isStarted() ) { + LOG.debug( "3. Starting the LDAP server" ); ldapServer.start(); } + // Start the LDAPS server if ( ldapsServer != null && ! ldapsServer.isStarted() ) { + LOG.debug( "4. Starting the LDAPS server" ); ldapsServer.start(); } + + LOG.debug( "Server successfully started" ); } @@ -172,21 +209,14 @@ this.synchPeriodMillis = synchPeriodMillis; } - + + /** + * Get the directory where + * @return + */ public File getLdifDirectory() { - if ( ldifDirectory == null ) - { - return null; - } - else if ( ldifDirectory.isAbsolute() ) - { - return this.ldifDirectory; - } - else - { - return new File( directoryService.getWorkingDirectory().getParent() , ldifDirectory.toString() ); - } + return ldifDirectory; } @@ -213,31 +243,8 @@ LOG.info( "The LDIF directory file is {}", ldifDirectory.getAbsolutePath() ); this.ldifDirectory = ldifDirectory; } - - - public List getLdifFilters() - { - return new ArrayList( ldifFilters ); - } - - - public void setLdifFilters( List filters ) - { - if ( LOG.isInfoEnabled() ) - { - LOG.info( "Set the ldif filters :" ); - - for ( LdifLoadFilter filter:filters ) - { - LOG.info( " Ldif Filter {}", filter ); - } - } - - ldifFilters.clear(); - ldifFilters.addAll( filters ); - } - - + + // ---------------------------------------------------------------------- // From CoreContextFactory: presently in intermediate step but these // methods will be moved to the appropriate protocol service eventually. @@ -246,6 +253,13 @@ // ---------------------------------------------------------------------- + /** + * Check that the entry where are stored the loaded Ldif files is created. + * + * If not, create it. + * + * The files are stored in ou=loadedLdifFiles,ou=configuration,ou=system + */ private void ensureLdifFileBase( DirContext root ) { Attributes entry = new AttributesImpl( SchemaConstants.OU_AT, "loadedLdifFiles", true ); @@ -254,35 +268,40 @@ try { - root.createSubcontext( LDIF_FILES_DN, entry ); - LOG.info( "Creating " + LDIF_FILES_DN ); + root.createSubcontext( ServerDNConstants.LDIF_FILES_DN, entry ); + LOG.info( "Creating " + ServerDNConstants.LDIF_FILES_DN ); } catch ( NamingException e ) { - LOG.info( LDIF_FILES_DN + " exists" ); + LOG.info( ServerDNConstants.LDIF_FILES_DN + " exists" ); } } + /** + * Create a string containing a hex dump of the loaded ldif file name. + * + * It is associated with the attributeType wrt to the underlying system. + */ private String buildProtectedFileEntry( File ldif ) { - StringBuffer buf = new StringBuffer(); - - buf.append( File.separatorChar == '\\' ? WINDOWSFILE_ATTR : UNIXFILE_ATTR ); - buf.append( "=" ); - - buf.append( StringTools.dumpHexPairs( StringTools.getBytesUtf8( getCanonical( ldif ) ) ) ); - - buf.append( "," ); - buf.append( LDIF_FILES_DN ); - - return buf.toString(); + String fileSep = File.separatorChar == '\\' ? + ApacheSchemaConstants.WINDOWS_FILE_AT : + ApacheSchemaConstants.UNIX_FILE_AT; + + return fileSep + + "=" + + StringTools.dumpHexPairs( StringTools.getBytesUtf8( getCanonical( ldif ) ) ) + + "," + + ServerDNConstants.LDIF_FILES_DN; } private void addFileEntry( DirContext root, File ldif ) throws NamingException { - String rdnAttr = File.separatorChar == '\\' ? WINDOWSFILE_ATTR : UNIXFILE_ATTR; + String rdnAttr = File.separatorChar == '\\' ? + ApacheSchemaConstants.WINDOWS_FILE_AT : + ApacheSchemaConstants.UNIX_FILE_AT; String oc = File.separatorChar == '\\' ? ApacheSchemaConstants.WINDOWS_FILE_OC : ApacheSchemaConstants.UNIX_FILE_OC; Attributes entry = new AttributesImpl( rdnAttr, getCanonical( ldif ), true ); @@ -292,6 +311,12 @@ } + /** + * + * @param root + * @param ldif + * @return + */ private Attributes getLdifFileEntry( DirContext root, File ldif ) { try @@ -324,7 +349,37 @@ } - private void loadLdifs() throws NamingException + /** + * Load a ldif into the directory. + * + * @param root The context in which we will inject the entries + * @param ldifFile The ldif file to read + * @throws NamingException If something went wrong while loading the entries + */ + private void loadLdif( DirContext root, File ldifFile ) throws NamingException + { + Attributes fileEntry = getLdifFileEntry( root, ldifFile ); + + if ( fileEntry != null ) + { + String time = ( String ) fileEntry.get( SchemaConstants.CREATE_TIMESTAMP_AT ).get(); + LOG.info( "Load of LDIF file '" + getCanonical( ldifFile ) + + "' skipped. It has already been loaded on " + time + "." ); + } + else + { + LdifFileLoader loader = new LdifFileLoader( root, ldifFile, ldifFilters ); + int count = loader.execute(); + LOG.info( "Loaded " + count + " entries from LDIF file '" + getCanonical( ldifFile ) + "'" ); + addFileEntry( root, ldifFile ); + } + } + + + /** + * Load the ldif files if there are some + */ + public void loadLdifs() throws NamingException { // LOG and bail if property not set if ( ldifDirectory == null ) @@ -336,17 +391,17 @@ // LOG and bail if LDIF directory does not exists if ( ! ldifDirectory.exists() ) { - LOG.warn( "LDIF load directory '" + getCanonical( ldifDirectory ) - + "' does not exist. No LDIF files will be loaded." ); + LOG.warn( "LDIF load directory '{}' does not exist. No LDIF files will be loaded.", + getCanonical( ldifDirectory ) ); return; } LdapDN dn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN ); - // Must normailize the dn or - IllegalStateException! + // Must normalize the dn or - IllegalStateException! AttributeTypeRegistry reg = directoryService.getRegistries().getAttributeTypeRegistry(); - dn.normalize( reg.getNormalizerMapping() ); + dn.normalize( reg.getNormalizerMapping() ); LdapPrincipal admin = new LdapPrincipal( dn, AuthenticationLevel.STRONG ); @@ -355,71 +410,66 @@ ensureLdifFileBase( root ); // if ldif directory is a file try to load it - if ( ! ldifDirectory.isDirectory() ) + if ( ldifDirectory.isFile() ) { if ( LOG.isInfoEnabled() ) { - LOG.info( "LDIF load directory '" + getCanonical( ldifDirectory ) - + "' is a file. Will attempt to load as LDIF." ); + LOG.info( "LDIF load directory '{}' is a file. Will attempt to load as LDIF.", + getCanonical( ldifDirectory ) ); } - Attributes fileEntry = getLdifFileEntry( root, ldifDirectory ); - - if ( fileEntry != null ) + try { - String time = ( String ) fileEntry.get( SchemaConstants.CREATE_TIMESTAMP_AT ).get(); - - if ( LOG.isInfoEnabled() ) - { - LOG.info( "Load of LDIF file '" + getCanonical( ldifDirectory ) - + "' skipped. It has already been loaded on " + time + "." ); - } - - return; + loadLdif( root, ldifDirectory ); } - - LdifFileLoader loader = new LdifFileLoader( root, ldifDirectory, ldifFilters ); - loader.execute(); - - addFileEntry( root, ldifDirectory ); - return; - } - - // get all the ldif files within the directory (should be sorted alphabetically) - File[] ldifFiles = ldifDirectory.listFiles( new FileFilter() - { - public boolean accept( File pathname ) + catch ( NamingException ne ) { - boolean isLdif = pathname.getName().toLowerCase().endsWith( ".ldif" ); - return pathname.isFile() && pathname.canRead() && isLdif; + // If the file can't be read, log the error, and stop + // loading LDIFs. + LOG.error( "Cannot load the ldif file '{}', error : ", + ldifDirectory.getAbsolutePath(), + ne.getMessage() ); + throw ne; } - } ); - - // LOG and bail if we could not find any LDIF files - if ( ldifFiles == null || ldifFiles.length == 0 ) - { - LOG.warn( "LDIF load directory '" + getCanonical( ldifDirectory ) - + "' does not contain any LDIF files. No LDIF files will be loaded." ); - return; } - - // load all the ldif files and load each one that is loaded - for ( File ldifFile : ldifFiles ) + else { - Attributes fileEntry = getLdifFileEntry( root, ldifFile ); - - if ( fileEntry != null ) + // get all the ldif files within the directory (should be sorted alphabetically) + File[] ldifFiles = ldifDirectory.listFiles( new FileFilter() { - String time = ( String ) fileEntry.get( SchemaConstants.CREATE_TIMESTAMP_AT ).get(); - LOG.info( "Load of LDIF file '" + getCanonical( ldifFile ) - + "' skipped. It has already been loaded on " + time + "." ); - continue; + public boolean accept( File pathname ) + { + boolean isLdif = pathname.getName().toLowerCase().endsWith( ".ldif" ); + return pathname.isFile() && pathname.canRead() && isLdif; + } + } ); + + // LOG and bail if we could not find any LDIF files + if ( ( ldifFiles == null ) || ( ldifFiles.length == 0 ) ) + { + LOG.warn( "LDIF load directory '{}' does not contain any LDIF files. No LDIF files will be loaded.", + getCanonical( ldifDirectory ) ); + return; + } + + // load all the ldif files and load each one that is loaded + for ( File ldifFile : ldifFiles ) + { + try + { + LOG.info( "Loading LDIF file '{}'", ldifFile.getName() ); + loadLdif( root, ldifFile ); + } + catch ( NamingException ne ) + { + // If the file can't be read, log the error, and stop + // loading LDIFs. + LOG.error( "Cannot load the ldif file '{}', error : {}", + ldifFile.getAbsolutePath(), + ne.getMessage() ); + throw ne; + } } - - LdifFileLoader loader = new LdifFileLoader( root, ldifFile, ldifFilters ); - int count = loader.execute(); - LOG.info( "Loaded " + count + " entries from LDIF file '" + getCanonical( ldifFile ) + "'" ); - addFileEntry( root, ldifFile ); } } } Added: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractEntry.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractEntry.java?rev=643046&view=auto ============================================================================== --- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractEntry.java (added) +++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractEntry.java Mon Mar 31 09:19:45 2008 @@ -0,0 +1,114 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.directory.shared.ldap.entry; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.apache.directory.shared.ldap.name.LdapDN; + + +/** + * The Abstract class where all the DefaultClientEntry and DefaultServerEntry + * common fields and methods will be found. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ +public abstract class AbstractEntry implements Entry +{ + /** The DN for this entry */ + protected LdapDN dn; + + /** A map containing all the attributes for this entry */ + protected Map attributes = new HashMap(); + + + /** + * Get this entry's DN. + * + * @return The entry's DN + */ + public LdapDN getDn() + { + return dn; + } + + + /** + * Set this entry's DN. + * + * @param dn The DN associated with this entry + */ + public void setDn( LdapDN dn ) + { + this.dn = dn; + } + + + /** + * Remove all the attributes for this entry. The DN is not reset + */ + public void clear() + { + attributes.clear(); + } + + + /** + * Returns an enumeration containing the zero or more attributes in the + * collection. The behavior of the enumeration is not specified if the + * attribute collection is changed. + * + * @return an enumeration of all contained attributes + */ + public Iterator iterator() + { + return Collections.unmodifiableMap( attributes ).values().iterator(); + } + + + /** + * Returns the number of attributes. + * + * @return the number of attributes + */ + public int size() + { + return attributes.size(); + } + + + /** + * Clone the current entry + */ + public Entry clone() + { + try + { + return (Entry)super.clone(); + } + catch ( CloneNotSupportedException cnse ) + { + return null; + } + } +}