directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gokt...@apache.org
Subject svn commit: r1338652 - in /directory/apacheds/branches/apacheds-osgi/hub: api/src/main/java/org/apache/directory/server/hub/api/component/util/ connectors/ipojo/core/src/main/java/org/apache/directory/server/hub/connector/ipojo/core/ connectors/ipojo/h...
Date Tue, 15 May 2012 11:24:31 GMT
Author: gokturk
Date: Tue May 15 11:24:30 2012
New Revision: 1338652

URL: http://svn.apache.org/viewvc?rev=1338652&view=rev
Log:
* Make ipojo-connector/handler capable of embedding factory nature from within specific component
type annotation

Added:
    directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/util/IPojoComponentConstants.java
      - copied, changed from r1338498, directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/util/InterceptorConstants.java
Removed:
    directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/util/InterceptorConstants.java
Modified:
    directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/core/src/main/java/org/apache/directory/server/hub/connector/ipojo/core/DcMetadataBuilder.java
    directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryInterceptorHandler.java
    directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java

Copied: directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/util/IPojoComponentConstants.java
(from r1338498, directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/util/InterceptorConstants.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/util/IPojoComponentConstants.java?p2=directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/util/IPojoComponentConstants.java&p1=directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/util/InterceptorConstants.java&r1=1338498&r2=1338652&rev=1338652&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/util/InterceptorConstants.java
(original)
+++ directory/apacheds/branches/apacheds-osgi/hub/api/src/main/java/org/apache/directory/server/hub/api/component/util/IPojoComponentConstants.java
Tue May 15 11:24:30 2012
@@ -21,8 +21,10 @@
 package org.apache.directory.server.hub.api.component.util;
 
 
-public class InterceptorConstants
+public class IPojoComponentConstants
 {
+    public static final String PROP_IS_FACTORY = "isFactory";
+
     public static final String PROP_INTERCEPTION_POINT = "interceptionPoint";
 
     public static final String PROP_INTERCEPTOR_OPERATIONS = "operations";

Modified: directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/core/src/main/java/org/apache/directory/server/hub/connector/ipojo/core/DcMetadataBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/core/src/main/java/org/apache/directory/server/hub/connector/ipojo/core/DcMetadataBuilder.java?rev=1338652&r1=1338651&r2=1338652&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/core/src/main/java/org/apache/directory/server/hub/connector/ipojo/core/DcMetadataBuilder.java
(original)
+++ directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/core/src/main/java/org/apache/directory/server/hub/connector/ipojo/core/DcMetadataBuilder.java
Tue May 15 11:24:30 2012
@@ -27,6 +27,7 @@ import java.util.Hashtable;
 import java.util.List;
 import org.apache.directory.server.component.handler.ipojo.property.DirectoryPropertyDescription;
 import org.apache.directory.server.hub.api.component.util.ComponentConstants;
+import org.apache.directory.server.hub.api.component.util.IPojoComponentConstants;
 import org.apache.directory.server.hub.api.meta.DcMetadataDescriptor;
 import org.apache.directory.server.hub.api.meta.DcPropertyDescription;
 import org.apache.felix.ipojo.ComponentFactory;
@@ -42,6 +43,7 @@ public class DcMetadataBuilder
     {
         String metadataPID = factory.getName();
         Version metaVersion = factory.getBundleContext().getBundle().getVersion();
+        boolean isFactory = true;
 
         List<DcPropertyDescription> properties = new ArrayList<DcPropertyDescription>();
 
@@ -57,6 +59,7 @@ public class DcMetadataBuilder
             String type = normalizeType( property.getType() );
             String description = "";
             String containerFor = "";
+            
 
             DirectoryPropertyDescription dpd = null;
             if ( property instanceof DirectoryPropertyDescription )
@@ -71,9 +74,22 @@ public class DcMetadataBuilder
                 constant = dpd.isConstant();
             }
 
+            if ( immutable )
+            {
+                // Immutable components must be mandatory too.
+                mandatory = true;
+            }
+
             if ( constant )
             {
-                constants.put( name, defaultValue );
+                if ( name.equals( IPojoComponentConstants.PROP_IS_FACTORY ) )
+                {
+                    isFactory = Boolean.parseBoolean( defaultValue );
+                }
+                else
+                {
+                    constants.put( name, defaultValue );
+                }
             }
             else
             {
@@ -95,7 +111,7 @@ public class DcMetadataBuilder
         String[] implemented = parseArray( interfaces );
         String[] extended = parseArray( sclasses );
 
-        DcMetadataDescriptor metadata = new DcMetadataDescriptor( metadataPID, true, metaVersion,
className,
+        DcMetadataDescriptor metadata = new DcMetadataDescriptor( metadataPID, isFactory,
metaVersion, className,
             implemented, extended, constants, properties.toArray( new DcPropertyDescription[0]
) );
 
         return metadata;

Modified: directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryInterceptorHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryInterceptorHandler.java?rev=1338652&r1=1338651&r2=1338652&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryInterceptorHandler.java
(original)
+++ directory/apacheds/branches/apacheds-osgi/hub/connectors/ipojo/handler/src/main/java/org/apache/directory/server/component/handler/ipojo/DirectoryInterceptorHandler.java
Tue May 15 11:24:30 2012
@@ -22,9 +22,8 @@ package org.apache.directory.server.comp
 
 
 import java.util.Hashtable;
-import java.util.Properties;
 
-import org.apache.directory.server.hub.api.component.util.InterceptorConstants;
+import org.apache.directory.server.hub.api.component.util.IPojoComponentConstants;
 import org.apache.felix.ipojo.annotations.Handler;
 import org.apache.felix.ipojo.metadata.Element;
 
@@ -54,12 +53,13 @@ public class DirectoryInterceptorHandler
         // Only one interceptor per class is allowed
         Element interceptor = interceptors[0];
 
-        String interceptionPoint = interceptor.getAttribute( InterceptorConstants.PROP_INTERCEPTION_POINT
);
-        String interceptorOperations = interceptor.getAttribute( InterceptorConstants.PROP_INTERCEPTOR_OPERATIONS
);
+        String interceptionPoint = interceptor.getAttribute( IPojoComponentConstants.PROP_INTERCEPTION_POINT
);
+        String interceptorOperations = interceptor.getAttribute( IPojoComponentConstants.PROP_INTERCEPTOR_OPERATIONS
);
 
         Hashtable<String, String> constants = new Hashtable<String, String>();
-        constants.put( InterceptorConstants.PROP_INTERCEPTION_POINT, interceptionPoint );
-        constants.put( InterceptorConstants.PROP_INTERCEPTOR_OPERATIONS, interceptorOperations
);
+        constants.put( IPojoComponentConstants.PROP_INTERCEPTION_POINT, interceptionPoint
);
+        constants.put( IPojoComponentConstants.PROP_INTERCEPTOR_OPERATIONS, interceptorOperations
);
+        constants.put( IPojoComponentConstants.PROP_IS_FACTORY, "false" );
 
         return constants;
 

Modified: directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java?rev=1338652&r1=1338651&r2=1338652&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java
(original)
+++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java
Tue May 15 11:24:30 2012
@@ -39,7 +39,7 @@ import org.apache.directory.server.hub.a
 import org.apache.directory.server.hub.api.component.DirectoryComponent;
 import org.apache.directory.server.hub.api.component.DirectoryComponentConstants;
 import org.apache.directory.server.hub.api.component.util.InterceptionPoint;
-import org.apache.directory.server.hub.api.component.util.InterceptorConstants;
+import org.apache.directory.server.hub.api.component.util.IPojoComponentConstants;
 import org.apache.directory.server.hub.api.component.util.InterceptorOperation;
 import org.apache.directory.server.hub.api.exception.BadConfigurationException;
 import org.apache.directory.server.hub.api.exception.ComponentInstantiationException;
@@ -856,8 +856,8 @@ public class ComponentHubImpl implements
         configurator.init( this );
 
         DcConfiguration config = new DcConfiguration( new ArrayList<DcProperty>() );
-        config.addConstant( InterceptorConstants.PROP_INTERCEPTION_POINT, InterceptionPoint.END.toString()
);
-        config.addConstant( InterceptorConstants.PROP_INTERCEPTOR_OPERATIONS,
+        config.addConstant( IPojoComponentConstants.PROP_INTERCEPTION_POINT, InterceptionPoint.END.toString()
);
+        config.addConstant( IPojoComponentConstants.PROP_INTERCEPTOR_OPERATIONS,
             "[" +
                 InterceptorOperation.ADD + "," +
                 InterceptorOperation.DELETE + "," +



Mime
View raw message