directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gokt...@apache.org
Subject svn commit: r1336671 [1/2] - in /directory/apacheds/branches/apacheds-osgi/hub/core: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/server/ src/main/j...
Date Thu, 10 May 2012 13:27:48 GMT
Author: gokturk
Date: Thu May 10 13:27:47 2012
New Revision: 1336671

URL: http://svn.apache.org/viewvc?rev=1336671&view=rev
Log:
ApacheDS ComponentHub implementation,

Provides facilities for,
* Connecting any OSGI compliant component framework to ApacheDS
* Providing an ability to describe complex and collection types as reference in ApacheDS
* Handles dependency and lifecycle of components


Added:
    directory/apacheds/branches/apacheds-osgi/hub/core/
    directory/apacheds/branches/apacheds-osgi/hub/core/pom.xml
    directory/apacheds/branches/apacheds-osgi/hub/core/src/
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/
    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/DependencyResolver.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/ParentLinkRegistry.java
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/configurator/
    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/configurator/EntryModifier.java
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/collection/
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/collection/CollectionConnector.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/connector/collection/CollectionOperations.java
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/meta/
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/meta/DCMetadataNormalizer.java
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/store/
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/store/ApacheDSConfigStore.java
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/store/OIDManager.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/StoreDCBuilder.java
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/store/StoreSchemaConstants.java
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/store/StoreSchemaManager.java
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/util/
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/util/DCDependency.java
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/util/DCDependencyType.java
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/util/ParentLink.java

Added: directory/apacheds/branches/apacheds-osgi/hub/core/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/core/pom.xml?rev=1336671&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/core/pom.xml (added)
+++ directory/apacheds/branches/apacheds-osgi/hub/core/pom.xml Thu May 10 13:27:47 2012
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.directory.server</groupId>
+    <artifactId>apacheds-hub</artifactId>    
+    <version>2.0.0-M7-SNAPSHOT</version>
+  </parent>
+  <artifactId>apacheds-hub-core</artifactId>
+  <name>Component Hub Core</name>
+  <description>Component Hub Core</description>
+  
+  <packaging>bundle</packaging>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-hub-api</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.shared</groupId>
+      <artifactId>shared-ldap-model</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-ldif-partition</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-core-api</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.shared</groupId>
+      <artifactId>shared-util</artifactId>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <inherited>true</inherited>
+        <extensions>true</extensions>
+        <configuration>
+          <manifestLocation>META-INF</manifestLocation>
+          <unpackBundle>true</unpackBundle>
+          <instructions>
+            <Bundle-SymbolicName>${project.groupId}.hub.core</Bundle-SymbolicName>
+            <Export-Package>
+                {local-packages};version=${project.version};-noimport:=true
+            </Export-Package>
+          </instructions>
+        </configuration>
+      </plugin>     
+    </plugins>
+  </build>
+  
+</project>

Added: 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=1336671&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java (added)
+++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java Thu May 10 13:27:47 2012
@@ -0,0 +1,809 @@
+package org.apache.directory.server.hub.core;
+
+
+import java.lang.reflect.Array;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.directory.server.hub.api.AbstractHubClient;
+import org.apache.directory.server.hub.api.ComponentHub;
+import org.apache.directory.server.hub.api.HubStore;
+import org.apache.directory.server.hub.api.component.DCConfiguration;
+import org.apache.directory.server.hub.api.component.DCProperty;
+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.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;
+import org.apache.directory.server.hub.api.meta.DCMetadataDescriptor;
+import org.apache.directory.server.hub.api.meta.DCOperationsManager;
+import org.apache.directory.server.hub.api.meta.DCPropertyDescription;
+import org.apache.directory.server.hub.api.meta.DCPropertyType;
+import org.apache.directory.server.hub.api.registry.DCMetadataRegistry;
+import org.apache.directory.server.hub.api.registry.DirectoryComponentRegistry;
+import org.apache.directory.server.hub.api.registry.InjectionRegistry;
+import org.apache.directory.server.hub.api.registry.PIDHandlerRegistry;
+import org.apache.directory.server.hub.core.connector.collection.CollectionConnector;
+import org.apache.directory.server.hub.core.meta.DCMetadataNormalizer;
+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;
+
+
+public class ComponentHubImpl implements ComponentHub
+{
+    // Registries
+    private DirectoryComponentRegistry componentsReg = new DirectoryComponentRegistry();
+    private DCMetadataRegistry metadatasReg = new DCMetadataRegistry();
+    private InjectionRegistry injectionsReg = new InjectionRegistry();
+    private PIDHandlerRegistry handlersReg = new PIDHandlerRegistry();
+    private ParentLinkRegistry parentLinksReg = new ParentLinkRegistry();
+
+    private CollectionConnector collectionConnector;
+
+    private HubStore store;
+
+    private HubClientManager clientManager = new HubClientManager( this );
+
+    private DependencyResolver dependencyResolver = new DependencyResolver();
+
+
+    public ComponentHubImpl( HubStore store )
+    {
+        this.store = store;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.hub.ComponentHub#init()
+     */
+    @Override
+    public void init() throws StoreNotValidException
+    {
+        store.init( this );
+
+        try
+        {
+            List<DCMetadataDescriptor> metadatas = store.getMetadataDescriptors();
+            metadatasReg.addMetadataDescriptor( metadatas );
+
+            List<DirectoryComponent> components = store.getComponents();
+            for ( DirectoryComponent component : components )
+            {
+                setInjectionProperties( metadatasReg.getMetadataDescriptor( component.getComponentManagerPID() ),
+                    component.getConfiguration() );
+                componentsReg.addDirectoryComponent( component );
+            }
+        }
+        catch ( HubStoreException e )
+        {
+            throw new StoreNotValidException( "HubStore is corrupted" );
+        }
+
+        collectionConnector = new CollectionConnector();
+        collectionConnector.init( this );
+
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.hub.ComponentHub#connectHandler(org.apache.directory.server.hub.component.meta.DCMetadataDescriptor, org.apache.directory.server.hub.component.meta.DCOperationsManager)
+     */
+    @Override
+    public void connectHandler( DCMetadataDescriptor metadata, DCOperationsManager operationsManager )
+        throws HubAbortException
+    {
+        DCMetadataDescriptor existingMetadata = metadatasReg.getMetadataDescriptor( metadata.getMetadataPID() );
+
+        DCMetadataNormalizer.normalizeDCMetadata( metadata );
+
+        if ( existingMetadata == null )
+        {
+
+            try
+            {
+                store.installMetadataDescriptor( metadata );
+
+                metadatasReg.addMetadataDescriptor( metadata );
+                handlersReg.setPIDHandler( metadata.getMetadataPID(), operationsManager );
+
+                return;
+            }
+            catch ( HubStoreException e )
+            {
+                throw new HubAbortException( "Store rejected metadata descriptor", e );
+            }
+        }
+
+        if ( !existingMetadata.compatibleWith( metadata ) )
+        {
+            try
+            {
+                /* 
+                 * Updating store with new metadata might cause existing components(Not instantiated yet!) to be updated.
+                 * Updates will be propagated to ComponentHub from Store.
+                 */
+                store.updateMetadataDescriptor( existingMetadata, metadata );
+            }
+            catch ( HubStoreException e )
+            {
+                throw new HubAbortException( "Store raised an error while updating metadata:"
+                    + metadata.getMetadataPID(), e );
+            }
+
+        }
+
+        /*
+         * This call will set metadata with constant properties.
+         * Stored metadata is kept until this point for new component configurations.
+         */
+        metadatasReg.addMetadataDescriptor( metadata );
+
+        handlersReg.setPIDHandler( metadata.getMetadataPID(), operationsManager );
+        activateHandler( metadata.getMetadataPID() );
+
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.hub.ComponentHub#disconnectHandler(java.lang.String)
+     */
+    @Override
+    public void disconnectHandler( String handlerPID )
+    {
+        DCMetadataDescriptor meta = metadatasReg.getMetadataDescriptor( handlerPID );
+        if ( meta != null )
+        {
+            deactivateHandler( handlerPID );
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.hub.ComponentHub#updateComponentName(org.apache.directory.server.hub.component.DirectoryComponent, java.lang.String)
+     */
+    @Override
+    public void updateComponentName( DirectoryComponent component, String newPID ) throws HubAbortException
+    {
+        List<ParentLink> parentLinks = parentLinksReg.getParentLinks( component );
+        if ( parentLinks != null )
+        {
+            throw new HubAbortException(
+                "You can't change name of component which is being referenced by other component" );
+        }
+
+        // Which also sets DC's new Name
+        componentsReg.changeComponentReference( component, newPID );
+
+        List<DirectoryComponent> waitingComponents = dependencyResolver
+            .getWaiting( new DCDependency( DCDependencyType.REFERENCE, component
+                .getComponentPID() ) );
+
+        if ( waitingComponents != null )
+        {
+            for ( DirectoryComponent dependent : waitingComponents )
+            {
+                instantiateComponent( dependent );
+            }
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.hub.ComponentHub#updateComponent(org.apache.directory.server.hub.component.DirectoryComponent, org.apache.directory.server.hub.component.DCConfiguration)
+     */
+    @Override
+    public void updateComponent( DirectoryComponent component, DCConfiguration newConfiguration )
+        throws HubAbortException
+    {
+        setInjectionProperties( metadatasReg.getMetadataDescriptor( component.getComponentManagerPID() ),
+            newConfiguration );
+
+        if ( component.getRuntimeInfo() != null )
+        {
+            try
+            {
+                validateConfiguration( component, newConfiguration );
+            }
+            catch ( BadConfigurationException e )
+            {
+                throw new HubAbortException(
+                    "Active DirectoryComponent can not be reconfigured with incorrect configuration", e );
+            }
+        }
+
+        if ( component.isDirty() )
+        {
+            try
+            {
+                store.updateComponent( component, newConfiguration );
+            }
+            catch ( HubStoreException e )
+            {
+                throw new HubAbortException( "HubStore error raised while updating:" + component.getComponentPID(), e );
+            }
+        }
+
+        component.setConfiguration( newConfiguration );
+
+        if ( component.getRuntimeInfo() != null )
+        {
+            reconfigureComponent( component );
+        }
+        else
+        {
+            if ( component.instantiationFailed() )
+            {
+                instantiateComponent( component );
+            }
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.hub.ComponentHub#addComponent(org.apache.directory.server.hub.component.DirectoryComponent)
+     */
+    @Override
+    public void addComponent( DirectoryComponent component ) throws HubAbortException
+    {
+        DirectoryComponent check = componentsReg.getComponentByReference( component.getComponentPID() );
+        if ( check != null )
+        {
+            throw new HubAbortException( "You can not have two component with same ID:"
+                + component.getComponentPID() );
+        }
+
+        setInjectionProperties( metadatasReg.getMetadataDescriptor( component.getComponentManagerPID() ),
+            component.getConfiguration() );
+
+        if ( component.isDirty() )
+        {
+            try
+            {
+                store.installComponent( component );
+            }
+            catch ( HubStoreException e )
+            {
+                throw new HubAbortException( "Component couldn't be added to store, discarding...", e );
+            }
+        }
+
+        componentsReg.addDirectoryComponent( component );
+
+        instantiateComponent( component );
+
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.hub.ComponentHub#removeComponent(org.apache.directory.server.hub.component.DirectoryComponent)
+     */
+    @Override
+    public void removeComponent( DirectoryComponent component ) throws HubAbortException
+    {
+        clientManager.fireDCRemoving( component );
+
+        if ( component.isDirty() )
+        {
+            try
+            {
+                store.uninstallComponent( component );
+            }
+            catch ( HubStoreException e )
+            {
+                throw new HubAbortException( "Component couldn't be removed from store, it is still active.", e );
+            }
+        }
+
+        handleComponentRemoval( component );
+
+        componentsReg.removeDirectoryComponent( component );
+
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.hub.ComponentHub#addInjection(java.lang.String, java.lang.Object)
+     */
+    @Override
+    public void addInjection( String injectionType, Object injection )
+    {
+        injectionsReg.addInjection( injectionType, injection );
+
+        List<DirectoryComponent> waitingComponents = dependencyResolver.getWaiting( new DCDependency(
+            DCDependencyType.INJECTION, injectionType ) );
+
+        if ( waitingComponents != null )
+        {
+            for ( DirectoryComponent component : waitingComponents )
+            {
+                instantiateComponent( component );
+            }
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.hub.ComponentHub#removeInjection(java.lang.String)
+     */
+    @Override
+    public void removeInjection( String injectionType )
+    {
+        injectionsReg.removeInjection( injectionType );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.hub.ComponentHub#registerClient(org.apache.directory.server.hub.client.AbstractHubClient, java.lang.String)
+     */
+    @Override
+    public void registerClient( AbstractHubClient hubClient, String type )
+    {
+        clientManager.registerHubClient( hubClient, type );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.hub.ComponentHub#unregisterClient(org.apache.directory.server.hub.client.AbstractHubClient, java.lang.String)
+     */
+    @Override
+    public void unregisterClient( AbstractHubClient hubClient, String type )
+    {
+        clientManager.unregisterHubClient( hubClient, type );
+    }
+
+
+    private void activateHandler( String pid )
+    {
+        Collection<DirectoryComponent> components = componentsReg.getComponents( pid );
+
+        if ( components != null )
+        {
+            for ( DirectoryComponent component : components )
+            {
+                instantiateComponent( component );
+            }
+        }
+    }
+
+
+    private void deactivateHandler( String pid )
+    {
+        List<DirectoryComponent> attachedComponents = componentsReg.getComponents( pid );
+
+        if ( attachedComponents != null )
+        {
+            for ( DirectoryComponent component : attachedComponents )
+            {
+                disposeComponent( component );
+            }
+        }
+    }
+
+
+    private void setInjectionProperties( DCMetadataDescriptor metadata, DCConfiguration configuration )
+    {
+
+        for ( DCPropertyDescription pd : metadata.getPropertyDescriptons() )
+        {
+            if ( pd.getPropertyContext() == DCPropertyType.INJECTION )
+            {
+                if ( pd.isMandatory() )
+                {
+                    configuration.addProperty( new DCProperty( pd.getName(), null ) );
+                }
+            }
+        }
+    }
+
+
+    private void validateConfiguration( DirectoryComponent component, DCConfiguration configuration )
+        throws BadConfigurationException
+    {
+        DCMetadataDescriptor metadata = metadatasReg.getMetadataDescriptor( component.getComponentManagerPID() );
+
+        for ( DCProperty property : configuration )
+        {
+            String propertyName = property.getName();
+            String propertyValue = property.getValue();
+
+            DCPropertyDescription pd = metadata.getPropertyDescription( propertyName );
+
+            if ( pd == null )
+            {
+                continue;
+            }
+
+            switch ( pd.getPropertyContext() )
+            {
+                case CONSTANT:
+                case PRIMITIVE:
+                case PRIMITIVE_COLLECTION:
+                    break;
+
+                case REFERENCE:
+                case COLLECTION:
+
+                    if ( propertyValue.equals( DirectoryComponentConstants.DC_VAL_NULL ) )
+                    {
+                        break;
+                    }
+
+                    DirectoryComponent reference = componentsReg.getComponentByReference( propertyValue );
+
+                    if ( reference == null || reference.getRuntimeInfo() == null )
+                    {
+                        throw new BadConfigurationException( "Component:" + component.getComponentPID()
+                            + " is lacking property:" + propertyName );
+                    }
+
+                    DCMetadataDescriptor referenceMetadata = metadatasReg.getMetadataDescriptor( reference
+                        .getComponentManagerPID() );
+
+                    // Means iterating property is a collection item, we should match type with container type.
+                    if ( metadata.is( Collection.class.getName() ) )
+                    {
+                        DCProperty containerProp = null;
+
+                        if ( metadata.is( List.class.getName() ) )
+                        {
+                            containerProp = component.getConfiguration().getProperty(
+                                DirectoryComponentConstants.DC_LIST_PROP_TYPE );
+                        }
+                        else if ( metadata.is( Set.class.getName() ) )
+                        {
+                            containerProp = component.getConfiguration().getProperty(
+                                DirectoryComponentConstants.DC_SET_PROP_TYPE );
+                        }
+                        else if ( metadata.is( Array.class.getName() ) )
+                        {
+                            containerProp = component.getConfiguration().getProperty(
+                                DirectoryComponentConstants.DC_ARRAY_PROP_TYPE );
+                        }
+                        else
+                        {
+                            throw new BadConfigurationException( "Wrong collection metadata for :"
+                                + metadata.getMetadataPID() );
+                        }
+
+                        if ( !referenceMetadata.is( containerProp.getValue() ) )
+                        {
+                            throw new BadConfigurationException( "Collection item:" + reference.getComponentPID()
+                                + " is not compatible with collection" );
+                        }
+                    }
+                    else
+                    {
+                        if ( !referenceMetadata.is( pd.getType() ) )
+                        {
+                            throw new BadConfigurationException( "Component property:"
+                                + reference.getComponentPID()
+                                + " is not compatible with declared property type" );
+                        }
+                    }
+
+                    break;
+
+                case INJECTION:
+
+                    Object injection = injectionsReg.getInjection( pd.getType() );
+                    if ( injection == null )
+                    {
+                        throw new BadConfigurationException( "Component:" + component.getComponentPID()
+                            + " is lacking property:" + propertyName );
+                    }
+            }
+        }
+    }
+
+
+    /**
+     * Process the configuration supplied or component's own configuration.
+     *
+     * @param component
+     * @param configuration
+     */
+    private void processConfiguration( DirectoryComponent component ) throws BadConfigurationException
+    {
+        parentLinksReg.destroyComponentLinks( component );
+        DCMetadataDescriptor metadata = metadatasReg.getMetadataDescriptor( component.getComponentManagerPID() );
+
+        // Loading meta-constant properties into component
+        for ( DCPropertyDescription pd : metadata.getPropertyDescriptons() )
+        {
+            if ( pd.getPropertyContext() == DCPropertyType.CONSTANT )
+            {
+                component.getConfiguration().addProperty( new DCProperty( pd.getName(), pd.getDefaultValue() ) );
+            }
+        }
+
+        for ( DCProperty property : component.getConfiguration() )
+        {
+            String propertyName = property.getName();
+            String propertyValue = property.getValue();
+
+            DCPropertyDescription pd = metadata.getPropertyDescription( propertyName );
+
+            if ( pd == null )
+            {
+                property.setObject( property.getValue() );
+                continue;
+            }
+
+            if ( pd.getPropertyContext() == DCPropertyType.CONSTANT )
+            {
+                property.setObject( propertyValue );
+                continue;
+            }
+
+            switch ( pd.getPropertyContext() )
+            {
+                case CONSTANT:
+                case PRIMITIVE:
+                case PRIMITIVE_COLLECTION:
+
+                    property.setObject( propertyValue );
+                    break;
+
+                case REFERENCE:
+                case COLLECTION:
+
+                    if ( propertyValue.equals( DirectoryComponentConstants.DC_VAL_NULL ) )
+                    {
+                        property.setObject( null );
+                        break;
+                    }
+
+                    DirectoryComponent reference = componentsReg.getComponentByReference( propertyValue );
+
+                    if ( reference == null || reference.getRuntimeInfo() == null )
+                    {
+                        dependencyResolver.addDependencyHook( component, new DCDependency( DCDependencyType.REFERENCE,
+                            propertyValue ) );
+
+                        throw new BadConfigurationException( "Component:" + component.getComponentPID()
+                            + " is lacking property:" + propertyName );
+                    }
+
+                    DCMetadataDescriptor referenceMetadata = metadatasReg.getMetadataDescriptor( reference
+                        .getComponentManagerPID() );
+
+                    // Means iterating property is a collection item, we should match type with container type.
+                    if ( metadata.is( Collection.class.getName() ) )
+                    {
+                        DCProperty containerProp = null;
+
+                        if ( metadata.is( List.class.getName() ) )
+                        {
+                            containerProp = component.getConfiguration().getProperty(
+                                DirectoryComponentConstants.DC_LIST_PROP_TYPE );
+                        }
+                        else if ( metadata.is( Set.class.getName() ) )
+                        {
+                            containerProp = component.getConfiguration().getProperty(
+                                DirectoryComponentConstants.DC_SET_PROP_TYPE );
+                        }
+                        else if ( metadata.is( Array.class.getName() ) )
+                        {
+                            containerProp = component.getConfiguration().getProperty(
+                                DirectoryComponentConstants.DC_ARRAY_PROP_TYPE );
+                        }
+                        else
+                        {
+                            throw new BadConfigurationException( "Wrong collection metadata for :"
+                                + metadata.getMetadataPID() );
+                        }
+
+                        if ( !referenceMetadata.is( containerProp.getValue() ) )
+                        {
+                            throw new BadConfigurationException( "Collection item:" + reference.getComponentPID()
+                                + " is not compatible with collection" );
+                        }
+
+                        property.setObject( reference );
+                    }
+                    else
+                    {
+                        if ( !referenceMetadata.is( pd.getType() ) )
+                        {
+                            throw new BadConfigurationException( "Component property:"
+                                + reference.getComponentPID()
+                                + " is not compatible with declared property type" );
+                        }
+
+                        property.setObject( reference.getRuntimeInfo().getPojo() );
+                    }
+
+                    parentLinksReg.addParentLink( reference, new ParentLink( component, propertyName ) );
+
+                    break;
+
+                case INJECTION:
+
+                    Object injection = injectionsReg.getInjection( pd.getType() );
+                    if ( injection == null )
+                    {
+                        dependencyResolver.addDependencyHook( component, new DCDependency( DCDependencyType.INJECTION,
+                            pd.getType() ) );
+                        throw new BadConfigurationException( "Component:" + component.getComponentPID()
+                            + " is lacking property:" + propertyName );
+                    }
+            }
+        }
+    }
+
+
+    private void instantiateComponent( DirectoryComponent component )
+    {
+        DCOperationsManager opManager = handlersReg.getPIDHandler( component.getComponentManagerPID() );
+        if ( opManager == null )
+        {
+            return;
+        }
+
+        try
+        {
+            processConfiguration( component );
+            opManager.instantiateComponent( component );
+
+            component.setFailFlag( false );
+            clientManager.fireDCActivated( component );
+
+            List<DirectoryComponent> waitingComponents = dependencyResolver
+                .getWaiting( new DCDependency( DCDependencyType.REFERENCE, component
+                    .getComponentPID() ) );
+
+            if ( waitingComponents != null )
+            {
+                for ( DirectoryComponent dependent : waitingComponents )
+                {
+                    instantiateComponent( dependent );
+                }
+            }
+
+        }
+        catch ( ComponentInstantiationException e )
+        {
+            component.setFailFlag( true );
+        }
+        catch ( BadConfigurationException e )
+        {
+            component.setFailFlag( true );
+        }
+    }
+
+
+    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<ParentLink> 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 );
+
+        List<ParentLink> parents = parentLinksReg.getParentLinks( component );
+        if ( parents != null )
+        {
+            for ( ParentLink parentLink : parents )
+            {
+                dependencyResolver.addDependencyHook( parentLink.getParent(),
+                    new DCDependency( DCDependencyType.REFERENCE, component.getComponentPID() ) );
+                disposeComponent( parentLink.getParent() );
+            }
+        }
+
+        DCOperationsManager opManager = handlersReg.getPIDHandler( component.getComponentManagerPID() );
+        if ( opManager != null )
+        {
+            opManager.disposeComponent( component );
+        }
+
+        component.setRuntimeInfo( null );
+    }
+
+
+    private void handleComponentRemoval( DirectoryComponent component )
+    {
+        List<ParentLink> parents = parentLinksReg.getParentLinks( component );
+        if ( parents != null )
+        {
+            for ( ParentLink parentLink : parents )
+            {
+                DCProperty refProperty = parentLink.getParent().getConfiguration()
+                    .getProperty( parentLink.getLinkPoint() );
+                refProperty.setValue( "null" );
+
+                reconfigureComponent( component );
+            }
+        }
+
+        DCOperationsManager opManager = handlersReg.getPIDHandler( component.getComponentManagerPID() );
+        if ( opManager != null )
+        {
+            opManager.disposeComponent( component );
+        }
+
+        component.setRuntimeInfo( null );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.hub.ComponentHub#getDCRegistry()
+     */
+    @Override
+    public DirectoryComponentRegistry getDCRegistry()
+    {
+        return componentsReg;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.hub.ComponentHub#getMetaRegistry()
+     */
+    @Override
+    public DCMetadataRegistry getMetaRegistry()
+    {
+        return metadatasReg;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.hub.ComponentHub#getInjectionRegistry()
+     */
+    @Override
+    public InjectionRegistry getInjectionRegistry()
+    {
+        return injectionsReg;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.hub.ComponentHub#getPIDHandlerRegistry()
+     */
+    @Override
+    public PIDHandlerRegistry getPIDHandlerRegistry()
+    {
+        return handlersReg;
+    }
+}

Added: directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/DependencyResolver.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/DependencyResolver.java?rev=1336671&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/DependencyResolver.java (added)
+++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/DependencyResolver.java Thu May 10 13:27:47 2012
@@ -0,0 +1,48 @@
+package org.apache.directory.server.hub.core;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.List;
+
+import org.apache.commons.collections.MultiMap;
+import org.apache.commons.collections.map.MultiValueMap;
+import org.apache.directory.server.hub.api.component.DirectoryComponent;
+import org.apache.directory.server.hub.core.util.DCDependency;
+
+
+public class DependencyResolver
+{
+    private Hashtable<DirectoryComponent, DCDependency> dependencyMap = new Hashtable();
+    private MultiMap componentMap = new MultiValueMap();
+
+
+    public void addDependencyHook( DirectoryComponent component, DCDependency dependency )
+    {
+        dependencyMap.put( component, dependency );
+        componentMap.put( dependency, component );
+    }
+
+
+    public void clearDependencyHooks( DirectoryComponent component )
+    {
+        DCDependency dep = dependencyMap.remove( component );
+        componentMap.remove( dep, component );
+    }
+
+
+    public List<DirectoryComponent> getWaiting( DCDependency dependency )
+    {
+        Collection<DirectoryComponent> waiting = ( Collection<DirectoryComponent> ) componentMap.remove( dependency );
+
+        if ( waiting != null )
+        {
+            return new ArrayList<DirectoryComponent>( waiting );
+        }
+        else
+        {
+            return null;
+        }
+    }
+}

Added: 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=1336671&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/HubClientManager.java (added)
+++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/HubClientManager.java Thu May 10 13:27:47 2012
@@ -0,0 +1,137 @@
+package org.apache.directory.server.hub.core;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.collections.MultiMap;
+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.DirectoryComponent;
+import org.apache.directory.server.hub.api.exception.HubAbortException;
+import org.apache.directory.server.hub.api.meta.DCMetadataDescriptor;
+
+
+public class HubClientManager
+{
+    private ComponentHub hub;
+
+    private MultiMap typeRegistrations = new MultiValueMap();
+    private MultiMap clientRegistrations = new MultiValueMap();
+
+
+    public synchronized void registerHubClient( AbstractHubClient hubClient, String type )
+    {
+        typeRegistrations.put( type, hubClient );
+        clientRegistrations.put( hubClient, type );
+
+        List<DirectoryComponent> existing = hub.getDCRegistry().getComponents();
+        if ( existing == null )
+        {
+            return;
+        }
+
+        for ( DirectoryComponent component : existing )
+        {
+            DCMetadataDescriptor metadata = hub.getMetaRegistry().getMetadataDescriptor(
+                component.getComponentManagerPID() );
+            if ( metadata.is( type ) )
+            {
+                if ( component.getRuntimeInfo() != null )
+                {
+                    hubClient.componentActivated( component );
+                }
+            }
+        }
+    }
+
+
+    public void unregisterHubClient( AbstractHubClient hubClient, String type )
+    {
+        if ( type == null )
+        {
+            Collection<String> registeredTypes = ( Collection ) clientRegistrations.remove( hubClient );
+            if ( registeredTypes != null )
+            {
+                for ( String reg : registeredTypes )
+                {
+                    typeRegistrations.remove( reg, hubClient );
+                }
+            }
+        }
+        else
+        {
+            typeRegistrations.remove( type, hubClient );
+            clientRegistrations.remove( hubClient, type );
+        }
+    }
+
+
+    public HubClientManager( ComponentHub hub )
+    {
+        this.hub = hub;
+    }
+
+
+    public synchronized void fireDCActivated( DirectoryComponent component )
+    {
+        List<AbstractHubClient> clients = getRegisteredClients( component );
+        for ( AbstractHubClient client : clients )
+        {
+            client.componentActivated( component );
+        }
+    }
+
+
+    public void fireDCDeactivating( DirectoryComponent component )
+    {
+        List<AbstractHubClient> clients = getRegisteredClients( component );
+        for ( AbstractHubClient client : clients )
+        {
+            client.componentDeactivating( component );
+        }
+    }
+
+
+    public void fireDCRemoving( DirectoryComponent component ) throws HubAbortException
+    {
+        List<AbstractHubClient> clients = getRegisteredClients( component );
+        for ( AbstractHubClient client : clients )
+        {
+            client.componentRemoving( component );
+        }
+    }
+
+
+    public void fireDCReconfigured( DirectoryComponent component )
+    {
+        List<AbstractHubClient> clients = getRegisteredClients( component );
+        for ( AbstractHubClient client : clients )
+        {
+            client.componentReconfigured( component );
+        }
+    }
+
+
+    public List<AbstractHubClient> getRegisteredClients( DirectoryComponent component )
+    {
+        List<AbstractHubClient> registeredClients = new ArrayList<AbstractHubClient>();
+
+        DCMetadataDescriptor metadata = hub.getMetaRegistry()
+            .getMetadataDescriptor( component.getComponentManagerPID() );
+
+        Set<String> registeredTypes = typeRegistrations.keySet();
+        for ( String type : registeredTypes )
+        {
+            if ( metadata.is( type ) )
+            {
+                registeredClients.addAll( ( Collection ) typeRegistrations.get( type ) );
+            }
+        }
+
+        return registeredClients;
+    }
+}

Added: directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ParentLinkRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ParentLinkRegistry.java?rev=1336671&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ParentLinkRegistry.java (added)
+++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ParentLinkRegistry.java Thu May 10 13:27:47 2012
@@ -0,0 +1,58 @@
+package org.apache.directory.server.hub.core;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.commons.collections.MultiMap;
+import org.apache.commons.collections.map.MultiValueMap;
+import org.apache.directory.server.hub.api.component.DirectoryComponent;
+import org.apache.directory.server.hub.core.util.ParentLink;
+
+
+public class ParentLinkRegistry
+{
+    private MultiMap parentLinks = new MultiValueMap();
+    private MultiMap childLinks = new MultiValueMap();
+
+
+    public void addParentLink( DirectoryComponent component, ParentLink link )
+    {
+        parentLinks.put( component, link );
+        childLinks.put( link.getParent(), component );
+    }
+
+
+    public List<ParentLink> getParentLinks( DirectoryComponent component )
+    {
+        Collection<ParentLink> parents = ( Collection<ParentLink> ) parentLinks.get( component );
+        if ( parents != null )
+        {
+            return new ArrayList<ParentLink>( parents );
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * Destroy any links pointing to given component
+     *
+     * @param component
+     */
+    public void destroyComponentLinks( DirectoryComponent component )
+    {
+        Collection<DirectoryComponent> childs = ( Collection ) childLinks.remove( component );
+        
+        if ( childs != null )
+        {
+            for ( DirectoryComponent child : childs )
+            {
+                parentLinks.remove( child, component );
+            }
+        }
+    }
+}

Added: 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=1336671&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/configurator/ConfiguratorInterceptor.java (added)
+++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/configurator/ConfiguratorInterceptor.java Thu May 10 13:27:47 2012
@@ -0,0 +1,305 @@
+package org.apache.directory.server.hub.core.configurator;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.InterceptorEnum;
+import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
+import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
+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.hub.api.ComponentHub;
+import org.apache.directory.server.hub.api.HubConnector;
+import org.apache.directory.server.hub.api.component.DCConfiguration;
+import org.apache.directory.server.hub.api.component.DCProperty;
+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.exception.HubAbortException;
+import org.apache.directory.server.hub.core.store.StoreDCBuilder;
+import org.apache.directory.server.hub.core.store.StoreSchemaConstants;
+import org.apache.directory.shared.ldap.model.entry.Attribute;
+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.Value;
+import org.apache.directory.shared.ldap.model.exception.LdapException;
+import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
+import org.apache.directory.shared.ldap.model.name.Dn;
+
+
+public class ConfiguratorInterceptor extends BaseInterceptor implements HubConnector
+{
+    private ComponentHub hub;
+    private StoreDCBuilder dcBuilder;
+
+
+    public ConfiguratorInterceptor()
+    {
+        super( InterceptorEnum.CONFIGURATOR_INTERCEPTOR );
+    }
+
+
+    /**
+     * Initialize the event interceptor. It creates a pool of executor which will be used
+     * to call the listeners in separate threads.
+     */
+    public void init( DirectoryService directoryService ) throws LdapException
+    {
+        super.init( directoryService );
+
+        dcBuilder = new StoreDCBuilder( directoryService.getSchemaManager() );
+    }
+
+
+    public void add( final AddOperationContext addContext ) throws LdapException
+    {
+        if ( !isConfigurationOperation( addContext ) || !isHubEntry( addContext.getEntry() ) )
+        {
+            next( addContext );
+            return;
+        }
+
+        DirectoryComponent component = dcBuilder.buildComponentFromEntry( addContext.getEntry() );
+
+        //Coming from store already.
+        component.setDirty( false );
+
+        try
+        {
+            hub.addComponent( component );
+
+            // If newly added component is a component item, its collection must be updated.
+            if ( component.getConfiguration().getCollectionIndex() != null )
+            {
+                Dn parentDn = new Dn( component.getConfigLocation() );
+                parentDn = parentDn.getParent();
+
+                DirectoryComponent parentComponent = hub.getDCRegistry().getComponentByLocation( parentDn.toString() );
+                if ( parentComponent.getComponentManagerPID().startsWith( StoreSchemaConstants.HUB_OC_COLLECTION ) )
+                {
+                    DCConfiguration newConfiguration = new DCConfiguration( parentComponent.getConfiguration() );
+
+                    String itemID = DirectoryComponentConstants.DC_PROP_ITEM_PREFIX
+                        + component.getComponentPID();
+
+                    newConfiguration.addProperty(
+                        new DCProperty( itemID, component.getComponentPID() ) );
+
+                    try
+                    {
+                        hub.updateComponent( parentComponent, newConfiguration );
+                    }
+                    catch ( HubAbortException e )
+                    {
+                        /*
+                         * If reconfiguration caused hub abort, it shouldn't prevent item entry to be removed,
+                         * because it has already been added to ComponentHub without error.
+                         */
+                    }
+
+                }
+            }
+        }
+        catch ( HubAbortException e )
+        {
+            throw new LdapException( e );
+        }
+
+        next( addContext );
+    }
+
+
+    public void delete( final DeleteOperationContext deleteContext ) throws LdapException
+    {
+        if ( !isConfigurationOperation( deleteContext ) || !isHubEntry( deleteContext.getEntry() ) )
+        {
+            next( deleteContext );
+            return;
+        }
+
+        String componentLocation = deleteContext.getDn().getNormName();
+        DirectoryComponent component = hub.getDCRegistry().getComponentByLocation( componentLocation );
+
+        if ( component != null )
+        {
+            try
+            {
+                // It is already deleting from store.
+                component.setDirty( false );
+
+                hub.removeComponent( component );
+            }
+            catch ( HubAbortException e )
+            {
+                throw new LdapException( e );
+            }
+        }
+
+        next( deleteContext );
+    }
+
+
+    public void modify( final ModifyOperationContext modifyContext ) throws LdapException
+    {
+        if ( !isConfigurationOperation( modifyContext ) || !isHubEntry( modifyContext.getEntry() ) )
+        {
+            next( modifyContext );
+            return;
+        }
+
+        String location = modifyContext.getDn().getNormName();
+        DirectoryComponent component = hub.getDCRegistry().getComponentByLocation( location );
+
+        if ( component == null )
+        {
+            next( modifyContext );
+            return;
+        }
+
+        List<Modification> mods = new ArrayList<Modification>( modifyContext.getModItems() );
+
+        // Detect name change request first.
+        for ( Modification mod : mods )
+        {
+            if ( mod.getAttribute().getUpId().equals( StoreSchemaConstants.HUB_AT_COMPONENT_NAME ) )
+            {
+                mods.remove( mod );
+
+                try
+                {
+                    hub.updateComponentName( component, mod.getAttribute().getString() );
+                }
+                catch ( HubAbortException e )
+                {
+                    throw new LdapException( e );
+                }
+            }
+        }
+
+        if ( mods.size() > 0 )
+        {
+            Entry modifiedEntry = EntryModifier.generateEntryWithMods( modifyContext.getEntry(),
+                modifyContext.getModItems() );
+            DirectoryComponent newComponent = dcBuilder.buildComponentFromEntry( modifiedEntry );
+
+            DCConfiguration newConfiguration = newComponent.getConfiguration();
+
+            try
+            {
+                hub.updateComponent( component, newConfiguration );
+            }
+            catch ( HubAbortException e )
+            {
+                throw new LdapException( e );
+            }
+        }
+
+        next( modifyContext );
+    }
+
+
+    public void move( MoveOperationContext moveContext ) throws LdapException
+    {
+        // TODO: implement
+        /*if ( !isConfigurationOperation( moveContext ) || !isHubEntry( moveContext.getEntry() ) )
+        {
+            next( moveContext );
+            return;
+        }*/
+
+        next( moveContext );
+    }
+
+
+    public void moveAndRename( final MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
+    {
+        // TODO: implement
+        /*if ( !isConfigurationOperation( moveAndRenameContext ) || !isHubEntry( moveAndRenameContext.getEntry() ) )
+        {
+            next( moveAndRenameContext );
+            return;
+        }*/
+        next( moveAndRenameContext );
+    }
+
+
+    public void rename( RenameOperationContext renameContext ) throws LdapException
+    {
+        if ( !isConfigurationOperation( renameContext ) || !isHubEntry( renameContext.getEntry() ) )
+        {
+            next( renameContext );
+            return;
+        }
+        String oldLocation = renameContext.getDn().getNormName();
+        DirectoryComponent component = hub.getDCRegistry().getComponentByLocation( oldLocation );
+        if ( component != null )
+        {
+            if ( oldLocation.contains( StoreSchemaConstants.HUB_AT_COMPONENT_NAME ) )
+            {
+                /*
+                 * Dn is constructed with ads-instance attribute,
+                 * component's PID is also changing.
+                 */
+
+                String newName = renameContext.getNewDn().getRdn().getNormValue().getString();
+                try
+                {
+                    hub.updateComponentName( component, newName );
+                }
+                catch ( HubAbortException e )
+                {
+                    throw new LdapException( e );
+                }
+            }
+
+            String newLocation = renameContext.getNewDn().getNormName();
+            hub.getDCRegistry().changeComponentLocation( component, newLocation );
+
+        }
+
+        next( renameContext );
+    }
+
+
+    public boolean isConfigurationOperation( OperationContext operation )
+    {
+        try
+        {
+            Dn targetDn = new Dn( operation.getDn().getNormName() );
+
+            return targetDn.isDescendantOf( new Dn( "ou=config" ) );
+        }
+        catch ( LdapInvalidDnException e )
+        {
+            return false;
+        }
+    }
+
+
+    public boolean isHubEntry( Entry entry )
+    {
+        Attribute ocAttrib = entry.get( schemaManager.getAttributeType( "objectclass" ) );
+        for ( Value<?> val : ocAttrib )
+        {
+            String ocName = val.getString();
+            if ( ocName.equals( StoreSchemaConstants.HUB_OC_COMPONENT ) )
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+
+    @Override
+    public void init( ComponentHub hub )
+    {
+        this.hub = hub;
+    }
+}

Added: directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/configurator/EntryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/configurator/EntryModifier.java?rev=1336671&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/configurator/EntryModifier.java (added)
+++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/configurator/EntryModifier.java Thu May 10 13:27:47 2012
@@ -0,0 +1,127 @@
+package org.apache.directory.server.hub.core.configurator;
+
+
+import java.util.List;
+
+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.Entry;
+import org.apache.directory.shared.ldap.model.entry.Modification;
+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.schema.AttributeType;
+
+
+public class EntryModifier
+{
+    public static Entry generateEntryWithMods( Entry currentEntry, List<Modification> mods )
+        throws LdapException
+    {
+        // The first step is to check that the modifications are valid :
+        // - the ATs are present in the schema
+        // - The value is syntaxically correct
+        //
+        // While doing that, we will apply the modification to a copy of the current entry
+        Entry tempEntry = currentEntry.clone();
+
+        // Now, apply each mod one by one
+        for ( Modification mod : mods )
+        {
+            Attribute attribute = mod.getAttribute();
+            AttributeType attributeType = attribute.getAttributeType();
+
+            switch ( mod.getOperation() )
+            {
+                case ADD_ATTRIBUTE:
+                    Attribute currentAttribute = tempEntry.get( attributeType );
+
+                    if ( currentAttribute != null )
+                    {
+                        for ( Value<?> value : attribute )
+                        {
+                            currentAttribute.add( value );
+                        }
+                    }
+                    else
+                    {
+                        Attribute newAttribute = attribute.clone();
+                        tempEntry.put( newAttribute );
+                    }
+
+                    break;
+
+                case REMOVE_ATTRIBUTE:
+
+                    if ( attribute.size() == 0 )
+                    {
+                        tempEntry.removeAttributes( attributeType );
+                    }
+                    else
+                    {
+                        currentAttribute = tempEntry.get( attributeType );
+
+                        for ( Value<?> value : attribute )
+                        {
+                            currentAttribute.remove( value );
+                        }
+
+                        if ( currentAttribute.size() == 0 )
+                        {
+                            tempEntry.removeAttributes( attributeType );
+                        }
+                    }
+
+                    break;
+
+                case REPLACE_ATTRIBUTE:
+                    if ( !tempEntry.containsAttribute( attributeType ) )
+                    {
+                        if ( attribute.size() == 0 )
+                        {
+                            break;
+                        }
+                        else
+                        {
+                            Attribute newAttribute = createNewAttribute( attribute );
+
+                            tempEntry.put( newAttribute );
+                        }
+                    }
+                    else
+                    {
+                        if ( attribute.size() == 0 )
+                        {
+                            tempEntry.removeAttributes( attributeType );
+                        }
+                        else
+                        {
+                            tempEntry.removeAttributes( attributeType );
+
+                            Attribute newAttribute = createNewAttribute( attribute );
+
+                            tempEntry.put( newAttribute );
+                        }
+                    }
+
+                    break;
+            }
+        }
+
+        return tempEntry;
+    }
+
+
+    private static Attribute createNewAttribute( Attribute attribute ) throws LdapException
+    {
+        AttributeType attributeType = attribute.getAttributeType();
+
+        Attribute newAttribute = new DefaultAttribute( attribute.getUpId(), attributeType );
+
+        for ( Value<?> value : attribute )
+        {
+            newAttribute.add( value );
+        }
+
+        return newAttribute;
+    }
+}

Added: directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/collection/CollectionConnector.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/CollectionConnector.java?rev=1336671&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/collection/CollectionConnector.java (added)
+++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/collection/CollectionConnector.java Thu May 10 13:27:47 2012
@@ -0,0 +1,45 @@
+package org.apache.directory.server.hub.core.connector.collection;
+
+
+import org.apache.directory.server.hub.api.ComponentHub;
+import org.apache.directory.server.hub.api.HubConnector;
+import org.apache.directory.server.hub.api.exception.HubAbortException;
+import org.apache.directory.server.hub.api.meta.DCPropertyDescription;
+import org.apache.directory.server.hub.api.meta.DCPropertyType;
+
+
+public class CollectionConnector implements HubConnector
+{
+    public enum CollectionType
+    {
+        LIST,
+        ARRAY,
+        SET
+    }
+
+
+    @Override
+    public void init( ComponentHub hub )
+    {
+        try
+        {
+            hub.connectHandler(
+                CollectionMetaDescriptorGenerator.generateMetadataDescriptor( CollectionType.LIST ),
+                new CollectionOperations( CollectionType.LIST ) );
+
+            hub.connectHandler(
+                CollectionMetaDescriptorGenerator.generateMetadataDescriptor( CollectionType.ARRAY ),
+                new CollectionOperations( CollectionType.ARRAY ) );
+
+            hub.connectHandler(
+                CollectionMetaDescriptorGenerator.generateMetadataDescriptor( CollectionType.SET ),
+                new CollectionOperations( CollectionType.SET ) );
+        }
+        catch ( HubAbortException e )
+        {
+            //TODO Log error
+        }
+
+    }
+
+}

Added: 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=1336671&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/collection/CollectionMetaDescriptorGenerator.java (added)
+++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/collection/CollectionMetaDescriptorGenerator.java Thu May 10 13:27:47 2012
@@ -0,0 +1,90 @@
+package org.apache.directory.server.hub.core.connector.collection;
+
+
+import java.lang.reflect.Array;
+import java.util.AbstractList;
+import java.util.AbstractSet;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.directory.server.hub.api.component.DirectoryComponentConstants;
+import org.apache.directory.server.hub.api.component.util.ComponentConstants;
+import org.apache.directory.server.hub.api.meta.DCMetadataDescriptor;
+import org.apache.directory.server.hub.api.meta.DCPropertyDescription;
+import org.apache.directory.server.hub.core.connector.collection.CollectionConnector.CollectionType;
+import org.osgi.framework.Version;
+
+
+public class CollectionMetaDescriptorGenerator
+{
+    public static DCMetadataDescriptor generateMetadataDescriptor( CollectionType type )
+    {
+        switch ( type )
+        {
+            case LIST:
+                return generateForList();
+            case ARRAY:
+                return generateForArray();
+            case SET:
+                return generateForSet();
+            default:
+                return null;
+        }
+    }
+
+
+    private static DCMetadataDescriptor generateForList()
+    {
+        String metaPid = DirectoryComponentConstants.DC_COLL_OC_LIST;
+        Version metaVersion = new Version( "2.0.0" );
+        String className = ArrayList.class.getName();
+        String[] implemented = new String[]
+            { List.class.getName(), Collection.class.getName() };
+        String[] extended = new String[]
+            { AbstractList.class.getName() };
+        DCPropertyDescription[] properties = new DCPropertyDescription[]
+            { new DCPropertyDescription( DirectoryComponentConstants.DC_LIST_PROP_TYPE,
+                ComponentConstants.PRIMITIVE_STR, Object.class.getName(), "Specifies collection's container type",
+                true, DirectoryComponentConstants.DC_VAL_NULL ) };
+
+        return new DCMetadataDescriptor( metaPid, true, metaVersion, className, implemented, extended, properties );
+    }
+
+
+    private static DCMetadataDescriptor generateForSet()
+    {
+        String metaPid = DirectoryComponentConstants.DC_COLL_OC_SET;
+        Version metaVersion = new Version( "2.0.0" );
+        String className = HashSet.class.getName();
+        String[] implemented = new String[]
+            { Set.class.getName(), Collection.class.getName() };
+        String[] extended = new String[]
+            { AbstractSet.class.getName() };
+        DCPropertyDescription[] properties = new DCPropertyDescription[]
+            { new DCPropertyDescription( DirectoryComponentConstants.DC_SET_PROP_TYPE,
+                ComponentConstants.PRIMITIVE_STR, Object.class.getName(), "Specifies collection's container type",
+                true, DirectoryComponentConstants.DC_VAL_NULL ) };
+
+        return new DCMetadataDescriptor( metaPid, true, metaVersion, className, implemented, extended, properties );
+    }
+
+
+    private static DCMetadataDescriptor generateForArray()
+    {
+        String metaPid = DirectoryComponentConstants.DC_COLL_OC_ARRAY;
+        Version metaVersion = new Version( "2.0.0" );
+        String className = Array.class.getName();
+        String[] implemented = new String[0];
+        String[] extended = new String[0];
+        DCPropertyDescription[] properties = new DCPropertyDescription[]
+            { new DCPropertyDescription( DirectoryComponentConstants.DC_ARRAY_PROP_TYPE,
+                ComponentConstants.PRIMITIVE_STR, Object.class.getName(), "Specifies collection's container type",
+                true, DirectoryComponentConstants.DC_VAL_NULL ) };
+
+        return new DCMetadataDescriptor( metaPid, true, metaVersion, className, implemented, extended, properties );
+    }
+
+}

Added: directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/collection/CollectionOperations.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/CollectionOperations.java?rev=1336671&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/collection/CollectionOperations.java (added)
+++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/connector/collection/CollectionOperations.java Thu May 10 13:27:47 2012
@@ -0,0 +1,164 @@
+package org.apache.directory.server.hub.core.connector.collection;
+
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+
+import org.apache.directory.server.hub.api.component.DCProperty;
+import org.apache.directory.server.hub.api.component.DCRuntime;
+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.exception.ComponentInstantiationException;
+import org.apache.directory.server.hub.api.exception.ComponentReconfigurationException;
+import org.apache.directory.server.hub.api.meta.DCOperationsManager;
+import org.apache.directory.server.hub.core.connector.collection.CollectionConnector.CollectionType;
+
+
+public class CollectionOperations implements DCOperationsManager
+{
+
+    CollectionType type;
+    Class collectionClass;
+
+
+    public CollectionOperations( CollectionType type )
+    {
+        this.type = type;
+        switch ( type )
+        {
+            case LIST:
+            case ARRAY:
+                collectionClass = ArrayList.class;
+                break;
+            case SET:
+                collectionClass = HashSet.class;
+                break;
+        }
+    }
+
+
+    @Override
+    public void instantiateComponent( DirectoryComponent component ) throws ComponentInstantiationException
+    {
+        Collection collection = null;
+
+        try
+        {
+            collection = ( Collection ) collectionClass.newInstance();
+        }
+        catch ( Exception e )
+        {
+            throw new ComponentInstantiationException( "Collection instantiation failed", e );
+        }
+
+        Hashtable<DirectoryComponent, Integer> indexMap = generateIndexMap( component );
+        List<DirectoryComponent> sortedList = extractSortedList( indexMap );
+
+        collection.addAll( sortedList );
+        Object pojo = ( type != CollectionType.ARRAY ) ? collection : collection.toArray();
+
+        component.setRuntimeInfo( new DCRuntime( null, pojo ) );
+
+    }
+
+
+    @Override
+    public void reconfigureComponent( DirectoryComponent component ) throws ComponentReconfigurationException
+    {
+        Object collectionObj = component.getRuntimeInfo().getPojo();
+        Collection collection;
+
+        if ( type == CollectionType.ARRAY )
+        {
+            collection = new ArrayList();
+        }
+        else
+        {
+            collection = ( Collection ) collectionObj;
+        }
+
+        collection.clear();
+
+        Hashtable<DirectoryComponent, Integer> indexMap = generateIndexMap( component );
+        List<DirectoryComponent> sortedList = extractSortedList( indexMap );
+
+        collection.addAll( sortedList );
+
+        Object pojo = ( type != CollectionType.ARRAY ) ? collection : collection.toArray();
+
+        component.getRuntimeInfo().setPojo( pojo );
+    }
+
+
+    @Override
+    public void disposeComponent( DirectoryComponent component )
+    {
+        component.setRuntimeInfo( null );
+    }
+
+
+    private Hashtable<DirectoryComponent, Integer> generateIndexMap( DirectoryComponent component )
+    {
+        Hashtable<DirectoryComponent, Integer> collectionMap = new Hashtable<DirectoryComponent, Integer>();
+
+        for ( DCProperty prop : component.getConfiguration() )
+        {
+            if ( prop.getName().startsWith( DirectoryComponentConstants.DC_PROP_ITEM_PREFIX ) )
+            {
+                DirectoryComponent reference = ( DirectoryComponent ) prop.getObject();
+                Integer index = reference.getConfiguration().getCollectionIndex();
+
+                collectionMap.put( reference, index );
+            }
+        }
+
+        return collectionMap;
+    }
+
+
+    private List<DirectoryComponent> extractSortedList( Hashtable<DirectoryComponent, Integer> indexMap )
+    {
+        List<DirectoryComponent> sortedList = new ArrayList<DirectoryComponent>( indexMap.keySet() );
+
+        if ( type == CollectionType.SET )
+        {
+            return sortedList;
+        }
+
+        Collections.sort( sortedList, new IndexMapSorter( indexMap ) );
+
+        return sortedList;
+    }
+
+    private class IndexMapSorter implements Comparator<DirectoryComponent>
+    {
+
+        private Hashtable<DirectoryComponent, Integer> indexMap;
+
+
+        public IndexMapSorter( Hashtable<DirectoryComponent, Integer> indexMap )
+        {
+            this.indexMap = indexMap;
+        }
+
+
+        @Override
+        public int compare( DirectoryComponent o1, DirectoryComponent o2 )
+        {
+            Integer index1 = indexMap.get( o1 );
+            Integer index2 = indexMap.get( o2 );
+
+            index1 = ( index1 != null ) ? index1 : new Integer( 0 );
+            index2 = ( index2 != null ) ? index2 : new Integer( 0 );
+
+            return index1.compareTo( index2 );
+        }
+
+    }
+}

Added: directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/meta/DCMetadataNormalizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/meta/DCMetadataNormalizer.java?rev=1336671&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/meta/DCMetadataNormalizer.java (added)
+++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/meta/DCMetadataNormalizer.java Thu May 10 13:27:47 2012
@@ -0,0 +1,120 @@
+package org.apache.directory.server.hub.core.meta;
+
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.hub.api.component.util.ComponentConstants;
+import org.apache.directory.server.hub.api.meta.DCMetadataDescriptor;
+import org.apache.directory.server.hub.api.meta.DCPropertyDescription;
+import org.apache.directory.server.hub.api.meta.DCPropertyType;
+import org.apache.directory.shared.ldap.model.schema.SchemaManager;
+
+
+public class DCMetadataNormalizer
+{
+    public static void normalizeDCMetadata( DCMetadataDescriptor metadata )
+    {
+        for ( DCPropertyDescription pd : metadata.getPropertyDescriptons() )
+        {
+            if ( isPrimitive( pd.getType() ) )
+            {
+                pd.setPropertyContext( DCPropertyType.PRIMITIVE );
+                if ( pd.getDefaultValue() == null )
+                {
+                    pd.setDefaultValue( "-1" );
+                }
+            }
+            else if ( isInjection( pd.getType() ) )
+            {
+                pd.setPropertyContext( DCPropertyType.INJECTION );
+            }
+            else if ( isCollection( pd.getType() ) )
+            {
+                if ( isPrimitive( pd.getContainerFor() ) )
+                {
+                    pd.setPropertyContext( DCPropertyType.PRIMITIVE_COLLECTION );
+                    if ( pd.getDefaultValue() == null )
+                    {
+                        pd.setDefaultValue( "[]" );
+                    }
+                }
+                else
+                {
+                    pd.setPropertyContext( DCPropertyType.COLLECTION );
+                    if ( pd.getDefaultValue() == null )
+                    {
+                        pd.setDefaultValue( "null" );
+                    }
+                }
+            }
+            else
+            {
+                pd.setPropertyContext( DCPropertyType.REFERENCE );
+                if ( pd.getDefaultValue() == null )
+                {
+                    pd.setDefaultValue( "null" );
+                }
+            }
+        }
+    }
+
+
+    private static boolean isPrimitive( String type )
+    {
+        if ( type.equals( ComponentConstants.PRIMITIVE_STR )
+            || type.equals( ComponentConstants.PRIMITIVE_INT )
+            || type.equals( ComponentConstants.PRIMITIVE_FLOAT )
+            || type.equals( ComponentConstants.PRIMITIVE_BOOL ) )
+        {
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    private static boolean isInjection( String type )
+    {
+        for ( String injectionType : injectionTypes )
+        {
+            if ( injectionType.equals( type ) )
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+
+    private static boolean isCollection( String type )
+    {
+        if ( type.equals( Collection.class.getName() )
+            || type.equals( List.class.getName() )
+            || type.equals( ArrayList.class.getName() )
+            || type.equals( Set.class.getName() )
+            || type.equals( HashSet.class.getName() )
+            || type.equals( Array.class.getName() ) )
+        {
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    private static String[] injectionTypes = new String[]
+        {
+            DirectoryService.class.getName(),
+            SchemaManager.class.getName()
+    };
+}



Mime
View raw message