geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r767576 [2/4] - in /geronimo/sandbox/blueprint: blueprint-api/src/main/java/org/osgi/service/blueprint/context/ blueprint-api/src/main/java/org/osgi/service/blueprint/convert/ blueprint-api/src/main/java/org/osgi/service/blueprint/namespace...
Date Wed, 22 Apr 2009 15:57:38 GMT
Copied: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java (from r767394, geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ModuleContextImpl.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java?p2=geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java&p1=geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ModuleContextImpl.java&r1=767394&r2=767576&rev=767576&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ModuleContextImpl.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java Wed Apr 22 15:57:35 2009
@@ -18,7 +18,6 @@
  */
 package org.apache.geronimo.blueprint.context;
 
-import java.lang.reflect.InvocationTargetException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -36,22 +35,21 @@
 import org.apache.geronimo.blueprint.NamespaceHandlerRegistry;
 import org.apache.geronimo.blueprint.convert.ConversionServiceImpl;
 import org.apache.geronimo.blueprint.namespace.ComponentDefinitionRegistryImpl;
-import org.apache.xbean.recipe.ConstructionException;
 import org.apache.xbean.recipe.ObjectGraph;
 import org.apache.xbean.recipe.Repository;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.blueprint.context.ModuleContext;
+import org.osgi.service.blueprint.context.BlueprintContext;
 import org.osgi.service.blueprint.context.NoSuchComponentException;
 import org.osgi.service.blueprint.convert.ConversionService;
 import org.osgi.service.blueprint.convert.Converter;
 import org.osgi.service.blueprint.namespace.ComponentDefinitionRegistry;
 import org.osgi.service.blueprint.reflect.ComponentMetadata;
-import org.osgi.service.blueprint.reflect.LocalComponentMetadata;
-import org.osgi.service.blueprint.reflect.ServiceExportComponentMetadata;
-import org.osgi.service.blueprint.reflect.ServiceReferenceComponentMetadata;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.ServiceMetadata;
+import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
 
 /**
  * TODO: javadoc
@@ -59,7 +57,7 @@
  * @author <a href="mailto:dev@geronimo.apache.org">Apache Geronimo Project</a>
  * @version $Rev: 760378 $, $Date: 2009-03-31 11:31:38 +0200 (Tue, 31 Mar 2009) $
  */
-public class ModuleContextImpl implements ModuleContext {
+public class BlueprintContextImpl implements BlueprintContext {
 
     private final BundleContext bundleContext;
     private final ModuleContextEventSender sender;
@@ -70,7 +68,7 @@
     private ObjectGraph objectGraph;
     private ServiceRegistration registration;
 
-    public ModuleContextImpl(BundleContext bundleContext, ModuleContextEventSender sender, NamespaceHandlerRegistry handlers, List<URL> urls) {
+    public BlueprintContextImpl(BundleContext bundleContext, ModuleContextEventSender sender, NamespaceHandlerRegistry handlers, List<URL> urls) {
         this.bundleContext = bundleContext;
         this.sender = sender;
         this.handlers = handlers;
@@ -127,7 +125,7 @@
                       bundleContext.getBundle().getSymbolicName());
             props.put(BlueprintConstants.CONTEXT_VERSION_PROPERTY, 
                       bundleContext.getBundle().getHeaders().get(Constants.BUNDLE_VERSION));
-            registration = bundleContext.registerService(ModuleContext.class.getName(), this, props);
+            registration = bundleContext.registerService(BlueprintContext.class.getName(), this, props);
 
             sender.sendCreated(this);
         } catch (WaitForDependencyException e) {
@@ -158,12 +156,12 @@
         List<String> components = new ArrayList<String>();
         for (String name : componentDefinitionRegistry.getComponentDefinitionNames()) {
             ComponentMetadata component = componentDefinitionRegistry.getComponentDefinition(name);
-            if (component instanceof LocalComponentMetadata) {
-                LocalComponentMetadata local = (LocalComponentMetadata) component;
+            if (component instanceof BeanMetadata) {
+                BeanMetadata local = (BeanMetadata) component;
                 String scope = local.getScope();
-                if (!local.isLazy() && 
-                    (LocalComponentMetadata.SCOPE_BUNDLE.equals(scope) || 
-                     LocalComponentMetadata.SCOPE_SINGLETON.equals(scope))) {
+                if (!local.isLazyInit() &&
+                    (BeanMetadata.SCOPE_BUNDLE.equals(scope) ||
+                     BeanMetadata.SCOPE_SINGLETON.equals(scope))) {
                     components.add(name);
                 }
             }
@@ -173,15 +171,15 @@
     }
     
     private void registerAllServices() {
-        for (ServiceExportComponentMetadata service : getExportedServicesMetadata()) {
-            ServiceRegistrationProxy proxy = (ServiceRegistrationProxy) getComponent(service.getName());
+        for (ServiceMetadata service : getExportedServicesMetadata()) {
+            ServiceRegistrationProxy proxy = (ServiceRegistrationProxy) getComponent(service.getId());
             proxy.register();
         }
     }
     
     private void unregisterAllServices() {
-        for (ServiceExportComponentMetadata service : getExportedServicesMetadata()) {
-            ServiceRegistrationProxy proxy = (ServiceRegistrationProxy) getComponent(service.getName());
+        for (ServiceMetadata service : getExportedServicesMetadata()) {
+            ServiceRegistrationProxy proxy = (ServiceRegistrationProxy) getComponent(service.getId());
             proxy.unregister();
         }
     }
@@ -206,16 +204,16 @@
         return metadata;
     }
 
-    public Collection<ServiceReferenceComponentMetadata> getReferencedServicesMetadata() {
-        return getMetadata(ServiceReferenceComponentMetadata.class);
+    public Collection<ServiceReferenceMetadata> getReferencedServicesMetadata() {
+        return getMetadata(ServiceReferenceMetadata.class);
     }
 
-    public Collection<ServiceExportComponentMetadata> getExportedServicesMetadata() {
-        return getMetadata(ServiceExportComponentMetadata.class);
+    public Collection<ServiceMetadata> getExportedServicesMetadata() {
+        return getMetadata(ServiceMetadata.class);
     }
 
-    public Collection<LocalComponentMetadata> getLocalComponentsMetadata() {
-        return getMetadata(LocalComponentMetadata.class);
+    public Collection<BeanMetadata> getBeanComponentsMetadata() {
+        return getMetadata(BeanMetadata.class);
     }
 
     private <T> Collection<T> getMetadata(Class<T> clazz) {

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BundleScopeServiceFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BundleScopeServiceFactory.java?rev=767576&r1=767575&r2=767576&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BundleScopeServiceFactory.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BundleScopeServiceFactory.java Wed Apr 22 15:57:35 2009
@@ -35,11 +35,11 @@
  */
 public class BundleScopeServiceFactory implements ServiceFactory {
 
-    private ModuleContextImpl moduleContext;
+    private BlueprintContextImpl moduleContext;
     private BlueprintObjectRecipe serviceRecipe;
     private Map<Bundle, Entry> instanceMap = Collections.synchronizedMap(new HashMap<Bundle, Entry>()); 
     
-    public BundleScopeServiceFactory(ModuleContextImpl moduleContext, BlueprintObjectRecipe serviceRecipe) {
+    public BundleScopeServiceFactory(BlueprintContextImpl moduleContext, BlueprintObjectRecipe serviceRecipe) {
         this.moduleContext = moduleContext;
         this.serviceRecipe = serviceRecipe;
     }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/CollectionBasedServiceReferenceRecipe.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/CollectionBasedServiceReferenceRecipe.java?rev=767576&r1=767575&r2=767576&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/CollectionBasedServiceReferenceRecipe.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/CollectionBasedServiceReferenceRecipe.java Wed Apr 22 15:57:35 2009
@@ -24,15 +24,12 @@
 import java.util.Comparator;
 import java.util.List;
 import java.util.ListIterator;
-import java.util.AbstractList;
 import java.util.Iterator;
-import java.util.AbstractSet;
 import java.util.RandomAccess;
 import java.util.SortedSet;
 import java.util.Set;
 import java.util.AbstractCollection;
 import java.util.ArrayList;
-import java.util.concurrent.CopyOnWriteArrayList;
 
 import net.sf.cglib.proxy.Dispatcher;
 import org.apache.geronimo.blueprint.Destroyable;
@@ -48,8 +45,8 @@
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.service.blueprint.context.ModuleContext;
-import org.osgi.service.blueprint.reflect.CollectionBasedServiceReferenceComponentMetadata;
+import org.osgi.service.blueprint.context.BlueprintContext;
+import org.osgi.service.blueprint.reflect.RefCollectionMetadata;
 
 /**
  * A recipe to create a managed collection of service references
@@ -59,15 +56,15 @@
  */
 public class CollectionBasedServiceReferenceRecipe extends AbstractServiceReferenceRecipe {
 
-    private final CollectionBasedServiceReferenceComponentMetadata metadata;
+    private final RefCollectionMetadata metadata;
     private final Recipe comparatorRecipe;
     private Comparator comparator;
 
     private ManagedCollection collection;
 
-    public CollectionBasedServiceReferenceRecipe(ModuleContext moduleContext,
+    public CollectionBasedServiceReferenceRecipe(BlueprintContext moduleContext,
                                                  ModuleContextEventSender sender,
-                                                 CollectionBasedServiceReferenceComponentMetadata metadata,
+                                                 RefCollectionMetadata metadata,
                                                  Recipe listenersRecipe,
                                                  Recipe comparatorRecipe) {
         super(moduleContext, sender, metadata, listenersRecipe);
@@ -84,11 +81,11 @@
 
             if (comparatorRecipe != null) {
                 comparator = (Comparator) comparatorRecipe.create(proxyClassLoader);
-            } else if (metadata.getOrderingComparisonBasis() != 0) {
+            } else if (metadata.getOrderingBasis() != 0) {
                 comparator = new NaturalOrderComparator();
             }
-            boolean orderReferences = metadata.getOrderingComparisonBasis() == CollectionBasedServiceReferenceComponentMetadata.ORDER_BASIS_SERVICE_REFERENCES;
-            boolean memberReferences = metadata.getMemberType() == CollectionBasedServiceReferenceComponentMetadata.MEMBER_TYPE_SERVICE_REFERENCES;
+            boolean orderReferences = metadata.getOrderingBasis() == RefCollectionMetadata.ORDER_BASIS_SERVICE_REFERENCE;
+            boolean memberReferences = metadata.getMemberType() == RefCollectionMetadata.MEMBER_TYPE_SERVICE_REFERENCE;
             if (metadata.getCollectionType() == List.class) {
                 if (comparator != null) {
                     collection = new ManagedSortedList(memberReferences, orderReferences, comparator);

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/DefaultModuleContextEventSender.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/DefaultModuleContextEventSender.java?rev=767576&r1=767575&r2=767576&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/DefaultModuleContextEventSender.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/DefaultModuleContextEventSender.java Wed Apr 22 15:57:35 2009
@@ -28,10 +28,9 @@
 import org.osgi.util.tracker.ServiceTracker;
 import org.osgi.service.event.EventAdmin;
 import org.osgi.service.event.Event;
-import org.osgi.service.event.EventConstants;
-import org.osgi.service.blueprint.context.ModuleContextEventConstants;
-import org.osgi.service.blueprint.context.ModuleContext;
-import org.osgi.service.blueprint.context.ModuleContextListener;
+import org.osgi.service.blueprint.context.EventConstants;
+import org.osgi.service.blueprint.context.BlueprintContext;
+import org.osgi.service.blueprint.context.BlueprintContextListener;
 import org.apache.geronimo.blueprint.BlueprintConstants;
 import org.apache.geronimo.blueprint.ModuleContextEventSender;
 
@@ -51,51 +50,53 @@
         this.extenderBundle = bundleContext.getBundle();
         this.eventAdminServiceTracker = new ServiceTracker(bundleContext, EventAdmin.class.getName(), null);
         this.eventAdminServiceTracker.open();
-        this.contextListenerTracker = new ServiceTracker(bundleContext, ModuleContextListener.class.getName(), null);
+        this.contextListenerTracker = new ServiceTracker(bundleContext, BlueprintContextListener.class.getName(), null);
         this.contextListenerTracker.open();
     }
 
-    public void sendCreating(ModuleContext moduleContext) {
+    public void sendCreating(BlueprintContext moduleContext) {
         sendEvent(moduleContext, TOPIC_CREATING, null, null, null);
     }
 
-    public void sendCreated(ModuleContext moduleContext) {
+    public void sendCreated(BlueprintContext moduleContext) {
         sendEvent(moduleContext, TOPIC_CREATED, null, null, null);
     }
 
-    public void sendDestroying(ModuleContext moduleContext) {
+    public void sendDestroying(BlueprintContext moduleContext) {
         sendEvent(moduleContext, TOPIC_DESTROYING, null, null, null);
     }
 
-    public void sendDestroyed(ModuleContext moduleContext) {
+    public void sendDestroyed(BlueprintContext moduleContext) {
         sendEvent(moduleContext, TOPIC_DESTROYED, null, null, null);
     }
 
-    public void sendWaiting(ModuleContext moduleContext, String[] serviceObjectClass, String serviceFilter) {
+    public void sendWaiting(BlueprintContext moduleContext, String[] serviceObjectClass, String serviceFilter) {
         sendEvent(moduleContext, TOPIC_WAITING, null, serviceObjectClass, serviceFilter);
     }
 
-    public void sendFailure(ModuleContext moduleContext, Throwable cause) {
+    public void sendFailure(BlueprintContext moduleContext, Throwable cause) {
         sendEvent(moduleContext, TOPIC_FAILURE, cause, null, null);
     }
 
-    public void sendFailure(ModuleContext moduleContext, Throwable cause, String[] serviceObjectClass, String serviceFilter) {
+    public void sendFailure(BlueprintContext moduleContext, Throwable cause, String[] serviceObjectClass, String serviceFilter) {
         sendEvent(moduleContext, TOPIC_FAILURE, cause, serviceObjectClass, serviceFilter);
     }
 
-    public void sendEvent(ModuleContext moduleContext, String topic, Throwable cause, String[] serviceObjectClass, String serviceFilter) {
+    public void sendEvent(BlueprintContext moduleContext, String topic, Throwable cause, String[] serviceObjectClass, String serviceFilter) {
 
         if (topic == TOPIC_CREATED || topic == TOPIC_FAILURE) {
             Object[] listeners = contextListenerTracker.getServices();
-            for (Object listener : listeners) {
-                try {
-                    if (topic == TOPIC_CREATED) {
-                        ((ModuleContextListener) listener).contextCreated(moduleContext.getBundleContext().getBundle());
-                    } else if (topic == TOPIC_FAILURE) {
-                        ((ModuleContextListener) listener).contextCreationFailed(moduleContext.getBundleContext().getBundle(), cause);
+            if (listeners != null) {
+                for (Object listener : listeners) {
+                    try {
+                        if (topic == TOPIC_CREATED) {
+                            ((BlueprintContextListener) listener).contextCreated(moduleContext.getBundleContext().getBundle());
+                        } else if (topic == TOPIC_FAILURE) {
+                            ((BlueprintContextListener) listener).contextCreationFailed(moduleContext.getBundleContext().getBundle(), cause);
+                        }
+                    } catch (Throwable t) {
+                        t.printStackTrace(); // TODO: log
                     }
-                } catch (Throwable t) {
-                    t.printStackTrace(); // TODO: log
                 }
             }
         }
@@ -108,23 +109,23 @@
         Bundle bundle = moduleContext.getBundleContext().getBundle();
 
         Dictionary props = new Hashtable();
-        props.put(EventConstants.BUNDLE_SYMBOLICNAME, bundle.getSymbolicName());
-        props.put(EventConstants.BUNDLE_ID, bundle.getBundleId());
-        props.put(EventConstants.BUNDLE, bundle);
+        props.put(org.osgi.service.event.EventConstants.BUNDLE_SYMBOLICNAME, bundle.getSymbolicName());
+        props.put(org.osgi.service.event.EventConstants.BUNDLE_ID, bundle.getBundleId());
+        props.put(org.osgi.service.event.EventConstants.BUNDLE, bundle);
         Version version = getBundleVersion(bundle);
         if (version != null) {
             props.put(BlueprintConstants.BUNDLE_VERSION, version);
         }
-        props.put(EventConstants.TIMESTAMP, System.currentTimeMillis());
-        props.put(ModuleContextEventConstants.EXTENDER_BUNDLE, extenderBundle);
-        props.put(ModuleContextEventConstants.EXTENDER_ID, extenderBundle.getBundleId());
-        props.put(ModuleContextEventConstants.EXTENDER_SYMBOLICNAME, extenderBundle.getSymbolicName());
+        props.put(org.osgi.service.event.EventConstants.TIMESTAMP, System.currentTimeMillis());
+        props.put(EventConstants.EXTENDER_BUNDLE, extenderBundle);
+        props.put(EventConstants.EXTENDER_ID, extenderBundle.getBundleId());
+        props.put(EventConstants.EXTENDER_SYMBOLICNAME, extenderBundle.getSymbolicName());
         
         if (cause != null) {
-            props.put(EventConstants.EXCEPTION, cause);
+            props.put(org.osgi.service.event.EventConstants.EXCEPTION, cause);
         }
         if (serviceObjectClass != null) {
-            props.put(EventConstants.SERVICE_OBJECTCLASS, serviceObjectClass);
+            props.put(org.osgi.service.event.EventConstants.SERVICE_OBJECTCLASS, serviceObjectClass);
         }
         if (serviceFilter != null) {
             props.put(BlueprintConstants.SERVICE_FILTER, serviceFilter);

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java?rev=767576&r1=767575&r2=767576&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java Wed Apr 22 15:57:35 2009
@@ -29,7 +29,8 @@
 import java.util.Comparator;
 
 import org.apache.geronimo.blueprint.namespace.ComponentDefinitionRegistryImpl;
-import org.apache.geronimo.blueprint.reflect.ServiceExportComponentMetadataImpl;
+import org.apache.geronimo.blueprint.reflect.ServiceMetadataImpl;
+import org.apache.geronimo.blueprint.reflect.MapMetadataImpl;
 import org.apache.geronimo.blueprint.utils.ReflectionUtils;
 import org.apache.xbean.recipe.ArrayRecipe;
 import org.apache.xbean.recipe.CollectionRecipe;
@@ -42,25 +43,23 @@
 import org.apache.xbean.recipe.Repository;
 import org.osgi.service.blueprint.convert.ConversionService;
 import org.osgi.service.blueprint.namespace.ComponentDefinitionRegistry;
-import org.osgi.service.blueprint.reflect.ArrayValue;
 import org.osgi.service.blueprint.reflect.ComponentMetadata;
-import org.osgi.service.blueprint.reflect.ComponentValue;
-import org.osgi.service.blueprint.reflect.ListValue;
-import org.osgi.service.blueprint.reflect.LocalComponentMetadata;
-import org.osgi.service.blueprint.reflect.MapValue;
-import org.osgi.service.blueprint.reflect.NullValue;
-import org.osgi.service.blueprint.reflect.PropertiesValue;
-import org.osgi.service.blueprint.reflect.PropertyInjectionMetadata;
-import org.osgi.service.blueprint.reflect.ReferenceNameValue;
-import org.osgi.service.blueprint.reflect.ReferenceValue;
-import org.osgi.service.blueprint.reflect.RegistrationListenerMetadata;
-import org.osgi.service.blueprint.reflect.ServiceExportComponentMetadata;
-import org.osgi.service.blueprint.reflect.SetValue;
-import org.osgi.service.blueprint.reflect.TypedStringValue;
-import org.osgi.service.blueprint.reflect.Value;
-import org.osgi.service.blueprint.reflect.UnaryServiceReferenceComponentMetadata;
-import org.osgi.service.blueprint.reflect.CollectionBasedServiceReferenceComponentMetadata;
-import org.osgi.service.blueprint.reflect.BindingListenerMetadata;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.MapMetadata;
+import org.osgi.service.blueprint.reflect.NullMetadata;
+import org.osgi.service.blueprint.reflect.PropsMetadata;
+import org.osgi.service.blueprint.reflect.IdRefMetadata;
+import org.osgi.service.blueprint.reflect.RefMetadata;
+import org.osgi.service.blueprint.reflect.RegistrationListener;
+import org.osgi.service.blueprint.reflect.ServiceMetadata;
+import org.osgi.service.blueprint.reflect.ValueMetadata;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.osgi.service.blueprint.reflect.ReferenceMetadata;
+import org.osgi.service.blueprint.reflect.RefCollectionMetadata;
+import org.osgi.service.blueprint.reflect.Listener;
+import org.osgi.service.blueprint.reflect.BeanProperty;
+import org.osgi.service.blueprint.reflect.CollectionMetadata;
+import org.osgi.service.blueprint.reflect.MapEntry;
 
 /**
  * TODO: javadoc
@@ -85,9 +84,9 @@
         primitiveClasses.put("boolean", boolean.class);
     }
     
-    private ModuleContextImpl moduleContext;
+    private BlueprintContextImpl moduleContext;
     
-    public Instanciator(ModuleContextImpl moduleContext) {
+    public Instanciator(BlueprintContextImpl moduleContext) {
         this.moduleContext = moduleContext;
     }
     
@@ -106,11 +105,11 @@
         addBuiltinComponents(repository);
         
         // Create type-converter recipes
-        for (Value value : registry.getTypeConverters()) {
-            if (value instanceof ComponentValue) {
+        for (Metadata value : registry.getTypeConverters()) {
+            if (value instanceof ComponentMetadata) {
                 Recipe recipe = (Recipe) getValue(value, null);
                 repository.add(recipe.getName(), recipe);
-            } else if (value instanceof ReferenceValue) {
+            } else if (value instanceof RefMetadata) {
                 ReferenceRecipe recipe = (ReferenceRecipe) getValue(value, null);
                 repository.add(recipe.getReferenceName(), recipe);
             } else {
@@ -128,25 +127,24 @@
     }
 
     private Recipe createRecipe(ComponentMetadata component) throws Exception {
-        if (component instanceof LocalComponentMetadata) {
-            return createComponentRecipe( (LocalComponentMetadata) component);
-        } else if (component instanceof ServiceExportComponentMetadata) {
-            return createServiceRecipe( (ServiceExportComponentMetadata) component);
-        } else if (component instanceof UnaryServiceReferenceComponentMetadata) {
-            return createUnaryServiceReferenceRecipe(component);
-        } else if (component instanceof CollectionBasedServiceReferenceComponentMetadata) {
-            return createCollectionBasedServiceReferenceRecipe(component);
+        if (component instanceof BeanMetadata) {
+            return createComponentRecipe((BeanMetadata) component);
+        } else if (component instanceof ServiceMetadata) {
+            return createServiceRecipe((ServiceMetadata) component);
+        } else if (component instanceof ReferenceMetadata) {
+            return createUnaryServiceReferenceRecipe((ReferenceMetadata) component);
+        } else if (component instanceof RefCollectionMetadata) {
+            return createCollectionBasedServiceReferenceRecipe((RefCollectionMetadata) component);
         } else {
             throw new IllegalStateException("Unsupported component type " + component.getClass());
         }
     }
 
-    private Recipe createCollectionBasedServiceReferenceRecipe(ComponentMetadata component) throws Exception {
-        CollectionBasedServiceReferenceComponentMetadata metadata = (CollectionBasedServiceReferenceComponentMetadata) component;
+    private Recipe createCollectionBasedServiceReferenceRecipe(RefCollectionMetadata metadata) throws Exception {
         CollectionRecipe listenersRecipe = null;
-        if (metadata.getBindingListeners() != null) {
+        if (metadata.getServiceListeners() != null) {
             listenersRecipe = new CollectionRecipe(ArrayList.class);
-            for (BindingListenerMetadata listener : (Collection<BindingListenerMetadata>) metadata.getBindingListeners()) {
+            for (Listener listener : (Collection<Listener>) metadata.getServiceListeners()) {
                 listenersRecipe.add(createRecipe(listener));
             }
         }
@@ -160,16 +158,15 @@
                                                                    metadata,
                                                                    listenersRecipe,
                                                                    comparatorRecipe);
-        recipe.setName(component.getName());
+        recipe.setName(metadata.getId());
         return recipe;
     }
 
-    private UnaryServiceReferenceRecipe createUnaryServiceReferenceRecipe(ComponentMetadata component) throws Exception {
-        UnaryServiceReferenceComponentMetadata metadata = (UnaryServiceReferenceComponentMetadata) component;
+    private UnaryServiceReferenceRecipe createUnaryServiceReferenceRecipe(ReferenceMetadata metadata) throws Exception {
         CollectionRecipe listenersRecipe = null;
-        if (metadata.getBindingListeners() != null) {
+        if (metadata.getServiceListeners() != null) {
             listenersRecipe = new CollectionRecipe(ArrayList.class);
-            for (BindingListenerMetadata listener : (Collection<BindingListenerMetadata>) metadata.getBindingListeners()) {
+            for (Listener listener : (Collection<Listener>) metadata.getServiceListeners()) {
                 listenersRecipe.add(createRecipe(listener));
             }
         }
@@ -177,32 +174,32 @@
                                                                    moduleContext.getSender(),
                                                                    metadata,
                                                                    listenersRecipe);
-        recipe.setName(component.getName());
+        recipe.setName(metadata.getId());
         return recipe;
     }
 
-    private ObjectRecipe createServiceRecipe(ServiceExportComponentMetadata serviceExport) throws Exception {
+    private ObjectRecipe createServiceRecipe(ServiceMetadata serviceExport) throws Exception {
         ObjectRecipe recipe = new ObjectRecipe(ServiceRegistrationProxy.class);
         recipe.allow(Option.PRIVATE_PROPERTIES);
-        recipe.setName(serviceExport.getName());
+        recipe.setName(serviceExport.getId());
         recipe.setProperty("moduleContext", moduleContext);
-        LocalComponentMetadata exportedComponent = getLocalServiceComponent(serviceExport.getExportedComponent());
-        if (exportedComponent != null && LocalComponentMetadata.SCOPE_BUNDLE.equals(exportedComponent.getScope())) {
+        BeanMetadata exportedComponent = getLocalServiceComponent(serviceExport.getServiceComponent());
+        if (exportedComponent != null && BeanMetadata.SCOPE_BUNDLE.equals(exportedComponent.getScope())) {
             BlueprintObjectRecipe exportedComponentRecipe = createComponentRecipe(exportedComponent);
             recipe.setProperty("service", new BundleScopeServiceFactory(moduleContext, exportedComponentRecipe));
         } else {
-            recipe.setProperty("service", getValue(serviceExport.getExportedComponent(), null));
+            recipe.setProperty("service", getValue(serviceExport.getServiceComponent(), null));
         }
         recipe.setProperty("metadata", serviceExport);
-        if (serviceExport instanceof ServiceExportComponentMetadataImpl) {
-            ServiceExportComponentMetadataImpl impl = (ServiceExportComponentMetadataImpl) serviceExport;
-            if (impl.getServicePropertiesValue() != null) {
-                recipe.setProperty("serviceProperties", getValue(impl.getServicePropertiesValue(), null));
+        if (serviceExport instanceof ServiceMetadataImpl) {
+            ServiceMetadataImpl impl = (ServiceMetadataImpl) serviceExport;
+            if (impl.getServiceProperties() != null) {
+                recipe.setProperty("serviceProperties", getValue(new MapMetadataImpl(null, null, impl.getServiceProperties()), null));
             }
         }
         if (serviceExport.getRegistrationListeners() != null) {
             CollectionRecipe listenersRecipe = new CollectionRecipe(ArrayList.class);
-            for (RegistrationListenerMetadata listener : (Collection<RegistrationListenerMetadata>)serviceExport.getRegistrationListeners()) {
+            for (RegistrationListener listener : (Collection<RegistrationListener>)serviceExport.getRegistrationListeners()) {
                 listenersRecipe.add(createRecipe(listener));
             }
             recipe.setProperty("listeners", listenersRecipe);
@@ -210,15 +207,15 @@
         return recipe;
     }
 
-    private BlueprintObjectRecipe createComponentRecipe(LocalComponentMetadata local) throws Exception {
+    private BlueprintObjectRecipe createComponentRecipe(BeanMetadata local) throws Exception {
         BlueprintObjectRecipe recipe = new BlueprintObjectRecipe(loadClass(local.getClassName()));
         recipe.allow(Option.PRIVATE_PROPERTIES);
-        recipe.setName(local.getName());
-        for (PropertyInjectionMetadata property : (Collection<PropertyInjectionMetadata>) local.getPropertyInjectionMetadata()) {
+        recipe.setName(local.getId());
+        for (BeanProperty property : local.getProperties()) {
             Object value = getValue(property.getValue(), null);
             recipe.setProperty(property.getName(), value);
         }
-        if (LocalComponentMetadata.SCOPE_PROTOTYPE.equals(local.getScope())) {
+        if (BeanMetadata.SCOPE_PROTOTYPE.equals(local.getScope())) {
             recipe.setKeepRecipe(true);
         }
         ComponentDefinitionRegistryImpl registry = (ComponentDefinitionRegistryImpl)getComponentDefinitionRegistry();
@@ -230,7 +227,7 @@
         } else if (initMethod.length() > 0) {
             Method method = ReflectionUtils.getLifecycleMethod(recipe.getType(), initMethod);
             if (method == null) {
-                throw new ConstructionException("Component '" + local.getName() + "' does not have init-method: " + initMethod);
+                throw new ConstructionException("Component '" + local.getId() + "' does not have init-method: " + initMethod);
             }
             recipe.setInitMethod(method);
         }
@@ -242,7 +239,7 @@
         } else if (destroyMethod.length() > 0) {
             Method method = ReflectionUtils.getLifecycleMethod(recipe.getType(), destroyMethod);
             if (method == null) {
-                throw new ConstructionException("Component '" + local.getName() + "' does not have destroy-method: " + destroyMethod);
+                throw new ConstructionException("Component '" + local.getId() + "' does not have destroy-method: " + destroyMethod);
             }
             recipe.setDestroyMethod(method);
         }
@@ -252,7 +249,7 @@
         return recipe;
     }
 
-    private Recipe createRecipe(RegistrationListenerMetadata listener) throws Exception {
+    private Recipe createRecipe(RegistrationListener listener) throws Exception {
         ObjectRecipe recipe = new ObjectRecipe(ServiceRegistrationProxy.Listener.class);
         recipe.allow(Option.PRIVATE_PROPERTIES);
         recipe.setProperty("listener", getValue(listener.getListenerComponent(), null));
@@ -260,7 +257,7 @@
         return recipe;
     }
 
-    private Recipe createRecipe(BindingListenerMetadata listener) throws Exception {
+    private Recipe createRecipe(Listener listener) throws Exception {
         ObjectRecipe recipe = new ObjectRecipe(AbstractServiceReferenceRecipe.Listener.class);
         recipe.allow(Option.PRIVATE_PROPERTIES);
         recipe.setProperty("listener", getValue(listener.getListenerComponent(), null));
@@ -268,75 +265,78 @@
         return recipe;
     }
 
-    private LocalComponentMetadata getLocalServiceComponent(Value value) throws Exception {
+    private BeanMetadata getLocalServiceComponent(Metadata value) throws Exception {
         ComponentMetadata metadata = null;
-        if (value instanceof ReferenceValue) {
-            ReferenceValue ref = (ReferenceValue) value;
+        if (value instanceof RefMetadata) {
+            RefMetadata ref = (RefMetadata) value;
             ComponentDefinitionRegistry registry = getComponentDefinitionRegistry();
-            metadata = registry.getComponentDefinition(ref.getComponentName());
-        } else if (value instanceof ComponentValue) {
-            ComponentValue comp = (ComponentValue) value;
-            metadata = comp.getComponentMetadata();
+            metadata = registry.getComponentDefinition(ref.getComponentId());
+        } else if (value instanceof ComponentMetadata) {
+            metadata = (ComponentMetadata) value;
         }
-        if (metadata instanceof LocalComponentMetadata) {
-            return (LocalComponentMetadata) metadata;
+        if (metadata instanceof BeanMetadata) {
+            return (BeanMetadata) metadata;
         } else {
             return null;
         }
     }
     
-    private Object getValue(Value v, Class groupingType) throws Exception {
-        if (v instanceof NullValue) {
+    private Object getValue(Metadata v, Class groupingType) throws Exception {
+        if (v instanceof NullMetadata) {
             return null;
-        } else if (v instanceof TypedStringValue) {
-            TypedStringValue stringValue = (TypedStringValue) v; 
+        } else if (v instanceof ComponentMetadata) {
+            return createRecipe((ComponentMetadata) v);
+        } else if (v instanceof ValueMetadata) {
+            ValueMetadata stringValue = (ValueMetadata) v;
             String value = stringValue.getStringValue();
             Class type = loadClass(stringValue.getTypeName());
             return new ValueRecipe(getConversionService(), value, type, groupingType);
-        } else if (v instanceof ReferenceValue) {
-            String componentName = ((ReferenceValue) v).getComponentName();
+        } else if (v instanceof RefMetadata) {
+            String componentName = ((RefMetadata) v).getComponentId();
             return new ReferenceRecipe(componentName);
-        } else if (v instanceof ListValue) {
-            ListValue listValue = (ListValue) v;
-            Class type = loadClass(listValue.getValueType());
-            CollectionRecipe cr = new CollectionRecipe(ArrayList.class);
-            for (Value lv : (List<Value>) listValue.getList()) {
-                cr.add(getValue(lv, type));
-            }
-            return cr;
-        } else if (v instanceof SetValue) {
-            SetValue setValue = (SetValue) v;
-            Class type = loadClass(setValue.getValueType());
-            CollectionRecipe cr = new CollectionRecipe(HashSet.class);
-            for (Value lv : (Set<Value>) setValue.getSet()) {
-                cr.add(getValue(lv, type));
-            }
-            return cr;
-        } else if (v instanceof MapValue) {
-            MapValue mapValue = (MapValue) v;
-            Class keyType = loadClass(mapValue.getKeyType());
-            Class valueType = loadClass(mapValue.getValueType());            
+        } else if (v instanceof CollectionMetadata) {
+            CollectionMetadata collectionMetadata = (CollectionMetadata) v;
+            Class type = loadClass(collectionMetadata.getValueTypeName());
+            if (collectionMetadata.getCollectionClass() == Object[].class) {
+                ArrayRecipe ar = new ArrayRecipe();
+                for (Metadata lv : collectionMetadata.getValues()) {
+                    ar.add(getValue(lv, type));
+                }
+                return ar;
+            } else {
+                Class cl = collectionMetadata.getCollectionClass() == List.class ? ArrayList.class : HashSet.class;
+                CollectionRecipe cr = new CollectionRecipe(cl);
+                for (Metadata lv : collectionMetadata.getValues()) {
+                    cr.add(getValue(lv, type));
+                }
+                return cr;
+            }
+        } else if (v instanceof MapMetadata) {
+            MapMetadata mapValue = (MapMetadata) v;
+            Class keyType = loadClass(mapValue.getKeyTypeName());
+            Class valueType = loadClass(mapValue.getValueTypeName());
+            MapRecipe mr = new MapRecipe(HashMap.class);
+            for (MapEntry entry : mapValue.getEntries()) {
+                Object key = getValue(entry.getKey(), keyType);
+                Object val = getValue(entry.getValue(), valueType);
+                mr.put(key, val);
+            }
+            return mr;
+        } else if (v instanceof PropsMetadata) {
+            // TODO
+            /*
+            PropsMetadata mapValue = (PropsMetadata) v;
             MapRecipe mr = new MapRecipe(HashMap.class);
-            for (Map.Entry<Value,Value> entry : ((Map<Value,Value>) mapValue.getMap()).entrySet()) {
+            for (MapEntry entry : mapValue.getEntries()) {
                 Object key = getValue(entry.getKey(), keyType);
                 Object val = getValue(entry.getValue(), valueType);
                 mr.put(key, val);
             }
             return mr;
-        } else if (v instanceof ArrayValue) {
-            ArrayValue arrayValue = (ArrayValue) v;
-            Class type = loadClass(arrayValue.getValueType());
-            ArrayRecipe ar = (type == null) ? new ArrayRecipe() : new ArrayRecipe(type);
-            for (Value value : arrayValue.getArray()) {
-                ar.add(getValue(value, type));
-            }
-            return ar;
-        } else if (v instanceof ComponentValue) {
-            return createRecipe(((ComponentValue) v).getComponentMetadata());
-        } else if (v instanceof PropertiesValue) {
-            return ((PropertiesValue) v).getPropertiesValue();
-        } else if (v instanceof ReferenceNameValue) {
-            return ((ReferenceNameValue) v).getReferenceName();
+            */
+            return null;
+        } else if (v instanceof IdRefMetadata) {
+            return ((IdRefMetadata) v).getComponentId();
         } else {
             throw new IllegalStateException("Unsupported value: " + v.getClass().getName());
         }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Parser.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Parser.java?rev=767576&r1=767575&r2=767576&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Parser.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Parser.java Wed Apr 22 15:57:35 2009
@@ -23,11 +23,8 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
-import java.util.Properties;
 import java.util.Set;
 
 import javax.xml.parsers.DocumentBuilder;
@@ -46,40 +43,38 @@
 import org.apache.geronimo.blueprint.NamespaceHandlerRegistry;
 import org.apache.geronimo.blueprint.namespace.ComponentDefinitionRegistryImpl;
 import org.apache.geronimo.blueprint.namespace.ParserContextImpl;
-import org.apache.geronimo.blueprint.reflect.ArrayValueImpl;
-import org.apache.geronimo.blueprint.reflect.BindingListenerMetadataImpl;
-import org.apache.geronimo.blueprint.reflect.CollectionBasedServiceReferenceComponentMetadataImpl;
-import org.apache.geronimo.blueprint.reflect.ComponentValueImpl;
-import org.apache.geronimo.blueprint.reflect.ListValueImpl;
-import org.apache.geronimo.blueprint.reflect.LocalComponentMetadataImpl;
-import org.apache.geronimo.blueprint.reflect.MapValueImpl;
-import org.apache.geronimo.blueprint.reflect.MethodInjectionMetadataImpl;
-import org.apache.geronimo.blueprint.reflect.ParameterSpecificationImpl;
-import org.apache.geronimo.blueprint.reflect.PropertiesValueImpl;
-import org.apache.geronimo.blueprint.reflect.PropertyInjectionMetadataImpl;
-import org.apache.geronimo.blueprint.reflect.ReferenceValueImpl;
-import org.apache.geronimo.blueprint.reflect.RegistrationListenerMetadataImpl;
-import org.apache.geronimo.blueprint.reflect.ServiceExportComponentMetadataImpl;
-import org.apache.geronimo.blueprint.reflect.ServiceReferenceComponentMetadataImpl;
-import org.apache.geronimo.blueprint.reflect.SetValueImpl;
-import org.apache.geronimo.blueprint.reflect.TypedStringValueImpl;
-import org.apache.geronimo.blueprint.reflect.UnaryServiceReferenceComponentMetadataImpl;
+import org.apache.geronimo.blueprint.reflect.ListenerImpl;
+import org.apache.geronimo.blueprint.reflect.RefCollectionMetadataImpl;
+import org.apache.geronimo.blueprint.reflect.CollectionMetadataImpl;
+import org.apache.geronimo.blueprint.reflect.BeanMetadataImpl;
+import org.apache.geronimo.blueprint.reflect.MapMetadataImpl;
+import org.apache.geronimo.blueprint.reflect.BeanArgumentImpl;
+import org.apache.geronimo.blueprint.reflect.PropsMetadataImpl;
+import org.apache.geronimo.blueprint.reflect.RefMetadataImpl;
+import org.apache.geronimo.blueprint.reflect.RegistrationListenerImpl;
+import org.apache.geronimo.blueprint.reflect.ServiceMetadataImpl;
+import org.apache.geronimo.blueprint.reflect.ServiceReferenceMetadataImpl;
+import org.apache.geronimo.blueprint.reflect.ValueMetadataImpl;
+import org.apache.geronimo.blueprint.reflect.ReferenceMetadataImpl;
+import org.apache.geronimo.blueprint.reflect.BeanPropertyImpl;
+import org.apache.geronimo.blueprint.reflect.MapEntryImpl;
 import org.osgi.service.blueprint.context.ComponentDefinitionException;
 import org.osgi.service.blueprint.namespace.NamespaceHandler;
-import org.osgi.service.blueprint.reflect.ArrayValue;
-import org.osgi.service.blueprint.reflect.BindingListenerMetadata;
-import org.osgi.service.blueprint.reflect.CollectionBasedServiceReferenceComponentMetadata;
+import org.osgi.service.blueprint.reflect.Listener;
+import org.osgi.service.blueprint.reflect.RefCollectionMetadata;
 import org.osgi.service.blueprint.reflect.ComponentMetadata;
-import org.osgi.service.blueprint.reflect.ListValue;
-import org.osgi.service.blueprint.reflect.LocalComponentMetadata;
-import org.osgi.service.blueprint.reflect.MapValue;
-import org.osgi.service.blueprint.reflect.NullValue;
-import org.osgi.service.blueprint.reflect.PropertiesValue;
-import org.osgi.service.blueprint.reflect.RegistrationListenerMetadata;
-import org.osgi.service.blueprint.reflect.ServiceExportComponentMetadata;
-import org.osgi.service.blueprint.reflect.ServiceReferenceComponentMetadata;
-import org.osgi.service.blueprint.reflect.SetValue;
-import org.osgi.service.blueprint.reflect.Value;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.MapMetadata;
+import org.osgi.service.blueprint.reflect.NullMetadata;
+import org.osgi.service.blueprint.reflect.PropsMetadata;
+import org.osgi.service.blueprint.reflect.RegistrationListener;
+import org.osgi.service.blueprint.reflect.ServiceMetadata;
+import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.osgi.service.blueprint.reflect.Target;
+import org.osgi.service.blueprint.reflect.CollectionMetadata;
+import org.osgi.service.blueprint.reflect.MapEntry;
+import org.osgi.service.blueprint.reflect.NonNullMetadata;
 import org.xml.sax.InputSource;
 
 /**
@@ -93,11 +88,11 @@
     public static final String BLUEPRINT_NAMESPACE = "http://www.osgi.org/xmlns/blueprint/v1.0.0";
     public static final String BLUEPRINT_COMPENDIUM_NAMESPACE = "http://www.osgi.org/xmlns/blueprint-compendium/v1.0.0";
 
-    public static final String COMPONENTS_ELEMENT = "components";
+    public static final String BLUEPRINT_ELEMENT = "blueprint";
     public static final String DESCRIPTION_ELEMENT = "description";
     public static final String TYPE_CONVERTERS_ELEMENT = "type-converters";
-    public static final String COMPONENT_ELEMENT = "component";
-    public static final String CONSTRUCTOR_ARG_ELEMENT = "constructor-arg";
+    public static final String BEAN_ELEMENT = "bean";
+    public static final String ARGUMENT_ELEMENT = "argument";
     public static final String REF_ELEMENT = "ref";
     public static final String IDREF_ELEMENT = "idref";
     public static final String LIST_ELEMENT = "list";
@@ -252,8 +247,8 @@
         defaultDestroyMethod = null;
         Element root = doc.getDocumentElement();
         if (!isBlueprintNamespace(root.getNamespaceURI()) ||
-                !nodeNameEquals(root, COMPONENTS_ELEMENT)) {
-            throw new ComponentDefinitionException("Root element must be {" + BLUEPRINT_NAMESPACE + "}" + COMPONENTS_ELEMENT + " element");
+                !nodeNameEquals(root, BLUEPRINT_ELEMENT)) {
+            throw new ComponentDefinitionException("Root element must be {" + BLUEPRINT_NAMESPACE + "}" + BLUEPRINT_ELEMENT + " element");
         }
         // Parse global attributes
         if (root.hasAttribute(DEFAULT_LAZY_INIT_ATTRIBUTE)) {
@@ -315,20 +310,20 @@
             // Ignore description
         } else if (nodeNameEquals(element, TYPE_CONVERTERS_ELEMENT)) {
             parseTypeConverters(element);
-        } else if (nodeNameEquals(element, COMPONENT_ELEMENT)) {
-            ComponentMetadata component = parseComponentMetadata(element);
+        } else if (nodeNameEquals(element, BEAN_ELEMENT)) {
+            ComponentMetadata component = parseBeanMetadata(element);
             registry.registerComponentDefinition(component);
         } else if (nodeNameEquals(element, SERVICE_ELEMENT)) {
             ComponentMetadata service = parseService(element);
             registry.registerComponentDefinition(service);
         } else if (nodeNameEquals(element, REFERENCE_ELEMENT)) {
-            ComponentMetadata reference = parseUnaryReference(element);
+            ComponentMetadata reference = parseReference(element);
             registry.registerComponentDefinition(reference);
         } else if (nodeNameEquals(element, REFLIST_ELEMENT) ) {
-            ComponentMetadata references = parseReferenceCollection(element, List.class);
+            ComponentMetadata references = parseRefCollection(element, List.class);
             registry.registerComponentDefinition(references);
         } else if (nodeNameEquals(element, REFSET_ELEMENT)) {
-            ComponentMetadata references = parseReferenceCollection(element, Set.class);
+            ComponentMetadata references = parseRefCollection(element, Set.class);
             registry.registerComponentDefinition(references);
         } else {
             throw new ComponentDefinitionException("Unknown element " + element.getNodeName() + " in namespace " + BLUEPRINT_NAMESPACE);
@@ -346,27 +341,27 @@
             Node node = nl.item(i);
             if (node instanceof Element) {
                 Element e = (Element) node;
-                if (nodeNameEquals(e, COMPONENT_ELEMENT)) {
-                    ComponentMetadata metadata = parseComponentMetadata(e);
-                    registry.registerTypeConverter(new ComponentValueImpl(metadata));
+                if (nodeNameEquals(e, BEAN_ELEMENT)) {
+                    ComponentMetadata metadata = parseBeanMetadata(e);
+                    registry.registerTypeConverter((Target) metadata);
                 } else if (nodeNameEquals(e, REF_ELEMENT)) {
                     String componentName = e.getAttribute(COMPONENT_ATTRIBUTE);
-                    registry.registerTypeConverter(new ReferenceValueImpl(componentName));
+                    registry.registerTypeConverter(new RefMetadataImpl(componentName));
                 }
             }
         }
     }
 
-    private ComponentMetadata parseComponentMetadata(Element element) {
-        LocalComponentMetadataImpl metadata = new LocalComponentMetadataImpl();
-        metadata.setName(getName(element));
+    private ComponentMetadata parseBeanMetadata(Element element) {
+        BeanMetadataImpl metadata = new BeanMetadataImpl();
+        metadata.setId(getName(element));
         if (element.hasAttribute(CLASS_ATTRIBUTE)) {
             metadata.setClassName(element.getAttribute(CLASS_ATTRIBUTE));
         }
         if (element.hasAttribute(SCOPE_ATTRIBUTE)) {
             metadata.setScope(element.getAttribute(SCOPE_ATTRIBUTE));
         } else {
-            metadata.setScope(LocalComponentMetadata.SCOPE_SINGLETON);
+            metadata.setScope(BeanMetadata.SCOPE_SINGLETON);
         }
         String lazy = element.hasAttribute(LAZY_INIT_ATTRIBUTE) ? element.getAttribute(LAZY_INIT_ATTRIBUTE) : defaultLazyInit;
         if (BOOLEAN_DEFAULT.equals(lazy)) {
@@ -375,14 +370,14 @@
             }
         }
         if (BOOLEAN_TRUE.equals(lazy)) {
-            metadata.setLazy(true);
+            metadata.setLazyInit(true);
         } else if (BOOLEAN_FALSE.equals(lazy)) {
-            metadata.setLazy(false);
+            metadata.setLazyInit(false);
         } else {
             throw new ComponentDefinitionException("Attribute " + LAZY_INIT_ATTRIBUTE + " must be equals to " + BOOLEAN_DEFAULT + ", " + BOOLEAN_TRUE + " or " + BOOLEAN_FALSE);
         }
         if (element.hasAttribute(DEPENDS_ON_ATTRIBUTE)) {
-            metadata.setExplicitDependencies(parseListAsSet(element.getAttribute(DEPENDS_ON_ATTRIBUTE)));
+            metadata.setExplicitDependencies(parseList(element.getAttribute(DEPENDS_ON_ATTRIBUTE)));
         }
         if (element.hasAttribute(INIT_METHOD_ATTRIBUTE)) {
             metadata.setInitMethodName(element.getAttribute(INIT_METHOD_ATTRIBUTE));
@@ -391,11 +386,11 @@
             metadata.setDestroyMethodName(element.getAttribute(DESTROY_METHOD_ATTRIBUTE));
         }
         if (element.hasAttribute(FACTORY_COMPONENT_ATTRIBUTE)) {
-            metadata.setFactoryComponent(new ReferenceValueImpl(element.getAttribute(FACTORY_COMPONENT_ATTRIBUTE)));
+            metadata.setFactoryComponent(new RefMetadataImpl(element.getAttribute(FACTORY_COMPONENT_ATTRIBUTE)));
         }
         if (element.hasAttribute(FACTORY_METHOD_ATTRIBUTE)) {
             String factoryMethod = element.getAttribute(FACTORY_METHOD_ATTRIBUTE);
-            metadata.setFactoryMethodMetadata(new MethodInjectionMetadataImpl(factoryMethod, null));
+            metadata.setFactoryMethodName(factoryMethod);
         }
 
         // Parse elements
@@ -405,15 +400,15 @@
             if (node instanceof Element) {
                 Element e = (Element) node;
                 if (isBlueprintNamespace(node.getNamespaceURI())) {                
-                    if (nodeNameEquals(node, CONSTRUCTOR_ARG_ELEMENT)) {
+                    if (nodeNameEquals(node, ARGUMENT_ELEMENT)) {
                         int index = e.hasAttribute(INDEX_ATTRIBUTE) ? Integer.parseInt(e.getAttribute(INDEX_ATTRIBUTE)) : -1;
                         String type = e.hasAttribute(TYPE_ATTRIBUTE) ? e.getAttribute(TYPE_ATTRIBUTE) : null;
-                        Value value = parseValue(e, metadata);
-                        metadata.addConsuctorArg(new ParameterSpecificationImpl(value, type, index));
+                        Metadata value = parseValue(e, metadata);
+                        metadata.addArgument(new BeanArgumentImpl(value, type, index));
                     } else if (nodeNameEquals(node, PROPERTY_ELEMENT)) {
                         String name = e.hasAttribute(NAME_ATTRIBUTE) ? e.getAttribute(NAME_ATTRIBUTE) : null;
-                        Value value = parseValue(e, metadata);
-                        metadata.addProperty(new PropertyInjectionMetadataImpl(name, value));
+                        Metadata value = parseValue(e, metadata);
+                        metadata.addProperty(new BeanPropertyImpl(name, value));
                     }
                 }
             }
@@ -431,26 +426,26 @@
     }
 
     private ComponentMetadata parseService(Element element) {
-        ServiceExportComponentMetadataImpl service = new ServiceExportComponentMetadataImpl();
-        service.setName(getName(element));
+        ServiceMetadataImpl service = new ServiceMetadataImpl();
+        service.setId(getName(element));
         if (element.hasAttribute(INTERFACE_ATTRIBUTE)) {
-            service.setInterfaceNames(Collections.singleton(element.getAttribute(INTERFACE_ATTRIBUTE)));
+            service.setInterfaceNames(Collections.singletonList(element.getAttribute(INTERFACE_ATTRIBUTE)));
         }
         if (element.hasAttribute(REF_ATTRIBUTE)) {
-            service.setExportedComponent(new ReferenceValueImpl(element.getAttribute(REF_ATTRIBUTE)));
+            service.setExportedComponent(new RefMetadataImpl(element.getAttribute(REF_ATTRIBUTE)));
         }
         if (element.hasAttribute(DEPENDS_ON_ATTRIBUTE)) {
-            service.setExplicitDependencies(parseListAsSet(element.getAttribute(DEPENDS_ON_ATTRIBUTE)));
+            service.setExplicitDependencies(parseList(element.getAttribute(DEPENDS_ON_ATTRIBUTE)));
         }
         String autoExport = element.hasAttribute(AUTO_EXPORT_ATTRIBUTE) ? element.getAttribute(AUTO_EXPORT_ATTRIBUTE) : AUTO_EXPORT_DEFAULT;
         if (AUTO_EXPORT_DISABLED.equals(autoExport)) {
-            service.setAutoExportMode(ServiceExportComponentMetadata.EXPORT_MODE_DISABLED);
+            service.setAutoExportMode(ServiceMetadata.AUTO_EXPORT_DISABLED);
         } else if (AUTO_EXPORT_INTERFACES.equals(autoExport)) {
-            service.setAutoExportMode(ServiceExportComponentMetadata.EXPORT_MODE_INTERFACES);
+            service.setAutoExportMode(ServiceMetadata.AUTO_EXPORT_INTERFACES);
         } else if (AUTO_EXPORT_CLASS_HIERARCHY.equals(autoExport)) {
-            service.setAutoExportMode(ServiceExportComponentMetadata.EXPORT_MODE_CLASS_HIERARCHY);
+            service.setAutoExportMode(ServiceMetadata.AUTO_EXPORT_CLASS_HIERARCHY);
         } else if (AUTO_EXPORT_ALL.equals(autoExport)) {
-            service.setAutoExportMode(ServiceExportComponentMetadata.EXPORT_MODE_ALL);
+            service.setAutoExportMode(ServiceMetadata.AUTO_EXPORT_ALL_CLASSES);
         } else {
             throw new ComponentDefinitionException("Illegal value (" + autoExport + ") for " + AUTO_EXPORT_ATTRIBUTE + " attribute");
         }
@@ -473,21 +468,21 @@
                         }
                         service.setInterfaceNames(parseInterfaceNames(e));
                     } else if (nodeNameEquals(e, SERVICE_PROPERTIES_ELEMENT)) {
-                        service.setServicePropertiesValue(parseMap(e, service));
+                        service.setServiceProperties(parseMap(e, service).getEntries());
                     } else if (nodeNameEquals(e, REGISTRATION_LISTENER_ELEMENT)) {
                         service.addRegistrationListener(parseRegistrationListener(e));
-                    } else if (nodeNameEquals(e, COMPONENT_ELEMENT)) {
-                        if (service.getExportedComponent() != null) {
-                            throw new ComponentDefinitionException("Only one of " + REF_ATTRIBUTE + " attribute, " + COMPONENT_ELEMENT + " element or custom inner element can be set");
+                    } else if (nodeNameEquals(e, BEAN_ELEMENT)) {
+                        if (service.getServiceComponent() != null) {
+                            throw new ComponentDefinitionException("Only one of " + REF_ATTRIBUTE + " attribute, " + BEAN_ELEMENT + " element or custom inner element can be set");
                         }
-                        service.setExportedComponent(new ComponentValueImpl(parseComponentMetadata(e)));
+                        service.setExportedComponent((Target) parseBeanMetadata(e));
                     }
                 }
             }
         }
         // Check service
-        if (service.getExportedComponent() == null) {
-            throw new ComponentDefinitionException("One of " + REF_ATTRIBUTE + " attribute, " + COMPONENT_ELEMENT + " element or custom inner element must be set");
+        if (service.getServiceComponent() == null) {
+            throw new ComponentDefinitionException("One of " + REF_ATTRIBUTE + " attribute, " + BEAN_ELEMENT + " element or custom inner element must be set");
         }
         
         ComponentMetadata s = service;
@@ -498,115 +493,74 @@
         return s;
     }
 
-    private ArrayValue parseArray(Element element, ComponentMetadata enclosingComponent) {
-        // Parse attributes
-        String valueType = element.hasAttribute(VALUE_TYPE_ATTRIBUTE) ? element.getAttribute(VALUE_TYPE_ATTRIBUTE) : null;
-        // Parse elements
-        List<Value> list = new ArrayList<Value>();
-        NodeList nl = element.getChildNodes();
-        for (int i = 0; i < nl.getLength(); i++) {
-            Node node = nl.item(i);
-            if (node instanceof Element) {
-                Value val = parseValueElement((Element) node, enclosingComponent, true);
-                list.add(val);
-            }
-        }
-        return new ArrayValueImpl(valueType, list.toArray(new Value[list.size()]));
+    private CollectionMetadata parseArray(Element element, ComponentMetadata enclosingComponent) {
+        return parseCollection(Object[].class, element, enclosingComponent);
     }
 
-    private ListValue parseList(Element element, ComponentMetadata enclosingComponent) {
-        // Parse attributes
-        String valueType = element.hasAttribute(VALUE_TYPE_ATTRIBUTE) ? element.getAttribute(VALUE_TYPE_ATTRIBUTE) : null;
-        // Parse elements
-        List<Value> list = new ArrayList<Value>();
-        NodeList nl = element.getChildNodes();
-        for (int i = 0; i < nl.getLength(); i++) {
-            Node node = nl.item(i);
-            if (node instanceof Element) {
-                Value val = parseValueElement((Element) node, enclosingComponent, true);
-                list.add(val);
-            }
-        }
-        return new ListValueImpl(valueType, list);
+    private CollectionMetadata parseList(Element element, ComponentMetadata enclosingComponent) {
+        return parseCollection(List.class, element, enclosingComponent);
     }
 
-    private SetValue parseSet(Element element, ComponentMetadata enclosingComponent) {
+    private CollectionMetadata parseSet(Element element, ComponentMetadata enclosingComponent) {
+        return parseCollection(Set.class, element, enclosingComponent);
+    }
+
+    private CollectionMetadata parseCollection(Class collectionType, Element element, ComponentMetadata enclosingComponent) {
         // Parse attributes
         String valueType = element.hasAttribute(VALUE_TYPE_ATTRIBUTE) ? element.getAttribute(VALUE_TYPE_ATTRIBUTE) : null;
         // Parse elements
-        Set<Value> set = new HashSet<Value>();
+        List<Metadata> list = new ArrayList<Metadata>();
         NodeList nl = element.getChildNodes();
         for (int i = 0; i < nl.getLength(); i++) {
             Node node = nl.item(i);
             if (node instanceof Element) {
-                Value val = parseValueElement((Element) node, enclosingComponent, true);
-                set.add(val);
+                Metadata val = parseValueElement((Element) node, enclosingComponent, true);
+                list.add(val);
             }
         }
-        return new SetValueImpl(valueType, set);
+        return new CollectionMetadataImpl(collectionType, valueType, list);
     }
 
-    private PropertiesValue parseProps(Element element) {
+    private PropsMetadata parseProps(Element element) {
         // Parse elements
-        Properties props = new Properties();
-        NodeList nl = element.getChildNodes();
-        for (int i = 0; i < nl.getLength(); i++) {
-            Node node = nl.item(i);
-            if (node instanceof Element) {
-                Element e = (Element) node;
-                if (nodeNameEquals(e, PROP_ELEMENT)) {
-                    String key = e.getAttribute(KEY_ATTRIBUTE);
-                    String val;
-                    if (e.hasAttribute(VALUE_ATTRIBUTE)) {
-                        val = e.getAttribute(VALUE_ATTRIBUTE);
-                    } else {
-                        val = getTextValue(e);
-                    }
-                    props.setProperty(key, val);
-                } else {
-                    throw new ComponentDefinitionException("Unknown element " + e.getNodeName());
-                }
-
-            }
-        }
-        return new PropertiesValueImpl(props);
+        return new PropsMetadataImpl(parseMap(element, null).getEntries());
     }
 
-    private MapValue parseMap(Element element, ComponentMetadata enclosingComponent) {
+    private MapMetadata parseMap(Element element, ComponentMetadata enclosingComponent) {
         // Parse attributes
         String keyType = element.hasAttribute(KEY_TYPE_ATTRIBUTE) ? element.getAttribute(KEY_TYPE_ATTRIBUTE) : null;
         String valueType = element.hasAttribute(VALUE_TYPE_ATTRIBUTE) ? element.getAttribute(VALUE_TYPE_ATTRIBUTE) : null;
         // Parse elements
-        Map<Value, Value> map = new HashMap<Value, Value>();
+        List<MapEntry> entries = new ArrayList<MapEntry>();
         NodeList nl = element.getChildNodes();
         for (int i = 0; i < nl.getLength(); i++) {
             Node node = nl.item(i);
             if (node instanceof Element) {
                 Element e = (Element) node;
                 if (nodeNameEquals(e, ENTRY_ELEMENT)) {
-                    parseMapEntry(map, e, enclosingComponent);
+                    entries.add(parseMapEntry(e, enclosingComponent));
                 }
             }
         }
-        return new MapValueImpl(keyType, valueType, map);
+        return new MapMetadataImpl(keyType, valueType, entries);
     }
 
-    private void parseMapEntry(Map<Value, Value> map, Element element, ComponentMetadata enclosingComponent) {
+    private MapEntry parseMapEntry(Element element, ComponentMetadata enclosingComponent) {
         // Parse attributes
         String key = element.hasAttribute(KEY_ATTRIBUTE) ? element.getAttribute(KEY_ATTRIBUTE) : null;
         String keyRef = element.hasAttribute(KEY_REF_ATTRIBUTE) ? element.getAttribute(KEY_REF_ATTRIBUTE) : null;
         String value = element.hasAttribute(VALUE_ATTRIBUTE) ? element.getAttribute(VALUE_ATTRIBUTE) : null;
         String valueRef = element.hasAttribute(VALUE_REF_ATTRIBUTE) ? element.getAttribute(VALUE_REF_ATTRIBUTE) : null;
         // Parse elements
-        Value keyValue = null;
-        Value valValue = null;
+        NonNullMetadata keyValue = null;
+        Metadata valValue = null;
         NodeList nl = element.getChildNodes();
         for (int i = 0; i < nl.getLength(); i++) {
             Node node = nl.item(i);
             if (node instanceof Element) {
                 Element e = (Element) node;
                 if (nodeNameEquals(e, KEY_ELEMENT)) {
-                    keyValue = parseValueElement(e, enclosingComponent, false);
+                    keyValue = (NonNullMetadata) parseValueElement(e, enclosingComponent, false);
                 } else {
                     valValue = parseValueElement(e, enclosingComponent, true);
                 }
@@ -616,28 +570,28 @@
         if (keyValue != null && (key != null || keyRef != null) || (keyValue == null && key == null && keyRef == null)) {
             throw new ComponentDefinitionException("Only and only one of " + KEY_ATTRIBUTE + " attribute, " + KEY_REF_ATTRIBUTE + " attribute or " + KEY_ELEMENT + " element must be set");
         } else if (keyValue == null && key != null) {
-            keyValue = new TypedStringValueImpl(key);
+            keyValue = new ValueMetadataImpl(key);
         } else if (keyValue == null /*&& keyRef != null*/) {
-            keyValue = new ReferenceValueImpl(keyRef);
+            keyValue = new RefMetadataImpl(keyRef);
         }
         // Check value
         if (valValue != null && (value != null || valueRef != null) || (valValue == null && value == null && valueRef == null)) {
             throw new ComponentDefinitionException("Only and only one of " + VALUE_ATTRIBUTE + " attribute, " + VALUE_REF_ATTRIBUTE + " attribute or sub element must be set");
         } else if (valValue == null && value != null) {
-            valValue = new TypedStringValueImpl(value);
+            valValue = new ValueMetadataImpl(value);
         } else if (valValue == null /*&& valueRef != null*/) {
-            valValue = new ReferenceValueImpl(valueRef);
+            valValue = new RefMetadataImpl(valueRef);
         }
-        map.put(keyValue, valValue);
+        return new MapEntryImpl(keyValue, valValue);
     }
 
-    private RegistrationListenerMetadata parseRegistrationListener(Element element) {
+    private RegistrationListener parseRegistrationListener(Element element) {
         // Parse attributes
         String ref = element.hasAttribute(REF_ATTRIBUTE) ? element.getAttribute(REF_ATTRIBUTE) : null;
         String registrationMethod = element.getAttribute(REGISTRATION_METHOD_ATTRIBUTE);
         String unregistrationMethod = element.getAttribute(UNREGISTRATION_METHOD_ATTRIBUTE);
         // Parse elements
-        Value listenerComponent = null;
+        Metadata listenerComponent = null;
         NodeList nl = element.getChildNodes();
         for (int i = 0; i < nl.getLength(); i++) {
             Node node = nl.item(i);
@@ -648,26 +602,23 @@
                     if (component == null || component.length() == 0) {
                         throw new ComponentDefinitionException("Element " + REF_ELEMENT + " must have a valid " + COMPONENT_ATTRIBUTE + " attribute");
                     }
-                    listenerComponent = new ReferenceValueImpl(component);
-                } else if (nodeNameEquals(e, COMPONENT_ELEMENT)) {
-                    ComponentMetadata component = parseComponentMetadata(e);
-                    listenerComponent = new ComponentValueImpl(component);
+                    listenerComponent = new RefMetadataImpl(component);
+                } else if (nodeNameEquals(e, BEAN_ELEMENT)) {
+                    listenerComponent = parseBeanMetadata(e);
                 } else if (nodeNameEquals(e, REFERENCE_ELEMENT)) {
-                    ComponentMetadata reference = parseUnaryReference(e);
-                    listenerComponent = new ComponentValueImpl(reference);
+                    listenerComponent = parseReference(e);
                 } else if (nodeNameEquals(e, SERVICE_ELEMENT)) {
-                    ComponentMetadata service = parseService(e);
-                    listenerComponent = new ComponentValueImpl(service);
+                    listenerComponent = parseService(e);
                 }
             }
         }
         if (listenerComponent != null && ref != null) {
             throw new ComponentDefinitionException("Attribute " + REF_ATTRIBUTE + " can not be set in addition to a child element");
         } else if (listenerComponent == null && ref != null) {
-            listenerComponent = new ReferenceValueImpl(ref);
+            listenerComponent = new RefMetadataImpl(ref);
         }
-        RegistrationListenerMetadataImpl listener = new RegistrationListenerMetadataImpl();
-        listener.setListenerComponent(listenerComponent);
+        RegistrationListenerImpl listener = new RegistrationListenerImpl();
+        listener.setListenerComponent((Target) listenerComponent);
         if (registrationMethod == null || registrationMethod.length() == 0) {
             throw new ComponentDefinitionException("Attribute " + REGISTRATION_METHOD_ATTRIBUTE + " must be set");
         }
@@ -679,9 +630,9 @@
         return listener;
     }
 
-    private ComponentMetadata parseUnaryReference(Element element) {
-        UnaryServiceReferenceComponentMetadataImpl reference = new UnaryServiceReferenceComponentMetadataImpl();
-        reference.setName(getName(element));
+    private ComponentMetadata parseReference(Element element) {
+        ReferenceMetadataImpl reference = new ReferenceMetadataImpl();
+        reference.setId(getName(element));
         parseReference(element, reference);
         String timeout = element.hasAttribute(TIMEOUT_ATTRIBUTE) ? element.getAttribute(TIMEOUT_ATTRIBUTE) : this.defaultTimeout;
         try {
@@ -698,30 +649,30 @@
         return r;
     }
 
-    private ComponentMetadata parseReferenceCollection(Element element, Class collectionType) {
-        CollectionBasedServiceReferenceComponentMetadataImpl references = new CollectionBasedServiceReferenceComponentMetadataImpl();
-        references.setName(getName(element));
+    private ComponentMetadata parseRefCollection(Element element, Class collectionType) {
+        RefCollectionMetadataImpl references = new RefCollectionMetadataImpl();
+        references.setId(getName(element));
         references.setCollectionType(collectionType);
 
         if (element.hasAttribute(COMPARATOR_REF_ATTRIBUTE)) {
-            references.setComparator(new ReferenceValueImpl(element.getAttribute(COMPARATOR_REF_ATTRIBUTE)));
+            references.setComparator(new RefMetadataImpl(element.getAttribute(COMPARATOR_REF_ATTRIBUTE)));
         }
         if (element.hasAttribute(MEMBER_TYPE_ATTRIBUTE)) {
             String memberType = element.getAttribute(MEMBER_TYPE_ATTRIBUTE);
             if (MEMBER_TYPE_SERVICES.equals(memberType)) {
-                references.setMemberType(CollectionBasedServiceReferenceComponentMetadata.MEMBER_TYPE_SERVICES);
+                references.setMemberType(RefCollectionMetadata.MEMBER_TYPE_SERVICE_INSTANCE);
             } else if (MEMBER_TYPE_SERVICE_REFERENCE.equals(memberType)) {
-                references.setMemberType(CollectionBasedServiceReferenceComponentMetadata.MEMBER_TYPE_SERVICE_REFERENCES);
+                references.setMemberType(RefCollectionMetadata.MEMBER_TYPE_SERVICE_REFERENCE);
             }
         } else {
-            references.setMemberType(CollectionBasedServiceReferenceComponentMetadata.MEMBER_TYPE_SERVICES);
+            references.setMemberType(RefCollectionMetadata.MEMBER_TYPE_SERVICE_INSTANCE);
         }
         if (element.hasAttribute(ORDERING_BASIS_ATTRIBUTE)) {
             String ordering = element.getAttribute(ORDERING_BASIS_ATTRIBUTE);
             if (ORDERING_BASIS_SERVICES.equals(ordering)) {
-                references.setOrderingComparisonBasis(CollectionBasedServiceReferenceComponentMetadata.ORDER_BASIS_SERVICES);
+                references.setOrderingBasis(RefCollectionMetadata.ORDER_BASIS_SERVICE);
             } else if (ODERING_BASIS_SERVICE_REFERENCES.equals(ordering)) {
-                references.setOrderingComparisonBasis(CollectionBasedServiceReferenceComponentMetadata.ORDER_BASIS_SERVICE_REFERENCES);
+                references.setOrderingBasis(RefCollectionMetadata.ORDER_BASIS_SERVICE_REFERENCE);
             }
         }
         parseReference(element, references);
@@ -747,8 +698,8 @@
         return r;
     }
 
-    private void parseComparator(Element element, CollectionBasedServiceReferenceComponentMetadataImpl references) {
-        Value comparator = null;
+    private void parseComparator(Element element, RefCollectionMetadataImpl references) {
+        Metadata comparator = null;
         NodeList nl = element.getChildNodes();
         for (int i = 0; i < nl.getLength(); i++) {
             Node node = nl.item(i);
@@ -760,33 +711,29 @@
                         if (component == null || component.length() == 0) {
                             throw new ComponentDefinitionException("Element " + REF_ELEMENT + " must have a valid " + COMPONENT_ATTRIBUTE + " attribute");
                         }
-                        comparator = new ReferenceValueImpl(component);
-                    } else if (nodeNameEquals(e, COMPONENT_ELEMENT)) {
-                        ComponentMetadata component = parseComponentMetadata(e);
-                        comparator = new ComponentValueImpl(component);
+                        comparator = new RefMetadataImpl(component);
+                    } else if (nodeNameEquals(e, BEAN_ELEMENT)) {
+                        comparator = parseBeanMetadata(e);
                     } else if (nodeNameEquals(e, REFERENCE_ELEMENT)) {
-                        ComponentMetadata reference = parseUnaryReference(e);
-                        comparator = new ComponentValueImpl(reference);
+                        comparator = parseReference(e);
                     } else if (nodeNameEquals(e, SERVICE_ELEMENT)) {
-                        ComponentMetadata service = parseService(e);
-                        comparator = new ComponentValueImpl(service);
+                        comparator = parseService(e);
                     }
                 } else {
-                    ComponentMetadata custom = parseCustomElement(e, references);
-                    comparator = new ComponentValueImpl(custom);
+                    comparator = parseCustomElement(e, references);
                 }
             }
         }
         if (comparator == null) {
-            throw new ComponentDefinitionException("One of " + REF_ELEMENT + ", " + COMPONENTS_ELEMENT + ", " + REFERENCE_ELEMENT + ", " + SERVICE_ELEMENT + " or custom element is required");
+            throw new ComponentDefinitionException("One of " + REF_ELEMENT + ", " + BLUEPRINT_ELEMENT + ", " + REFERENCE_ELEMENT + ", " + SERVICE_ELEMENT + " or custom element is required");
         }
-        references.setComparator(comparator);
+        references.setComparator((Target) comparator);
     }
 
-    private void parseReference(Element element, ServiceReferenceComponentMetadataImpl reference) {
+    private void parseReference(Element element, ServiceReferenceMetadataImpl reference) {
         // Parse attributes
         if (element.hasAttribute(INTERFACE_ATTRIBUTE)) {
-            reference.setInterfaceNames(Collections.singleton(element.getAttribute(INTERFACE_ATTRIBUTE)));
+            reference.setInterfaceNames(Collections.singletonList(element.getAttribute(INTERFACE_ATTRIBUTE)));
         }
         if (element.hasAttribute(FILTER_ATTRIBUTE)) {
             reference.setFilter(element.getAttribute(FILTER_ATTRIBUTE));
@@ -796,9 +743,9 @@
         }
         String availability = element.hasAttribute(AVAILABILITY_ATTRIBUTE) ? element.getAttribute(AVAILABILITY_ATTRIBUTE) : defaultAvailability;
         if (AVAILABILITY_MANDATORY.equals(availability)) {
-            reference.setServiceAvailabilitySpecification(ServiceReferenceComponentMetadata.MANDATORY_AVAILABILITY);
+            reference.setAvailability(ServiceReferenceMetadata.MANDATORY_AVAILABILITY);
         } else if (AVAILABILITY_OPTIONAL.equals(availability)) {
-            reference.setServiceAvailabilitySpecification(ServiceReferenceComponentMetadata.OPTIONAL_AVAILABILITY);
+            reference.setAvailability(ServiceReferenceMetadata.OPTIONAL_AVAILABILITY);
         } else {
             throw new ComponentDefinitionException("Illegal value for " + AVAILABILITY_ATTRIBUTE + " attribute: " + availability);
         }
@@ -815,18 +762,18 @@
                         }
                         reference.setInterfaceNames(parseInterfaceNames(e));
                     } else if (nodeNameEquals(e, LISTENER_ELEMENT)) {
-                        reference.addBindingListener(parseBindingListener(e, reference));
+                        reference.addServiceListener(parseServiceListener(e, reference));
                     }
                 }
             }
         }
     }
 
-    private BindingListenerMetadata parseBindingListener(Element element, ComponentMetadata enclosingComponent) {
-        BindingListenerMetadataImpl listener = new BindingListenerMetadataImpl();
+    private Listener parseServiceListener(Element element, ComponentMetadata enclosingComponent) {
+        ListenerImpl listener = new ListenerImpl();
         // Parse attributes
         if (element.hasAttribute(REF_ATTRIBUTE)) {
-            listener.setListenerComponent(new ReferenceValueImpl(element.getAttribute(REF_ATTRIBUTE)));
+            listener.setListenerComponent(new RefMetadataImpl(element.getAttribute(REF_ATTRIBUTE)));
         }
         listener.setBindMethodName(element.getAttribute(BIND_METHOD_ATTRIBUTE));
         listener.setUnbindMethodName(element.getAttribute(UNBIND_METHOD_ATTRIBUTE));
@@ -845,40 +792,40 @@
                         if (component == null || component.length() == 0) {
                             throw new ComponentDefinitionException("Element " + REF_ELEMENT + " must have a valid " + COMPONENT_ATTRIBUTE + " attribute");
                         }
-                        listener.setListenerComponent(new ReferenceValueImpl(component));
-                    } else if (nodeNameEquals(e, COMPONENT_ELEMENT)) {
+                        listener.setListenerComponent(new RefMetadataImpl(component));
+                    } else if (nodeNameEquals(e, BEAN_ELEMENT)) {
                         if (listener.getListenerComponent() != null) {
                             throw new ComponentDefinitionException("Attribute " + REF_ATTRIBUTE + " can not be set in addition to a child element");
                         }
-                        ComponentMetadata component = parseComponentMetadata(e);
-                        listener.setListenerComponent(new ComponentValueImpl(component));
+                        ComponentMetadata component = parseBeanMetadata(e);
+                        listener.setListenerComponent((Target) component);
                     } else if (nodeNameEquals(e, REFERENCE_ELEMENT)) {
                         if (listener.getListenerComponent() != null) {
                             throw new ComponentDefinitionException("Attribute " + REF_ATTRIBUTE + " can not be set in addition to a child element");
                         }
-                        ComponentMetadata reference = parseUnaryReference(e);
-                        listener.setListenerComponent(new ComponentValueImpl(reference));
+                        ComponentMetadata reference = parseReference(e);
+                        listener.setListenerComponent((Target) reference);
                     } else if (nodeNameEquals(e, SERVICE_ELEMENT)) {
                         if (listener.getListenerComponent() != null) {
                             throw new ComponentDefinitionException("Attribute " + REF_ATTRIBUTE + " can not be set in addition to a child element");
                         }
                         ComponentMetadata service = parseService(e);
-                        listener.setListenerComponent(new ComponentValueImpl(service));
+                        listener.setListenerComponent((Target) service);
                     }
                 } else {
                     if (listener.getListenerComponent() != null) {
                         throw new ComponentDefinitionException("Attribute " + REF_ATTRIBUTE + " can not be set in addition to a child element");
                     }
                     ComponentMetadata custom = parseCustomElement(e, enclosingComponent);
-                    listener.setListenerComponent(new ComponentValueImpl(custom));
+                    listener.setListenerComponent((Target) custom);
                 }
             }
         }
         return listener;
     }
 
-    private Set<String> parseInterfaceNames(Element element) {
-        Set<String> interfaceNames = new HashSet<String>();
+    private List<String> parseInterfaceNames(Element element) {
+        List<String> interfaceNames = new ArrayList<String>();
         NodeList nl = element.getChildNodes();
         for (int i = 0; i < nl.getLength(); i++) {
             Node node = nl.item(i);
@@ -895,11 +842,11 @@
         return interfaceNames;
     }
 
-    private Value parseValue(Element element, ComponentMetadata enclosingComponent) {
+    private Metadata parseValue(Element element, ComponentMetadata enclosingComponent) {
         if (element.hasAttribute(REF_ATTRIBUTE)) {
-            return new ReferenceValueImpl(element.getAttribute(REF_ATTRIBUTE));
+            return new RefMetadataImpl(element.getAttribute(REF_ATTRIBUTE));
         } else if (element.hasAttribute(VALUE_ATTRIBUTE)) {
-            return new TypedStringValueImpl(element.getAttribute(VALUE_ATTRIBUTE));
+            return new ValueMetadataImpl(element.getAttribute(VALUE_ATTRIBUTE));
         } else {
             NodeList nl = element.getChildNodes();
             for (int i = 0; i < nl.getLength(); i++) {
@@ -917,31 +864,30 @@
         throw new ComponentDefinitionException("One of " + REF_ATTRIBUTE + " attribute, " + VALUE_ATTRIBUTE + " attribute or sub element must be set");
     }
 
-    private Value parseValueElement(Element element, ComponentMetadata enclosingComponent, boolean allowNull) {
+    private Metadata parseValueElement(Element element, ComponentMetadata enclosingComponent, boolean allowNull) {
         if (isBlueprintNamespace(element.getNamespaceURI())) {
-            if (nodeNameEquals(element, COMPONENT_ELEMENT)) {
-                ComponentMetadata inner = parseComponentMetadata(element);
-                return new ComponentValueImpl(inner);
+            if (nodeNameEquals(element, BEAN_ELEMENT)) {
+                return parseBeanMetadata(element);
             } else if (nodeNameEquals(element, NULL_ELEMENT) && allowNull) {
-                return NullValue.NULL;
+                return NullMetadata.NULL;
             } else if (nodeNameEquals(element, VALUE_ELEMENT)) {
                 String type = null;
                 if (element.hasAttribute(TYPE_ATTRIBUTE)) {
                     type = element.getAttribute(TYPE_ATTRIBUTE);
                 }
-                return new TypedStringValueImpl(getTextValue(element), type);
+                return new ValueMetadataImpl(getTextValue(element), type);
             } else if (nodeNameEquals(element, REF_ELEMENT)) {
                 String component = element.getAttribute(COMPONENT_ATTRIBUTE);
                 if (component == null || component.length() == 0) {
                     throw new ComponentDefinitionException("Element " + REF_ELEMENT + " must have a valid " + COMPONENT_ATTRIBUTE + " attribute");
                 }
-                return new ReferenceValueImpl(component);
+                return new RefMetadataImpl(component);
             } else if (nodeNameEquals(element, IDREF_ELEMENT)) {
                 String component = element.getAttribute(COMPONENT_ATTRIBUTE);
                 if (component == null || component.length() == 0) {
                     throw new ComponentDefinitionException("Element " + REF_ELEMENT + " must have a valid " + COMPONENT_ATTRIBUTE + " attribute");
                 }
-                return new ReferenceValueImpl(component);
+                return new RefMetadataImpl(component);
             } else if (nodeNameEquals(element, LIST_ELEMENT)) {
                 return parseList(element, enclosingComponent);
             } else if (nodeNameEquals(element, SET_ELEMENT)) {
@@ -956,8 +902,7 @@
                 throw new ComponentDefinitionException("Unknown blueprint element " + element.getNodeName());
             }
         } else {
-            ComponentMetadata innerComponent = parseCustomElement(element, enclosingComponent);
-            return new ComponentValueImpl(innerComponent);
+            return parseCustomElement(element, enclosingComponent);
         }
     }
 
@@ -1040,9 +985,9 @@
         return (name.equals(node.getNodeName()) || name.equals(node.getLocalName()));
     }
 
-    private static Set<String> parseListAsSet(String list) {
+    private static List<String> parseList(String list) {
         String[] items = list.split(",");
-        Set<String> set = new HashSet<String>();
+        List<String> set = new ArrayList<String>();
         for (String item : items) {
             item = item.trim();
             if (item.length() > 0) {



Mime
View raw message