Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F1263C8F8 for ; Mon, 11 Jun 2012 13:13:22 +0000 (UTC) Received: (qmail 96584 invoked by uid 500); 11 Jun 2012 13:13:22 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 96523 invoked by uid 500); 11 Jun 2012 13:13:22 -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 96514 invoked by uid 99); 11 Jun 2012 13:13:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jun 2012 13:13:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jun 2012 13:13:19 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id BAC5A2388847 for ; Mon, 11 Jun 2012 13:12:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1348830 - in /directory/apacheds/branches/apacheds-osgi/hub: api/src/main/java/org/apache/directory/server/hub/api/ api/src/main/java/org/apache/directory/server/hub/api/component/ api/src/main/java/org/apache/directory/server/hub/api/comp... Date: Mon, 11 Jun 2012 13:12:57 -0000 To: commits@directory.apache.org From: gokturk@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120611131258.BAC5A2388847@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gokturk Date: Mon Jun 11 13:12:56 2012 New Revision: 1348830 URL: http://svn.apache.org/viewvc?rev=1348830&view=rev Log: * specific ipojo component types' assumptions on on being factory and being exclusive is changed. They can specify those aspects now. * new exclusive flag is added to DirectoryComponent. When a factory is exclusive, while reconfiguring its immutable property, its previous reference is disposed prior to creating new reference, avoiding any exclusive resource clash. * IPojoComponentConstants class in hub-api is now merged with DcHandlerConstants in hub-connector-ipojo-handler. * constants concepts in DirectoryMeta is now renamed as attributes for more meaningful naming schema. Removed: directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/util/IPojoComponentConstants.java Modified: directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/AbstractHubClient.java directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/ComponentHub.java directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/DcConfiguration.java directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/meta/DcMetadataDescriptor.java directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/core/src/main/java/org/apache/directory/server/hub/connector/ipojo/core/DcMetadataBuilder.java directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryComponent.java directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryInterceptor.java directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryPartition.java directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryServer.java directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/AbstractDcHandler.java directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DcHandlerConstants.java directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryComponentHandler.java directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryInterceptorHandler.java directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryPartitionHandler.java directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryServerHandler.java directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/HubClientManager.java directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/configurator/ConfiguratorInterceptor.java directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/collection/CollectionMetaDescriptorGenerator.java directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/store/StoreConfigManager.java directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/store/StoreSchemaConstants.java Modified: directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/AbstractHubClient.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/AbstractHubClient.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/AbstractHubClient.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/AbstractHubClient.java Mon Jun 11 13:12:56 2012 @@ -21,6 +21,7 @@ package org.apache.directory.server.hub.api; +import org.apache.directory.server.hub.api.component.DcConfiguration; import org.apache.directory.server.hub.api.component.DirectoryComponent; import org.apache.directory.server.hub.api.exception.HubAbortException; @@ -33,19 +34,26 @@ public class AbstractHubClient } - public void componentDeactivating( DirectoryComponent component ) + public void componentDeactivating( DirectoryComponent component ) throws HubAbortException { } - public void componentRemoving( DirectoryComponent component ) throws HubAbortException + public void componentDeactivated( DirectoryComponent component ) { } - public void componentReconfigured( DirectoryComponent component ) + public void componentReconfiguring( DirectoryComponent component, DcConfiguration newConfiguration ) + throws HubAbortException + { + + } + + + public void componentReconfigured( DirectoryComponent component, boolean newInstance ) { } Modified: directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/ComponentHub.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/ComponentHub.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/ComponentHub.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/ComponentHub.java Mon Jun 11 13:12:56 2012 @@ -20,6 +20,10 @@ package org.apache.directory.server.hub.api; + +import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; +import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; + import org.apache.directory.server.hub.api.component.DcConfiguration; import org.apache.directory.server.hub.api.component.DirectoryComponent; import org.apache.directory.server.hub.api.exception.HubAbortException; @@ -32,8 +36,6 @@ import org.apache.directory.server.hub.a import org.apache.directory.server.hub.api.registry.PidHandlerRegistry; - - public interface ComponentHub { @@ -83,4 +85,10 @@ public interface ComponentHub public abstract PidHandlerRegistry getPIDHandlerRegistry(); + + public abstract ReadLock getReadLock(); + + + public abstract WriteLock getWriteLock(); + } \ No newline at end of file Modified: directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/DcConfiguration.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/DcConfiguration.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/DcConfiguration.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/DcConfiguration.java Mon Jun 11 13:12:56 2012 @@ -33,7 +33,7 @@ public class DcConfiguration implements private Hashtable propertyMap; private Integer collectionIndex = null; - private Hashtable constantProperties = new Hashtable(); + private Hashtable attributes = new Hashtable(); public DcConfiguration( List properties ) @@ -71,6 +71,12 @@ public class DcConfiguration implements public void addProperty( DcProperty property ) { + DcProperty existing = propertyMap.get( property.getName() ); + if ( existing != null ) + { + removeProperty( property.getName() ); + } + properties.add( property ); propertyMap.put( property.getName(), property ); } @@ -104,15 +110,15 @@ public class DcConfiguration implements } - public void addConstant( String name, String value ) + public void addAttribute( String name, String value ) { - constantProperties.put( name, value ); + attributes.put( name, value ); } - public String getConstantProperty( String name ) + public String getAttribute( String name ) { - return constantProperties.get( name ); + return attributes.get( name ); } } Modified: directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/meta/DcMetadataDescriptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/meta/DcMetadataDescriptor.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/meta/DcMetadataDescriptor.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/meta/DcMetadataDescriptor.java Mon Jun 11 13:12:56 2012 @@ -40,28 +40,31 @@ public class DcMetadataDescriptor private Hashtable propertyMap; - private Hashtable constants; + private Hashtable attributes; private boolean factory; + private boolean exclusive; public DcMetadataDescriptor( String metadataPID, boolean isFactory, + boolean isExclusive, Version metaVersion, String className, String[] implemented, String[] extended, - Hashtable constants, + Hashtable attributes, DcPropertyDescription[] properties ) { this.metadataPID = metadataPID; this.factory = isFactory; + this.exclusive = isExclusive; this.metaVersion = metaVersion; this.className = className; this.implemented = implemented; this.extended = extended; - this.constants = constants; + this.attributes = attributes; this.properties = properties; propertyMap = new Hashtable(); @@ -88,6 +91,12 @@ public class DcMetadataDescriptor } + public boolean isExclusive() + { + return exclusive; + } + + public Version getMetaVersion() { return metaVersion; @@ -184,9 +193,9 @@ public class DcMetadataDescriptor } - public Hashtable getConstants() + public Hashtable getAttributes() { - return constants; + return attributes; } } Modified: directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/core/src/main/java/org/apache/directory/server/hub/connector/ipojo/core/DcMetadataBuilder.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/core/src/main/java/org/apache/directory/server/hub/connector/ipojo/core/DcMetadataBuilder.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/core/src/main/java/org/apache/directory/server/hub/connector/ipojo/core/DcMetadataBuilder.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/core/src/main/java/org/apache/directory/server/hub/connector/ipojo/core/DcMetadataBuilder.java Mon Jun 11 13:12:56 2012 @@ -25,9 +25,10 @@ import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; + +import org.apache.directory.server.component.handler.ipojo.DcHandlerConstants; import org.apache.directory.server.component.handler.ipojo.property.DirectoryPropertyDescription; import org.apache.directory.server.hub.api.component.util.ComponentConstants; -import org.apache.directory.server.hub.api.component.util.IPojoComponentConstants; import org.apache.directory.server.hub.api.meta.DcMetadataDescriptor; import org.apache.directory.server.hub.api.meta.DcPropertyDescription; import org.apache.felix.ipojo.ComponentFactory; @@ -44,10 +45,11 @@ public class DcMetadataBuilder String metadataPID = factory.getName(); Version metaVersion = factory.getBundleContext().getBundle().getVersion(); boolean isFactory = true; + boolean isExclusive = false; List properties = new ArrayList(); - Hashtable constants = new Hashtable(); + Hashtable attributes = new Hashtable(); for ( PropertyDescription property : factory.getComponentDescription().getProperties() ) { @@ -59,7 +61,6 @@ public class DcMetadataBuilder String type = normalizeType( property.getType() ); String description = ""; String containerFor = ""; - DirectoryPropertyDescription dpd = null; if ( property instanceof DirectoryPropertyDescription ) @@ -82,13 +83,17 @@ public class DcMetadataBuilder if ( constant ) { - if ( name.equals( IPojoComponentConstants.PROP_IS_FACTORY ) ) + if ( name.equals( DcHandlerConstants.META_IS_FACTORY ) ) { isFactory = Boolean.parseBoolean( defaultValue ); } + else if ( name.equals( DcHandlerConstants.META_IS_EXCLUSIVE ) ) + { + isExclusive = Boolean.parseBoolean( defaultValue ); + } else { - constants.put( name, defaultValue ); + attributes.put( name, defaultValue ); } } else @@ -111,8 +116,9 @@ public class DcMetadataBuilder String[] implemented = parseArray( interfaces ); String[] extended = parseArray( sclasses ); - DcMetadataDescriptor metadata = new DcMetadataDescriptor( metadataPID, isFactory, metaVersion, className, - implemented, extended, constants, properties.toArray( new DcPropertyDescription[0] ) ); + DcMetadataDescriptor metadata = new DcMetadataDescriptor( metadataPID, isFactory, isExclusive, metaVersion, + className, + implemented, extended, attributes, properties.toArray( new DcPropertyDescription[0] ) ); return metadata; } Modified: directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryComponent.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryComponent.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryComponent.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryComponent.java Mon Jun 11 13:12:56 2012 @@ -33,5 +33,8 @@ import java.lang.annotation.Target; @Target(ElementType.TYPE) public @interface DirectoryComponent { - + boolean factory() default true; + + + boolean exclusive() default false; } \ No newline at end of file Modified: directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryInterceptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryInterceptor.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryInterceptor.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryInterceptor.java Mon Jun 11 13:12:56 2012 @@ -36,6 +36,11 @@ import org.apache.directory.server.hub.a @Target(ElementType.TYPE) public @interface DirectoryInterceptor { + boolean factory() default true; + + + boolean exclusive() default false; + /* * Used to specify interception point for all component instances * instantiated from factory. Modified: directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryPartition.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryPartition.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryPartition.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryPartition.java Mon Jun 11 13:12:56 2012 @@ -32,5 +32,8 @@ import java.lang.annotation.Target; @Target(ElementType.TYPE) public @interface DirectoryPartition { + boolean factory() default true; + + boolean exclusive() default false; } Modified: directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryServer.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryServer.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryServer.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/DirectoryServer.java Mon Jun 11 13:12:56 2012 @@ -33,5 +33,8 @@ import java.lang.annotation.Target; @Target(ElementType.TYPE) public @interface DirectoryServer { + boolean factory() default true; + + boolean exclusive() default false; } Modified: directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/AbstractDcHandler.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/AbstractDcHandler.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/AbstractDcHandler.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/AbstractDcHandler.java Mon Jun 11 13:12:56 2012 @@ -194,6 +194,7 @@ public abstract class AbstractDcHandler // If property is constructor index then it must be mandatory. if ( paramIndex != null ) { + immutable = true; mandatory = true; } Modified: directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DcHandlerConstants.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DcHandlerConstants.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DcHandlerConstants.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DcHandlerConstants.java Mon Jun 11 13:12:56 2012 @@ -40,8 +40,18 @@ public class DcHandlerConstants public static final String DSSERVER_HANDLER_NS = "org.apache.directory.server.component.handler"; /* - * Property name for specifying components owning ApacheDS instance name; + * Property names for meta properties at handler level */ public static final String DSCOMPONENT_OWNER_PROP_NAME = "dscomponent.owner"; + public static final String DSCOMPONENT_FACTORY_PROP_NAME = "factory"; + public static final String DSCOMPONENT_EXCLUSIVE_PROP_NAME = "exclusive"; + + /* + * Property names for meta proeprties at connector level + */ + public static final String META_IS_FACTORY = "isFactory"; + public static final String META_IS_EXCLUSIVE = "isImmutable"; + public static final String INTERCEPTOR_INTERCEPTION_POINT = "interceptionPoint"; + public static final String INTERCEPTOR_INTERCEPTOR_OPERATIONS = "operations"; } Modified: directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryComponentHandler.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryComponentHandler.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryComponentHandler.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryComponentHandler.java Mon Jun 11 13:12:56 2012 @@ -26,6 +26,7 @@ import java.util.Hashtable; import org.apache.felix.ipojo.annotations.Handler; import org.apache.felix.ipojo.metadata.Element; + @Handler(name = DcHandlerConstants.DSCOMPONENT_HANDLER_NAME, namespace = DcHandlerConstants.DSCOMPONENT_HANDLER_NS) public class DirectoryComponentHandler extends AbstractDcHandler { @@ -45,9 +46,28 @@ public class DirectoryComponentHandler e @Override - protected Hashtable extractConstantProperties( Element ipojoMetadata ) + protected Hashtable extractConstantProperties( Element ipojoMetadata ) { - return null; + Hashtable constants = new Hashtable(); + + Element[] components = ipojoMetadata.getElements( getHandlerName(), getHandlerNamespaceName() ); + // Only one interceptor per class is allowed + Element component = components[0]; + + String isFactory = component.getAttribute( DcHandlerConstants.DSCOMPONENT_FACTORY_PROP_NAME ); + if ( isFactory != null ) + { + constants.put( DcHandlerConstants.META_IS_FACTORY, isFactory ); + } + + String isExclusive = component.getAttribute( DcHandlerConstants.DSCOMPONENT_EXCLUSIVE_PROP_NAME ); + if ( isExclusive != null ) + { + constants.put( DcHandlerConstants.META_IS_EXCLUSIVE, isExclusive ); + } + + return constants; + } } Modified: directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryInterceptorHandler.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryInterceptorHandler.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryInterceptorHandler.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryInterceptorHandler.java Mon Jun 11 13:12:56 2012 @@ -23,7 +23,6 @@ package org.apache.directory.server.comp import java.util.Hashtable; -import org.apache.directory.server.hub.api.component.util.IPojoComponentConstants; import org.apache.felix.ipojo.annotations.Handler; import org.apache.felix.ipojo.metadata.Element; @@ -53,13 +52,26 @@ public class DirectoryInterceptorHandler // Only one interceptor per class is allowed Element interceptor = interceptors[0]; - String interceptionPoint = interceptor.getAttribute( IPojoComponentConstants.PROP_INTERCEPTION_POINT ); - String interceptorOperations = interceptor.getAttribute( IPojoComponentConstants.PROP_INTERCEPTOR_OPERATIONS ); - Hashtable constants = new Hashtable(); - constants.put( IPojoComponentConstants.PROP_INTERCEPTION_POINT, interceptionPoint ); - constants.put( IPojoComponentConstants.PROP_INTERCEPTOR_OPERATIONS, interceptorOperations ); - constants.put( IPojoComponentConstants.PROP_IS_FACTORY, "false" ); + + String interceptionPoint = interceptor.getAttribute( DcHandlerConstants.INTERCEPTOR_INTERCEPTION_POINT ); + String interceptorOperations = interceptor + .getAttribute( DcHandlerConstants.INTERCEPTOR_INTERCEPTOR_OPERATIONS ); + + String isFactory = interceptor.getAttribute( DcHandlerConstants.DSCOMPONENT_FACTORY_PROP_NAME ); + if ( isFactory != null ) + { + constants.put( DcHandlerConstants.META_IS_FACTORY, isFactory ); + } + + String isExclusive = interceptor.getAttribute( DcHandlerConstants.DSCOMPONENT_EXCLUSIVE_PROP_NAME ); + if ( isExclusive != null ) + { + constants.put( DcHandlerConstants.META_IS_EXCLUSIVE, isExclusive ); + } + + constants.put( DcHandlerConstants.INTERCEPTOR_INTERCEPTION_POINT, interceptionPoint ); + constants.put( DcHandlerConstants.INTERCEPTOR_INTERCEPTOR_OPERATIONS, interceptorOperations ); return constants; Modified: directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryPartitionHandler.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryPartitionHandler.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryPartitionHandler.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryPartitionHandler.java Mon Jun 11 13:12:56 2012 @@ -47,9 +47,27 @@ public class DirectoryPartitionHandler e @Override - protected Hashtable extractConstantProperties( Element ipojoMetadata ) + protected Hashtable extractConstantProperties( Element ipojoMetadata ) { - return null; + Element[] partitions = ipojoMetadata.getElements( getHandlerName(), getHandlerNamespaceName() ); + // Only one partition per class is allowed + Element partition = partitions[0]; + + Hashtable constants = new Hashtable(); + + String isFactory = partition.getAttribute( DcHandlerConstants.DSCOMPONENT_FACTORY_PROP_NAME ); + if ( isFactory != null ) + { + constants.put( DcHandlerConstants.META_IS_FACTORY, isFactory ); + } + + String isExclusive = partition.getAttribute( DcHandlerConstants.DSCOMPONENT_EXCLUSIVE_PROP_NAME ); + if ( isExclusive != null ) + { + constants.put( DcHandlerConstants.META_IS_EXCLUSIVE, isExclusive ); + } + + return constants; } } Modified: directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryServerHandler.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryServerHandler.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryServerHandler.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryServerHandler.java Mon Jun 11 13:12:56 2012 @@ -49,7 +49,25 @@ public class DirectoryServerHandler exte @Override protected Hashtable extractConstantProperties( Element ipojoMetadata ) { - return null; + Element[] servers = ipojoMetadata.getElements( getHandlerName(), getHandlerNamespaceName() ); + // Only one server per class is allowed + Element server = servers[0]; + + Hashtable constants = new Hashtable(); + + String isFactory = server.getAttribute( DcHandlerConstants.DSCOMPONENT_FACTORY_PROP_NAME ); + if ( isFactory != null ) + { + constants.put( DcHandlerConstants.META_IS_FACTORY, isFactory ); + } + + String isExclusive = server.getAttribute( DcHandlerConstants.DSCOMPONENT_EXCLUSIVE_PROP_NAME ); + if ( isExclusive != null ) + { + constants.put( DcHandlerConstants.META_IS_EXCLUSIVE, isExclusive ); + } + + return constants; } } Modified: directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java Mon Jun 11 13:12:56 2012 @@ -26,9 +26,12 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Hashtable; import java.util.List; -import java.util.Properties; import java.util.Set; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; +import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; +import org.apache.directory.server.component.handler.ipojo.DcHandlerConstants; import org.apache.directory.server.core.api.interceptor.Interceptor; import org.apache.directory.server.hub.api.AbstractHubClient; import org.apache.directory.server.hub.api.ComponentHub; @@ -39,11 +42,9 @@ import org.apache.directory.server.hub.a import org.apache.directory.server.hub.api.component.DirectoryComponent; import org.apache.directory.server.hub.api.component.DirectoryComponentConstants; import org.apache.directory.server.hub.api.component.util.InterceptionPoint; -import org.apache.directory.server.hub.api.component.util.IPojoComponentConstants; import org.apache.directory.server.hub.api.component.util.InterceptorOperation; import org.apache.directory.server.hub.api.exception.BadConfigurationException; import org.apache.directory.server.hub.api.exception.ComponentInstantiationException; -import org.apache.directory.server.hub.api.exception.ComponentReconfigurationException; import org.apache.directory.server.hub.api.exception.HubAbortException; import org.apache.directory.server.hub.api.exception.HubStoreException; import org.apache.directory.server.hub.api.exception.StoreNotValidException; @@ -62,7 +63,6 @@ import org.apache.directory.server.hub.c import org.apache.directory.server.hub.core.util.DCDependency; import org.apache.directory.server.hub.core.util.ParentLink; import org.apache.directory.server.hub.core.util.DCDependency.DCDependencyType; -import org.apache.felix.ipojo.IPojoContext; import org.osgi.framework.Version; @@ -75,6 +75,10 @@ public class ComponentHubImpl implements private PidHandlerRegistry handlersReg = new PidHandlerRegistry(); private ParentLinkRegistry parentLinksReg = new ParentLinkRegistry(); + private ReentrantReadWriteLock hubLock = new ReentrantReadWriteLock(); + private ReadLock readLock = hubLock.readLock(); + private WriteLock writeLock = hubLock.writeLock(); + private CollectionConnector collectionConnector; public IPojoConnector ipojoConnector; @@ -258,10 +262,15 @@ public class ComponentHubImpl implements catch ( BadConfigurationException e ) { throw new HubAbortException( - "Active DirectoryComponent can not be reconfigured with incorrect configuration", e ); + "Active DirectoryComponent can not be reconfigured with invalid configuration", e ); } } + clientManager.fireDCReconfiguring( component, newConfiguration ); + + boolean isExclusive = metadata.isExclusive(); + boolean reinstantiate = false; + // Immutable property change handling if ( component.getRuntimeInfo() != null ) { @@ -273,44 +282,95 @@ public class ComponentHubImpl implements DcProperty oldProp = component.getConfiguration().getProperty( prop.getName() ); if ( oldProp != null && !( oldProp.getValue().equals( prop.getValue() ) ) ) { - // We're changing immutable property of live component - boolean wasDirty = component.isDirty(); - component.setDirty( false ); - - try - { - removeComponent( component ); - component.setDirty( wasDirty ); - break; - } - catch ( HubAbortException e ) - { - throw new HubAbortException( - "Reconfiguration of immutable property led to re-instantiation, which has been rejected by hub", - e ); - } + reinstantiate = true; } } } } - if ( component.isDirty() ) + DcConfiguration oldConfiguration = component.getConfiguration(); + DcRuntime oldRuntime = component.getRuntimeInfo(); + + DcOperationsManager operations = handlersReg.getPIDHandler( component.getComponentManagerPID() ); + + component.setConfiguration( newConfiguration ); + try + { + processConfiguration( component ); + } + catch ( BadConfigurationException e ) + { + throw new HubAbortException( "New configuration is rejected while processing", e ); + } + + if ( component.getRuntimeInfo() != null ) { try { - store.updateComponent( component, newConfiguration ); + if ( reinstantiate ) + { + if ( isExclusive ) + { + operations.disposeComponent( component ); + } + else + { + component.setRuntimeInfo( null ); + } + } + else + { + operations.reconfigureComponent( component ); + } + + clientManager.fireDCReconfigured( component, reinstantiate ); + + List parents = parentLinksReg.getParentLinks( component ); + if ( parents != null ) + { + for ( ParentLink parentLink : parents ) + { + DirectoryComponent parent = parentLink.getParent(); + DcConfiguration newParentConf = new DcConfiguration( component.getConfiguration() ); + newParentConf.addProperty( new DcProperty( + DirectoryComponentConstants.DC_PROP_INNER_RECONF_NAME, parentLink + .getLinkPoint() ) ); + + updateComponent( parent, newParentConf ); + } + } } - catch ( HubStoreException e ) + catch ( Exception e ) { - throw new HubAbortException( "HubStore error raised while updating:" + component.getComponentPID(), e ); - } - } + if ( reinstantiate && !isExclusive ) + { + component.setRuntimeInfo( oldRuntime ); + component.setConfiguration( oldConfiguration ); - component.setConfiguration( newConfiguration ); + throw new HubAbortException( "Reconfiguration is rejected by target component:" + + component.getComponentPID(), e ); + } + else + { + component.setConfiguration( oldConfiguration ); + try + { + processConfiguration( component ); + operations.reconfigureComponent( component ); - if ( component.getRuntimeInfo() != null ) - { - reconfigureComponent( component ); + throw new HubAbortException( "Reconfiguration is rejected by target component:" + + component.getComponentPID(), e ); + } + catch ( Exception e2 ) + { + disposeComponent( component ); + + throw new HubAbortException( "Reconfiguration reverted but component couldn't be saved:" + + component.getComponentPID(), e ); + + } + } + } } else { @@ -319,6 +379,18 @@ public class ComponentHubImpl implements instantiateComponent( component ); } } + + if ( component.isDirty() ) + { + try + { + store.updateComponent( component, newConfiguration ); + } + catch ( HubStoreException e ) + { + // TODO Error log:Store couldn't be updated... + } + } } @@ -372,7 +444,55 @@ public class ComponentHubImpl implements @Override public void removeComponent( DirectoryComponent component ) throws HubAbortException { - clientManager.fireDCRemoving( component ); + clientManager.fireDCDeactivating( component ); + + List parents = parentLinksReg.getParentLinks( component ); + if ( parents != null ) + { + List alteredParents = new ArrayList(); + for ( ParentLink parentLink : parents ) + { + DcConfiguration newParentConf = parentLink.getParent().getConfiguration(); + DcProperty refProperty = newParentConf.getProperty( parentLink.getLinkPoint() ); + refProperty.setValue( "null" ); + + try + { + updateComponent( parentLink.getParent(), newParentConf ); + alteredParents.add( parentLink ); + } + catch ( HubAbortException e ) + { + /* + * At some parent, deletion rejected ! change already altered parents to previous state. + */ + + for ( ParentLink alteredLink : alteredParents ) + { + DcConfiguration revertedConf = parentLink.getParent().getConfiguration(); + DcProperty refProperty2 = newParentConf.getProperty( parentLink.getLinkPoint() ); + refProperty.setValue( component.getComponentPID() ); + + try + { + updateComponent( alteredLink.getParent(), revertedConf ); + } + catch ( HubAbortException e2 ) + { + // TODO log given parent couldn't be reverted from cancelled removal of its referenced property. + } + } + } + } + } + + DcOperationsManager opManager = handlersReg.getPIDHandler( component.getComponentManagerPID() ); + if ( opManager != null ) + { + opManager.disposeComponent( component ); + } + + componentsReg.removeDirectoryComponent( component ); if ( component.isDirty() ) { @@ -382,14 +502,9 @@ public class ComponentHubImpl implements } catch ( HubStoreException e ) { - throw new HubAbortException( "Component couldn't be removed from store, it is still active.", e ); + // TODO log: "Component couldn't be removed from store, it is still active." } } - - handleComponentRemoval( component ); - - componentsReg.removeDirectoryComponent( component ); - } @@ -599,12 +714,12 @@ public class ComponentHubImpl implements DcMetadataDescriptor metadata = metadatasReg.getMetadataDescriptor( component.getComponentManagerPID() ); // Loading meta-constant properties into component - Hashtable constants = metadata.getConstants(); - if ( constants != null ) + Hashtable attributes = metadata.getAttributes(); + if ( attributes != null ) { - for ( String key : constants.keySet() ) + for ( String key : attributes.keySet() ) { - component.getConfiguration().addConstant( key, constants.get( key ) ); + component.getConfiguration().addAttribute( key, attributes.get( key ) ); } } @@ -764,50 +879,9 @@ public class ComponentHubImpl implements } - private void reconfigureComponent( DirectoryComponent component ) - { - DcOperationsManager opManager = handlersReg.getPIDHandler( component.getComponentManagerPID() ); - if ( opManager == null ) - { - return; - } - - try - { - processConfiguration( component ); - opManager.reconfigureComponent( component ); - - component.setFailFlag( false ); - clientManager.fireDCReconfigured( component ); - - List parents = parentLinksReg.getParentLinks( component ); - if ( parents != null ) - { - for ( ParentLink parentLink : parents ) - { - DirectoryComponent parent = parentLink.getParent(); - parent.getConfiguration().addProperty( - new DcProperty( DirectoryComponentConstants.DC_PROP_INNER_RECONF_NAME, parentLink - .getLinkPoint() ) ); - - reconfigureComponent( parent ); - } - } - } - catch ( ComponentReconfigurationException e ) - { - component.setFailFlag( true ); - } - catch ( BadConfigurationException e ) - { - component.setFailFlag( true ); - } - } - - private void disposeComponent( DirectoryComponent component ) { - clientManager.fireDCDeactivating( component ); + clientManager.fireDCDeactivated( component ); List parents = parentLinksReg.getParentLinks( component ); if ( parents != null ) @@ -830,39 +904,14 @@ public class ComponentHubImpl implements } - private void handleComponentRemoval( DirectoryComponent component ) - { - List parents = parentLinksReg.getParentLinks( component ); - if ( parents != null ) - { - for ( ParentLink parentLink : parents ) - { - DcProperty refProperty = parentLink.getParent().getConfiguration() - .getProperty( parentLink.getLinkPoint() ); - refProperty.setValue( "null" ); - - reconfigureComponent( parentLink.getParent() ); - } - } - - DcOperationsManager opManager = handlersReg.getPIDHandler( component.getComponentManagerPID() ); - if ( opManager != null ) - { - opManager.disposeComponent( component ); - } - - component.setRuntimeInfo( null ); - } - - private void insertConfiguratorInterceptor() { configurator = new ConfiguratorInterceptor(); configurator.init( this ); DcConfiguration config = new DcConfiguration( new ArrayList() ); - config.addConstant( IPojoComponentConstants.PROP_INTERCEPTION_POINT, InterceptionPoint.END.toString() ); - config.addConstant( IPojoComponentConstants.PROP_INTERCEPTOR_OPERATIONS, + config.addAttribute( DcHandlerConstants.INTERCEPTOR_INTERCEPTION_POINT, InterceptionPoint.END.toString() ); + config.addAttribute( DcHandlerConstants.INTERCEPTOR_INTERCEPTOR_OPERATIONS, "[" + InterceptorOperation.ADD + "," + InterceptorOperation.DELETE + "," + @@ -876,7 +925,7 @@ public class ComponentHubImpl implements component.setDirty( false ); DcMetadataDescriptor configuratorMeta = - new DcMetadataDescriptor( "configuratorMeta", false, new Version( "2.0.0" ), + new DcMetadataDescriptor( "configuratorMeta", false, false, new Version( "2.0.0" ), ConfiguratorInterceptor.class.getName(), new String[] { Interceptor.class.getName() }, new String[0], null, new DcPropertyDescription[0] ); @@ -925,4 +974,18 @@ public class ComponentHubImpl implements { return handlersReg; } + + + @Override + public ReadLock getReadLock() + { + return readLock; + } + + + @Override + public WriteLock getWriteLock() + { + return writeLock; + } } Modified: directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/HubClientManager.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/HubClientManager.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/HubClientManager.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/HubClientManager.java Mon Jun 11 13:12:56 2012 @@ -30,6 +30,7 @@ import org.apache.commons.collections.Mu import org.apache.commons.collections.map.MultiValueMap; import org.apache.directory.server.hub.api.AbstractHubClient; import org.apache.directory.server.hub.api.ComponentHub; +import org.apache.directory.server.hub.api.component.DcConfiguration; import org.apache.directory.server.hub.api.component.DirectoryComponent; import org.apache.directory.server.hub.api.exception.HubAbortException; import org.apache.directory.server.hub.api.meta.DcMetadataDescriptor; @@ -106,7 +107,17 @@ public class HubClientManager } - public void fireDCDeactivating( DirectoryComponent component ) + public void fireDCDeactivated( DirectoryComponent component ) + { + List clients = getRegisteredClients( component ); + for ( AbstractHubClient client : clients ) + { + client.componentDeactivated( component ); + } + } + + + public void fireDCDeactivating( DirectoryComponent component ) throws HubAbortException { List clients = getRegisteredClients( component ); for ( AbstractHubClient client : clients ) @@ -116,22 +127,23 @@ public class HubClientManager } - public void fireDCRemoving( DirectoryComponent component ) throws HubAbortException + public void fireDCReconfiguring( DirectoryComponent component, DcConfiguration newConfiguration ) + throws HubAbortException { List clients = getRegisteredClients( component ); for ( AbstractHubClient client : clients ) { - client.componentRemoving( component ); + client.componentReconfiguring( component, newConfiguration ); } } - public void fireDCReconfigured( DirectoryComponent component ) + public void fireDCReconfigured( DirectoryComponent component, boolean newInstance ) { List clients = getRegisteredClients( component ); for ( AbstractHubClient client : clients ) { - client.componentReconfigured( component ); + client.componentReconfigured( component, newInstance ); } } Modified: directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/configurator/ConfiguratorInterceptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/configurator/ConfiguratorInterceptor.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/configurator/ConfiguratorInterceptor.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/configurator/ConfiguratorInterceptor.java Mon Jun 11 13:12:56 2012 @@ -100,7 +100,9 @@ public class ConfiguratorInterceptor ext parentDn = parentDn.getParent(); DirectoryComponent parentComponent = hub.getDCRegistry().getComponentByLocation( parentDn.toString() ); - if ( parentComponent.getComponentManagerPID().startsWith( StoreSchemaConstants.HUB_OC_COLLECTION ) ) + if ( component.getComponentManagerPID().equals( StoreSchemaConstants.HUB_OC_COLL_LIST ) + || component.getComponentManagerPID().equals( StoreSchemaConstants.HUB_OC_COLL_SET ) + || component.getComponentManagerPID().equals( StoreSchemaConstants.HUB_OC_COLL_ARRAY ) ) { DcConfiguration newConfiguration = new DcConfiguration( parentComponent.getConfiguration() ); Modified: directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/collection/CollectionMetaDescriptorGenerator.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/collection/CollectionMetaDescriptorGenerator.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/collection/CollectionMetaDescriptorGenerator.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/collection/CollectionMetaDescriptorGenerator.java Mon Jun 11 13:12:56 2012 @@ -70,7 +70,8 @@ public class CollectionMetaDescriptorGen ComponentConstants.PRIMITIVE_STR, Object.class.getName(), "Specifies collection's container type", true, false, DirectoryComponentConstants.DC_VAL_NULL ) }; - return new DcMetadataDescriptor( metaPid, true, metaVersion, className, implemented, extended, null, properties ); + return new DcMetadataDescriptor( metaPid, true, false, metaVersion, className, implemented, extended, null, + properties ); } @@ -88,7 +89,8 @@ public class CollectionMetaDescriptorGen ComponentConstants.PRIMITIVE_STR, Object.class.getName(), "Specifies collection's container type", true, false, DirectoryComponentConstants.DC_VAL_NULL ) }; - return new DcMetadataDescriptor( metaPid, true, metaVersion, className, implemented, extended, null, properties ); + return new DcMetadataDescriptor( metaPid, true, false, metaVersion, className, implemented, extended, null, + properties ); } @@ -104,7 +106,8 @@ public class CollectionMetaDescriptorGen ComponentConstants.PRIMITIVE_STR, Object.class.getName(), "Specifies collection's container type", true, false, DirectoryComponentConstants.DC_VAL_NULL ) }; - return new DcMetadataDescriptor( metaPid, true, metaVersion, className, implemented, extended, null, properties ); + return new DcMetadataDescriptor( metaPid, true, false, metaVersion, className, implemented, extended, null, + properties ); } } Modified: directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/store/StoreConfigManager.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/store/StoreConfigManager.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/store/StoreConfigManager.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/store/StoreConfigManager.java Mon Jun 11 13:12:56 2012 @@ -191,24 +191,29 @@ public class StoreConfigManager Entry mdEntry = new DefaultEntry( schemaManager, mdDn ); mdEntry.add( schemaManager.getAttributeType( "objectclass" ), "ads-meta-descriptor" ); - mdEntry.add( schemaManager.getAttributeType( "ads-meta-pid" ), metadata.getMetadataPID() ); - mdEntry.add( schemaManager.getAttributeType( "ads-meta-version" ), metadata.getMetaVersion().toString() ); - mdEntry.add( schemaManager.getAttributeType( "ads-meta-factory" ), ( metadata.isFactory() ) ? "TRUE" : "FALSE" ); - mdEntry.add( schemaManager.getAttributeType( "ads-meta-classname" ), metadata.getClassName() ); + mdEntry.add( schemaManager.getAttributeType( StoreSchemaConstants.HUB_AT_MD_PID ), metadata.getMetadataPID() ); + mdEntry.add( schemaManager.getAttributeType( StoreSchemaConstants.HUB_AT_MD_VERSION ), metadata + .getMetaVersion().toString() ); + mdEntry.add( schemaManager.getAttributeType( StoreSchemaConstants.HUB_AT_MD_FACTORY ), + ( metadata.isFactory() ) ? "TRUE" : "FALSE" ); + mdEntry.add( schemaManager.getAttributeType( StoreSchemaConstants.HUB_AT_MD_EXCLUSIVE ), + ( metadata.isExclusive() ) ? "TRUE" : "FALSE" ); + mdEntry.add( schemaManager.getAttributeType( StoreSchemaConstants.HUB_AT_MD_CLASSNAME ), + metadata.getClassName() ); for ( DcPropertyDescription pd : metadata.getPropertyDescriptons() ) { - mdEntry.add( schemaManager.getAttributeType( "ads-meta-property" ), pd.getName() ); + mdEntry.add( schemaManager.getAttributeType( StoreSchemaConstants.HUB_AT_MD_PROP ), pd.getName() ); } for ( String iface : metadata.getImplementedInterfaces() ) { - mdEntry.add( schemaManager.getAttributeType( "ads-meta-implements" ), iface ); + mdEntry.add( schemaManager.getAttributeType( StoreSchemaConstants.HUB_AT_MD_IMPLEMENTS ), iface ); } for ( String sclass : metadata.getExtendedClasses() ) { - mdEntry.add( schemaManager.getAttributeType( "ads-meta-extends" ), sclass ); + mdEntry.add( schemaManager.getAttributeType( StoreSchemaConstants.HUB_AT_MD_EXTENDS ), sclass ); } mdEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() ); @@ -379,7 +384,9 @@ public class StoreConfigManager continue; } - if ( component.getComponentManagerPID().startsWith( StoreSchemaConstants.HUB_OC_COLLECTION ) ) + if ( component.getComponentManagerPID().equals( StoreSchemaConstants.HUB_OC_COLL_LIST ) + || component.getComponentManagerPID().equals( StoreSchemaConstants.HUB_OC_COLL_SET ) + || component.getComponentManagerPID().equals( StoreSchemaConstants.HUB_OC_COLL_ARRAY ) ) { List items = getComponents( new Dn( schemaManager, component.getConfigLocation() ), SearchScope.ONELEVEL ); @@ -557,6 +564,7 @@ public class StoreConfigManager Attribute implemented = entry.get( schemaManager.getAttributeType( StoreSchemaConstants.HUB_AT_MD_IMPLEMENTS ) ); Attribute props = entry.get( schemaManager.getAttributeType( StoreSchemaConstants.HUB_AT_MD_PROP ) ); Attribute factory = entry.get( schemaManager.getAttributeType( StoreSchemaConstants.HUB_AT_MD_FACTORY ) ); + Attribute exclusive = entry.get( schemaManager.getAttributeType( StoreSchemaConstants.HUB_AT_MD_EXCLUSIVE ) ); try { @@ -592,8 +600,9 @@ public class StoreConfigManager } } boolean isFactory = Boolean.parseBoolean( factory.getString() ); + boolean isExclusive = Boolean.parseBoolean( exclusive.getString() ); - return new DcMetadataDescriptor( pid.getString(), isFactory, new Version( + return new DcMetadataDescriptor( pid.getString(), isFactory, isExclusive, new Version( version.getString() ), classname.getString(), implementedList.toArray( new String[0] ), extendedList.toArray( new String[0] ), null, pds.toArray( new DcPropertyDescription[0] ) ); Modified: directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/store/StoreSchemaConstants.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/store/StoreSchemaConstants.java?rev=1348830&r1=1348829&r2=1348830&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/store/StoreSchemaConstants.java (original) +++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/store/StoreSchemaConstants.java Mon Jun 11 13:12:56 2012 @@ -35,6 +35,7 @@ public class StoreSchemaConstants public static final String HUB_AT_MD_IMPLEMENTS = "ads-meta-implements"; public static final String HUB_AT_MD_EXTENDS = "ads-meta-extends"; public static final String HUB_AT_MD_FACTORY = "ads-meta-factory"; + public static final String HUB_AT_MD_EXCLUSIVE = "ads-meta-immutable"; public static final String HUB_AT_MD_PROP = "ads-meta-property"; public static final String HUB_AT_PD_NAME = "ads-pd-name"; @@ -46,11 +47,10 @@ public class StoreSchemaConstants public static final String HUB_AT_PD_CONTAINERFOR = "ads-pd-containerFor"; public static final String HUB_OC_COMPONENT = "ads-component"; - public static final String HUB_OC_COLLECTION = "ads-collection"; public static final String HUB_OC_COLLECTION_ITEM = "ads-collection-item"; - public static final String HUB_OC_COLL_LIST = "ads-collection-list"; - public static final String HUB_OC_COLL_SET = "ads-collection-set"; - public static final String HUB_OC_COLL_ARRAT = "ads-collection-array"; + public static final String HUB_OC_COLL_LIST = "ads-list"; + public static final String HUB_OC_COLL_SET = "ads-set"; + public static final String HUB_OC_COLL_ARRAY = "ads-array"; public static final String HUB_OC_METADESC = "ads-meta-descriptor"; public static final String HUB_OC_PROPERTYDESC = "ads-property-descriptor";