geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r781432 - in /geronimo/sandbox/blueprint: blueprint-api/src/main/java/org/osgi/service/blueprint/container/ blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ blueprint-core/src/main/java/org/apache/geronimo/blueprint/container...
Date Wed, 03 Jun 2009 15:28:46 GMT
Author: gnodet
Date: Wed Jun  3 15:28:45 2009
New Revision: 781432

URL: http://svn.apache.org/viewvc?rev=781432&view=rev
Log:
Update schema and apis so that all components have the initialization (eager / lazy) attribute

Modified:
    geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java
    geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java
    geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.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/mutable/MutableBeanMetadata.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableComponentMetadata.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/BeanMetadataImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ComponentMetadataImpl.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/container/BlueprintEvent.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java?rev=781432&r1=781431&r2=781432&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java
Wed Jun  3 15:28:45 2009
@@ -27,7 +27,7 @@
  *
  * <p>
  * In addition, when a listener is registered, the blueprint extender
- * will synchronously send to this listener the last event for each blueprint bundle managed
+ * will send to this listener the last event for each blueprint bundle managed
  * by this extender.  This replay of events is designed so that the new listener can
  * be informed of the state of each managed bundle.  Events sent during this replay will
  * have the {@link #replay} flag set. The blueprint extender must ensure that this replay
phase

Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java?rev=781432&r1=781431&r2=781432&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java
Wed Jun  3 15:28:45 2009
@@ -26,10 +26,6 @@
 
     static final String SCOPE_BUNDLE = "bundle";
 
-    static final int INITIALIZATION_EAGER = 1;
-
-    static final int INITIALIZATION_LAZY = 2;
-
     String getClassName();
 
     String getInitMethodName();
@@ -40,8 +36,6 @@
 
     List<BeanProperty> getProperties();
 
-    int getInitialization();
-
     String getFactoryMethodName();
     
     Target getFactoryComponent();

Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java?rev=781432&r1=781431&r2=781432&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java
Wed Jun  3 15:28:45 2009
@@ -18,6 +18,12 @@
 
 public interface ComponentMetadata extends NonNullMetadata {
 
+    static final int INITIALIZATION_EAGER = 1;
+
+    static final int INITIALIZATION_LAZY = 2;
+
     String getId();
 
+    int getInitialization();
+
 }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java?rev=781432&r1=781431&r2=781432&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java
Wed Jun  3 15:28:45 2009
@@ -466,18 +466,14 @@
         List<String> components = new ArrayList<String>();
         for (String name : componentDefinitionRegistry.getComponentDefinitionNames()) {
             ComponentMetadata component = componentDefinitionRegistry.getComponentDefinition(name);
+            boolean eager = component.getInitialization() == ComponentMetadata.INITIALIZATION_EAGER;
             if (component instanceof BeanMetadata) {
                 BeanMetadata local = (BeanMetadata) component;
                 String scope = local.getScope();
-                if (local.getInitialization() == BeanMetadata.INITIALIZATION_EAGER &&
BeanMetadata.SCOPE_SINGLETON.equals(scope)) {
-                    components.add(name);
-                }
-            } else if (component instanceof ServiceMetadata) {
+                eager &= BeanMetadata.SCOPE_SINGLETON.equals(scope);
+            }
+            if (eager) {
                 components.add(name);
-            } else if (component instanceof ServiceReferenceMetadata) {
-                if (!((ServiceReferenceMetadata) component).getServiceListeners().isEmpty())
{
-                    components.add(name);
-                }
             }
         }
         LOGGER.debug("Instantiating components: {}", components);

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=781432&r1=781431&r2=781432&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
Wed Jun  3 15:28:45 2009
@@ -481,9 +481,9 @@
         }
         String initialization = element.hasAttribute(INITIALIZATION_ATTRIBUTE) ? element.getAttribute(INITIALIZATION_ATTRIBUTE)
: defaultInitialization;
         if (INITIALIZATION_EAGER.equals(initialization)) {
-            metadata.setInitialization(BeanMetadata.INITIALIZATION_EAGER);
+            metadata.setInitialization(ComponentMetadata.INITIALIZATION_EAGER);
         } else if (INITIALIZATION_LAZY.equals(initialization)) {
-            metadata.setInitialization(BeanMetadata.INITIALIZATION_LAZY);
+            metadata.setInitialization(ComponentMetadata.INITIALIZATION_LAZY);
         } else {
             throw new ComponentDefinitionException("Attribute " + INITIALIZATION_ATTRIBUTE
+ " must be equals to " + INITIALIZATION_EAGER + " or " + INITIALIZATION_LAZY);
         }
@@ -560,6 +560,14 @@
         if (topElement) {
             service.setId(getId(element));
         }
+        String initialization = element.hasAttribute(INITIALIZATION_ATTRIBUTE) ? element.getAttribute(INITIALIZATION_ATTRIBUTE)
: defaultInitialization;
+        if (INITIALIZATION_EAGER.equals(initialization)) {
+            service.setInitialization(ComponentMetadata.INITIALIZATION_EAGER);
+        } else if (INITIALIZATION_LAZY.equals(initialization)) {
+            service.setInitialization(ComponentMetadata.INITIALIZATION_LAZY);
+        } else {
+            throw new ComponentDefinitionException("Attribute " + INITIALIZATION_ATTRIBUTE
+ " must be equals to " + INITIALIZATION_EAGER + " or " + INITIALIZATION_LAZY);
+        }
         if (element.hasAttribute(INTERFACE_ATTRIBUTE)) {
             service.setInterfaceNames(Collections.singletonList(element.getAttribute(INTERFACE_ATTRIBUTE)));
             hasInterfaceNameAttribute = true;
@@ -976,6 +984,14 @@
 
     private void parseReference(Element element, ServiceReferenceMetadataImpl reference)
{
         // Parse attributes
+        String initialization = element.hasAttribute(INITIALIZATION_ATTRIBUTE) ? element.getAttribute(INITIALIZATION_ATTRIBUTE)
: defaultInitialization;
+        if (INITIALIZATION_EAGER.equals(initialization)) {
+            reference.setInitialization(ComponentMetadata.INITIALIZATION_EAGER);
+        } else if (INITIALIZATION_LAZY.equals(initialization)) {
+            reference.setInitialization(ComponentMetadata.INITIALIZATION_LAZY);
+        } else {
+            throw new ComponentDefinitionException("Attribute " + INITIALIZATION_ATTRIBUTE
+ " must be equals to " + INITIALIZATION_EAGER + " or " + INITIALIZATION_LAZY);
+        }
         if (element.hasAttribute(INTERFACE_ATTRIBUTE)) {
             reference.setInterfaceNames(Collections.singletonList(element.getAttribute(INTERFACE_ATTRIBUTE)));
         }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableBeanMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableBeanMetadata.java?rev=781432&r1=781431&r2=781432&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableBeanMetadata.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableBeanMetadata.java
Wed Jun  3 15:28:45 2009
@@ -52,8 +52,6 @@
 
     void removeProperty(BeanProperty property);
 
-    void setInitialization(int initialization);
-
     void setFactoryMethodName(String factoryMethodName);
 
     void setFactoryComponent(Target factoryComponent);

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableComponentMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableComponentMetadata.java?rev=781432&r1=781431&r2=781432&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableComponentMetadata.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableComponentMetadata.java
Wed Jun  3 15:28:45 2009
@@ -30,4 +30,6 @@
 
     void setId(String id);
 
+    void setInitialization(int initialization);
+
 }
\ No newline at end of file

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/BeanMetadataImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/BeanMetadataImpl.java?rev=781432&r1=781431&r2=781432&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/BeanMetadataImpl.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/BeanMetadataImpl.java
Wed Jun  3 15:28:45 2009
@@ -51,7 +51,6 @@
     private boolean processor;
 
     public BeanMetadataImpl() {
-        initialization = INITIALIZATION_EAGER;
         scope = SCOPE_SINGLETON;
     }
 
@@ -160,14 +159,6 @@
         }
     }
 
-    public int getInitialization() {
-        return initialization;
-    }
-
-    public void setInitialization(int initialization) {
-        this.initialization = initialization;
-    }
-
     public String getFactoryMethodName() {
         return this.factoryMethodName;
     }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ComponentMetadataImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ComponentMetadataImpl.java?rev=781432&r1=781431&r2=781432&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ComponentMetadataImpl.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ComponentMetadataImpl.java
Wed Jun  3 15:28:45 2009
@@ -30,6 +30,7 @@
 public class ComponentMetadataImpl implements MutableComponentMetadata {
 
     protected String id;
+    protected int initialization = INITIALIZATION_EAGER;
 
     protected ComponentMetadataImpl() {
     }
@@ -46,4 +47,11 @@
         this.id = id;
     }
 
+    public int getInitialization() {
+        return initialization;
+    }
+
+    public void setInitialization(int initialization) {
+        this.initialization = initialization;
+    }
 }

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=781432&r1=781431&r2=781432&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
Wed Jun  3 15:28:45 2009
@@ -58,6 +58,19 @@
         </xsd:annotation>
 
         <xsd:attribute name="id" type="xsd:ID" />
+
+        <xsd:attribute name="initialization" type="Tinitialization">
+            <xsd:annotation>
+                <xsd:documentation>
+                  <![CDATA[
+                  The initialization attribute for this component.  This can either
+                  be "eager" or "lazy".  If not specified, it
+                  defaults to default-initialization attribute of the enclosing
+                  <blueprint> element.  The default, default is "eager"
+                  ]]>
+                </xsd:documentation>
+            </xsd:annotation>
+        </xsd:attribute>
     </xsd:complexType>
 
     <xsd:element name="blueprint" type="Tblueprint">
@@ -244,21 +257,7 @@
                 <xsd:attribute name="destroy-method" type="TnullableMethod" />
                 <xsd:attribute name="factory-method" type="Tmethod" />
                 <xsd:attribute name="factory-ref" type="Tidref" />
-
                 <xsd:attribute name="scope" type="Tscope" />
-
-                <xsd:attribute name="initialization" type="Tinitialization">
-                    <xsd:annotation>
-                        <xsd:documentation>
-                          <![CDATA[
-                          The initialization attribute for this <bean>.  This can either
-                          be "eager" or "lazy".  If not specified, it
-                          defaults to default-initialization attribute of the enclosing
-                          <blueprint> element.  The default, default is "eager"
-                          ]]>
-                        </xsd:documentation>
-                    </xsd:annotation>
-                </xsd:attribute>
                 <xsd:anyAttribute namespace="##other" processContents="lax" />
             </xsd:extension>
         </xsd:complexContent>
@@ -623,9 +622,9 @@
         <xsd:annotation>
             <xsd:documentation>
               <![CDATA[
-              Tinitializationt defines the initialization type for beans.  This is used in
this
+              Tinitializationt defines the initialization type for components.  This is used
in this
               schema by the <blueprint> default-initialization attribute and the
-              <bean> initialization attribute.
+              initialization attribute.
               ]]>
             </xsd:documentation>
         </xsd:annotation>



Mime
View raw message