geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r781840 - in /geronimo/sandbox/blueprint: blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ blueprint-core/src/main/java/org/apache/geronimo/blueprint/refle...
Date Thu, 04 Jun 2009 19:41:28 GMT
Author: gnodet
Date: Thu Jun  4 19:41:27 2009
New Revision: 781840

URL: http://svn.apache.org/viewvc?rev=781840&view=rev
Log:
Fix <ref-list/> and <ref-set/> collections

Modified:
    geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/Parser.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RecipeBuilder.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RefCollectionRecipe.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ServiceMetadataImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd

Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java?rev=781840&r1=781839&r2=781840&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java
Thu Jun  4 19:41:27 2009
@@ -41,6 +41,4 @@
     
     Collection<RegistrationListener> getRegistrationListeners();
 
-    List<String> getExplicitDependencies();
-    
 }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/Parser.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/Parser.java?rev=781840&r1=781839&r2=781840&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/Parser.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/Parser.java
Thu Jun  4 19:41:27 2009
@@ -186,10 +186,8 @@
     public static final String AVAILABILITY_OPTIONAL = "optional";
     public static final String AVAILABILITY_DEFAULT = AVAILABILITY_MANDATORY;
     public static final String TIMEOUT_DEFAULT = "300000";
-    public static final String MEMBER_TYPE_SERVICES = "service-instance";
-    public static final String MEMBER_TYPE_SERVICE_REFERENCE = "service-reference";
-    public static final String ORDERING_BASIS_SERVICES = "service";
-    public static final String ORDERING_BASIS_SERVICE_REFERENCES = "service-reference";
+    public static final String USE_SERVICE_OBJECT = "service-object";
+    public static final String USE_SERVICE_REFERENCE = "service-reference";
     public static final String INITIALIZATION_EAGER = "eager";
     public static final String INITIALIZATION_LAZY = "lazy";
     public static final String INITIALIZATION_DEFAULT = INITIALIZATION_EAGER;
@@ -892,19 +890,17 @@
         }
         if (element.hasAttribute(MEMBER_TYPE_ATTRIBUTE)) {
             String memberType = element.getAttribute(MEMBER_TYPE_ATTRIBUTE);
-            if (MEMBER_TYPE_SERVICES.equals(memberType)) {
+            if (USE_SERVICE_OBJECT.equals(memberType)) {
                 references.setMemberType(RefCollectionMetadata.USE_SERVICE_OBJECT);
-            } else if (MEMBER_TYPE_SERVICE_REFERENCE.equals(memberType)) {
+            } else if (USE_SERVICE_REFERENCE.equals(memberType)) {
                 references.setMemberType(RefCollectionMetadata.USE_SERVICE_REFERENCE);
             }
-//        } else {
-//            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)) {
+            if (USE_SERVICE_OBJECT.equals(ordering)) {
                 references.setOrderingBasis(RefCollectionMetadata.USE_SERVICE_OBJECT);
-            } else if (ORDERING_BASIS_SERVICE_REFERENCES.equals(ordering)) {
+            } else if (USE_SERVICE_REFERENCE.equals(ordering)) {
                 references.setOrderingBasis(RefCollectionMetadata.USE_SERVICE_REFERENCE);
             }
         }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RecipeBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RecipeBuilder.java?rev=781840&r1=781839&r2=781840&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RecipeBuilder.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RecipeBuilder.java
Thu Jun  4 19:41:27 2009
@@ -156,7 +156,7 @@
             }
         }
         List<Recipe> deps = new ArrayList<Recipe>();
-        for (String name : serviceExport.getExplicitDependencies()) {
+        for (String name : serviceExport.getDependsOn()) {
             deps.add(new RefRecipe(getName(null), name));
         }
         ServiceRecipe recipe = new ServiceRecipe(getName(serviceExport.getId()),

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RefCollectionRecipe.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RefCollectionRecipe.java?rev=781840&r1=781839&r2=781840&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RefCollectionRecipe.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RefCollectionRecipe.java
Thu Jun  4 19:41:27 2009
@@ -82,21 +82,19 @@
                 comparator = new NaturalOrderComparator();
             }
             boolean orderReferences = metadata.getOrderingBasis() == RefCollectionMetadata.USE_SERVICE_REFERENCE;
+            boolean allowDuplicates;
             if (metadata.getCollectionType() == List.class) {
-                if (comparator != null) {
-                    storage = new DynamicCollection<ServiceDispatcher>(true, new DispatcherComparator(comparator,
orderReferences));
-                } else {
-                    storage = new DynamicCollection<ServiceDispatcher>(true, null);
-                }
+                allowDuplicates = true;
             } else if (metadata.getCollectionType() == Set.class) {
-                if (comparator != null) {
-                    storage = new DynamicCollection<ServiceDispatcher>(false, new DispatcherComparator(comparator,
orderReferences));
-                } else {
-                    storage = new DynamicCollection<ServiceDispatcher>(false, null);
-                }
+                allowDuplicates = false;
             } else {
                 throw new IllegalArgumentException("Unsupported collection type " + metadata.getCollectionType().getName());
             }
+            if (comparator != null) {
+                storage = new DynamicCollection<ServiceDispatcher>(allowDuplicates,
new DispatcherComparator(comparator, orderReferences));
+            } else {
+                storage = new DynamicCollection<ServiceDispatcher>(allowDuplicates,
null);
+            }
 
             // Handle initial references
             createListeners();
@@ -157,7 +155,10 @@
                         }
                     }
                     dispatcher.proxy = createProxy(dispatcher, interfaces);
-                    storage.add(dispatcher);
+                    if (!storage.add(dispatcher)) {
+                        dispatcher.destroy();
+                        return;
+                    }
                 }
                 if (listeners != null) {
                     for (Listener listener : listeners) {
@@ -185,11 +186,9 @@
                         }
                     }
                 }
-                for (ManagedCollection collection : collections) {
-                    collection.removeDispatcher(dispatcher);
-                }
+                storage.remove(dispatcher);
+                dispatcher.destroy();
             }
-            dispatcher.destroy();
         }
     }
 
@@ -426,11 +425,6 @@
             super(references, dispatchers);
         }
 
-        @Override
-        public int size() {
-            return dispatchers.size();
-        }
-
         public Object get(int index) {
             return references ? dispatchers.get(index).reference : dispatchers.get(index).proxy;
         }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ServiceMetadataImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ServiceMetadataImpl.java?rev=781840&r1=781839&r2=781840&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ServiceMetadataImpl.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ServiceMetadataImpl.java
Thu Jun  4 19:41:27 2009
@@ -62,7 +62,7 @@
         for (RegistrationListener listener : source.getRegistrationListeners()) {
             addRegistrationListener(new RegistrationListenerImpl(listener));
         }
-        this.explicitDependencies = new ArrayList<String>(source.getExplicitDependencies());
+        this.explicitDependencies = new ArrayList<String>(source.getDependsOn());
     }
 
     public Target getServiceComponent() {
@@ -176,7 +176,7 @@
         }
     }
 
-    public List<String> getExplicitDependencies() {
+    public List<String> getDependsOn() {
         if (this.explicitDependencies == null) {
             return Collections.emptyList();
         } else {

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd?rev=781840&r1=781839&r2=781840&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd
Thu Jun  4 19:41:27 2009
@@ -303,13 +303,14 @@
             <xsd:restriction base="Tbean">
                 <xsd:group ref="beanElements" />
                 <xsd:attribute name="id" use="prohibited"/>
+                <xsd:attribute name="depends-on" type="TdependsOn" use="optional"/>
+                <xsd:attribute name="initialization" use="prohibited"/>
                 <xsd:attribute name="class" type="Tclass" />
                 <xsd:attribute name="init-method" type="Tmethod" />
                 <xsd:attribute name="destroy-method" use="prohibited"/>
                 <xsd:attribute name="factory-method" type="Tmethod" />
                 <xsd:attribute name="factory-ref" type="Tidref" />
                 <xsd:attribute name="scope" fixed="prototype" type="Tscope"/>
-                <xsd:attribute name="lazy-init" use="prohibited"/>
                 <xsd:anyAttribute namespace="##other" processContents="lax" />
             </xsd:restriction>
         </xsd:complexContent>
@@ -422,12 +423,13 @@
                     <xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"
/>
                 </xsd:sequence>
                 <xsd:attribute name="id" use="prohibited"/>
+                <xsd:attribute name="depends-on" type="TdependsOn" use="optional"/>
+                <xsd:attribute name="initialization" use="prohibited"/>
                 <xsd:attribute name="interface" type="Tclass" use="optional"/>
                 <xsd:attribute name="filter" type="xsd:normalizedString" use="optional"/>
                 <xsd:attribute name="component-name" type="Tidref" use="optional"/>
                 <xsd:attribute name="availability" type="Tavailability" use="optional"/>
                 <xsd:attribute name="timeout" type="Ttimeout" use="optional"/>
-                <xsd:attribute name="depends-on" type="TdependsOn" use="optional"/>
                 <xsd:anyAttribute namespace="##other" processContents="lax" />
             </xsd:restriction>
         </xsd:complexContent>
@@ -750,9 +752,10 @@
                     <xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"
/>
                 </xsd:sequence>
                 <xsd:attribute name="id" use="prohibited"/>
+                <xsd:attribute name="depends-on" type="TdependsOn" use="optional"/>
+                <xsd:attribute name="initialization" use="prohibited"/>
                 <xsd:attribute name="interface" type="Tclass" use="optional" />
                 <xsd:attribute name="ref" type="Tidref" use="optional" />
-                <xsd:attribute name="depends-on" type="TdependsOn" use="optional"/>
                 <xsd:attribute name="auto-export" type="TautoExportModes" default="disabled"
/>
                 <xsd:attribute name="ranking" type="xsd:int" default="0"/>
                 <xsd:anyAttribute namespace="##other" processContents="lax" />



Mime
View raw message