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 2011/10/20 21:42:13 UTC
svn commit: r1187013 [4/12] - in /directory/apacheds/branches/apacheds-txns:
./ all/ apache-felix/ apache-felix/bundle/ apache-felix/src/
apache-felix/src/main/ apache-felix/src/main/resources/ core-annotations/
core-annotations/src/main/java/org/apach...
Added: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java?rev=1187013&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java (added)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java Thu Oct 20 19:41:49 2011
@@ -0,0 +1,1112 @@
+/*
+ * 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.server.core.shared.partition;
+
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.naming.ConfigurationException;
+import javax.naming.directory.SearchControls;
+
+import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.api.CoreSession;
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.entry.ClonedServerEntry;
+import org.apache.directory.server.core.api.filtering.BaseEntryFilteringCursor;
+import org.apache.directory.server.core.api.filtering.CursorList;
+import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
+import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.GetRootDSEOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.MoveAndRenameOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.MoveOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.RenameOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.UnbindOperationContext;
+import org.apache.directory.server.core.api.partition.AbstractPartition;
+import org.apache.directory.server.core.api.partition.Partition;
+import org.apache.directory.server.core.api.partition.PartitionNexus;
+import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.model.cursor.EmptyCursor;
+import org.apache.directory.shared.ldap.model.cursor.SingletonCursor;
+import org.apache.directory.shared.ldap.model.entry.Attribute;
+import org.apache.directory.shared.ldap.model.entry.DefaultAttribute;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.model.entry.DefaultModification;
+import org.apache.directory.shared.ldap.model.entry.Entry;
+import org.apache.directory.shared.ldap.model.entry.Modification;
+import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
+import org.apache.directory.shared.ldap.model.entry.Value;
+import org.apache.directory.shared.ldap.model.exception.LdapException;
+import org.apache.directory.shared.ldap.model.exception.LdapNoSuchAttributeException;
+import org.apache.directory.shared.ldap.model.exception.LdapNoSuchObjectException;
+import org.apache.directory.shared.ldap.model.exception.LdapOperationErrorException;
+import org.apache.directory.shared.ldap.model.exception.LdapOtherException;
+import org.apache.directory.shared.ldap.model.filter.ExprNode;
+import org.apache.directory.shared.ldap.model.filter.PresenceNode;
+import org.apache.directory.shared.ldap.model.message.SearchScope;
+import org.apache.directory.shared.ldap.model.message.extended.NoticeOfDisconnect;
+import org.apache.directory.shared.ldap.model.name.Dn;
+import org.apache.directory.shared.ldap.model.name.DnUtils;
+import org.apache.directory.shared.ldap.model.schema.AttributeType;
+import org.apache.directory.shared.ldap.model.schema.Normalizer;
+import org.apache.directory.shared.ldap.model.schema.UsageEnum;
+import org.apache.directory.shared.ldap.util.tree.DnNode;
+import org.apache.directory.shared.util.DateUtils;
+import org.apache.directory.shared.util.exception.MultiException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * A root {@link Partition} that contains all other partitions, and
+ * routes all operations to the child partition that matches to its base suffixes.
+ * It also provides some extended operations such as accessing rootDSE and
+ * listing base suffixes.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class DefaultPartitionNexus extends AbstractPartition implements PartitionNexus
+{
+ /** A logger for this class */
+ private static final Logger LOG = LoggerFactory.getLogger( DefaultPartitionNexus.class );
+
+ /** the fixed id: 'NEXUS' */
+ private static final String ID = "NEXUS";
+
+ /** Speedup for logs */
+ private static final boolean IS_DEBUG = LOG.isDebugEnabled();
+
+ /** the vendorName string proudly set to: Apache Software Foundation*/
+ private static final String ASF = "Apache Software Foundation";
+
+ /** the read only rootDSE attributes */
+ private final Entry rootDSE;
+
+ /** The DirectoryService instance */
+ private DirectoryService directoryService;
+
+ /** the partitions keyed by normalized suffix strings */
+ private Map<String, Partition> partitions = new HashMap<String, Partition>();
+
+ /** A structure to hold all the partitions */
+ private DnNode<Partition> partitionLookupTree = new DnNode<Partition>();
+
+ /** the system partition */
+ //private Partition system;
+
+ /** A reference to the EntryCSN attributeType */
+ private static AttributeType ENTRY_CSN_AT;
+
+ /** A reference to the ObjectClass attributeType */
+ private static AttributeType OBJECT_CLASS_AT;
+
+ private final List<Modification> mods = new ArrayList<Modification>( 2 );
+
+ private String lastSyncedCtxCsn = null;
+
+ /** The cn=schema Dn */
+ private Dn subschemSubentryDn;
+
+
+
+ /**
+ * Creates the root nexus singleton of the entire system. The root DSE has
+ * several attributes that are injected into it besides those that may
+ * already exist. As partitions are added to the system more namingContexts
+ * attributes are added to the rootDSE.
+ *
+ * @see <a href="http://www.faqs.org/rfcs/rfc3045.html">Vendor Information</a>
+ * @param rootDSE the root entry for the DSA
+ * @throws javax.naming.Exception on failure to initialize
+ */
+ public DefaultPartitionNexus( Entry rootDSE ) throws Exception
+ {
+ id = ID;
+ suffixDn = null;
+
+ // setup that root DSE
+ this.rootDSE = rootDSE;
+
+ // Add the basic informations
+ rootDSE.put( SchemaConstants.SUBSCHEMA_SUBENTRY_AT, ServerDNConstants.CN_SCHEMA_DN );
+ rootDSE.put( SchemaConstants.SUPPORTED_LDAP_VERSION_AT, "3" );
+ rootDSE.put( SchemaConstants.SUPPORTED_FEATURES_AT, SchemaConstants.FEATURE_ALL_OPERATIONAL_ATTRIBUTES );
+ rootDSE.put( SchemaConstants.SUPPORTED_EXTENSION_AT, NoticeOfDisconnect.EXTENSION_OID );
+
+ // Add the objectClasses
+ rootDSE.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, SchemaConstants.EXTENSIBLE_OBJECT_OC );
+
+ // Add the 'vendor' name and version infos
+ rootDSE.put( SchemaConstants.VENDOR_NAME_AT, ASF );
+
+ Properties props = new Properties();
+
+ try
+ {
+ props.load( getClass().getResourceAsStream( "version.properties" ) );
+ }
+ catch ( IOException e )
+ {
+ LOG.error( I18n.err( I18n.ERR_33 ) );
+ }
+
+ rootDSE.put( SchemaConstants.VENDOR_VERSION_AT, props.getProperty( "apacheds.version", "UNKNOWN" ) );
+
+ // The rootDSE uuid has been randomly created
+ rootDSE.put( SchemaConstants.ENTRY_UUID_AT, "f290425c-8272-4e62-8a67-92b06f38dbf5" );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.server.core.partition.PartitionNexus#initialize()
+ */
+ protected void doInit() throws Exception
+ {
+ // NOTE: We ignore ContextPartitionConfiguration parameter here.
+ if ( !initialized )
+ {
+ // Add the supported controls
+ Iterator<String> ctrlOidItr = directoryService.getLdapCodecService().registeredControls();
+
+ while ( ctrlOidItr.hasNext() )
+ {
+ rootDSE.add( SchemaConstants.SUPPORTED_CONTROL_AT, ctrlOidItr.next() );
+ }
+
+ schemaManager = directoryService.getSchemaManager();
+ ENTRY_CSN_AT = schemaManager.getAttributeType( SchemaConstants.ENTRY_CSN_AT );
+ OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
+
+ // Initialize and normalize the localy used DNs
+ Dn adminDn = directoryService.getDnFactory().create( ServerDNConstants.ADMIN_SYSTEM_DN );
+ adminDn.apply( schemaManager );
+
+ Value<?> attr = rootDSE.get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
+ subschemSubentryDn = directoryService.getDnFactory().create( attr.getString() );
+
+ //initializeSystemPartition( directoryService );
+
+ List<Partition> initializedPartitions = new ArrayList<Partition>();
+
+ initializedPartitions.add( 0, directoryService.getSystemPartition() );
+ addContextPartition( directoryService.getSystemPartition() );
+
+ try
+ {
+ for ( Partition partition : directoryService.getPartitions() )
+ {
+ addContextPartition( partition );
+ initializedPartitions.add( partition );
+ }
+
+ createContextCsnModList();
+
+ initialized = true;
+ }
+ finally
+ {
+ if ( !initialized )
+ {
+ Iterator<Partition> i = initializedPartitions.iterator();
+
+ while ( i.hasNext() )
+ {
+ Partition partition = i.next();
+ i.remove();
+
+ try
+ {
+ partition.destroy();
+ }
+ catch ( Exception e )
+ {
+ LOG.warn( "Failed to destroy a partition: " + partition.getSuffixDn(), e );
+ }
+ finally
+ {
+ unregister( partition );
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ private Partition initializeSystemPartition( DirectoryService directoryService ) throws Exception
+ {
+ // initialize system partition first
+ Partition system = directoryService.getSystemPartition();
+
+ // Add root context entry for system partition
+ Dn systemSuffixDn = directoryService.getDnFactory().create( ServerDNConstants.SYSTEM_DN );
+ CoreSession adminSession = directoryService.getAdminSession();
+
+ if ( !system.hasEntry( new EntryOperationContext( adminSession, systemSuffixDn ) ) )
+ {
+ Entry systemEntry = new DefaultEntry( schemaManager, systemSuffixDn );
+
+ // Add the ObjectClasses
+ systemEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC,
+ SchemaConstants.ORGANIZATIONAL_UNIT_OC, SchemaConstants.EXTENSIBLE_OBJECT_OC );
+
+ // Add some operational attributes
+ systemEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN );
+ systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
+ systemEntry.add( SchemaConstants.ENTRY_CSN_AT, directoryService.getCSN().toString() );
+ systemEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
+ systemEntry.put( DnUtils.getRdnAttributeType( ServerDNConstants.SYSTEM_DN ), DnUtils
+ .getRdnValue( ServerDNConstants.SYSTEM_DN ) );
+
+ AddOperationContext addOperationContext = new AddOperationContext( adminSession, systemEntry );
+ system.add( addOperationContext );
+ }
+
+ String key = system.getSuffixDn().getNormName();
+
+ if ( partitions.containsKey( key ) )
+ {
+ throw new ConfigurationException( I18n.err( I18n.ERR_263, key ) );
+ }
+
+ synchronized ( partitionLookupTree )
+ {
+ partitions.put( key, system );
+ partitionLookupTree.add( system.getSuffixDn(), system );
+ Attribute namingContexts = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT );
+
+ if ( namingContexts == null )
+ {
+ namingContexts = new DefaultAttribute( schemaManager
+ .getAttributeType( SchemaConstants.NAMING_CONTEXTS_AT ), system.getSuffixDn().getName() );
+ rootDSE.put( namingContexts );
+ }
+ else
+ {
+ namingContexts.add( system.getSuffixDn().getName() );
+ }
+ }
+
+ return system;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.server.core.partition.PartitionNexus#destroy()
+ */
+ protected synchronized void doDestroy()
+ {
+ if ( !initialized )
+ {
+ return;
+ }
+
+ // make sure this loop is not fail fast so all backing stores can
+ // have an attempt at closing down and synching their cached entries
+ for ( String suffix : new HashSet<String>( this.partitions.keySet() ) )
+ {
+ try
+ {
+ removeContextPartition( directoryService.getDnFactory().create( suffix ) );
+ }
+ catch ( Exception e )
+ {
+ LOG.warn( "Failed to destroy a partition: " + suffix, e );
+ }
+ }
+
+ initialized = false;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setId( String id )
+ {
+ throw new UnsupportedOperationException( I18n.err( I18n.ERR_264 ) );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setSuffixDn( Dn suffix )
+ {
+ throw new UnsupportedOperationException();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.server.core.partition.PartitionNexus#sync()
+ */
+ public void sync() throws Exception
+ {
+ MultiException error = null;
+
+ // store the contextCSN value in the entry ou=system
+ // note that this modification shouldn't change the entryCSN value of ou=system entry
+ try
+ {
+ String currentCtxCsn = directoryService.getContextCsn();
+ // update only if the CSN changes
+ if ( ( currentCtxCsn != null ) && !currentCtxCsn.equals( lastSyncedCtxCsn ) )
+ {
+ lastSyncedCtxCsn = currentCtxCsn;
+
+ Attribute contextCsnAt = mods.get( 0 ).getAttribute();
+ contextCsnAt.clear();
+ contextCsnAt.add( lastSyncedCtxCsn );
+
+ Attribute timeStampAt = mods.get( 1 ).getAttribute();
+ timeStampAt.clear();
+ timeStampAt.add( DateUtils.getGeneralizedTime() );
+
+ ModifyOperationContext csnModContext = new ModifyOperationContext( directoryService.getAdminSession(),
+ directoryService.getSystemPartition().getSuffixDn(), mods );
+ directoryService.getSystemPartition().modify( csnModContext );
+ }
+ }
+ catch ( Exception e )
+ {
+ LOG.warn( "Failed to save the contextCSN attribute value in ou=system entry.", e );
+ if ( error == null )
+ {
+ error = new MultiException( I18n.err( I18n.ERR_265 ) );
+ }
+
+ error.addThrowable( e );
+ }
+
+ for ( Partition partition : this.partitions.values() )
+ {
+ try
+ {
+ partition.sync();
+ }
+ catch ( Exception e )
+ {
+ LOG.warn( "Failed to flush partition data out.", e );
+ if ( error == null )
+ {
+ //noinspection ThrowableInstanceNeverThrown
+ error = new MultiException( I18n.err( I18n.ERR_265 ) );
+ }
+
+ // @todo really need to send this info to a monitor
+ error.addThrowable( e );
+ }
+ }
+
+ if ( error != null )
+ {
+ throw error;
+ }
+ }
+
+
+ // ------------------------------------------------------------------------
+ // DirectoryPartition Interface Method Implementations
+ // ------------------------------------------------------------------------
+ /* (non-Javadoc)
+ * @see org.apache.directory.server.core.partition.PartitionNexus#add(org.apache.directory.server.core.interceptor.context.AddOperationContext)
+ */
+ public void add( AddOperationContext addContext ) throws LdapException
+ {
+ Partition partition = getPartition( addContext.getDn() );
+ partition.add( addContext );
+
+ Attribute at = addContext.getEntry().get( SchemaConstants.ENTRY_CSN_AT );
+ directoryService.setContextCsn( at.getString() );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.server.core.partition.PartitionNexus#bind(org.apache.directory.server.core.interceptor.context.BindOperationContext)
+ */
+ public void bind( BindOperationContext bindContext ) throws LdapException
+ {
+ Partition partition = getPartition( bindContext.getDn() );
+ partition.bind( bindContext );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.server.core.partition.PartitionNexus#compare(org.apache.directory.server.core.interceptor.context.CompareOperationContext)
+ */
+ public boolean compare( CompareOperationContext compareContext ) throws LdapException
+ {
+ Attribute attr = compareContext.getOriginalEntry().get( compareContext.getAttributeType() );
+
+ // complain if the attribute being compared does not exist in the entry
+ if ( attr == null )
+ {
+ throw new LdapNoSuchAttributeException();
+ }
+
+ // see first if simple match without normalization succeeds
+ if ( attr.contains( compareContext.getValue() ) )
+ {
+ return true;
+ }
+
+ // now must apply normalization to all values (attr and in request) to compare
+
+ /*
+ * Get ahold of the normalizer for the attribute and normalize the request
+ * assertion value for comparisons with normalized attribute values. Loop
+ * through all values looking for a match.
+ */
+ Normalizer normalizer = compareContext.getAttributeType().getEquality().getNormalizer();
+ Value<?> reqVal = normalizer.normalize( compareContext.getValue() );
+
+ for ( Value<?> value : attr )
+ {
+ Value<?> attrValObj = normalizer.normalize( value );
+
+ if ( attrValObj.equals( reqVal ) )
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.server.core.partition.PartitionNexus#delete(org.apache.directory.server.core.interceptor.context.DeleteOperationContext)
+ */
+ public void delete( DeleteOperationContext deleteContext ) throws LdapException
+ {
+ Partition partition = getPartition( deleteContext.getDn() );
+ partition.delete( deleteContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
+ {
+ Dn dn = hasEntryContext.getDn();
+
+ if ( IS_DEBUG )
+ {
+ LOG.debug( "Check if Dn '" + dn + "' exists." );
+ }
+
+ if ( dn.isRootDSE() )
+ {
+ return true;
+ }
+
+ Partition partition = getPartition( dn );
+
+ return partition.hasEntry( hasEntryContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException
+ {
+ Partition partition = getPartition( listContext.getDn() );
+
+ return partition.list( listContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
+ {
+ Dn dn = lookupContext.getDn();
+
+ if ( dn.equals( subschemSubentryDn ) )
+ {
+ return new ClonedServerEntry( rootDSE.clone() );
+ }
+
+ // This is for the case we do a lookup on the rootDSE
+ if ( dn.size() == 0 )
+ {
+ Entry retval = new ClonedServerEntry( rootDSE );
+
+ if ( ( lookupContext.getAttrsId() != null ) && !lookupContext.getAttrsId().isEmpty() )
+ {
+ for ( Attribute attribute : rootDSE.getAttributes() )
+ {
+ AttributeType attributeType = attribute.getAttributeType();
+ String oid = attributeType.getOid();
+
+ if ( !lookupContext.getAttrsId().contains( oid ) )
+ {
+ retval.removeAttributes( attributeType );
+ }
+ }
+
+ return retval;
+ }
+ else
+ {
+ return new ClonedServerEntry( rootDSE );
+ }
+ }
+
+ Partition partition = getPartition( dn );
+ Entry entry = partition.lookup( lookupContext );
+
+ if ( entry == null )
+ {
+ LdapNoSuchObjectException e = new LdapNoSuchObjectException( "Attempt to lookup non-existant entry: "
+ + dn.getName() );
+
+ throw e;
+ }
+
+ return entry;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void modify( ModifyOperationContext modifyContext ) throws LdapException
+ {
+ // Special case : if we don't have any modification to apply, just return
+ if ( modifyContext.getModItems().size() == 0 )
+ {
+ return;
+ }
+
+ Partition partition = getPartition( modifyContext.getDn() );
+
+ partition.modify( modifyContext );
+
+ Entry alteredEntry = modifyContext.getAlteredEntry();
+
+ if ( alteredEntry != null )
+ {
+ directoryService.setContextCsn( alteredEntry.get( ENTRY_CSN_AT ).getString() );
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void move( MoveOperationContext moveContext ) throws LdapException
+ {
+ // Get the current partition
+ Partition partition = getPartition( moveContext.getDn() );
+
+ // We also have to get the new partition as it can be different
+ //Partition newBackend = getPartition( opContext.getNewDn() );
+
+ partition.move( moveContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
+ {
+ Partition partition = getPartition( moveAndRenameContext.getDn() );
+ partition.moveAndRename( moveAndRenameContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void rename( RenameOperationContext renameContext ) throws LdapException
+ {
+ Partition partition = getPartition( renameContext.getDn() );
+ partition.rename( renameContext );
+ }
+
+
+ private EntryFilteringCursor searchRootDSE( SearchOperationContext searchContext ) throws LdapException
+ {
+ SearchControls searchControls = searchContext.getSearchControls();
+
+ String[] ids = searchControls.getReturningAttributes();
+
+ // -----------------------------------------------------------
+ // If nothing is asked for then we just return the entry asis.
+ // We let other mechanisms filter out operational attributes.
+ // -----------------------------------------------------------
+ if ( ( ids == null ) || ( ids.length == 0 ) )
+ {
+ Entry rootDSE = getRootDSE( null );
+ return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( rootDSE ), searchContext );
+ }
+
+ // -----------------------------------------------------------
+ // Collect all the real attributes besides 1.1, +, and * and
+ // note if we've seen these special attributes as well.
+ // -----------------------------------------------------------
+
+ Set<String> realIds = new HashSet<String>();
+ boolean allUserAttributes = searchContext.isAllUserAttributes();
+ boolean allOperationalAttributes = searchContext.isAllOperationalAttributes();
+ boolean noAttribute = searchContext.isNoAttributes();
+
+ for ( String id : ids )
+ {
+ String idTrimmed = id.trim();
+
+ try
+ {
+ realIds.add( schemaManager.getAttributeTypeRegistry().getOidByName( idTrimmed ) );
+ }
+ catch ( Exception e )
+ {
+ realIds.add( idTrimmed );
+ }
+ }
+
+ // return nothing
+ if ( noAttribute )
+ {
+ Entry serverEntry = new DefaultEntry( schemaManager, Dn.ROOT_DSE );
+ return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( serverEntry ), searchContext );
+ }
+
+ // return everything
+ if ( allUserAttributes && allOperationalAttributes )
+ {
+ Entry rootDSE = getRootDSE( null );
+ return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( rootDSE ), searchContext );
+ }
+
+ Entry serverEntry = new DefaultEntry( schemaManager, Dn.ROOT_DSE );
+
+ Entry rootDSE = getRootDSE( new GetRootDSEOperationContext( searchContext.getSession() ) );
+
+ for ( Attribute attribute : rootDSE )
+ {
+ AttributeType type = schemaManager.lookupAttributeTypeRegistry( attribute.getUpId() );
+
+ if ( realIds.contains( type.getOid() ) )
+ {
+ serverEntry.put( attribute );
+ }
+ else if ( allUserAttributes && ( type.getUsage() == UsageEnum.USER_APPLICATIONS ) )
+ {
+ serverEntry.put( attribute );
+ }
+ else if ( allOperationalAttributes && ( type.getUsage() != UsageEnum.USER_APPLICATIONS ) )
+ {
+ serverEntry.put( attribute );
+ }
+ }
+
+ return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( serverEntry ), searchContext );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.server.core.partition.PartitionNexus#search(org.apache.directory.server.core.interceptor.context.SearchOperationContext)
+ */
+ public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
+ {
+ Dn base = searchContext.getDn();
+ SearchControls searchCtls = searchContext.getSearchControls();
+ ExprNode filter = searchContext.getFilter();
+
+ // TODO since we're handling the *, and + in the EntryFilteringCursor
+ // we may not need this code: we need see if this is actually the
+ // case and remove this code.
+ if ( base.size() == 0 )
+ {
+ // We are searching from the rootDSE. We have to distinguish three cases :
+ // 1) The scope is OBJECT : we have to return the rootDSE entry, filtered
+ // 2) The scope is ONELEVEL : we have to return all the Namin
+ boolean isObjectScope = searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE;
+
+ boolean isOnelevelScope = searchCtls.getSearchScope() == SearchControls.ONELEVEL_SCOPE;
+
+ boolean isSublevelScope = searchCtls.getSearchScope() == SearchControls.SUBTREE_SCOPE;
+
+ // test for (objectClass=*)
+ boolean isSearchAll = false;
+
+ // We have to be careful, as we may have a filter which is not a PresenceFilter
+ if ( filter instanceof PresenceNode)
+ {
+ isSearchAll = ( ( PresenceNode ) filter ).getAttributeType().equals( OBJECT_CLASS_AT );
+ }
+
+ /*
+ * if basedn is "", filter is "(objectclass=*)" and scope is object
+ * then we have a request for the rootDSE
+ */
+ if ( ( filter instanceof PresenceNode ) && isObjectScope && isSearchAll )
+ {
+ return searchRootDSE( searchContext );
+ }
+ else if ( isObjectScope && ( !isSearchAll ) )
+ {
+ return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext );
+ }
+ else if ( isOnelevelScope )
+ {
+ List<EntryFilteringCursor> cursors = new ArrayList<EntryFilteringCursor>();
+
+ for ( Partition partition : partitions.values() )
+ {
+ Dn contextDn = partition.getSuffixDn();
+ EntryOperationContext hasEntryContext = new EntryOperationContext( null, contextDn );
+ // search only if the context entry exists
+ if( partition.hasEntry( hasEntryContext ) )
+ {
+ searchContext.setDn( contextDn );
+ searchContext.setScope( SearchScope.OBJECT );
+ cursors.add( partition.search( searchContext ) );
+ }
+ }
+
+ return new CursorList( cursors, searchContext );
+ }
+ else if ( isSublevelScope )
+ {
+ List<EntryFilteringCursor> cursors = new ArrayList<EntryFilteringCursor>();
+
+ for ( Partition partition : partitions.values() )
+ {
+ Entry entry = partition.lookup( new LookupOperationContext( directoryService.getAdminSession(),
+ partition.getSuffixDn() ) );
+
+ if ( entry != null )
+ {
+ Partition backend = getPartition( entry.getDn() );
+ searchContext.setDn( entry.getDn() );
+ cursors.add( backend.search( searchContext ) );
+ }
+ }
+
+ // don't feed the above Cursors' list to a BaseEntryFilteringCursor it is skipping the naming context entry of each partition
+ return new CursorList( cursors, searchContext );
+ }
+
+ // TODO : handle searches based on the RootDSE
+ throw new LdapNoSuchObjectException();
+ }
+
+ if ( !base.isSchemaAware() )
+ {
+ base.apply( schemaManager );
+ }
+
+ Partition backend = getPartition( base );
+
+ return backend.search( searchContext );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.server.core.partition.PartitionNexus#unbind(org.apache.directory.server.core.interceptor.context.UnbindOperationContext)
+ */
+ public void unbind( UnbindOperationContext unbindContext ) throws LdapException
+ {
+ Partition partition = getPartition( unbindContext.getDn() );
+ partition.unbind( unbindContext );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.server.core.partition.PartitionNexus#getRootDSE(org.apache.directory.server.core.interceptor.context.GetRootDSEOperationContext)
+ */
+ public Entry getRootDSE( GetRootDSEOperationContext getRootDSEContext )
+ {
+ return rootDSE.clone();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.server.core.partition.PartitionNexus#addContextPartition(org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext)
+ */
+ public synchronized void addContextPartition( Partition partition ) throws LdapException
+ {
+ // Turn on default indices
+ String key = partition.getSuffixDn().getNormName();
+
+ if ( partitions.containsKey( key ) )
+ {
+ throw new LdapOtherException( I18n.err( I18n.ERR_263, key ) );
+ }
+
+ if ( !partition.isInitialized() )
+ {
+ partition.initialize();
+ }
+
+ synchronized ( partitionLookupTree )
+ {
+ Dn partitionSuffix = partition.getSuffixDn();
+
+ if ( partitionSuffix == null )
+ {
+ throw new LdapOtherException( I18n.err( I18n.ERR_267, partition.getId() ) );
+ }
+
+ partitions.put( partitionSuffix.getNormName(), partition );
+ partitionLookupTree.add( partition.getSuffixDn(), partition );
+
+ Attribute namingContexts = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT );
+
+ if ( namingContexts == null )
+ {
+ namingContexts = new DefaultAttribute( schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.NAMING_CONTEXTS_AT ), partitionSuffix.getName() );
+ rootDSE.put( namingContexts );
+ }
+ else
+ {
+ namingContexts.add( partitionSuffix.getName() );
+ }
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.server.core.partition.PartitionNexus#removeContextPartition(Dn partitionDN)
+ */
+ public synchronized void removeContextPartition( Dn partitionDn )
+ throws LdapException
+ {
+ // Get the Partition name. It's a Dn.
+ String key = partitionDn.getNormName();
+
+ // Retrieve this partition from the aprtition's table
+ Partition partition = partitions.get( key );
+
+ if ( partition == null )
+ {
+ String msg = I18n.err( I18n.ERR_34, key );
+ LOG.error( msg );
+ throw new LdapNoSuchObjectException( msg );
+ }
+
+ String partitionSuffix = partition.getSuffixDn().getName();
+
+ // Retrieve the namingContexts from the RootDSE : the partition
+ // suffix must be present in those namingContexts
+ Attribute namingContexts = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT );
+
+ if ( namingContexts != null )
+ {
+ if ( namingContexts.contains( partitionSuffix ) )
+ {
+ namingContexts.remove( partitionSuffix );
+ }
+ else
+ {
+ String msg = I18n.err( I18n.ERR_35, key );
+ LOG.error( msg );
+ throw new LdapNoSuchObjectException( msg );
+ }
+ }
+
+ // Update the partition tree
+ synchronized ( partitionLookupTree )
+ {
+ partitionLookupTree.remove( partition.getSuffixDn() );
+ }
+
+ partitions.remove( key );
+
+ try
+ {
+ partition.destroy();
+ }
+ catch ( Exception e )
+ {
+ throw new LdapOperationErrorException( e.getMessage(), e );
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.server.core.partition.PartitionNexus#getPartition(org.apache.directory.shared.ldap.model.name.Dn)
+ */
+ public Partition getPartition( Dn dn ) throws LdapException
+ {
+ Partition parent = null;
+
+ synchronized ( partitionLookupTree )
+ {
+ parent = partitionLookupTree.getElement( dn );
+ }
+
+ if ( parent == null )
+ {
+ throw new LdapNoSuchObjectException( I18n.err( I18n.ERR_268, dn ) );
+ }
+ else
+ {
+ return parent;
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Dn getSuffixDn( Dn dn ) throws LdapException
+ {
+ Partition partition = getPartition( dn );
+
+ return partition.getSuffixDn();
+ }
+
+
+ /* (non-Javadoc)
+ */
+ public Set<String> listSuffixes() throws LdapException
+ {
+ return Collections.unmodifiableSet( partitions.keySet() );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.server.core.partition.PartitionNexus#registerSupportedExtensions(java.util.Set)
+ */
+ public void registerSupportedExtensions( Set<String> extensionOids ) throws LdapException
+ {
+ Attribute supportedExtension = rootDSE.get( SchemaConstants.SUPPORTED_EXTENSION_AT );
+
+ if ( supportedExtension == null )
+ {
+ rootDSE.put( SchemaConstants.SUPPORTED_EXTENSION_AT, (String)null );
+ supportedExtension = rootDSE.get( SchemaConstants.SUPPORTED_EXTENSION_AT );
+ }
+
+ for ( String extensionOid : extensionOids )
+ {
+ supportedExtension.add( extensionOid );
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.server.core.partition.PartitionNexus#registerSupportedSaslMechanisms(java.util.Set)
+ */
+ public void registerSupportedSaslMechanisms( Set<String> supportedSaslMechanisms ) throws LdapException
+ {
+ Attribute supportedSaslMechanismsAt = null;
+
+ supportedSaslMechanismsAt = new DefaultAttribute( schemaManager.lookupAttributeTypeRegistry( SchemaConstants.SUPPORTED_SASL_MECHANISMS_AT ) );
+
+ for ( String saslMechanism : supportedSaslMechanisms )
+ {
+ supportedSaslMechanismsAt.add( saslMechanism );
+ }
+
+ rootDSE.add( supportedSaslMechanismsAt );
+ }
+
+
+ /**
+ * Unregisters an ContextPartition with this BackendManager. Called for each
+ * registered Backend right befor it is to be stopped. This prevents
+ * protocol server requests from reaching the Backend and effectively puts
+ * the ContextPartition's naming context offline.
+ *
+ * Operations against the naming context should result in an LDAP BUSY
+ * result code in the returnValue if the naming context is not online.
+ *
+ * @param partition ContextPartition component to unregister with this
+ * BackendNexus.
+ * @throws Exception if there are problems unregistering the partition
+ */
+ private void unregister( Partition partition ) throws Exception
+ {
+ Attribute namingContexts = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT );
+
+ if ( namingContexts != null )
+ {
+ namingContexts.remove( partition.getSuffixDn().getName() );
+ }
+
+ partitions.remove( partition.getSuffixDn().getName() );
+ }
+
+
+ /**
+ * @return the directoryService
+ */
+ public DirectoryService getDirectoryService()
+ {
+ return directoryService;
+ }
+
+
+ /**
+ * @param directoryService the directoryService to set
+ */
+ public void setDirectoryService( DirectoryService directoryService )
+ {
+ this.directoryService = directoryService;
+ }
+
+
+ private void createContextCsnModList() throws LdapException
+ {
+ Modification contextCsnMod = new DefaultModification();
+ contextCsnMod.setOperation( ModificationOperation.REPLACE_ATTRIBUTE );
+ DefaultAttribute contextCsnAt = new DefaultAttribute( schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.CONTEXT_CSN_AT ) );
+ contextCsnMod.setAttribute( contextCsnAt );
+
+ mods.add( contextCsnMod );
+
+ Modification timeStampMod = new DefaultModification();
+ timeStampMod.setOperation( ModificationOperation.REPLACE_ATTRIBUTE );
+ DefaultAttribute timeStampAt = new DefaultAttribute( schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.MODIFY_TIMESTAMP_AT ) );
+ timeStampMod.setAttribute( timeStampAt );
+
+ mods.add( timeStampMod );
+ }
+}
Added: directory/apacheds/branches/apacheds-txns/core-shared/src/main/resources/org/apache/directory/server/core/shared/partition/version.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/resources/org/apache/directory/server/core/shared/partition/version.properties?rev=1187013&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/resources/org/apache/directory/server/core/shared/partition/version.properties (added)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/resources/org/apache/directory/server/core/shared/partition/version.properties Thu Oct 20 19:41:49 2011
@@ -0,0 +1,18 @@
+# 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.
+
+apacheds.version=${pom.version}
Modified: directory/apacheds/branches/apacheds-txns/core/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/pom.xml?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/pom.xml (original)
+++ directory/apacheds/branches/apacheds-txns/core/pom.xml Thu Oct 20 19:41:49 2011
@@ -29,7 +29,7 @@
<artifactId>apacheds-core</artifactId>
<name>ApacheDS Core</name>
- <packaging>jar</packaging>
+ <packaging>bundle</packaging>
<description>
Server's core contains the JNDI provider, interceptors, schema, and
@@ -60,6 +60,91 @@
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-core-shared</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-admin</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-authn</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-authz</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-changelog</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-collective</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-event</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-exception</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-hash</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-journal</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-logger</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-normalization</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-operational</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-referral</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-schema</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-subtree</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apacheds-interceptors-trigger</artifactId>
+ </dependency>
<dependency>
<groupId>commons-collections</groupId>
@@ -164,6 +249,33 @@
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ <addMavenDescriptor>false</addMavenDescriptor>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <inherited>true</inherited>
+ <extensions>true</extensions>
+ <configuration>
+ <manifestLocation>META-INF</manifestLocation>
+ <instructions>
+ <Bundle-SymbolicName>${project.groupId}.core</Bundle-SymbolicName>
+ <Export-Package>
+ {local-packages};version=${project.version};-noimport:=true
+ </Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
</plugins>
<resources>
@@ -176,5 +288,4 @@
</resource>
</resources>
</build>
-</project>
-
+</project>
\ No newline at end of file
Modified: directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Thu Oct 20 19:41:49 2011
@@ -39,42 +39,54 @@ import javax.naming.directory.Attributes
import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.admin.AdministrativePointInterceptor;
-import org.apache.directory.server.core.administrative.AccessControlAdministrativePoint;
-import org.apache.directory.server.core.administrative.CollectiveAttributeAdministrativePoint;
-import org.apache.directory.server.core.administrative.SubschemaAdministrativePoint;
-import org.apache.directory.server.core.administrative.TriggerExecutionAdministrativePoint;
+import org.apache.directory.server.core.api.CacheService;
+import org.apache.directory.server.core.api.CoreSession;
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.DnFactory;
+import org.apache.directory.server.core.api.InstanceLayout;
+import org.apache.directory.server.core.api.LdapPrincipal;
+import org.apache.directory.server.core.api.OperationManager;
+import org.apache.directory.server.core.api.ReferralManager;
+import org.apache.directory.server.core.api.administrative.AccessControlAdministrativePoint;
+import org.apache.directory.server.core.api.administrative.CollectiveAttributeAdministrativePoint;
+import org.apache.directory.server.core.api.administrative.SubschemaAdministrativePoint;
+import org.apache.directory.server.core.api.administrative.TriggerExecutionAdministrativePoint;
+import org.apache.directory.server.core.api.changelog.ChangeLog;
+import org.apache.directory.server.core.api.changelog.ChangeLogEvent;
+import org.apache.directory.server.core.api.changelog.Tag;
+import org.apache.directory.server.core.api.changelog.TaggableSearchableChangeLogStore;
+import org.apache.directory.server.core.api.event.EventService;
+import org.apache.directory.server.core.api.interceptor.Interceptor;
+import org.apache.directory.server.core.api.interceptor.InterceptorChain;
+import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.api.journal.Journal;
+import org.apache.directory.server.core.api.partition.Partition;
+import org.apache.directory.server.core.api.partition.PartitionNexus;
+import org.apache.directory.server.core.api.schema.SchemaPartition;
+import org.apache.directory.server.core.api.subtree.SubentryCache;
+import org.apache.directory.server.core.api.subtree.SubtreeEvaluator;
import org.apache.directory.server.core.authn.AuthenticationInterceptor;
import org.apache.directory.server.core.authn.ppolicy.PpolicyConfigContainer;
import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
-import org.apache.directory.server.core.changelog.ChangeLog;
-import org.apache.directory.server.core.changelog.ChangeLogEvent;
import org.apache.directory.server.core.changelog.ChangeLogInterceptor;
import org.apache.directory.server.core.changelog.DefaultChangeLog;
-import org.apache.directory.server.core.changelog.Tag;
-import org.apache.directory.server.core.changelog.TaggableSearchableChangeLogStore;
import org.apache.directory.server.core.collective.CollectiveAttributeInterceptor;
import org.apache.directory.server.core.event.EventInterceptor;
-import org.apache.directory.server.core.event.EventService;
import org.apache.directory.server.core.exception.ExceptionInterceptor;
-import org.apache.directory.server.core.interceptor.Interceptor;
-import org.apache.directory.server.core.interceptor.InterceptorChain;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.BindOperationContext;
-import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.journal.DefaultJournal;
-import org.apache.directory.server.core.journal.Journal;
import org.apache.directory.server.core.journal.JournalInterceptor;
import org.apache.directory.server.core.normalization.NormalizationInterceptor;
import org.apache.directory.server.core.operational.OperationalAttributeInterceptor;
-import org.apache.directory.server.core.partition.DefaultPartitionNexus;
-import org.apache.directory.server.core.partition.Partition;
-import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.core.referral.ReferralInterceptor;
import org.apache.directory.server.core.schema.SchemaInterceptor;
-import org.apache.directory.server.core.schema.SchemaPartition;
import org.apache.directory.server.core.security.TlsKeyGenerator;
+import org.apache.directory.server.core.shared.DefaultCoreSession;
+import org.apache.directory.server.core.shared.DefaultDnFactory;
+import org.apache.directory.server.core.shared.partition.DefaultPartitionNexus;
import org.apache.directory.server.core.subtree.SubentryInterceptor;
import org.apache.directory.server.core.trigger.TriggerInterceptor;
import org.apache.directory.server.i18n.I18n;
@@ -263,6 +275,12 @@ public class DefaultDirectoryService imp
/** The Dn factory */
private DnFactory dnFactory;
+
+ /** The Subentry cache */
+ SubentryCache subentryCache = new SubentryCache();
+
+ /** The Subtree evaluator instance */
+ private SubtreeEvaluator evaluator;
/**
* The synchronizer thread. It flush data on disk periodically.
@@ -322,6 +340,7 @@ public class DefaultDirectoryService imp
journal = new DefaultJournal();
syncPeriodMillis = DEFAULT_SYNC_PERIOD;
csnFactory = new CsnFactory( replicaId );
+ evaluator = new SubtreeEvaluator( schemaManager );
}
@@ -455,13 +474,12 @@ public class DefaultDirectoryService imp
for ( Interceptor interceptor : interceptors )
{
- String name = interceptor.getName();
-
- if ( names.contains( name ) )
+ if ( names.contains( interceptor.getName() ) )
{
LOG.warn( "Encountered duplicate definitions for {} interceptor", interceptor.getName() );
}
- names.add( name );
+
+ names.add( interceptor.getName() );
}
this.interceptors = interceptors;
@@ -509,34 +527,49 @@ public class DefaultDirectoryService imp
/**
* {@inheritDoc}
*/
- public void setInstanceLayout( InstanceLayout instanceLayout )
+ public void setInstanceLayout( InstanceLayout instanceLayout ) throws IOException
{
this.instanceLayout = instanceLayout;
// Create the directories if they are missing
if ( !instanceLayout.getInstanceDirectory().exists() )
{
- instanceLayout.getInstanceDirectory().mkdirs();
+ if ( !instanceLayout.getInstanceDirectory().mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getInstanceDirectory() ) );
+ }
}
if ( !instanceLayout.getLogDirectory().exists() )
{
- instanceLayout.getLogDirectory().mkdirs();
+ if ( !instanceLayout.getLogDirectory().mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getLogDirectory() ) );
+ }
}
if ( !instanceLayout.getRunDirectory().exists() )
{
- instanceLayout.getRunDirectory().mkdirs();
+ if ( !instanceLayout.getRunDirectory().mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getRunDirectory() ) );
+ }
}
if ( !instanceLayout.getPartitionsDirectory().exists() )
{
- instanceLayout.getPartitionsDirectory().mkdirs();
+ if ( !instanceLayout.getPartitionsDirectory().mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getPartitionsDirectory() ) );
+ }
}
if ( !instanceLayout.getConfDirectory().exists() )
{
- instanceLayout.getConfDirectory().mkdirs();
+ if ( !instanceLayout.getConfDirectory().mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getConfDirectory() ) );
+ }
}
}
@@ -1915,7 +1948,7 @@ public class DefaultDirectoryService imp
*/
public boolean isPwdPolicyEnabled()
{
- AuthenticationInterceptor authenticationInterceptor = (AuthenticationInterceptor)getInterceptor( AuthenticationInterceptor.class.getName() );
+ AuthenticationInterceptor authenticationInterceptor = (AuthenticationInterceptor)getInterceptor( AuthenticationInterceptor.class.getSimpleName() );
if ( authenticationInterceptor == null )
{
@@ -1937,4 +1970,23 @@ public class DefaultDirectoryService imp
{
return dnFactory;
}
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public SubentryCache getSubentryCache()
+ {
+ return subentryCache;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public SubtreeEvaluator getEvaluator()
+ {
+ return evaluator;
+ }
+
}
\ No newline at end of file
Modified: directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java (original)
+++ directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java Thu Oct 20 19:41:49 2011
@@ -23,24 +23,27 @@ package org.apache.directory.server.core
import java.util.ArrayList;
import java.util.List;
-import org.apache.directory.server.core.filtering.EntryFilteringCursor;
-import org.apache.directory.server.core.interceptor.InterceptorChain;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.BindOperationContext;
-import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetRootDSEOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.OperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
-import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
-import org.apache.directory.server.core.invocation.InvocationStack;
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.OperationManager;
+import org.apache.directory.server.core.api.ReferralManager;
+import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
+import org.apache.directory.server.core.api.interceptor.InterceptorChain;
+import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.GetRootDSEOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.MoveAndRenameOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.MoveOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.OperationContext;
+import org.apache.directory.server.core.api.interceptor.context.RenameOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.UnbindOperationContext;
+import org.apache.directory.server.core.api.invocation.InvocationStack;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.entry.Attribute;
Modified: directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java (original)
+++ directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java Thu Oct 20 19:41:49 2011
@@ -20,7 +20,7 @@
package org.apache.directory.server.core.prefs;
-import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.api.DirectoryService;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.util.exception.NotImplementedException;
Modified: directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java (original)
+++ directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java Thu Oct 20 19:41:49 2011
@@ -29,8 +29,8 @@ import java.util.prefs.BackingStoreExcep
import java.util.prefs.Preferences;
import org.apache.directory.server.constants.ApacheSchemaConstants;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.filtering.EntryFilteringCursor;
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.entry.Attribute;
Modified: directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java (original)
+++ directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java Thu Oct 20 19:41:49 2011
@@ -38,9 +38,9 @@ import java.util.Enumeration;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.NotImplementedException;
import org.apache.directory.server.constants.ServerDNConstants;
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.LdapPrincipal;
+import org.apache.directory.server.core.api.CoreSession;
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.LdapPrincipal;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.model.entry.Entry;
Modified: directory/apacheds/branches/apacheds-txns/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java Thu Oct 20 19:41:49 2011
@@ -28,14 +28,15 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.apache.directory.server.core.DefaultCoreSession;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.LdapPrincipal;
-import org.apache.directory.server.core.MockDirectoryService;
-import org.apache.directory.server.core.MockInterceptor;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.invocation.InvocationStack;
-import org.apache.directory.server.core.partition.ByPassConstants;
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.LdapPrincipal;
+import org.apache.directory.server.core.api.MockDirectoryService;
+import org.apache.directory.server.core.api.MockInterceptor;
+import org.apache.directory.server.core.api.interceptor.InterceptorChain;
+import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.api.invocation.InvocationStack;
+import org.apache.directory.server.core.api.partition.ByPassConstants;
+import org.apache.directory.server.core.shared.DefaultCoreSession;
import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
Propchange: directory/apacheds/branches/apacheds-txns/http-directory-bridge/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu Oct 20 19:41:49 2011
@@ -0,0 +1,11 @@
+/directory/apacheds/branches/apacheds-codec-merge/http-directory-bridge:982369-987590
+/directory/apacheds/branches/apacheds-config/http-directory-bridge:1023442-1029077
+/directory/apacheds/branches/apacheds-kerberos-codec-2.0/http-directory-bridge:1040956-1043765
+/directory/apacheds/branches/apacheds-replication/http-directory-bridge:749790-764110
+/directory/apacheds/branches/apacheds-schema/http-directory-bridge:806623-896441
+/directory/apacheds/branches/apacheds-subtree/http-directory-bridge:965203-965686
+/directory/apacheds/branches/milestones/http-directory-bridge:1072812-1075328
+/directory/apacheds/branches/xdbm-refactoring/http-directory-bridge:945827-946347
+/directory/apacheds/trunk/http-directory-bridge:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1186962
+/directory/apacheds/trunk/interceptors/http-directory-bridge:1183435-1186974
+/directory/studio/trunk/http-directory-bridge:1067786-1067997
Modified: directory/apacheds/branches/apacheds-txns/http-directory-bridge/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/http-directory-bridge/pom.xml?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/http-directory-bridge/pom.xml (original)
+++ directory/apacheds/branches/apacheds-txns/http-directory-bridge/pom.xml Thu Oct 20 19:41:49 2011
@@ -27,6 +27,7 @@
<artifactId>apacheds-http-directory-bridge</artifactId>
<name>ApacheDS DirectoryService-WebApp bridge</name>
+ <packaging>bundle</packaging>
<dependencies>
@@ -45,5 +46,36 @@
<artifactId>shared-ldap-model</artifactId>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ <addMavenDescriptor>false</addMavenDescriptor>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <inherited>true</inherited>
+ <extensions>true</extensions>
+ <configuration>
+ <manifestLocation>META-INF</manifestLocation>
+ <instructions>
+ <Bundle-SymbolicName>${project.groupId}.http.directory.bridge</Bundle-SymbolicName>
+ <Export-Package>
+ {local-packages};version=${project.version};-noimport:=true
+ </Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
Propchange: directory/apacheds/branches/apacheds-txns/http-integration/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Oct 20 19:41:49 2011
@@ -3,5 +3,6 @@
/directory/apacheds/branches/apacheds-dnfactory-experiment/http-integration:980138-980935
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/http-integration:1040956-1043765
/directory/apacheds/branches/milestones/http-integration:1072812-1075328
-/directory/apacheds/trunk/http-integration:1066126-1067785,1068026-1072718,1072800-1075329
+/directory/apacheds/trunk/http-integration:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1186962
+/directory/apacheds/trunk/interceptors/http-integration:1183435-1186974
/directory/studio/trunk/http-integration:1067786-1067997
Modified: directory/apacheds/branches/apacheds-txns/http-integration/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/http-integration/pom.xml?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/http-integration/pom.xml (original)
+++ directory/apacheds/branches/apacheds-txns/http-integration/pom.xml Thu Oct 20 19:41:49 2011
@@ -29,6 +29,7 @@
<artifactId>apacheds-http-integration</artifactId>
<name>ApacheDS Jetty HTTP Server Integration</name>
+ <packaging>bundle</packaging>
<dependencies>
<dependency>
@@ -103,6 +104,33 @@
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ <addMavenDescriptor>false</addMavenDescriptor>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <inherited>true</inherited>
+ <extensions>true</extensions>
+ <configuration>
+ <manifestLocation>META-INF</manifestLocation>
+ <instructions>
+ <Bundle-SymbolicName>${project.groupId}.http.integration</Bundle-SymbolicName>
+ <Export-Package>
+ {local-packages};version=${project.version};-noimport:=true
+ </Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
</plugins>
</build>
</project>
Modified: directory/apacheds/branches/apacheds-txns/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java (original)
+++ directory/apacheds/branches/apacheds-txns/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java Thu Oct 20 19:41:49 2011
@@ -36,9 +36,9 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
-import org.apache.directory.server.HttpDirectoryService;
+import org.apache.directory.server.bridge.http.HttpDirectoryService;
import org.apache.directory.server.constants.ServerDNConstants;
-import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.api.DirectoryService;
import org.apache.directory.server.core.security.TlsKeyGenerator;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.protocol.shared.transport.TcpTransport;
Propchange: directory/apacheds/branches/apacheds-txns/i18n/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Oct 20 19:41:49 2011
@@ -3,5 +3,6 @@
/directory/apacheds/branches/apacheds-dnfactory-experiment/i18n:980138-980935
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/i18n:1040956-1043765
/directory/apacheds/branches/milestones/i18n:1072812-1075328
-/directory/apacheds/trunk/i18n:1066126-1067785,1068026-1072718,1072800-1075329
+/directory/apacheds/trunk/i18n:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1186962
+/directory/apacheds/trunk/interceptors/i18n:1183435-1186974
/directory/studio/trunk/i18n:1067786-1067997
Modified: directory/apacheds/branches/apacheds-txns/i18n/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/i18n/pom.xml?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/i18n/pom.xml (original)
+++ directory/apacheds/branches/apacheds-txns/i18n/pom.xml Thu Oct 20 19:41:49 2011
@@ -27,7 +27,39 @@
<artifactId>apacheds-i18n</artifactId>
<name>ApacheDS I18n</name>
+ <packaging>bundle</packaging>
<description>Internationalization of errors and other messages</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ <addMavenDescriptor>false</addMavenDescriptor>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <inherited>true</inherited>
+ <extensions>true</extensions>
+ <configuration>
+ <manifestLocation>META-INF</manifestLocation>
+ <instructions>
+ <Bundle-SymbolicName>${project.groupId}.i18n</Bundle-SymbolicName>
+ <Export-Package>
+ {local-packages};version=${project.version};-noimport:=true
+ </Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
Modified: directory/apacheds/branches/apacheds-txns/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java (original)
+++ directory/apacheds/branches/apacheds-txns/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java Thu Oct 20 19:41:49 2011
@@ -145,9 +145,9 @@ public enum I18n
// ERR_109( "ERR_109" ),
// ERR_110( "ERR_110" ),
// ERR_111( "ERR_111" ),
- // ERR_112( "ERR_112" ),
- // ERR_113( "ERR_113" ),
- // ERR_114( "ERR_ 114" ),
+ ERR_112_COULD_NOT_CREATE_DIRECORY("ERR_112_COULD_NOT_CREATE_DIRECORY"),
+ ERR_113_COULD_NOT_DELETE_FILE_OR_DIRECTORY("ERR_113_COULD_NOT_DELETE_FILE_OR_DIRECTORY"),
+ ERR_114("ERR_114"),
ERR_115("ERR_115"),
ERR_116("ERR_116"),
ERR_117("ERR_117"),
Modified: directory/apacheds/branches/apacheds-txns/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties (original)
+++ directory/apacheds/branches/apacheds-txns/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties Thu Oct 20 19:41:49 2011
@@ -133,9 +133,9 @@ ERR_91=Attempt to destroy wrapped partit
# ERR_109=
# ERR_110=
# ERR_111=
-# ERR_112=
-# ERR_113=
-# ERR_114=
+ERR_112_COULD_NOT_CREATE_DIRECORY=Could not create directory {0}
+ERR_113_COULD_NOT_DELETE_FILE_OR_DIRECTORY=Could not delete file or directory {0}
+ERR_114=Unable to create a DirectoryService instance for unknow reason
ERR_115=Failed to delete the working directory.
ERR_116=Failed to delete\:
ERR_117=Unsupported changetype found in LDIF: {0}
Propchange: directory/apacheds/branches/apacheds-txns/installers/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Oct 20 19:41:49 2011
@@ -1,6 +1,7 @@
/directory/apacheds/branches/apacheds-config/installers:1023442-1029077
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/installers:1040956-1043765
/directory/apacheds/branches/milestones/installers:1072812-1075328
-/directory/apacheds/trunk/installers:1066126-1067785,1068026-1072718,1072800-1075329
+/directory/apacheds/trunk/installers:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1186962
+/directory/apacheds/trunk/interceptors/installers:1183435-1186974
/directory/installers/branches/installers-schema/apacheds:806631-896441
/directory/studio/trunk/installers:1067786-1067997
Propchange: directory/apacheds/branches/apacheds-txns/installers-maven-plugin/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Oct 20 19:41:49 2011
@@ -1,6 +1,7 @@
/directory/apacheds/branches/apacheds-config/installers-maven-plugin:1023442-1029077
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/installers-maven-plugin:1040956-1043765
/directory/apacheds/branches/milestones/installers-maven-plugin:1072812-1075328
-/directory/apacheds/trunk/installers-maven-plugin:1066126-1067785,1068026-1072718,1072800-1075329
+/directory/apacheds/trunk/installers-maven-plugin:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1186962
+/directory/apacheds/trunk/interceptors/installers-maven-plugin:1183435-1186974
/directory/daemon/branches/daemon-schema/plugin:806630-896441
/directory/studio/trunk/installers-maven-plugin:1067786-1067997
Modified: directory/apacheds/branches/apacheds-txns/installers-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/installers-maven-plugin/pom.xml?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/installers-maven-plugin/pom.xml (original)
+++ directory/apacheds/branches/apacheds-txns/installers-maven-plugin/pom.xml Thu Oct 20 19:41:49 2011
@@ -122,15 +122,17 @@
</execution>
</executions>
</plugin>
- </plugins>
- </build>
-
- <!-- Generating plugin documentation -->
- <reporting>
- <plugins>
<plugin>
- <artifactId>maven-plugin-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <configuration>
+ <reportPlugins combine.children="append">
+ <plugin>
+ <artifactId>maven-plugin-plugin</artifactId>
+ </plugin>
+ </reportPlugins>
+ </configuration>
</plugin>
</plugins>
- </reporting>
+ </build>
</project>
Modified: directory/apacheds/branches/apacheds-txns/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/AbstractMojoCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/AbstractMojoCommand.java?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/AbstractMojoCommand.java (original)
+++ directory/apacheds/branches/apacheds-txns/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/AbstractMojoCommand.java Thu Oct 20 19:41:49 2011
@@ -25,7 +25,7 @@ import java.io.IOException;
import java.util.Properties;
import org.apache.directory.server.InstallationLayout;
-import org.apache.directory.server.core.InstanceLayout;
+import org.apache.directory.server.core.api.InstanceLayout;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
Modified: directory/apacheds/branches/apacheds-txns/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java?rev=1187013&r1=1187012&r2=1187013&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java (original)
+++ directory/apacheds/branches/apacheds-txns/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java Thu Oct 20 19:41:49 2011
@@ -36,6 +36,7 @@ import java.util.Properties;
import java.util.Set;
import org.apache.directory.server.InstallationLayout;
+import org.apache.directory.server.i18n.I18n;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.tools.ant.taskdefs.Execute;
@@ -224,7 +225,10 @@ public class MojoHelperUtils
{
File[] files = src.listFiles();
- dest.mkdirs();
+ if ( !dest.mkdirs() )
+ {
+ throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, dest ) );
+ }
for ( File file : files )
{