felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r656044 - in /felix/trunk/ipojo: arch/src/main/java/org/apache/felix/ipojo/arch/ arch/src/main/resources/ composite/src/main/java/org/apache/felix/ipojo/composite/ composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ c...
Date Tue, 13 May 2008 22:54:26 GMT
Author: clement
Date: Tue May 13 15:54:25 2008
New Revision: 656044

URL: http://svn.apache.org/viewvc?rev=656044&view=rev
Log:
Add the HandlerFactory interface to avoid the ClassCastException when proxying factories (Issue
Felix-552)
As a consequence, the archi command now target this kind of factory.
Some tests have been updated to reflect this change.

Modified:
    felix/trunk/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
    felix/trunk/ipojo/arch/src/main/resources/metadata.xml
    felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java
    felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeManager.java
    felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java
    felix/trunk/ipojo/core/pom.xml
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/HandlerFactory.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/ComponentTypeDescription.java
    felix/trunk/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
    felix/trunk/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadFactories.java
    felix/trunk/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
    felix/trunk/ipojo/tests/tests.core.configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
    felix/trunk/ipojo/tests/tests.core.external.handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/eh/HandlerTest.java
    felix/trunk/ipojo/tests/tests.core.external.handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
    felix/trunk/ipojo/tests/tests.core.factories/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
    felix/trunk/ipojo/tests/tests.core.lifecycle.callback/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
    felix/trunk/ipojo/tests/tests.core.lifecycle.controller/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
    felix/trunk/ipojo/tests/tests.core.manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
    felix/trunk/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
    felix/trunk/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java

Modified: felix/trunk/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
(original)
+++ felix/trunk/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
Tue May 13 15:54:25 2008
@@ -43,7 +43,7 @@
     private Factory[] m_factories;
     
     /** Handler Factories. */
-    private Factory[] m_handlers;
+    private HandlerFactory[] m_handlers;
 
     /**
      * Get the command name.
@@ -212,15 +212,14 @@
      */
     private void printHandlers(PrintStream out) {
         for (int i = 0; i < m_handlers.length; i++) {
-            HandlerFactory hf = (HandlerFactory) m_handlers[i];
-            String name = hf.getHandlerName();
-            if ("composite".equals(hf.getType())) {
+            String name = m_handlers[i].getHandlerName();
+            if ("composite".equals(m_handlers[i].getType())) {
                 name = name + " [composite]";
             }
-            if (hf.getMissingHandlers().size() == 0) {
+            if (m_handlers[i].getMissingHandlers().size() == 0) {
                 out.println("Handler " + name + " (VALID)");
             } else {
-                out.println("Handler " + name + " (INVALID : " + hf.getMissingHandlers()
+ ")");
+                out.println("Handler " + name + " (INVALID : " + m_handlers[i].getMissingHandlers()
+ ")");
             }
         }
     }

Modified: felix/trunk/ipojo/arch/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/arch/src/main/resources/metadata.xml?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/arch/src/main/resources/metadata.xml (original)
+++ felix/trunk/ipojo/arch/src/main/resources/metadata.xml Tue May 13 15:54:25 2008
@@ -22,10 +22,8 @@
 		factory="false">
 		<Provides />
 		<Requires field="m_archs" optional="true" />
-		<Requires field="m_factories" optional="true"
-			filter="(!(handler.name=*))" />
-		<Requires field="m_handlers" optional="true"
-			filter="(handler.name=*)" />
+		<Requires field="m_factories" optional="true"/>
+		<Requires field="m_handlers" optional="true"/>
 	</Component>
 	<instance component="org.apache.felix.ipojo.arch.ArchCommandImpl"
 		name="ArchCommand" />

Modified: felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java
(original)
+++ felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java
Tue May 13 15:54:25 2008
@@ -25,8 +25,8 @@
 import org.apache.felix.ipojo.ComponentFactory;
 import org.apache.felix.ipojo.ComponentInstance;
 import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.Factory;
 import org.apache.felix.ipojo.Handler;
+import org.apache.felix.ipojo.HandlerFactory;
 import org.apache.felix.ipojo.HandlerManager;
 import org.apache.felix.ipojo.IPojoContext;
 import org.apache.felix.ipojo.MissingHandlerException;
@@ -118,7 +118,7 @@
     public synchronized void starting() {
         if (m_requiredHandlers.size() != 0) {
             try {
-                String filter = "(&(" + Constants.OBJECTCLASS + "=" + Factory.class.getName()
+ ")"
+                String filter = "(&(" + Constants.OBJECTCLASS + "=" + HandlerFactory.class.getName()
+ ")"
                     + "(" + Handler.HANDLER_TYPE_PROPERTY + "=" + CompositeHandler.HANDLER_TYPE
+ ")" 
                     + "(factory.state=1)"
                     + ")";

Modified: felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeManager.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeManager.java
(original)
+++ felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeManager.java
Tue May 13 15:54:25 2008
@@ -49,17 +49,17 @@
     /**
      * The context of the component.
      */
-    private BundleContext m_context;
+    private final BundleContext m_context;
 
     /**
      * Parent factory (ComponentFactory).
      */
-    private CompositeFactory m_factory;
+    private final CompositeFactory m_factory;
 
     /**
      * Composite Handler list.
      */
-    private HandlerManager[] m_handlers = new HandlerManager[0];
+    private HandlerManager[] m_handlers;
 
     /**
      * Instance State Listener List.

Modified: felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java
(original)
+++ felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java
Tue May 13 15:54:25 2008
@@ -30,6 +30,7 @@
 import org.apache.felix.ipojo.Factory;
 import org.apache.felix.ipojo.HandlerFactory;
 import org.apache.felix.ipojo.HandlerManager;
+import org.apache.felix.ipojo.HandlerManagerFactory;
 import org.apache.felix.ipojo.MissingHandlerException;
 import org.apache.felix.ipojo.PolicyServiceContext;
 import org.apache.felix.ipojo.UnacceptableConfiguration;

Modified: felix/trunk/ipojo/core/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/pom.xml?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/core/pom.xml (original)
+++ felix/trunk/ipojo/core/pom.xml Tue May 13 15:54:25 2008
@@ -72,7 +72,7 @@
 						</Bundle-Activator>
 						<IPOJO-Extension>
 							component:org.apache.felix.ipojo.ComponentFactory,
-							handler:org.apache.felix.ipojo.HandlerFactory
+							handler:org.apache.felix.ipojo.HandlerManagerFactory
 						</IPOJO-Extension>
 						<Import-Package>
 							org.osgi.framework, org.osgi.service.cm,

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/HandlerFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/HandlerFactory.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/HandlerFactory.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/HandlerFactory.java Tue May
13 15:54:25 2008
@@ -18,156 +18,45 @@
  */
 package org.apache.felix.ipojo;
 
-import java.util.Dictionary;
-
-import org.apache.felix.ipojo.architecture.ComponentTypeDescription;
-import org.apache.felix.ipojo.metadata.Element;
-import org.osgi.framework.BundleContext;
 
 /**
- * The component factory manages component instance objects. This management
- * consist in creating and managing component instance build with the component
- * factory. This class could export Factory and ManagedServiceFactory services.
- * 
+ * Service interface published by handler factory. 
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class HandlerFactory extends ComponentFactory implements Factory {
+public interface HandlerFactory extends Factory {
 
     /**
      * iPOJO Default Namespace.
      */
-    public static final String IPOJO_NAMESPACE = "org.apache.felix.ipojo";
+    String IPOJO_NAMESPACE = "org.apache.felix.ipojo";
 
     /**
-     * Handler type (composite|primitive).
+     * Gets the namespace associated with this handler factory.
+     * @return the namespace used by this handler
      */
-    private final String m_type;
+    String getNamespace();
 
     /**
-     * iPOJO Handler Namespace.
-     * (Set the the iPOJO default namespace is not specified)
+     * Gets the name associated with this handler factory.
+     * @return the name used by this handler
      */
-    private final String m_namespace;
+    String getHandlerName();
 
     /**
-     * Handler start level.
-     * Lower level are priority are configured and started before higher level, and are stopped
after. 
+     * Gets the type of created handler.
+     * The handler can only be plugged on instance container with the same type.
+     * Basically, types are primitive and composite.
+     * @return the types of the handler
      */
-    private final int m_level;
+    String getType();
 
     /**
-     * Creates a handler factory.
-     * @param context : bundle context
-     * @param metadata : metadata of the component to create
-     * @throws ConfigurationException occurs when the element describing the factory is malformed.
+     * Gets the start level of the handlers created by this factory.
+     * Handlers with a low start level are configured and started before 
+     * handlers with an higher start level. Moreover, these handlers are
+     * stopped and disposed after.
+     * @return the handler's start level
      */
-    public HandlerFactory(BundleContext context, Element metadata) throws ConfigurationException
{
-        super(context, metadata);
-
-        // Get the name
-        m_factoryName = metadata.getAttribute("name");
-        if (m_factoryName == null) { throw new ConfigurationException("An Handler needs a
name"); }
-
-        // Get the type
-        String type = metadata.getAttribute("type");
-        if (type != null) {
-            m_type = type;
-        } else {
-            m_type = "primitive"; // Set to primitive if not specified.
-        }
-
-        String level = metadata.getAttribute("level");
-        if (level != null) {
-            m_level = new Integer(level).intValue();
-        } else {
-            m_level = Integer.MAX_VALUE; // Set to max if not specified.
-        }
-
-        // Get the namespace
-        String namespace = metadata.getAttribute("namespace");
-        if (namespace != null) {
-            m_namespace = namespace.toLowerCase();
-        } else {
-            m_namespace = IPOJO_NAMESPACE; // Set to the iPOJO default namespace if not specified.
-        }
-    }
-
-    public String getNamespace() {
-        return m_namespace;
-    }
-
-    public String getHandlerName() {
-        return m_namespace + ":" + getName();
-    }
-
-    public String getType() {
-        return m_type;
-    }
-
-    public int getStartLevel() {
-        return m_level;
-    }
-
-    public ComponentTypeDescription getComponentTypeDescription() {
-        return new HandlerTypeDescription(this);
-    }
+    int getStartLevel();
 
-    /**
-     * Stops the factory.
-     * This method does not disposed created instances.
-     * These instances will be disposed by the instance managers.
-     * This method is called with the lock.
-     */
-    public void stopping() {
-        if (m_tracker != null) {
-            m_tracker.close();
-            m_tracker = null;
-        }
-    }
-
-    /**
-     * Creates an instance. The given configuration needs to contain the 'name'
-     * property. This method is called when holding the lock.
-     * @param configuration : configuration of the created instance.
-     * @param context : the service context to push for this instance.
-     * @param handlers : handler array to used.
-     * @return the created component instance.
-     * not consistent with the component type of this factory.
-     * @throws org.apache.felix.ipojo.ConfigurationException : when the instance configuration
failed.
-     * @see org.apache.felix.ipojo.Factory#createComponentInstance(java.util.Dictionary)
-     */
-    public ComponentInstance createInstance(Dictionary configuration, IPojoContext context,
HandlerManager[] handlers) throws ConfigurationException {
-        HandlerManager instance = new HandlerManager(this, context, handlers);
-        instance.configure(m_componentMetadata, configuration);
-        return instance;
-    }
-
-    private class HandlerTypeDescription extends ComponentTypeDescription {
-
-        /**
-         * Constructor.
-         * @param factory : factory.
-         */
-        public HandlerTypeDescription(Factory factory) {
-            super(factory);
-        }
-
-        /**
-         * Add properties to publish : 
-         * handler.name, handler.namespace, handler.type and handler.level if the level is
not Integer.MAX.
-         * @return return the dictionary to publish.
-         * @see org.apache.felix.ipojo.architecture.ComponentTypeDescription#getPropertiesToPublish()
-         */
-        public Dictionary getPropertiesToPublish() {
-            Dictionary props = super.getPropertiesToPublish();
-
-            props.put(Handler.HANDLER_NAME_PROPERTY, m_factoryName);
-            props.put(Handler.HANDLER_NAMESPACE_PROPERTY, m_namespace);
-            props.put(Handler.HANDLER_TYPE_PROPERTY, m_type);
-            if (m_level != Integer.MAX_VALUE) {
-                props.put(Handler.HANDLER_LEVEL_PROPERTY, new Integer(m_level));
-            }
-            return props;
-        }
-    }
 }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java Tue May
13 15:54:25 2008
@@ -503,7 +503,7 @@
         if (m_isPublic) {
             // Exposition of the factory service
             m_sr =
-                    m_context.registerService(new String[] { Factory.class.getName(), ManagedServiceFactory.class.getName()
}, this, m_componentDesc
+                    m_context.registerService(m_componentDesc.getFactoryInterfacesToPublish(),
this, m_componentDesc
                             .getPropertiesToPublish());
         }
     }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/ComponentTypeDescription.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/ComponentTypeDescription.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/ComponentTypeDescription.java
(original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/ComponentTypeDescription.java
Tue May 13 15:54:25 2008
@@ -27,6 +27,7 @@
 import org.apache.felix.ipojo.metadata.Element;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
+import org.osgi.service.cm.ManagedServiceFactory;
 
 /**
  * Component Type description.
@@ -58,7 +59,7 @@
     }
 
     /**
-     * Get a printable form of the current component type description.
+     * Gets a printable form of the current component type description.
      * @return printable form of the component type description
      * @see java.lang.Object#toString()
      */
@@ -67,7 +68,7 @@
     }
 
     /**
-     * Get the implementation class of this component type.
+     * Gets the implementation class of this component type.
      * @return the component type implementation class name.
      */
     public String getClassName() {
@@ -75,7 +76,7 @@
     }
 
     /**
-     * Get component-type properties.
+     * Gets component-type properties.
      * @return the list of configuration properties accepted by the component type type.
      */
     public PropertyDescription[] getProperties() {
@@ -83,7 +84,7 @@
     }
 
     /**
-     * Add a String property in the component type.
+     * Adds a String property in the component type.
      * @param name : property name.
      * @param value : property value.
      */
@@ -92,7 +93,7 @@
     }
     
     /**
-     * Add a String property in the component type.
+     * Adds a String property in the component type.
      * @param name : property name.
      * @param value : property value.
      * @param immutable : the property is immutable.
@@ -103,7 +104,7 @@
     }
 
     /**
-     * Add a configuration properties to the component type.
+     * Adds a configuration properties to the component type.
      * @param pd : the property to add
      */
     public void addProperty(PropertyDescription pd) { //NOPMD remove the instance name of
the 'name' property.
@@ -125,7 +126,7 @@
     }
 
     /**
-     * Get the list of provided service offered by instances of this type.
+     * Gets the list of provided service offered by instances of this type.
      * @return the list of the provided service.
      */
     public String[] getprovidedServiceSpecification() {
@@ -133,7 +134,7 @@
     }
 
     /**
-     * Add a provided service to the component type.
+     * Adds a provided service to the component type.
      * @param serviceSpecification : the provided service to add (interface name)
      */
     public void addProvidedServiceSpecification(String serviceSpecification) {
@@ -144,7 +145,7 @@
     }
 
     /**
-     * Return the component-type name.
+     * Returns the component-type name.
      * @return the name of this component type
      */
     public String getName() {
@@ -152,7 +153,7 @@
     }
     
     /**
-     * Compute the default service properties to publish : 
+     * Computes the default service properties to publish : 
      * factory.name, service.pid, component.providedServiceSpecification, component.properties,
component.description, factory.State.
      * @return : the dictionary of properties to publish.
      */
@@ -180,10 +181,17 @@
 
     }
     
+    /**
+     * Gets the interfaces published by the factory.
+     * By default publish both {@link Factory} and {@link ManagedServiceFactory}.
+     * @return : the list of interface published by the factory.
+     */
+    public String[] getFactoryInterfacesToPublish() {
+        return new String[] {Factory.class.getName(), ManagedServiceFactory.class.getName()};
+    }
     
-
     /**
-     * Get the component type description.
+     * Gets the component type description.
      * @return : the description
      */
     public Element getDescription() {

Modified: felix/trunk/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
(original)
+++ felix/trunk/ipojo/tests/tests.core.annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
Tue May 13 15:54:25 2008
@@ -28,6 +28,7 @@
 import org.apache.felix.ipojo.Handler;
 import org.apache.felix.ipojo.HandlerFactory;
 import org.apache.felix.ipojo.ServiceContext;
+import org.apache.felix.ipojo.metadata.Element;
 import org.apache.felix.ipojo.parser.ManifestMetadataParser;
 import org.apache.felix.ipojo.parser.ParseException;
 import org.osgi.framework.BundleContext;
@@ -35,8 +36,6 @@
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.cm.ManagedServiceFactory;
 
-import org.apache.felix.ipojo.metadata.Element;
-
 public class Utils {
     
     public static Element getMetatadata(BundleContext bc, String component) {
@@ -82,7 +81,7 @@
     public static HandlerFactory getHandlerFactoryByName(BundleContext bc, String factoryName)
{
         ServiceReference[] refs;
         try {
-            refs = bc.getServiceReferences(Factory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY
+ "=" + factoryName + ")");
+            refs = bc.getServiceReferences(HandlerFactory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY
+ "=" + factoryName + ")");
             if (refs == null) {
                 System.err.println("Cannot get the factory " + factoryName);
                 return null;

Modified: felix/trunk/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadFactories.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadFactories.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadFactories.java
(original)
+++ felix/trunk/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/bad/BadFactories.java
Tue May 13 15:54:25 2008
@@ -20,7 +20,7 @@
 
 import org.apache.felix.ipojo.ComponentFactory;
 import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.HandlerFactory;
+import org.apache.felix.ipojo.HandlerManagerFactory;
 import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
 import org.apache.felix.ipojo.metadata.Attribute;
 import org.apache.felix.ipojo.metadata.Element;
@@ -56,7 +56,7 @@
     
     public void testBadHandlerFactory1() {
         try {
-            new HandlerFactory(context, getElementHandlerFactoryWithNoClassName());
+            new HandlerManagerFactory(context, getElementHandlerFactoryWithNoClassName());
             fail("An handler factory with no class name must be rejected");
         } catch (ConfigurationException e) {
           // OK.   
@@ -65,7 +65,7 @@
     
     public void testBadHandlerFactory2() {
         try {
-            new HandlerFactory(context, getElementHandlerFactoryWithNoName());
+            new HandlerManagerFactory(context, getElementHandlerFactoryWithNoName());
             fail("An handler factory with no name must be rejected");
         } catch (ConfigurationException e) {
           // OK.   

Modified: felix/trunk/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
(original)
+++ felix/trunk/ipojo/tests/tests.core.bad.configurations/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
Tue May 13 15:54:25 2008
@@ -26,7 +26,7 @@
 import org.apache.felix.ipojo.ComponentInstance;
 import org.apache.felix.ipojo.Factory;
 import org.apache.felix.ipojo.Handler;
-import org.apache.felix.ipojo.HandlerFactory;
+import org.apache.felix.ipojo.HandlerManagerFactory;
 import org.apache.felix.ipojo.ServiceContext;
 //import org.apache.felix.ipojo.composite.CompositeManager;
 import org.osgi.framework.BundleContext;
@@ -51,7 +51,7 @@
         }
     }
 
-    public static HandlerFactory getHandlerFactoryByName(BundleContext bc, String factoryName)
{
+    public static HandlerManagerFactory getHandlerFactoryByName(BundleContext bc, String
factoryName) {
         ServiceReference[] refs;
         try {
             refs = bc.getServiceReferences(Factory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY
+ "=" + factoryName + ")");
@@ -59,7 +59,7 @@
                 System.err.println("Cannot get the factory " + factoryName);
                 return null;
             }
-            return (HandlerFactory) bc.getService(refs[0]);
+            return (HandlerManagerFactory) bc.getService(refs[0]);
         } catch (InvalidSyntaxException e) {
             System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
             return null;

Modified: felix/trunk/ipojo/tests/tests.core.configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/tests.core.configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/tests.core.configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
(original)
+++ felix/trunk/ipojo/tests/tests.core.configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
Tue May 13 15:54:25 2008
@@ -26,7 +26,7 @@
 import org.apache.felix.ipojo.ComponentInstance;
 import org.apache.felix.ipojo.Factory;
 import org.apache.felix.ipojo.Handler;
-import org.apache.felix.ipojo.HandlerFactory;
+import org.apache.felix.ipojo.HandlerManagerFactory;
 import org.apache.felix.ipojo.ServiceContext;
 //import org.apache.felix.ipojo.composite.CompositeManager;
 import org.osgi.framework.BundleContext;
@@ -51,7 +51,7 @@
         }
     }
 
-    public static HandlerFactory getHandlerFactoryByName(BundleContext bc, String factoryName)
{
+    public static HandlerManagerFactory getHandlerFactoryByName(BundleContext bc, String
factoryName) {
         ServiceReference[] refs;
         try {
             refs = bc.getServiceReferences(Factory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY
+ "=" + factoryName + ")");
@@ -59,7 +59,7 @@
                 System.err.println("Cannot get the factory " + factoryName);
                 return null;
             }
-            return (HandlerFactory) bc.getService(refs[0]);
+            return (HandlerManagerFactory) bc.getService(refs[0]);
         } catch (InvalidSyntaxException e) {
             System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
             return null;

Modified: felix/trunk/ipojo/tests/tests.core.external.handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/eh/HandlerTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/tests.core.external.handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/eh/HandlerTest.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/tests.core.external.handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/eh/HandlerTest.java
(original)
+++ felix/trunk/ipojo/tests/tests.core.external.handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/eh/HandlerTest.java
Tue May 13 15:54:25 2008
@@ -22,6 +22,7 @@
 
 import org.apache.felix.ipojo.ComponentInstance;
 import org.apache.felix.ipojo.HandlerFactory;
+import org.apache.felix.ipojo.HandlerManagerFactory;
 import org.apache.felix.ipojo.architecture.Architecture;
 import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
 import org.apache.felix.ipojo.test.scenarios.eh.service.CheckService;
@@ -158,7 +159,7 @@
         assertEquals("Check validity", arch.getInstanceDescription().getState(), ComponentInstance.VALID);
         
         // Kill the handler factory
-        HandlerFactory f = (HandlerFactory) Utils.getHandlerFactoryByName(context, "check");
+        HandlerManagerFactory f = (HandlerManagerFactory) Utils.getHandlerFactoryByName(context,
"check");
         f.stop();
         
         sr = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "HandlerTest-1");

Modified: felix/trunk/ipojo/tests/tests.core.external.handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/tests.core.external.handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/tests.core.external.handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
(original)
+++ felix/trunk/ipojo/tests/tests.core.external.handlers/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
Tue May 13 15:54:25 2008
@@ -28,7 +28,6 @@
 import org.apache.felix.ipojo.Handler;
 import org.apache.felix.ipojo.HandlerFactory;
 import org.apache.felix.ipojo.ServiceContext;
-//import org.apache.felix.ipojo.composite.CompositeManager;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
@@ -54,7 +53,7 @@
     public static HandlerFactory getHandlerFactoryByName(BundleContext bc, String factoryName)
{
         ServiceReference[] refs;
         try {
-            refs = bc.getServiceReferences(Factory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY
+ "=" + factoryName + ")");
+            refs = bc.getServiceReferences(HandlerFactory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY
+ "=" + factoryName + ")");
             if (refs == null) {
                 System.err.println("Cannot get the factory " + factoryName);
                 return null;

Modified: felix/trunk/ipojo/tests/tests.core.factories/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/tests.core.factories/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/tests.core.factories/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
(original)
+++ felix/trunk/ipojo/tests/tests.core.factories/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
Tue May 13 15:54:25 2008
@@ -26,7 +26,7 @@
 import org.apache.felix.ipojo.ComponentInstance;
 import org.apache.felix.ipojo.Factory;
 import org.apache.felix.ipojo.Handler;
-import org.apache.felix.ipojo.HandlerFactory;
+import org.apache.felix.ipojo.HandlerManagerFactory;
 import org.apache.felix.ipojo.ServiceContext;
 //import org.apache.felix.ipojo.composite.CompositeManager;
 import org.osgi.framework.BundleContext;
@@ -51,7 +51,7 @@
         }
     }
 
-    public static HandlerFactory getHandlerFactoryByName(BundleContext bc, String factoryName)
{
+    public static HandlerManagerFactory getHandlerFactoryByName(BundleContext bc, String
factoryName) {
         ServiceReference[] refs;
         try {
             refs = bc.getServiceReferences(Factory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY
+ "=" + factoryName + ")");
@@ -59,7 +59,7 @@
                 System.err.println("Cannot get the factory " + factoryName);
                 return null;
             }
-            return (HandlerFactory) bc.getService(refs[0]);
+            return (HandlerManagerFactory) bc.getService(refs[0]);
         } catch (InvalidSyntaxException e) {
             System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
             return null;

Modified: felix/trunk/ipojo/tests/tests.core.lifecycle.callback/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/tests.core.lifecycle.callback/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/tests.core.lifecycle.callback/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
(original)
+++ felix/trunk/ipojo/tests/tests.core.lifecycle.callback/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
Tue May 13 15:54:25 2008
@@ -26,7 +26,7 @@
 import org.apache.felix.ipojo.ComponentInstance;
 import org.apache.felix.ipojo.Factory;
 import org.apache.felix.ipojo.Handler;
-import org.apache.felix.ipojo.HandlerFactory;
+import org.apache.felix.ipojo.HandlerManagerFactory;
 import org.apache.felix.ipojo.ServiceContext;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.InvalidSyntaxException;
@@ -50,7 +50,7 @@
         }
     }
 
-    public static HandlerFactory getHandlerFactoryByName(BundleContext bc, String factoryName)
{
+    public static HandlerManagerFactory getHandlerFactoryByName(BundleContext bc, String
factoryName) {
         ServiceReference[] refs;
         try {
             refs = bc.getServiceReferences(Factory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY
+ "=" + factoryName + ")");
@@ -58,7 +58,7 @@
                 System.err.println("Cannot get the factory " + factoryName);
                 return null;
             }
-            return (HandlerFactory) bc.getService(refs[0]);
+            return (HandlerManagerFactory) bc.getService(refs[0]);
         } catch (InvalidSyntaxException e) {
             System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
             return null;

Modified: felix/trunk/ipojo/tests/tests.core.lifecycle.controller/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/tests.core.lifecycle.controller/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/tests.core.lifecycle.controller/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
(original)
+++ felix/trunk/ipojo/tests/tests.core.lifecycle.controller/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
Tue May 13 15:54:25 2008
@@ -26,7 +26,7 @@
 import org.apache.felix.ipojo.ComponentInstance;
 import org.apache.felix.ipojo.Factory;
 import org.apache.felix.ipojo.Handler;
-import org.apache.felix.ipojo.HandlerFactory;
+import org.apache.felix.ipojo.HandlerManagerFactory;
 import org.apache.felix.ipojo.ServiceContext;
 //import org.apache.felix.ipojo.composite.CompositeManager;
 import org.osgi.framework.BundleContext;
@@ -51,7 +51,7 @@
         }
     }
 
-    public static HandlerFactory getHandlerFactoryByName(BundleContext bc, String factoryName)
{
+    public static HandlerManagerFactory getHandlerFactoryByName(BundleContext bc, String
factoryName) {
         ServiceReference[] refs;
         try {
             refs = bc.getServiceReferences(Factory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY
+ "=" + factoryName + ")");
@@ -59,7 +59,7 @@
                 System.err.println("Cannot get the factory " + factoryName);
                 return null;
             }
-            return (HandlerFactory) bc.getService(refs[0]);
+            return (HandlerManagerFactory) bc.getService(refs[0]);
         } catch (InvalidSyntaxException e) {
             System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
             return null;

Modified: felix/trunk/ipojo/tests/tests.core.manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/tests.core.manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/tests.core.manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
(original)
+++ felix/trunk/ipojo/tests/tests.core.manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
Tue May 13 15:54:25 2008
@@ -26,7 +26,7 @@
 import org.apache.felix.ipojo.ComponentInstance;
 import org.apache.felix.ipojo.Factory;
 import org.apache.felix.ipojo.Handler;
-import org.apache.felix.ipojo.HandlerFactory;
+import org.apache.felix.ipojo.HandlerManagerFactory;
 import org.apache.felix.ipojo.ServiceContext;
 //import org.apache.felix.ipojo.composite.CompositeManager;
 import org.osgi.framework.BundleContext;
@@ -51,7 +51,7 @@
         }
     }
 
-    public static HandlerFactory getHandlerFactoryByName(BundleContext bc, String factoryName)
{
+    public static HandlerManagerFactory getHandlerFactoryByName(BundleContext bc, String
factoryName) {
         ServiceReference[] refs;
         try {
             refs = bc.getServiceReferences(Factory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY
+ "=" + factoryName + ")");
@@ -59,7 +59,7 @@
                 System.err.println("Cannot get the factory " + factoryName);
                 return null;
             }
-            return (HandlerFactory) bc.getService(refs[0]);
+            return (HandlerManagerFactory) bc.getService(refs[0]);
         } catch (InvalidSyntaxException e) {
             System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
             return null;

Modified: felix/trunk/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
(original)
+++ felix/trunk/ipojo/tests/tests.core.service.dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
Tue May 13 15:54:25 2008
@@ -26,7 +26,7 @@
 import org.apache.felix.ipojo.ComponentInstance;
 import org.apache.felix.ipojo.Factory;
 import org.apache.felix.ipojo.Handler;
-import org.apache.felix.ipojo.HandlerFactory;
+import org.apache.felix.ipojo.HandlerManagerFactory;
 import org.apache.felix.ipojo.ServiceContext;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.InvalidSyntaxException;
@@ -50,7 +50,7 @@
         }
     }
 
-    public static HandlerFactory getHandlerFactoryByName(BundleContext bc, String factoryName)
{
+    public static HandlerManagerFactory getHandlerFactoryByName(BundleContext bc, String
factoryName) {
         ServiceReference[] refs;
         try {
             refs = bc.getServiceReferences(Factory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY
+ "=" + factoryName + ")");
@@ -58,7 +58,7 @@
                 System.err.println("Cannot get the factory " + factoryName);
                 return null;
             }
-            return (HandlerFactory) bc.getService(refs[0]);
+            return (HandlerManagerFactory) bc.getService(refs[0]);
         } catch (InvalidSyntaxException e) {
             System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
             return null;

Modified: felix/trunk/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java?rev=656044&r1=656043&r2=656044&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
(original)
+++ felix/trunk/ipojo/tests/tests.core.service.providing/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
Tue May 13 15:54:25 2008
@@ -26,7 +26,7 @@
 import org.apache.felix.ipojo.ComponentInstance;
 import org.apache.felix.ipojo.Factory;
 import org.apache.felix.ipojo.Handler;
-import org.apache.felix.ipojo.HandlerFactory;
+import org.apache.felix.ipojo.HandlerManagerFactory;
 import org.apache.felix.ipojo.ServiceContext;
 //import org.apache.felix.ipojo.composite.CompositeManager;
 import org.osgi.framework.BundleContext;
@@ -51,7 +51,7 @@
         }
     }
 
-    public static HandlerFactory getHandlerFactoryByName(BundleContext bc, String factoryName)
{
+    public static HandlerManagerFactory getHandlerFactoryByName(BundleContext bc, String
factoryName) {
         ServiceReference[] refs;
         try {
             refs = bc.getServiceReferences(Factory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY
+ "=" + factoryName + ")");
@@ -59,7 +59,7 @@
                 System.err.println("Cannot get the factory " + factoryName);
                 return null;
             }
-            return (HandlerFactory) bc.getService(refs[0]);
+            return (HandlerManagerFactory) bc.getService(refs[0]);
         } catch (InvalidSyntaxException e) {
             System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
             return null;



Mime
View raw message