directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gokt...@apache.org
Subject svn commit: r1204918 [2/2] - in /directory/apacheds/branches/apacheds-osgi/component-hub: ./ 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/m...
Date Tue, 22 Nov 2011 11:03:29 GMT
Added: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/listener/AbstractHubListener.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/listener/AbstractHubListener.java?rev=1204918&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/listener/AbstractHubListener.java
(added)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/listener/AbstractHubListener.java
Tue Nov 22 11:03:26 2011
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.directory.server.component.hub.listener;
+
+
+import org.apache.directory.server.component.ADSComponent;
+import org.apache.felix.ipojo.Factory;
+
+
+/**
+ * Abstract HubListener implementation. Override the intended methods to receive notifications.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class AbstractHubListener implements HubListener
+{
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.directory.server.component.hub.listener.HubListener#onComponentCreation(org.apache.directory.server.component.ADSComponent)
+     */
+    @Override
+    public void onComponentCreation( ADSComponent component )
+    {
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.directory.server.component.hub.listener.HubListener#onComponentDeletion(org.apache.directory.server.component.ADSComponent)
+     */
+    @Override
+    public void onComponentDeletion( ADSComponent component )
+    {
+    }
+
+}

Added: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/listener/HubListener.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/listener/HubListener.java?rev=1204918&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/listener/HubListener.java
(added)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/listener/HubListener.java
Tue Nov 22 11:03:26 2011
@@ -0,0 +1,58 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.directory.server.component.hub.listener;
+
+
+import org.apache.directory.server.component.ADSComponent;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.architecture.Architecture;
+
+
+/**
+ * Interface for the classes those want to be notified of ComponentHub.
+ * Listeners can bind themselves using ComponentHub.registerListener() method,
+ * and can remove themselves using ComponentHub.removeListener() method.
+ * TODO HubListener.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface HubListener
+{
+
+    /**
+     * Notified when a new ADSComponent is created.
+     * Listener can change the newly created ADSComponent by modifying the suppliad argument.
+     *
+     * @param component newly created ADSComponent
+     * @return the overrided version of the ADSComponent or null if no change is intended.
+     */
+    public void onComponentCreation( ADSComponent component );
+
+
+    /**
+     * Notified when a new ADSComponent is about to be disposed.
+     * Called before component disposal begins.
+     *
+     * @param component disposing created ADSComponent
+     * @return the overrided version of the ADSComponent or null if no change is intended.
+     */
+    public void onComponentDeletion( ADSComponent component );
+
+}

Added: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstance.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstance.java?rev=1204918&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstance.java
(added)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstance.java
Tue Nov 22 11:03:26 2011
@@ -0,0 +1,127 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.component.instance;
+
+
+import java.util.Properties;
+
+import org.apache.directory.server.component.ADSComponent;
+
+
+/**
+ * Class that represents an individual instance of an ADSComponent
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ADSComponentInstance
+{
+    /*
+     * Actual instance reference.
+     */
+    private Object instance;
+
+    /*
+     * The parent component of this spesific instance
+     */
+    private ADSComponent parentComponent;
+
+    /*
+     * LdifEntry of configuration hook.
+     */
+    private Properties instanceConfiguration;
+
+    /*
+     * Dn value shows where the configuration hook is set on DIT.
+     */
+    private String configHookDn;
+
+
+    /**
+     * @return the instance
+     */
+    public Object getInstance()
+    {
+        return instance;
+    }
+
+
+    /**
+     * @param instance the instance to set
+     */
+    public void setInstance( Object instance )
+    {
+        this.instance = instance;
+    }
+
+
+    /**
+     * @return the parentComponent
+     */
+    public ADSComponent getParentComponent()
+    {
+        return parentComponent;
+    }
+
+
+    /**
+     * @param parentComponent the parentComponent to set
+     */
+    public void setParentComponent( ADSComponent parentComponent )
+    {
+        this.parentComponent = parentComponent;
+    }
+
+
+    /**
+     * @return the instanceConfiguration
+     */
+    public Properties getInstanceConfiguration()
+    {
+        return instanceConfiguration;
+    }
+
+
+    /**
+     * @param instanceConfiguration the instanceConfiguration to set
+     */
+    public void setInstanceConfiguration( Properties instanceConfiguration )
+    {
+        this.instanceConfiguration = instanceConfiguration;
+    }
+
+
+    /**
+     * @return the configHookDn
+     */
+    public String getConfigHookDn()
+    {
+        return configHookDn;
+    }
+
+
+    /**
+     * @param configHookDn the configHookDn to set
+     */
+    public void setConfigHookDn( String configHookDn )
+    {
+        this.configHookDn = configHookDn;
+    }
+
+}

Added: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstanceGenerator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstanceGenerator.java?rev=1204918&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstanceGenerator.java
(added)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstanceGenerator.java
Tue Nov 22 11:03:26 2011
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.component.instance;
+
+
+import java.util.Properties;
+
+import org.apache.directory.server.component.ADSComponent;
+import org.apache.felix.ipojo.Factory;
+
+
+public interface ADSComponentInstanceGenerator
+{
+    /**
+     * Creates an instance of a supplied ADSComponent.
+     * Generates actual java object an LdifEntry describing it.
+     *
+     * @param component ADSComponent reference to be instantiated
+     * @return ADSInstance reference created from ADSComponent
+     */
+    public ADSComponentInstance createInstance( ADSComponent component, Properties properties
);
+
+
+    /**
+     * Extract default configuration from factory. This configuration is 
+     * the map of default values of the published properties of a IPojo component.
+     *
+     * @param factory Factory reference to extract default configuration to instantiate it.
+     * @return Default configuration
+     */
+    public Properties extractDefaultConfiguration( ADSComponent component );
+
+}

Added: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/schema/ADSComponentSchema.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/schema/ADSComponentSchema.java?rev=1204918&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/schema/ADSComponentSchema.java
(added)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/schema/ADSComponentSchema.java
Tue Nov 22 11:03:26 2011
@@ -0,0 +1,98 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.component.schema;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.directory.shared.ldap.model.ldif.LdifEntry;
+
+
+/**
+ * Class that represents an ADSComponent's schema definition.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ADSComponentSchema
+{
+    /*
+     * Schema elements (attribs,ocs) for component.
+     */
+    private List<LdifEntry> schemaElements = null;
+
+    /*
+     * Schema name which @schemaElements will go under.
+     */
+    private String parentSchemaName = null;
+
+    /*
+     * The object class which will be used to represent instances of the component.
+     */
+    private String objectClassForComponent = null;
+
+
+    public ADSComponentSchema( String parentSchema, List<LdifEntry> elements, String
oc )
+    {
+        parentSchemaName = parentSchema;
+        schemaElements = elements;
+        objectClassForComponent = oc;
+    }
+
+
+    /**
+     * Returns name of the schema
+     *
+     * @return name of the schema
+     */
+    public String getParentSchemaName()
+    {
+        return parentSchemaName;
+    }
+
+
+    /**
+     * Gets the clone of the schema elements.
+     *
+     * @return clone of the schema elements.
+     */
+    public List<LdifEntry> getSchemaElements()
+    {
+        if ( schemaElements == null )
+        {
+            return null;
+        }
+
+        return new ArrayList<LdifEntry>( schemaElements );
+    }
+
+
+    /**
+     * Getter for OC to represent instances.
+     *
+     * @return
+     */
+    public String getOCName()
+    {
+        return objectClassForComponent;
+    }
+
+}

Added: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/schema/ComponentOIDGenerator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/schema/ComponentOIDGenerator.java?rev=1204918&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/schema/ComponentOIDGenerator.java
(added)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/schema/ComponentOIDGenerator.java
Tue Nov 22 11:03:26 2011
@@ -0,0 +1,88 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.component.schema;
+
+
+import org.apache.directory.server.component.ADSConstants;
+
+
+/**
+ * This is a simple incremental generator for OID assignments of custom generated schemas.
+ * Ensuring consistency among different servers on the cluster will be replication layer's
duty.
+ * TODO ADSComponentOIDGenerator.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ComponentOIDGenerator
+{
+    /*
+     * Base OID to generate sequential OIDs against.
+     */
+    private static String baseOID = null;
+
+    /*
+     * Counters to keep track.
+     */
+    private static int componentCounter;
+    private static int ocCounter;
+    private static int attribCounter;
+
+    static
+    {
+        baseOID = ADSConstants.ADS_COMPONENT_BASE_OID;
+
+        componentCounter = 0;
+        ocCounter = 0;
+        attribCounter = 0;
+    }
+
+
+    /**
+     * Returns OID for component
+     *
+     * @return oid for component
+     */
+    public static synchronized String generateComponentOID()
+    {
+        return baseOID + "." + ( ++componentCounter );
+    }
+
+
+    /**
+     * Returns OID for object class under specified component base OID.
+     *
+     * @return oid for object class
+     */
+    public static synchronized String generateOCOID( String componentBase )
+    {
+        return componentBase + ".1." + ( ++ocCounter );
+    }
+
+
+    /**
+     * Returns OID for attribute under specified component base OID.
+     *
+     * @return oid for attribute
+     */
+    public static synchronized String generateAttribOID( String componentBase )
+    {
+        return componentBase + ".2." + ( ++attribCounter );
+    }
+}

Added: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/schema/ComponentSchemaGenerator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/schema/ComponentSchemaGenerator.java?rev=1204918&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/schema/ComponentSchemaGenerator.java
(added)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/schema/ComponentSchemaGenerator.java
Tue Nov 22 11:03:26 2011
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.server.component.schema;
+
+
+import org.apache.felix.ipojo.Factory;
+
+
+/**
+ * Interface for classes generating schemas for component types.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface ComponentSchemaGenerator
+{
+    /**
+     * Generates a schema for representing all of factory's configurables.
+     * Returned schema is in right order to add it to LDAP without any sorting.
+     * 
+     * If factory does not need a custom schema, it does not generate a schema for
+     * it, just returns the name of stock schema instead.
+     *
+     * @param factory Factory reference to generate schema for.
+     * @return Schema in the form of LdifEntry list.
+     */
+    public ADSComponentSchema generateADSComponentSchema( Factory factory );
+
+}



Mime
View raw message