felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r730353 [1/3] - in /felix/trunk/ipojo: composite/src/main/java/org/apache/felix/ipojo/composite/ composite/src/main/java/org/apache/felix/ipojo/composite/instance/ composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiato...
Date Wed, 31 Dec 2008 09:02:57 GMT
Author: clement
Date: Wed Dec 31 01:02:55 2008
New Revision: 730353

URL: http://svn.apache.org/viewvc?rev=730353&view=rev
Log:
- Refactor instance descriptions to fit with the new introspection and reconfiguration API (instances will be reconfigurable directly from their instance description).
- Prepare the moving of junit4osgi (leave the example folder)

Added:
    felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeInstanceDescription.java   (with props)
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java   (with props)
Modified:
    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/instance/InstanceHandler.java
    felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandlerDescription.java
    felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java
    felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/Architecture.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/HandlerDescription.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/InstanceDescription.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyDescription.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandlerDescription.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerDescription.java
    felix/trunk/ipojo/examples/junit4osgi/pom.xml
    felix/trunk/ipojo/examples/pom.xml
    felix/trunk/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/EmptyCompositeTest.java
    felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instance/SimpleInstance.java
    felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/MultipleInstantiation.java
    felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalInstantiation.java
    felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/SimpleInstantiation.java
    felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ConfigurableFooProvider.java
    felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForImmediate.java
    felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForServices.java
    felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForImmediate.java
    felix/trunk/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForService.java
    felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/CallbackTestCase.java
    felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateCallbackSeveralFactoryTest.java
    felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateCallbackSingletonFactoryTest.java
    felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ImmediateCallbackTest.java
    felix/trunk/ipojo/tests/core/lifecycle-callback/src/main/java/org/apache/felix/ipojo/test/scenarios/lifecycle/callback/ParentCallbackTestCase.java
    felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyArchitectureTest.java
    felix/trunk/ipojo/tests/core/service-providing-strategies/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/strategies/CustomStrategyTest.java
    felix/trunk/ipojo/tests/core/service-providing-strategies/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/strategies/PerInstanceStrategyTest.java
    felix/trunk/ipojo/tests/core/service-providing/src/main/java/org/apache/felix/ipojo/test/scenarios/ps/ProvidedServiceArchitectureTest.java
    felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/POJOCreation.java
    felix/trunk/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/GetComponentInstanceTest.java

Added: felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeInstanceDescription.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeInstanceDescription.java?rev=730353&view=auto
==============================================================================
--- felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeInstanceDescription.java (added)
+++ felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeInstanceDescription.java Wed Dec 31 01:02:55 2008
@@ -0,0 +1,91 @@
+/* 
+ * 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.felix.ipojo.composite;
+
+import org.apache.felix.ipojo.ServiceContext;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.architecture.ComponentTypeDescription;
+import org.apache.felix.ipojo.architecture.InstanceDescription;
+import org.apache.felix.ipojo.metadata.Element;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Composite Instance Description.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class CompositeInstanceDescription extends InstanceDescription {
+    
+    /**
+     * Creates a Primitive Instance Description.
+     * @param type the component type description
+     * @param instance the instance description
+     */
+    public CompositeInstanceDescription(ComponentTypeDescription type, CompositeManager instance) {
+        super(type, instance);
+    }
+
+
+    /**
+     * Gets the list of contained instance in the describe instance.
+     * This list contains only instances who exposed their architecture.
+     * @return the list of contained instances.
+     */
+    public InstanceDescription[] getContainedInstances() {
+        // Get instances description of internal instance
+        ServiceContext internal = ((CompositeManager) m_instance).getServiceContext();
+        try {
+            ServiceReference[]refs = internal.getServiceReferences(Architecture.class.getName(), null);
+            if (refs != null) {
+                InstanceDescription[] descs = new InstanceDescription[refs.length];
+                for (int i = 0; i < refs.length; i++) {
+                    Architecture arch = (Architecture) internal.getService(refs[i]);
+                    descs[i] = arch.getInstanceDescription();
+                    internal.ungetService(refs[i]);
+                }
+                return descs;
+            }
+        } catch (InvalidSyntaxException e) {
+            // Cannot happen
+        }
+        return new InstanceDescription[0];
+    }
+
+    
+    /**
+     * Gets the instance description.
+     * Overridden to add created objects.
+     * @return the instance description
+     */
+    public Element getDescription() {
+        Element elem = super.getDescription();
+        // Contained instance (exposing architecture) (empty if primitive)
+        InstanceDescription[] descs = getContainedInstances();
+        if (descs.length > 0) {
+            Element inst = new Element("ContainedInstances", "");
+            for (int i = 0; i < descs.length; i++) {
+                inst.addElement(descs[i].getDescription());
+            }
+            elem.addElement(inst);
+        }
+        return elem;
+    }
+
+}

Propchange: felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeInstanceDescription.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=730353&r1=730352&r2=730353&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 Wed Dec 31 01:02:55 2008
@@ -25,17 +25,15 @@
 import org.apache.felix.ipojo.ComponentFactory;
 import org.apache.felix.ipojo.ComponentInstance;
 import org.apache.felix.ipojo.ConfigurationException;
+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.InstanceStateListener;
 import org.apache.felix.ipojo.ServiceContext;
-import org.apache.felix.ipojo.architecture.Architecture;
 import org.apache.felix.ipojo.architecture.InstanceDescription;
 import org.apache.felix.ipojo.metadata.Element;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
 
 /**
  * iPOJO Composite manager. The composite manager class manages one instance of
@@ -72,6 +70,11 @@
     private CompositeServiceContext m_internalContext;
     
     /**
+     * The instance description.
+     */
+    private final CompositeInstanceDescription m_description;
+    
+    /**
      * Name of the component instance.
      */
     private String m_name;
@@ -93,6 +96,8 @@
         // Initialize the service context.
         m_internalContext = new CompositeServiceContext(m_context, this);
         m_handlers = handlers;
+        m_description = new CompositeInstanceDescription(m_factory.getComponentDescription(), this);
+
     }
 
     /**
@@ -209,27 +214,7 @@
      * @see org.apache.felix.ipojo.ComponentInstance#getInstanceDescription()
      */
     public InstanceDescription getInstanceDescription() {
-        InstanceDescription desc = new InstanceDescription(m_name, m_state, getContext().getBundle().getBundleId(), m_factory.getComponentDescription());
-        CompositeHandler[] handlers = getRegistredCompositeHandlers();
-        for (int i = 0; i < handlers.length; i++) {
-            desc.addHandler(handlers[i].getDescription());
-        }
-
-        // Get instances description of internal instance
-        ServiceReference[] refs;
-        try {
-            refs = m_internalContext.getServiceReferences(Architecture.class.getName(), null);
-            if (refs != null) {
-                for (int i = 0; i < refs.length; i++) {
-                    Architecture arch = (Architecture) m_internalContext.getService(refs[i]);
-                    desc.addInstance(arch.getInstanceDescription());
-                    m_internalContext.ungetService(refs[i]);
-                }
-            }
-        } catch (InvalidSyntaxException e) {
-            // Cannot happen
-        }
-        return desc;
+        return m_description;
     }
 
     /**
@@ -350,6 +335,12 @@
         m_state = INVALID;
 
         m_internalContext.start(); // Turn on the factory tracking
+        
+        // Plug handler descriptions
+        Handler[] handlers = getRegistredCompositeHandlers();
+        for (int i = 0; i < handlers.length; i++) {
+            m_description.addHandler(handlers[i].getDescription());
+        }
 
         for (int i = 0; i < m_handlers.length; i++) {
             m_handlers[i].start();

Modified: felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandler.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandler.java (original)
+++ felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandler.java Wed Dec 31 01:02:55 2008
@@ -54,6 +54,11 @@
      */
     private Factory[] m_factories;
     
+    /**
+     * Handler description.
+     */
+    private InstanceHandlerDescription m_description;
+    
 
     /**
      * This structure aims to manage a configuration. It stores all necessary
@@ -238,6 +243,8 @@
             }
             m_configurations[i] = new ManagedConfiguration(conf);
         }
+        
+        m_description = new InstanceHandlerDescription(this, m_configurations);
     }
 
     /**
@@ -380,11 +387,7 @@
      * @see org.apache.felix.ipojo.CompositeHandler#getDescription()
      */
     public HandlerDescription getDescription() {
-        List list = new ArrayList();
-        for (int i = 0; i < m_configurations.length; i++) {
-            list.add(m_configurations[i]);
-        }
-        return new InstanceHandlerDescription(this, list);
+        return m_description;
     }
 
     /**

Modified: felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandlerDescription.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandlerDescription.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandlerDescription.java (original)
+++ felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandlerDescription.java Wed Dec 31 01:02:55 2008
@@ -18,8 +18,6 @@
  */
 package org.apache.felix.ipojo.composite.instance;
 
-import java.util.List;
-
 import org.apache.felix.ipojo.ComponentInstance;
 import org.apache.felix.ipojo.architecture.HandlerDescription;
 import org.apache.felix.ipojo.composite.CompositeHandler;
@@ -34,10 +32,11 @@
  */
 public class InstanceHandlerDescription extends HandlerDescription {
 
+  
     /**
      * List of managed instances.
      */
-    private List m_instances;
+    private ManagedConfiguration[] m_configurations; 
 
     /**
      * Constructor.
@@ -45,9 +44,9 @@
      * @param handler : handler
      * @param insts : list of component instances
      */
-    public InstanceHandlerDescription(CompositeHandler handler, List insts) {
+    public InstanceHandlerDescription(CompositeHandler handler, ManagedConfiguration[] insts) {
         super(handler);
-        m_instances = insts;
+        m_configurations = insts;
     }
 
     /**
@@ -57,8 +56,8 @@
      */
     public Element getHandlerInfo() {
         Element instances = super.getHandlerInfo();
-        for (int i = 0; i < m_instances.size(); i++) {
-            ManagedConfiguration inst = (ManagedConfiguration) m_instances.get(i);
+        for (int i = 0; i < m_configurations.length; i++) {
+            ManagedConfiguration inst = m_configurations[i];
             Element instance = new Element("Instance", "");
             if (inst.getInstance() == null) { 
                 instance.addAttribute(new Attribute("Factory", inst.getConfiguration().get("component").toString()));

Modified: felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java (original)
+++ felix/trunk/ipojo/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java Wed Dec 31 01:02:55 2008
@@ -61,6 +61,11 @@
      * Flag indicating if the handler has already finished the start method.
      */
     private boolean m_isStarted;
+    
+    /**
+     * The handler description.
+     */
+    private ServiceInstantiatorDescription m_description;
 
     /**
      * Source Managers.
@@ -228,10 +233,9 @@
             } else {
                 throw new ConfigurationException("Unknown action : " + action);
             }
-            
-            
-
         }
+        
+        m_description = new ServiceInstantiatorDescription(this, m_instances, m_importers);
     }
 
     /**
@@ -358,7 +362,7 @@
      * @see org.apache.felix.ipojo.CompositeHandler#getDescription()
      */
     public HandlerDescription getDescription() {
-        return new ServiceInstantiatorDescription(this, m_instances, m_importers);
+        return m_description;
     }
     
     public List getInstances() {

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=730353&r1=730352&r2=730353&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 Wed Dec 31 01:02:55 2008
@@ -80,6 +80,11 @@
      * List of component type.
      */
     private List m_types;
+    
+    /**
+     * Handler description.
+     */
+    private ProvidedServiceHandlerDescription m_description;
 
     /**
      * Initialize the component type.
@@ -163,6 +168,8 @@
                 m_exporters.add(imp);
             } // Others case cannot happen. The test was already made during the factory initialization.
         }
+        
+        m_description = new ProvidedServiceHandlerDescription(this, m_services, m_exporters);
 
     }
 
@@ -474,7 +481,7 @@
     }
 
     public HandlerDescription getDescription() {
-        return new ProvidedServiceHandlerDescription(this, m_managedServices, m_exporters);
+        return m_description;
     }
 
     /**

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java Wed Dec 31 01:02:55 2008
@@ -77,6 +77,11 @@
      * The instance factory.
      */
     private final ComponentFactory m_factory;
+    
+    /**
+     * The instance description.
+     */
+    private final PrimitiveInstanceDescription m_description;
 
     /**
      * The bundle context of the instance.
@@ -146,6 +151,7 @@
         m_factory = factory;
         m_context = context;
         m_handlers = handlers;
+        m_description = new PrimitiveInstanceDescription(m_factory.getComponentDescription(), this);
     }
 
     /**
@@ -177,25 +183,7 @@
      * @see org.apache.felix.ipojo.ComponentInstance#getInstanceDescription()
      */
     public InstanceDescription getInstanceDescription() {
-        int componentState = getState();
-        InstanceDescription desc =
-                new InstanceDescription(m_name, componentState, getContext().getBundle().getBundleId(), m_factory.getComponentDescription());
-
-        synchronized (this) { // Must be synchronized, it access to the m_pojoObjects list.
-            if (m_pojoObjects != null) {
-                String[] objects = new String[m_pojoObjects.size()];
-                for (int i = 0; i < m_pojoObjects.size(); i++) {
-                    objects[i] = m_pojoObjects.get(i).toString();
-                }
-                desc.setCreatedObjects(objects);
-            }
-        }
-
-        Handler[] handlers = getRegistredHandlers();
-        for (int i = 0; i < handlers.length; i++) {
-            desc.addHandler(handlers[i].getDescription());
-        }
-        return desc;
+        return m_description;
     }
 
     /**
@@ -295,6 +283,12 @@
             }
         }
         
+        // Plug handler descriptions
+        Handler[] handlers = getRegistredHandlers();
+        for (int i = 0; i < handlers.length; i++) {
+            m_description.addHandler(handlers[i].getDescription());
+        }
+        
         for (int i = 0; i < m_handlers.length; i++) {
             m_handlers[i].addInstanceStateListener(this);
             try {

Added: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java?rev=730353&view=auto
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java (added)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java Wed Dec 31 01:02:55 2008
@@ -0,0 +1,79 @@
+/* 
+ * 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.felix.ipojo;
+
+import org.apache.felix.ipojo.architecture.ComponentTypeDescription;
+import org.apache.felix.ipojo.architecture.InstanceDescription;
+import org.apache.felix.ipojo.metadata.Attribute;
+import org.apache.felix.ipojo.metadata.Element;
+
+/**
+ * Primitive Instance Description.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class PrimitiveInstanceDescription extends InstanceDescription {
+    
+    /**
+     * Creates a Primitive Instance Description.
+     * @param type the component type description
+     * @param instance the instance description
+     */
+    public PrimitiveInstanceDescription(ComponentTypeDescription type, InstanceManager instance) {
+        super(type, instance);
+    }
+
+    /**
+     * Gets the list of object created by the described instance.
+     * @return the created objects.
+     */
+    public String[] getCreatedObjects() {
+        // TODO should get a copy
+        Object [] objs = ((InstanceManager) m_instance).getPojoObjects();
+        if (objs != null) {
+            String[] result = new String[objs.length];
+            for (int i = 0; i < objs.length; i++) {
+                result[i] = objs[i].toString();
+            }
+            return result;
+        } else {
+            return new String[0];
+        }
+    }
+    
+    /**
+     * Gets the instance description.
+     * Overridden to add created objects.
+     * @return the instance description
+     */
+    public Element getDescription() {
+        Element elem = super.getDescription();
+        // Created Object (empty is composite)
+        String[] objs = getCreatedObjects();
+        for (int i = 0; i < objs.length; i++) {
+            Element obj = new Element("Object", "");
+            obj.addAttribute(new Attribute("name", ((Object) objs[i]).toString()));
+            elem.addElement(obj);
+        }
+        return elem;
+    }
+    
+    
+
+}

Propchange: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/Architecture.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/Architecture.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/Architecture.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/Architecture.java Wed Dec 31 01:02:55 2008
@@ -28,7 +28,7 @@
 
     /**
      * Returns the description of the instance.
-     * @return the current component instance description
+     * @return the component instance description
      */
     InstanceDescription getInstanceDescription();
 

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/HandlerDescription.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/HandlerDescription.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/HandlerDescription.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/HandlerDescription.java Wed Dec 31 01:02:55 2008
@@ -19,6 +19,7 @@
 package org.apache.felix.ipojo.architecture;
 
 import org.apache.felix.ipojo.Handler;
+import org.apache.felix.ipojo.HandlerFactory;
 import org.apache.felix.ipojo.metadata.Attribute;
 import org.apache.felix.ipojo.metadata.Element;
 
@@ -30,49 +31,51 @@
 public class HandlerDescription {
 
     /**
-     * Handler Class Name (i.e namespace).
+     * The Handler Qualified Name.
      */
     private String m_handlerName;
 
+
     /**
-     * Is the handler valid.
+     * The described handler instance.
      */
-    private boolean m_isValid;
+    private Handler m_handler;
 
     /**
-     * Constructor.
-     * 
-     * @param handler : handler.
+     * Creates a handler description.
+     * @param handler the handler.
      */
     public HandlerDescription(Handler handler) {
-        m_handlerName = handler.getClass().getName();
-        m_isValid = handler.isValid();
+        HandlerFactory factory = (HandlerFactory) handler.getHandlerManager().getFactory();
+        m_handlerName = factory.getHandlerName();
+        m_handler = handler;
     }
 
     /**
-     * Check if the handler is valid.
+     * Checks if the handler is valid.
      * @return true if the handler is valid.
      */
     public boolean isValid() {
-        return m_isValid;
+        return m_handler.isValid();
     }
 
     /**
-     * Get the handler name.
-     * @return the handler name (i.e. namespace).
+     * Gets the handler name.
+     * @return the handler qualified name (i.e. namespace:name).
      */
     public String getHandlerName() {
         return m_handlerName;
     }
 
     /**
-     * Get handler information.
+     * Gets handler information.
+     * This represent the actual state of the handler.
      * @return the handler information.
      */
     public Element getHandlerInfo() {
         Element elem = new Element("Handler", "");
         elem.addAttribute(new Attribute("name", m_handlerName));
-        if (m_isValid) {
+        if (isValid()) {
             elem.addAttribute(new Attribute("state", "valid"));
         } else {
             elem.addAttribute(new Attribute("state", "invalid"));

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/InstanceDescription.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/InstanceDescription.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/InstanceDescription.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/architecture/InstanceDescription.java Wed Dec 31 01:02:55 2008
@@ -19,6 +19,7 @@
 package org.apache.felix.ipojo.architecture;
 
 import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.InstanceStateListener;
 import org.apache.felix.ipojo.metadata.Attribute;
 import org.apache.felix.ipojo.metadata.Element;
 
@@ -27,87 +28,45 @@
  * 
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class InstanceDescription {
-
-    /**
-     * The name of the component (instance).
-     */
-    private String m_name;
-
-    /**
-     * Handlers of the component instance.
-     */
-    private HandlerDescription[] m_handlers = new HandlerDescription[0];
-
-    /**
-     * Created Instances of the components.
-     */
-    private String[] m_createdObjects = new String[0];
-
+public class InstanceDescription implements InstanceStateListener {
+   
     /**
-     * State of the component (VALID / UNRESOLVED).
+     * The list of handlers plugged on the component instance.
      */
-    private int m_state;
-
+    protected HandlerDescription[] m_handlers = new HandlerDescription[0];
+    
     /**
-     * BundleId who create the instance.
+     * The Underlying component instance.
      */
-    private long m_bundleId;
+    protected ComponentInstance m_instance;
 
     /**
      * Component Type of the instance.
      */
-    private ComponentTypeDescription m_type;
+    protected ComponentTypeDescription m_type;
 
     /**
-     * Contained instance list.
+     * Creates the instance description.
+     * @param ci  the state of the instance.
+     * @param desc  the component type description of this instance.
      */
-    private InstanceDescription[] m_containedInstances = new InstanceDescription[0];
-
-    /**
-     * Constructor.
-     * 
-     * @param name : the name of the component instance.
-     * @param state : the state of the instance.
-     * @param bundleId : bundle id owning this instance.
-     * @param desc : the component type description of this instance.
-     */
-    public InstanceDescription(String name, int state, long bundleId, ComponentTypeDescription desc) {
-        m_name = name;
-        m_state = state;
-        m_createdObjects = new String[0];
+    public InstanceDescription(ComponentTypeDescription desc, ComponentInstance ci) {
         m_handlers = new HandlerDescription[0];
-        m_containedInstances = new InstanceDescription[0];
-        m_bundleId = bundleId;
         m_type = desc;
+        m_instance = ci;
+        m_instance.addInstanceStateListener(this);
     }
 
     /**
-     * Get the instance name.
+     * Gets the instance name.
      * @return the name of the instance.
      */
     public String getName() {
-        return m_name;
-    }
-
-    /**
-     * Get the list of object created by the described instance.
-     * @return the created instances
-     */
-    public String[] getCreatedObjects() {
-        return m_createdObjects;
+        return m_instance.getInstanceName();
     }
 
     /**
-     * Set the array of objects created by the described instance.
-     * @param objects : the list of create objects.
-     */
-    public void setCreatedObjects(String[] objects) {
-        m_createdObjects = objects;
-    }
-
-    /**
-     * Get the component type description of the described instance.
+     * Gets the component type description of the described instance.
      * @return : the component type description of this instance.
      */
     public ComponentTypeDescription getComponentDescription() {
@@ -115,7 +74,7 @@
     }
 
     /**
-     * Get the plugged handler list.
+     * Gets the plugged handler list.
      * @return the live handler list
      */
     public HandlerDescription[] getHandlers() {
@@ -123,7 +82,7 @@
     }
 
     /**
-     * Add an handler description to the list.
+     * Adds an handler description to the list.
      * @param desc : the handler description to add
      */
     public void addHandler(HandlerDescription desc) {
@@ -140,82 +99,61 @@
         newHd[m_handlers.length] = desc;
         m_handlers = newHd;
     }
-
+    
     /**
-     * Add an instance description to the contained instance list.
-     * 
-     * @param inst : the handler description to add
+     * Gets a handler description by specifying the handler qualified name.
+     * @param handler the handler name
+     * @return the handler description or <code>null</code> if not found
      */
-    public void addInstance(InstanceDescription inst) {
-        // Verify that the dependency description is not already in the array.
-        for (int i = 0; i < m_containedInstances.length; i++) {
-            if (m_containedInstances[i].getName().equals(inst.getName())) {
-                return; // NOTHING TO DO, the description is already in the array
+    public HandlerDescription getHandlerDescription(String handler) {
+        for (int i = 0; i < m_handlers.length; i++) {
+            if (m_handlers[i].getHandlerName().equals(handler)) {
+                return m_handlers[i];
             }
         }
-        // The component Description is not in the array, add it
-        InstanceDescription[] newCi = new InstanceDescription[m_containedInstances.length + 1];
-        System.arraycopy(m_containedInstances, 0, newCi, 0, m_containedInstances.length);
-        newCi[m_containedInstances.length] = inst;
-        m_containedInstances = newCi;
+        return null;
     }
 
     /**
-     * Set the state of the component.
-     * 
-     * @param state : the state
-     */
-    public void setState(int state) {
-        m_state = state;
-    }
-
-    /**
-     * Get the state of the described instance.
+     * Gets the state of the described instance.
      * @return the state of the instance.
      */
     public int getState() {
-        return m_state;
+        waitForStability();
+        return m_instance.getState();
     }
 
     /**
-     * Get the bundle id of the bundle containing the described instance.
+     * Gets the bundle id of the bundle containing the component type of the instance.
      * @return the bundle id owning the component implementation class.
      */
     public long getBundleId() {
-        return m_bundleId;
-    }
-
-    /**
-     * Get the list of contained instance in the describe instance.
-     * This list contains only instances who exposed their architecture.
-     * @return the list of contained instances.
-     */
-    public InstanceDescription[] getContainedInstances() {
-        return m_containedInstances;
+        return m_instance.getFactory().getBundleContext().getBundle().getBundleId();
     }
 
     /**
-     * Get the instance description.
+     * Gets the instance description.
      * @return the instance description
      */
     public Element getDescription() {
         Element instance = new Element("Instance", "");
         instance.addAttribute(new Attribute("name", getName())); // Name
-        // State
-        if (m_state == ComponentInstance.STOPPED) {
+        
+        int state = getState();
+        if (state == ComponentInstance.STOPPED) {
             instance.addAttribute(new Attribute("state", "stopped"));
         }
-        if (m_state == ComponentInstance.VALID) {
+        if (state == ComponentInstance.VALID) {
             instance.addAttribute(new Attribute("state", "valid"));
         }
-        if (m_state == ComponentInstance.INVALID) {
+        if (state == ComponentInstance.INVALID) {
             instance.addAttribute(new Attribute("state", "invalid"));
         }
-        if (m_state == ComponentInstance.DISPOSED) {
+        if (state == ComponentInstance.DISPOSED) {
             instance.addAttribute(new Attribute("state", "disposed"));
         }
         // Bundle
-        instance.addAttribute(new Attribute("bundle", Long.toString(m_bundleId)));
+        instance.addAttribute(new Attribute("bundle", Long.toString(getBundleId())));
 
         // Component Type
         instance.addAttribute(new Attribute("component.type", m_type.getName()));
@@ -224,22 +162,33 @@
         for (int i = 0; i < m_handlers.length; i++) {
             instance.addElement(m_handlers[i].getHandlerInfo());
         }
-        // Created Object (empty is composite)
-        for (int i = 0; i < m_createdObjects.length; i++) {
-            Element obj = new Element("Object", "");
-            obj.addAttribute(new Attribute("name", ((Object) m_createdObjects[i]).toString()));
-            instance.addElement(obj);
-        }
-        // Contained instance (exposing architecture) (empty if primitive)
-        if (m_containedInstances.length > 0) {
-            Element inst = new Element("ContainedInstances", "");
-            for (int i = 0; i < m_containedInstances.length; i++) {
-                inst.addElement(m_containedInstances[i].getDescription());
+
+        return instance;
+
+    }
+
+    /**
+     * Waits for state stability before returning results.
+     */
+    private synchronized void waitForStability() {
+        while (m_instance.getState() == -2) { // Transition
+            try {
+                wait();
+            } catch (InterruptedException e) {
+               // We're interrupted, will re-check the condition.
             }
-            instance.addElement(inst);
         }
-        return instance;
+        
+    }
 
+    /**
+     * The underlying instance state changes.
+     * @param instance the instance
+     * @param newState the new state
+     * @see org.apache.felix.ipojo.InstanceStateListener#stateChanged(org.apache.felix.ipojo.ComponentInstance, int)
+     */
+    public synchronized void stateChanged(ComponentInstance instance, int newState) {
+        notifyAll(); // if we was in a transition, the transition is now done.
     }
 
 }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyDescription.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyDescription.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyDescription.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyDescription.java Wed Dec 31 01:02:55 2008
@@ -27,134 +27,51 @@
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class DependencyDescription {
-
-    /**
-     * Required Service Interface.
-     */
-    private String m_interface;
-    
-    /**
-     * Dependency Id.
-     */
-    private String m_id;
-
-    /**
-     * Is the dependency aggregate?
-     */
-    private boolean m_aggregate;
-
-    /**
-     * Is the dependency optional ?
-     */
-    private boolean m_optional;
-    
-    /**
-     * Binding policy used by this service dependency.
-     */
-    private int m_bindingPolicy;
-    
-    /**
-     * Does the dependency use a nullable object?
-     */
-    private boolean m_useNullable;
-    
-    /**
-     * Does the dependency use a default-implementation? 
-     */
-    private String m_defaultImplementation;
-
     /**
-     * State (VALID | INVALID).
+     * The described dependency.
      */
-    private int m_state;
-
-    /**
-     * Dependency Filter.
-     */
-    private String m_filter;
-    
-    /**
-     * Is the provider set frozen ?
-     */
-    private boolean m_isFrozen;
-    
-    /**
-     * Comparator used by the dependency.
-     * Null means OSGi default comparator.
-     */
-    private String m_comparator;
-
-    /**
-     * List of used service references.
-     */
-    private List m_usedServices;
-
-    /**
-     * List of matching service references.
-     */
-    private List m_serviceReferences;
+    private Dependency m_dependency;
 
     /**
      * Creates a dependency description.
-     * @param itf the needed interface
-     * @param id the dependency id.
-     * @param multiple is the dependency a multiple dependency ?
-     * @param optional is the dependency optional ?
-     * @param filter the filter
-     * @param policy binding policy
-     * @param nullable does the dependency support nullable object
-     * @param defaultImpl does the dependency use a default implementation
-     * @param comparator does the dependency use a special comparator
-     * @param frozen is the provider set frozen
-     * @param state the state
-     */
-    public DependencyDescription(String itf, String id, boolean multiple, boolean optional, String filter, int policy, boolean nullable, String defaultImpl, String comparator, boolean frozen, int state) {
-        super();
-        m_interface = itf;
-        m_id = id;
-        m_aggregate = multiple;
-        m_optional = optional;
-        m_filter = filter;
-        m_state = state;
-        m_bindingPolicy = policy;
-        m_useNullable = nullable;
-        m_defaultImplementation = defaultImpl;
-        m_comparator = comparator;
-        m_isFrozen = frozen;
+     * @param dep the described dependency
+     */
+    public DependencyDescription(Dependency dep) {
+        m_dependency = dep;
     }
 
-    public boolean isMultiple() { return m_aggregate; }
+    public boolean isMultiple() { return m_dependency.isAggregate(); }
 
-    public boolean isOptional() { return m_optional; }
+    public boolean isOptional() { return m_dependency.isOptional(); }
 
-    public String getFilter() { return m_filter; }
+    public String getFilter() { return m_dependency.getFilter(); }
 
-    public String getInterface() { return m_interface; }
+    public String getInterface() { return m_dependency.getSpecification().getName(); }
 
-    public int getState() { return m_state; }
+    public int getState() { return m_dependency.getState(); }
     
-    public String getId() { return m_id; }
+    public String getId() { return m_dependency.getId(); }
     
     /**
-     * Gets true if the dependency uses Nullable objects.
+     * Gets <code>true</code> if the dependency uses Nullable objects.
      * @return true if the dependency is optional and supports nullable object.
      */
-    public boolean supportsNullable() { return m_useNullable; }
+    public boolean supportsNullable() { return m_dependency.supportsNullable(); }
     
-    public String getDefaultImplementation() { return m_defaultImplementation; }
+    public String getDefaultImplementation() { return m_dependency.getDefaultImplementation(); }
     
-    public int getPolicy() { return m_bindingPolicy; }
+    public int getPolicy() { return m_dependency.getBindingPolicy(); }
     
-    public String getComparator() { return m_comparator; }
+    public String getComparator() { return m_dependency.getComparator(); }
     
-    public boolean isFrozen() { return m_isFrozen; }
+    public boolean isFrozen() { return m_dependency.isFrozen(); }
 
     /**
      * Gets the service reference list.
      * @return the list of matching service reference,
      * null if no service reference.
      */
-    public List getServiceReferences() { return m_serviceReferences; }
+    public List getServiceReferences() { return m_dependency.getServiceReferencesAsList(); }
 
     /**
      * Gets the service reference if only one service reference is used.
@@ -162,34 +79,19 @@
      * or null if no service reference.
      */
     public ServiceReference getServiceReference() { 
-        if (m_serviceReferences == null) {
+        List list = getServiceReferences();
+        if (list == null) {
             return null;
         } else {
-            return (ServiceReference) m_serviceReferences.get(0);
+            return (ServiceReference) list.get(0);
         }
     }
 
     /**
-     * Sets the service reference array.
-     * @param refs : the list of service reference
-     */
-    public void setServiceReferences(List refs) { m_serviceReferences = refs; }
-
-    /**
      * Gets the used service set.
      * @return the list [service reference] containing the used services,
      * null if no providers are used
      */
-    public List getUsedServices() { return m_usedServices; }
-
-    /**
-     * Sets the usedServices.
-     * @param usages : the list of used service reference.
-     */
-    public void setUsedServices(List usages) {
-        m_usedServices = usages;
-    }
-
-
+    public List getUsedServices() { return m_dependency.getUsedServiceReferences(); }
 
 }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java Wed Dec 31 01:02:55 2008
@@ -75,6 +75,11 @@
      * Is the handler started.
      */
     private boolean m_started;
+    
+    /**
+     * The handler description.
+     */
+    private DependencyHandlerDescription m_description;
 
     /**
      * Add a dependency.
@@ -435,6 +440,8 @@
                 }
             }
         }
+        
+        m_description = new DependencyHandlerDescription(this, m_dependencies); // Initialize the description.
     }
 
     /**
@@ -445,6 +452,7 @@
         // Start the dependencies
         for (int i = 0; i < m_dependencies.length; i++) {
             Dependency dep = m_dependencies[i];
+           
             dep.start();
         }
         // Check the state
@@ -481,17 +489,7 @@
      * @see org.apache.felix.ipojo.Handler#getDescription()
      */
     public HandlerDescription getDescription() {
-        DependencyHandlerDescription dhd = new DependencyHandlerDescription(this);
-        for (int j = 0; j < getDependencies().length; j++) {
-            Dependency dep = getDependencies()[j];
-            // Create & add the dependency description
-            DependencyDescription desc =
-                    new DependencyDescription(dep.getSpecification().getName(), dep.getId(), dep.isAggregate(), dep.isOptional(), dep.getFilter(), dep.getBindingPolicy(), dep.supportsNullable(), dep.getDefaultImplementation(), dep.getComparator(), dep.isFrozen(), dep.getState());
-            desc.setServiceReferences(dep.getServiceReferencesAsList());
-            desc.setUsedServices(dep.getUsedServiceReferences());
-            dhd.addDependency(desc);
-        }
-        return dhd;
+        return m_description;
     }
 
 }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandlerDescription.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandlerDescription.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandlerDescription.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandlerDescription.java Wed Dec 31 01:02:55 2008
@@ -21,7 +21,6 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.felix.ipojo.Handler;
 import org.apache.felix.ipojo.architecture.HandlerDescription;
 import org.apache.felix.ipojo.metadata.Attribute;
 import org.apache.felix.ipojo.metadata.Element;
@@ -42,11 +41,16 @@
     private DependencyDescription[] m_dependencies = new DependencyDescription[0];
 
     /**
-     * Constructor.
-     * @param handler : Handler.
+     * Creates the Dependency Handler description.
+     * @param handler the Dependency Handler.
+     * @param deps the Dependencies
      */
-    public DependencyHandlerDescription(Handler handler) {
+    public DependencyHandlerDescription(DependencyHandler handler, Dependency[] deps) {
         super(handler);
+        m_dependencies = new DependencyDescription[deps.length];
+        for (int i = 0; i < m_dependencies.length; i++) {
+            m_dependencies[i] = new DependencyDescription(deps[i]);
+        }
     }
 
     /**
@@ -58,27 +62,7 @@
     }
 
     /**
-     * Add a dependency.
-     * 
-     * @param dep : the dependency to add
-     */
-    public void addDependency(DependencyDescription dep) {
-        // Verify that the dependency description is not already in the array.
-        for (int i = 0; i < m_dependencies.length; i++) {
-            if (m_dependencies[i] == dep) {
-                return; // NOTHING TO DO, the description is already in the
-                        // array
-            }
-        }
-        // The component Description is not in the array, add it
-        DependencyDescription[] newDep = new DependencyDescription[m_dependencies.length + 1];
-        System.arraycopy(m_dependencies, 0, newDep, 0, m_dependencies.length);
-        newDep[m_dependencies.length] = dep;
-        m_dependencies = newDep;
-    }
-
-    /**
-     * Build Dependency Handler description.
+     * Builds the Dependency Handler description.
      * @return the handler description.
      * @see org.apache.felix.ipojo.architecture.HandlerDescription#getHandlerInfo()
      */

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.java Wed Dec 31 01:02:55 2008
@@ -20,6 +20,7 @@
 
 import java.util.Properties;
 
+import org.apache.felix.ipojo.util.Property;
 import org.osgi.framework.ServiceReference;
 
 /**
@@ -32,51 +33,24 @@
     /**
      * State : the service is unregistered.
      */
-    public static final int UNREGISTERED = 0;
+    public static final int UNREGISTERED = ProvidedService.UNREGISTERED;
 
     /**
      * State : the service is registered.
      */
-    public static final int REGISTERED = 1;
-
-    /**
-     * Provided Service Specification.
-     */
-    private String[] m_serviceSpecification;
-
-    /**
-     * State.
-     */
-    private int m_state;
-
-    /**
-     * The service reference.
-     */
-    private ServiceReference m_serviceReference;
-
-    // /**
-    // * Handler on the component description who contains this description.
-    // */
-    // private InstanceDescription m_parent;
-
+    public static final int REGISTERED = ProvidedService.REGISTERED;
+    
     /**
-     * Properties of the provided service.
+     * The describe provided service.
      */
-    private Properties m_properties = new Properties();
+    private ProvidedService m_ps;
 
     /**
      * Constructor.
-     * 
-     * @param serviceSpecification : the provided contract
-     * @param state : state (UNREGITRED | REGISTRED)
-     * @param ref : Service Registration (to obtain the reference), or null if
-     * state is UNREGISTRED
-     */
-    public ProvidedServiceDescription(String[] serviceSpecification, int state, ServiceReference ref) {
-        m_serviceSpecification = serviceSpecification;
-        m_state = state;
-        m_serviceReference = ref;
-        // m_parent = parent;
+     * @param ps the described provided service.
+     */
+    public ProvidedServiceDescription(ProvidedService ps) {
+        m_ps = ps;
     }
 
     /**
@@ -84,34 +58,23 @@
      * @return the provided contract name.
      */
     public String[] getServiceSpecification() {
-        return m_serviceSpecification;
-    }
-
-    /**
-     * Add a property to the current provided service description.
-     * 
-     * @param key : the key of the property
-     * @param value : the value of the property
-     */
-    public void addProperty(String key, String value) {
-        m_properties.put(key, value);
-    }
-
-    /**
-     * Set the set of properties. This function create a clone of the argument.
-     * 
-     * @param props : the properties
-     */
-    public void setProperty(Properties props) {
-        m_properties = props;
+        return m_ps.getServiceSpecifications();
     }
 
     /**
-     * Get the list of properties.
+     * Gets the list of properties.
+     * A copy of the actual property set is returned.
      * @return the properties.
      */
     public Properties getProperties() {
-        return m_properties;
+        Properties props = new Properties();
+        org.apache.felix.ipojo.util.Property[] ps = m_ps.getProperties();
+        for (int i = 0; i < ps.length; i++) {
+            if (ps[i].getValue() != Property.NO_VALUE) {
+                props.put(ps[i].getName(), ps[i].getValue());
+            }
+        }
+        return props;
     }
 
     /**
@@ -119,15 +82,15 @@
      * @return the state of the provided service (UNREGISTERED | REGISTRED).
      */
     public int getState() {
-        return m_state;
+        return m_ps.getState();
     }
 
     /**
      * Get the service reference.
-     * @return the service reference (null if the service is unregistred).
+     * @return the service reference (null if the service is unregistered).
      */
     public ServiceReference getServiceReference() {
-        return m_serviceReference;
+        return m_ps.getServiceReference();
     }
 
 }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java Wed Dec 31 01:02:55 2008
@@ -23,7 +23,6 @@
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Properties;
 import java.util.Set;
 
 import org.apache.felix.ipojo.ConfigurationException;
@@ -56,6 +55,11 @@
      * The list of the provided service.
      */
     private ProvidedService[] m_providedServices = new ProvidedService[0];
+    
+    /**
+     * The handler description.
+     */
+    private ProvidedServiceHandlerDescription m_description;
 
     /**
      * Add a provided service to the list .
@@ -173,6 +177,9 @@
                 }
                 throw new ConfigurationException("The provided service" + itfs + " is not valid");                
             }
+            
+            // Initialize the description.
+            m_description = new ProvidedServiceHandlerDescription(this, m_providedServices);
 
         }
     }
@@ -466,23 +473,7 @@
      * @see org.apache.felix.ipojo.Handler#getDescription()
      */
     public HandlerDescription getDescription() {
-        ProvidedServiceHandlerDescription pshd = new ProvidedServiceHandlerDescription(this);
-
-        for (int j = 0; j < getProvidedServices().length; j++) {
-            ProvidedService svc = getProvidedServices()[j];
-            ProvidedServiceDescription psd = new ProvidedServiceDescription(svc.getServiceSpecifications(), svc.getState(), svc.getServiceReference());
-
-            Properties props = new Properties();
-            for (int k = 0; k < svc.getProperties().length; k++) {
-                Property prop = svc.getProperties()[k];
-                if (prop.getValue() != null  && prop.getValue() != Property.NO_VALUE) {
-                    props.put(prop.getName(), prop.getValue().toString());
-                }
-            }
-            psd.setProperty(props);
-            pshd.addProvidedService(psd);
-        }
-        return pshd;
+        return m_description;
     }
 
     /**

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerDescription.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerDescription.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerDescription.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerDescription.java Wed Dec 31 01:02:55 2008
@@ -20,7 +20,6 @@
 
 import java.util.Iterator;
 
-import org.apache.felix.ipojo.Handler;
 import org.apache.felix.ipojo.architecture.HandlerDescription;
 import org.apache.felix.ipojo.metadata.Attribute;
 import org.apache.felix.ipojo.metadata.Element;
@@ -37,13 +36,18 @@
      * Provided Service Description list.
      */
     private ProvidedServiceDescription[] m_providedServices = new ProvidedServiceDescription[0];
-
+   
     /**
      * Constructor.
-     * @param handler : handler.
+     * @param handler the handler.
+     * @param pss the list of provided service
      */
-    public ProvidedServiceHandlerDescription(Handler handler) {
+    public ProvidedServiceHandlerDescription(ProvidedServiceHandler handler, ProvidedService[] pss) {
         super(handler);
+        m_providedServices = new ProvidedServiceDescription[pss.length];
+        for (int i = 0; i < pss.length; i++) {
+            m_providedServices[i] = new ProvidedServiceDescription(pss[i]);
+        }
     }
 
     /**
@@ -55,27 +59,6 @@
     }
 
     /**
-     * Add a provided service.
-     * 
-     * @param pds : the provided service to add
-     */
-    public void addProvidedService(ProvidedServiceDescription pds) {
-        // Verify that the provided service description is not already in the
-        // array.
-        for (int i = 0; i < m_providedServices.length; i++) {
-            if (m_providedServices[i] == pds) {
-                return; // NOTHING DO DO, the description is already in the
-                        // array
-            }
-        }
-        // The component Description is not in the array, add it
-        ProvidedServiceDescription[] newPSD = new ProvidedServiceDescription[m_providedServices.length + 1];
-        System.arraycopy(m_providedServices, 0, newPSD, 0, m_providedServices.length);
-        newPSD[m_providedServices.length] = pds;
-        m_providedServices = newPSD;
-    }
-
-    /**
      * Build the provided service handler description.
      * @return the handler description.
      * @see org.apache.felix.ipojo.architecture.HandlerDescription#getHandlerInfo()

Modified: felix/trunk/ipojo/examples/junit4osgi/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/examples/junit4osgi/pom.xml?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/examples/junit4osgi/pom.xml (original)
+++ felix/trunk/ipojo/examples/junit4osgi/pom.xml Wed Dec 31 01:02:55 2008
@@ -28,6 +28,7 @@
 		<module>junit4osgi</module>
 		<module>felix-command</module>
 		<module>maven-junit4osgi-plugin</module>
+		<module>immediate-launcher</module>
   </modules>
 
   <profiles>
@@ -38,7 +39,6 @@
 		</activation>
 		<modules>
 			<module>swing-runner</module>
-			<module>immediate-launcher</module>
 		</modules>
 	</profile>
 	<profile>
@@ -48,7 +48,6 @@
 		</activation>
 		<modules>
 			<module>swing-runner</module>
-			<module>immediate-launcher</module>
 		</modules>
 	</profile>
   </profiles>

Modified: felix/trunk/ipojo/examples/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/examples/pom.xml?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/examples/pom.xml (original)
+++ felix/trunk/ipojo/examples/pom.xml Wed Dec 31 01:02:55 2008
@@ -34,7 +34,6 @@
 			<jdk>1.5</jdk>
 		</activation>
 		<modules>
-			<module>junit4osgi</module>
 			<module>property-handler</module>
 		</modules>
 	</profile>
@@ -44,7 +43,6 @@
 			<jdk>1.6</jdk>
 		</activation>
 		<modules>
-			<module>junit4osgi</module>
 			<module>property-handler</module>
 		</modules>
 	</profile>

Modified: felix/trunk/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/EmptyCompositeTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/EmptyCompositeTest.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/EmptyCompositeTest.java (original)
+++ felix/trunk/ipojo/tests/composite/composite-runtime/src/main/java/org/apache/felix/ipojo/test/composite/infrastructure/EmptyCompositeTest.java Wed Dec 31 01:02:55 2008
@@ -24,7 +24,7 @@
 import org.apache.felix.ipojo.Factory;
 import org.apache.felix.ipojo.ServiceContext;
 import org.apache.felix.ipojo.architecture.ComponentTypeDescription;
-import org.apache.felix.ipojo.architecture.InstanceDescription;
+import org.apache.felix.ipojo.composite.CompositeInstanceDescription;
 import org.apache.felix.ipojo.composite.CompositeManager;
 import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
 import org.apache.felix.ipojo.test.composite.util.Utils;
@@ -51,7 +51,7 @@
 		assertEquals("Check offered service", cd.getprovidedServiceSpecification().length, 0);
 		assertEquals("Check configurable properties", cd.getProperties().length, 0);
 		
-		InstanceDescription id = ci.getInstanceDescription();
+		CompositeInstanceDescription id = (CompositeInstanceDescription) ci.getInstanceDescription();
 		assertEquals("Check composite instance name", id.getName(), "empty");
 		assertEquals("Check composite instance state (" + id.getState() + ")", id.getState(), ComponentInstance.VALID);
 		
@@ -100,17 +100,17 @@
 			fail("Unacceptable configuration : " + e.getMessage());
 		}
 		
-		InstanceDescription id = ci.getInstanceDescription();
+		CompositeInstanceDescription id = (CompositeInstanceDescription) ci.getInstanceDescription();
 		assertEquals("Check composite instance name", id.getName(), "empty");
 		assertEquals("Check composite instance state", id.getState(), ComponentInstance.VALID);
 		assertEquals("Check contained instance", id.getContainedInstances().length, 1);
-		InstanceDescription id2 = id.getContainedInstances()[0];
+		CompositeInstanceDescription id2 = (CompositeInstanceDescription) id.getContainedInstances()[0];
 		assertEquals("Check composite instance name", id2.getName(), "empty2");
 		assertEquals("Check composite instance state", id2.getState(), ComponentInstance.VALID);
 		assertEquals("Check contained instance", id2.getContainedInstances().length, 0);
 		
 		ci2.dispose();
-		id = ci.getInstanceDescription();
+		//id = ci.getInstanceDescription();
 		assertEquals("Check composite instance name", id.getName(), "empty");
 		assertEquals("Check composite instance state", id.getState(), ComponentInstance.VALID);
 		assertEquals("Check contained instance", id.getContainedInstances().length, 0);
@@ -150,17 +150,17 @@
 			fail("Unacceptable configuration : " + e.getMessage());
 		}
 		
-		InstanceDescription id = ci.getInstanceDescription();
+		CompositeInstanceDescription id = (CompositeInstanceDescription) ci.getInstanceDescription();
 		assertEquals("Check composite instance name", id.getName(), "empty");
 		assertEquals("Check composite instance state", id.getState(), ComponentInstance.VALID);
 		assertEquals("Check contained instance", id.getContainedInstances().length, 1);
-		InstanceDescription id2 = id.getContainedInstances()[0];
+		CompositeInstanceDescription id2 = (CompositeInstanceDescription) id.getContainedInstances()[0];
 		assertEquals("Check composite instance name", id2.getName(), "empty2");
 		assertEquals("Check composite instance state", id2.getState(), ComponentInstance.VALID);
 		assertEquals("Check contained instance", id2.getContainedInstances().length, 0);
 		
 		ci2.dispose();
-		id = ci.getInstanceDescription();
+		//id = ci.getInstanceDescription();
 		assertEquals("Check composite instance name", id.getName(), "empty");
 		assertEquals("Check composite instance state", id.getState(), ComponentInstance.VALID);
 		assertEquals("Check contained instance", id.getContainedInstances().length, 0);
@@ -200,17 +200,17 @@
 			fail("Unacceptable configuration : " + e.getMessage());
 		}
 		
-		InstanceDescription id = ci.getInstanceDescription();
+		CompositeInstanceDescription id = (CompositeInstanceDescription) ci.getInstanceDescription();
 		assertEquals("Check composite instance name", id.getName(), "empty");
 		assertEquals("Check composite instance state", id.getState(), ComponentInstance.VALID);
 		assertEquals("Check contained instance", id.getContainedInstances().length, 1);
-		InstanceDescription id2 = id.getContainedInstances()[0];
+		CompositeInstanceDescription id2 = (CompositeInstanceDescription) id.getContainedInstances()[0];
 		assertEquals("Check composite instance name", id2.getName(), "empty2");
 		assertEquals("Check composite instance state", id2.getState(), ComponentInstance.VALID);
 		assertEquals("Check contained instance", id2.getContainedInstances().length, 0);
 		
 		ci2.dispose();
-		id = ci.getInstanceDescription();
+		//id = ci.getInstanceDescription();
 		assertEquals("Check composite instance name", id.getName(), "empty");
 		assertEquals("Check composite instance state", id.getState(), ComponentInstance.VALID);
 		assertEquals("Check contained instance", id.getContainedInstances().length, 0);

Modified: felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instance/SimpleInstance.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instance/SimpleInstance.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instance/SimpleInstance.java (original)
+++ felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instance/SimpleInstance.java Wed Dec 31 01:02:55 2008
@@ -26,6 +26,7 @@
 import org.apache.felix.ipojo.ServiceContext;
 import org.apache.felix.ipojo.architecture.Architecture;
 import org.apache.felix.ipojo.architecture.InstanceDescription;
+import org.apache.felix.ipojo.composite.CompositeInstanceDescription;
 import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
 import org.apache.felix.ipojo.test.composite.service.FooService;
 import org.apache.felix.ipojo.test.composite.util.Utils;
@@ -195,12 +196,11 @@
 		ServiceReference ref = Utils.getServiceReference(getContext(), Architecture.class.getName(), "(architecture.instance=under)");
 		assertNotNull("Check architecture availability", ref);
 		Architecture arch = (Architecture) getContext().getService(ref);
-		InstanceDescription id = arch.getInstanceDescription();
+		CompositeInstanceDescription id = (CompositeInstanceDescription) arch.getInstanceDescription();
 		
 		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
 		InstanceDescription[] contained = id.getContainedInstances();
 		assertEquals("Check contained instances count (" + contained.length + ")", contained.length, 1);
-		assertEquals("Check that no object are created" , id.getCreatedObjects().length, 0);
 		assertEquals("Check instance name" , id.getName(), "under");
 		assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.1");
 		
@@ -213,11 +213,10 @@
 		ref = Utils.getServiceReference(getContext(), Architecture.class.getName(), "(architecture.instance=under)");
 		assertNotNull("Check architecture availability", ref);
 		arch = (Architecture) getContext().getService(ref);
-		id = arch.getInstanceDescription();
+		//id = arch.getInstanceDescription();
 		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
 		contained = id.getContainedInstances();
 		assertEquals("Check contained instances count", contained.length, 1);
-		assertEquals("Check that no object are created" , id.getCreatedObjects().length, 0);
 		assertEquals("Check instance name" , id.getName(), "under");
 		assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.1");
 		
@@ -226,11 +225,10 @@
 		ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
 		assertNotNull("Check architecture availability", ref);
 		arch = (Architecture) getContext().getService(ref);
-		id = arch.getInstanceDescription();
+		//id = arch.getInstanceDescription();
 		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
 		contained = id.getContainedInstances();
 		assertEquals("Check contained instances count", contained.length, 1);
-		assertEquals("Check that no object are created" , id.getCreatedObjects().length, 0);
 		assertEquals("Check instance name" , id.getName(), "under");
 		assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.1");
 
@@ -239,11 +237,10 @@
 		ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
 		assertNotNull("Check architecture availability", ref);
 		arch = (Architecture) getContext().getService(ref);
-		id = arch.getInstanceDescription();
+		//id = arch.getInstanceDescription();
 		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.INVALID);
 		contained = id.getContainedInstances();
 		assertEquals("Check contained instances count", contained.length, 0);
-		assertEquals("Check that no object are created" , id.getCreatedObjects().length, 0);
 		assertEquals("Check instance name" , id.getName(), "under");
 		assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.1");
 
@@ -252,11 +249,10 @@
 		ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
 		assertNotNull("Check architecture availability", ref);
 		arch = (Architecture) getContext().getService(ref);
-		id = arch.getInstanceDescription();
+		//id = arch.getInstanceDescription();
 		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
 		contained = id.getContainedInstances();
 		assertEquals("Check contained instances count", contained.length, 1);
-		assertEquals("Check that no object are created" , id.getCreatedObjects().length, 0);
 		assertEquals("Check instance name" , id.getName(), "under");
 		assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.1");
 

Modified: felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/MultipleInstantiation.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/MultipleInstantiation.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/MultipleInstantiation.java (original)
+++ felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/MultipleInstantiation.java Wed Dec 31 01:02:55 2008
@@ -26,6 +26,7 @@
 import org.apache.felix.ipojo.ServiceContext;
 import org.apache.felix.ipojo.architecture.Architecture;
 import org.apache.felix.ipojo.architecture.InstanceDescription;
+import org.apache.felix.ipojo.composite.CompositeInstanceDescription;
 import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
 import org.apache.felix.ipojo.test.composite.service.BarService;
 import org.apache.felix.ipojo.test.composite.util.Utils;
@@ -202,12 +203,11 @@
 		ServiceReference ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
 		assertNotNull("Check architecture availability", ref);
 		Architecture arch = (Architecture) getContext().getService(ref);
-		InstanceDescription id = arch.getInstanceDescription();
+        CompositeInstanceDescription id = (CompositeInstanceDescription) arch.getInstanceDescription();
 		
 		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
 		InstanceDescription[] contained = id.getContainedInstances();
 		assertEquals("Check contained instances count", contained.length, 3);
-		assertEquals("Check that no object are created" , id.getCreatedObjects().length, 0);
 		assertEquals("Check instance name" , id.getName(), "under");
 		assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.2");
 		
@@ -220,11 +220,10 @@
 		ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
 		assertNotNull("Check architecture availability", ref);
 		arch = (Architecture) getContext().getService(ref);
-		id = arch.getInstanceDescription();
+		//id = arch.getInstanceDescription();
 		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
 		contained = id.getContainedInstances();
 		assertEquals("Check contained instances count", contained.length, 2);
-		assertEquals("Check that no object are created" , id.getCreatedObjects().length, 0);
 		assertEquals("Check instance name" , id.getName(), "under");
 		assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.2");
 		
@@ -233,11 +232,10 @@
 		ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
 		assertNotNull("Check architecture availability", ref);
 		arch = (Architecture) getContext().getService(ref);
-		id = arch.getInstanceDescription();
+		//id = arch.getInstanceDescription();
 		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
 		contained = id.getContainedInstances();
 		assertEquals("Check contained instances count", contained.length, 1);
-		assertEquals("Check that no object are created" , id.getCreatedObjects().length, 0);
 		assertEquals("Check instance name" , id.getName(), "under");
 		assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.2");
 
@@ -246,11 +244,10 @@
 		ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
 		assertNotNull("Check architecture availability", ref);
 		arch = (Architecture) getContext().getService(ref);
-		id = arch.getInstanceDescription();
+		//id = arch.getInstanceDescription();
 		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.INVALID);
 		contained = id.getContainedInstances();
 		assertEquals("Check contained instances count", contained.length, 0);
-		assertEquals("Check that no object are created" , id.getCreatedObjects().length, 0);
 		assertEquals("Check instance name" , id.getName(), "under");
 		assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.2");
 
@@ -259,11 +256,10 @@
 		ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
 		assertNotNull("Check architecture availability", ref);
 		arch = (Architecture) getContext().getService(ref);
-		id = arch.getInstanceDescription();
+		//id = arch.getInstanceDescription();
 		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
 		contained = id.getContainedInstances();
 		assertEquals("Check contained instances count", contained.length, 1);
-		assertEquals("Check that no object are created" , id.getCreatedObjects().length, 0);
 		assertEquals("Check instance name" , id.getName(), "under");
 		assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.2");
 

Modified: felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalInstantiation.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalInstantiation.java?rev=730353&r1=730352&r2=730353&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalInstantiation.java (original)
+++ felix/trunk/ipojo/tests/composite/service-instance/src/main/java/org/apache/felix/ipojo/test/composite/instantiator/OptionalInstantiation.java Wed Dec 31 01:02:55 2008
@@ -26,6 +26,7 @@
 import org.apache.felix.ipojo.ServiceContext;
 import org.apache.felix.ipojo.architecture.Architecture;
 import org.apache.felix.ipojo.architecture.InstanceDescription;
+import org.apache.felix.ipojo.composite.CompositeInstanceDescription;
 import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
 import org.apache.felix.ipojo.test.composite.service.BarService;
 import org.apache.felix.ipojo.test.composite.util.Utils;
@@ -194,12 +195,11 @@
 		assertNotNull("Check architecture availability", ref);
 		Architecture arch = (Architecture) getContext().getService(ref);
 		assertNotNull("Check architecture", arch);
-		InstanceDescription id = arch.getInstanceDescription();
+        CompositeInstanceDescription id = (CompositeInstanceDescription) arch.getInstanceDescription();
 		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
 		InstanceDescription[] contained = id.getContainedInstances();
 		assertNotNull("Check contained not null", contained);
 		assertEquals("Check contained instances count ("+contained.length+") - 1", contained.length, 1);
-		assertEquals("Check that no object are created" , id.getCreatedObjects().length, 0);
 		assertEquals("Check instance name" , id.getName(), "under");
 		assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.3");
 		
@@ -213,11 +213,10 @@
 		ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
 		assertNotNull("Check architecture availability", ref);
 		arch = (Architecture) getContext().getService(ref);
-		id = arch.getInstanceDescription();
+		//id = arch.getInstanceDescription();
 		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
 		contained = id.getContainedInstances();
 		assertEquals("Check contained instances count", contained.length, 1);
-		assertEquals("Check that no object are created" , id.getCreatedObjects().length, 0);
 		assertEquals("Check instance name" , id.getName(), "under");
 		assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.3");
 		
@@ -226,11 +225,10 @@
 		ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
 		assertNotNull("Check architecture availability", ref);
 		arch = (Architecture) getContext().getService(ref);
-		id = arch.getInstanceDescription();
+		//id = arch.getInstanceDescription();
 		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
 		contained = id.getContainedInstances();
 		assertEquals("Check contained instances count", contained.length, 1);
-		assertEquals("Check that no object are created" , id.getCreatedObjects().length, 0);
 		assertEquals("Check instance name" , id.getName(), "under");
 		assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.3");
 
@@ -239,11 +237,10 @@
 		ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
 		assertNotNull("Check architecture availability", ref);
 		arch = (Architecture) getContext().getService(ref);
-		id = arch.getInstanceDescription();
+		//id = arch.getInstanceDescription();
 		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
 		contained = id.getContainedInstances();
 		assertEquals("Check contained instances count", contained.length, 0);
-		assertEquals("Check that no object are created" , id.getCreatedObjects().length, 0);
 		assertEquals("Check instance name" , id.getName(), "under");
 		assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.3");
 
@@ -252,11 +249,10 @@
 		ref = Utils.getServiceReferenceByName(getContext(), Architecture.class.getName(), "under");
 		assertNotNull("Check architecture availability", ref);
 		arch = (Architecture) getContext().getService(ref);
-		id = arch.getInstanceDescription();
+		//id = arch.getInstanceDescription();
 		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
 		contained = id.getContainedInstances();
 		assertEquals("Check contained instances count", contained.length, 1);
-		assertEquals("Check that no object are created" , id.getCreatedObjects().length, 0);
 		assertEquals("Check instance name" , id.getName(), "under");
 		assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.3");
 
@@ -265,15 +261,6 @@
 		fact2.start();
 		fact3.start();
 	}
-	
-	
-	
-	
-	
-	
-	
-	
-	
-	
+
 
 }



Mime
View raw message