geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r769278 - in /geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint: context/ namespace/ reflect/
Date Tue, 28 Apr 2009 07:57:01 GMT
Author: gnodet
Date: Tue Apr 28 07:57:00 2009
New Revision: 769278

URL: http://svn.apache.org/viewvc?rev=769278&view=rev
Log:
Fix a few minor issues

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Parser.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/namespace/ComponentDefinitionRegistryImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/MetadataUtil.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java?rev=769278&r1=769277&r2=769278&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
Tue Apr 28 07:57:00 2009
@@ -220,7 +220,7 @@
         } catch (Exception e) {
             state = State.Failed;
             // TODO: clean up
-            LOGGER.error("Unable to start blueprint context", e);
+            LOGGER.error("Unable to start blueprint context for bundle " + bundleContext.getBundle().getSymbolicName(),
e);
             sender.sendFailure(this, e);
         }
     }

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=769278&r1=769277&r2=769278&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
Tue Apr 28 07:57:00 2009
@@ -199,7 +199,9 @@
 
     private BlueprintObjectRecipe createBeanRecipe(BeanMetadata local) throws Exception {
         BlueprintObjectRecipe recipe = new BlueprintObjectRecipe(blueprintContext, loadClass(local.getClassName()));
-        recipe.setName(local.getId());
+        if (local.getId() != null) {
+            recipe.setName(local.getId());
+        }
         recipe.setExplicitDependencies(local.getExplicitDependencies());
         for (BeanProperty property : local.getProperties()) {
             Object value = getValue(property.getValue(), null);

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=769278&r1=769277&r2=769278&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
Tue Apr 28 07:57:00 2009
@@ -532,9 +532,11 @@
 
     private ComponentMetadata parseService(Element element) {
         ServiceMetadataImpl service = new ServiceMetadataImpl();
+        boolean hasInterfaceNameAttribute = false;
         service.setId(getName(element));
         if (element.hasAttribute(INTERFACE_ATTRIBUTE)) {
             service.setInterfaceNames(Collections.singletonList(element.getAttribute(INTERFACE_ATTRIBUTE)));
+            hasInterfaceNameAttribute = true;
         }
         if (element.hasAttribute(REF_ATTRIBUTE)) {
             service.setServiceComponent(new RefMetadataImpl(element.getAttribute(REF_ATTRIBUTE)));
@@ -568,7 +570,7 @@
                 Element e = (Element) node;
                 if (isBlueprintNamespace(e.getNamespaceURI())) {
                     if (nodeNameEquals(e, INTERFACES_ELEMENT)) {
-                        if (service.getInterfaceNames() != null) {
+                        if (hasInterfaceNameAttribute) {
                             throw new ComponentDefinitionException("Only one of " + INTERFACE_ATTRIBUTE
+ " attribute or " + INTERFACES_ELEMENT + " element must be used");
                         }
                         service.setInterfaceNames(parseInterfaceNames(e));
@@ -581,6 +583,8 @@
                             throw new ComponentDefinitionException("Only one of " + REF_ATTRIBUTE
+ " attribute, " + BEAN_ELEMENT + " element or custom inner element can be set");
                         }
                         service.setServiceComponent((Target) parseBeanMetadata(e));
+                    } else {
+                        // TODO: can be ref, reference or a custom element
                     }
                 }
             }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/namespace/ComponentDefinitionRegistryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/namespace/ComponentDefinitionRegistryImpl.java?rev=769278&r1=769277&r2=769278&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/namespace/ComponentDefinitionRegistryImpl.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/namespace/ComponentDefinitionRegistryImpl.java
Tue Apr 28 07:57:00 2009
@@ -69,11 +69,15 @@
     }
 
     public void registerComponentDefinition(ComponentMetadata component) {
-        String name = component.getId();
-        if (components.containsKey(name)) {
-            throw new ComponentNameAlreadyInUseException(name);
+        String id = component.getId();
+        if (id == null) {
+            // TODO: should we generate a unique name?
+            throw new IllegalArgumentException("Component must have a valid id");
         }
-        components.put(name, component);
+        if (components.containsKey(id)) {
+            throw new ComponentNameAlreadyInUseException(id);
+        }
+        components.put(id, component);
     }
 
     public void removeComponentDefinition(String name) {

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/MetadataUtil.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/MetadataUtil.java?rev=769278&r1=769277&r2=769278&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/MetadataUtil.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/MetadataUtil.java
Tue Apr 28 07:57:00 2009
@@ -30,6 +30,7 @@
 import org.osgi.service.blueprint.reflect.ServiceMetadata;
 import org.osgi.service.blueprint.reflect.Target;
 import org.osgi.service.blueprint.reflect.ValueMetadata;
+import org.osgi.service.blueprint.reflect.CollectionMetadata;
 
 
 /**
@@ -75,6 +76,9 @@
         else if (source instanceof ReferenceMetadata) {
             return new ReferenceMetadataImpl((ReferenceMetadata)source);
         }
+        else if (source instanceof CollectionMetadata) {
+            return new CollectionMetadataImpl((CollectionMetadata)source);
+        }
 
         throw new RuntimeException("Unknown Metadata type received: " + source.getClass().getName());
     }
@@ -132,6 +136,8 @@
             return type.cast(new ServiceMetadataImpl());
         } else if (ReferenceMetadata.class.isAssignableFrom(type)) {
             return type.cast(new ReferenceMetadataImpl());
+        } else if (CollectionMetadata.class.isAssignableFrom(type)) {
+            return type.cast(new CollectionMetadataImpl());
         } else {
             throw new IllegalArgumentException("Unsupport metadata type: " + (type != null
? type.getName() : null));
         }



Mime
View raw message