aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1595000 - in /aries/trunk/blueprint/blueprint-cm/src: main/java/org/apache/aries/blueprint/compendium/cm/ main/resources/OSGI-INF/blueprint/ main/resources/org/apache/aries/blueprint/compendium/cm/ test/resources/org/apache/aries/blueprint...
Date Thu, 15 May 2014 18:13:51 GMT
Author: dkulp
Date: Thu May 15 18:13:51 2014
New Revision: 1595000

URL: http://svn.apache.org/r1595000
Log:
Fix: Factory functionality for a managed component.
This closes #8

Added:
    aries/trunk/blueprint/blueprint-cm/src/main/resources/org/apache/aries/blueprint/compendium/cm/blueprint-cm-1.3.0.xsd
Modified:
    aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java
    aries/trunk/blueprint/blueprint-cm/src/main/resources/OSGI-INF/blueprint/blueprint-cm.xml
    aries/trunk/blueprint/blueprint-cm/src/test/resources/org/apache/aries/blueprint/compendium/cm/ManagedServiceFactoryTest.xml

Modified: aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java?rev=1595000&r1=1594999&r2=1595000&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java
(original)
+++ aries/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java
Thu May 15 18:13:51 2014
@@ -81,6 +81,7 @@ public class CmNamespaceHandler implemen
     public static final String BLUEPRINT_CM_NAMESPACE_1_0 = "http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0";
     public static final String BLUEPRINT_CM_NAMESPACE_1_1 = "http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0";
     public static final String BLUEPRINT_CM_NAMESPACE_1_2 = "http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.2.0";
+    public static final String BLUEPRINT_CM_NAMESPACE_1_3 = "http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0";
     public static final String BLUEPRINT_EXT_NAMESPACE_V1_0 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0";
     public static final String BLUEPRINT_EXT_NAMESPACE_V1_1 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.1.0";
     public static final String BLUEPRINT_EXT_NAMESPACE_V1_2 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.2.0";
@@ -148,7 +149,9 @@ public class CmNamespaceHandler implemen
     }
 
     public URL getSchemaLocation(String namespace) {
-        if (BLUEPRINT_CM_NAMESPACE_1_2.equals(namespace)) {
+        if (BLUEPRINT_CM_NAMESPACE_1_3.equals(namespace)) {
+            return getClass().getResource("blueprint-cm-1.3.0.xsd");
+        } else if (BLUEPRINT_CM_NAMESPACE_1_2.equals(namespace)) {
             return getClass().getResource("blueprint-cm-1.2.0.xsd");
         } else if (BLUEPRINT_CM_NAMESPACE_1_1.equals(namespace)) {
             return getClass().getResource("blueprint-cm-1.1.0.xsd");
@@ -591,7 +594,8 @@ public class CmNamespaceHandler implemen
     public static boolean isCmNamespace(String uri) {
         return BLUEPRINT_CM_NAMESPACE_1_0.equals(uri)
                 || BLUEPRINT_CM_NAMESPACE_1_1.equals(uri)
-                || BLUEPRINT_CM_NAMESPACE_1_2.equals(uri);
+                || BLUEPRINT_CM_NAMESPACE_1_2.equals(uri)
+                || BLUEPRINT_CM_NAMESPACE_1_3.equals(uri);
     }
 
     public static boolean isExtNamespace(String uri) {

Modified: aries/trunk/blueprint/blueprint-cm/src/main/resources/OSGI-INF/blueprint/blueprint-cm.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-cm/src/main/resources/OSGI-INF/blueprint/blueprint-cm.xml?rev=1595000&r1=1594999&r2=1595000&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-cm/src/main/resources/OSGI-INF/blueprint/blueprint-cm.xml
(original)
+++ aries/trunk/blueprint/blueprint-cm/src/main/resources/OSGI-INF/blueprint/blueprint-cm.xml
Thu May 15 18:13:51 2014
@@ -36,5 +36,10 @@
             <entry key="osgi.service.blueprint.namespace" value="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.2.0"/>
         </service-properties>
     </service>
+    <service ref="CmNamespaceHandler" interface="org.apache.aries.blueprint.NamespaceHandler">
+        <service-properties>
+            <entry key="osgi.service.blueprint.namespace" value="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0"/>
+        </service-properties>
+    </service>
     
 </blueprint>

Added: aries/trunk/blueprint/blueprint-cm/src/main/resources/org/apache/aries/blueprint/compendium/cm/blueprint-cm-1.3.0.xsd
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-cm/src/main/resources/org/apache/aries/blueprint/compendium/cm/blueprint-cm-1.3.0.xsd?rev=1595000&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-cm/src/main/resources/org/apache/aries/blueprint/compendium/cm/blueprint-cm-1.3.0.xsd
(added)
+++ aries/trunk/blueprint/blueprint-cm/src/main/resources/org/apache/aries/blueprint/compendium/cm/blueprint-cm-1.3.0.xsd
Thu May 15 18:13:51 2014
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+    /*
+    * $Revision$
+    *
+    * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+    *
+    * Licensed under the Apache License, Version 2.0 (the "License");
+    * you may not use this file except in compliance with the License.
+    * You may obtain a copy of the License at
+    *
+    *      http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
+    -->
+<xsd:schema xmlns="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            targetNamespace="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0"
+            elementFormDefault="qualified"
+            attributeFormDefault="unqualified"
+            version="1.0.0">
+
+    <xsd:import namespace="http://www.osgi.org/xmlns/blueprint/v1.0.0" />
+
+    <!-- property placeholder -->
+
+    <xsd:element name="property-placeholder" type="TpropertyPlaceholder"/>
+
+    <xsd:complexType name="TpropertyPlaceholder">
+        <xsd:complexContent>
+            <xsd:extension base="bp:Tcomponent">
+                <xsd:sequence>
+                    <!-- nested properties declaration -->
+                    <xsd:element name="default-properties" type="TdefaultProperties" minOccurs="0"
maxOccurs="1"/>
+                </xsd:sequence>
+
+                <!-- #### What should be the type for a persistent id?  I think we need
to define one like class and method -->
+                <xsd:attribute name="persistent-id" type="xsd:string" use="required"/>
+                <xsd:attribute name="placeholder-prefix" type="xsd:string" use="optional"
default="${"/>
+                <xsd:attribute name="placeholder-suffix" type="xsd:string" use="optional"
default="}"/>
+                <xsd:attribute name="defaults-ref" type="bp:Tidref" use="optional"/>
+                <xsd:attribute name="update-strategy" type="TplaceholderUpdateStrategyType"
use="optional" default="none"/>
+            </xsd:extension>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:simpleType name="TplaceholderUpdateStrategyType">
+        <xsd:restriction base="xsd:NMTOKEN">
+            <xsd:enumeration value="none"/>
+            <xsd:enumeration value="reload"/>
+        </xsd:restriction>
+    </xsd:simpleType>
+
+    <!-- #### is this the correct type here?  This is defining placeholder properties,
+         so should this be a restricted set of value types or should this be expanded to
+         all of the elements you can inject into a bean property? -->
+    <xsd:complexType name="TdefaultProperties">
+        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+            <xsd:element name="property" type="bp:Tproperty"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+
+    <!--  managed-properties  -->
+
+    <xsd:element name="managed-properties" type="TmanagedProperties"/>
+
+    <xsd:complexType name="TmanagedProperties">
+        <xsd:attribute name="persistent-id" type="xsd:string" use="required"/>
+        <xsd:attribute name="update-strategy" type="TupdateStrategyType" use="optional"/>
+        <xsd:attribute name="update-method" type="xsd:string" use="optional"/>
+    </xsd:complexType>
+
+    <xsd:simpleType name="TupdateStrategyType">
+        <xsd:restriction base="xsd:NMTOKEN">
+            <xsd:enumeration value="none"/>
+            <xsd:enumeration value="component-managed"/>
+            <xsd:enumeration value="container-managed"/>
+        </xsd:restriction>
+    </xsd:simpleType>
+
+    <!--  managed-service-factory -->
+
+    <xsd:element name="managed-service-factory" type="TmanagedServiceFactory"/>
+
+    <xsd:complexType name="TmanagedServiceFactory">
+        <xsd:complexContent>
+            <xsd:extension base="bp:Tcomponent">
+                <xsd:sequence>
+                    <xsd:group ref="bp:GbaseServiceElements"/>
+                    <xsd:element name="managed-component" type="TmanagedComponent" minOccurs="1"
maxOccurs="1"/>
+                </xsd:sequence>
+                <xsd:attribute name="interface" type="bp:Tclass" use="optional" />
+                <xsd:attribute name="ref" type="bp:Tidref" use="optional" />
+                <xsd:attribute name="auto-export" type="bp:TautoExportModes" default="disabled"
/>
+                <xsd:attribute name="ranking" type="xsd:int" default="0"/>
+                <xsd:attribute name="factory-pid" type="xsd:string" use="required"/>
+                <xsd:anyAttribute namespace="##other" processContents="strict"/>
+            </xsd:extension>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="TmanagedComponent">
+        <xsd:group ref="bp:GbeanElements"/>
+        <xsd:attribute name="class" type="bp:Tclass"/>
+        <xsd:attribute name="init-method" type="bp:Tmethod"/>
+        <xsd:attribute name="destroy-method" type="bp:Tmethod"/>
+        <xsd:attribute name="factory-method" type="bp:Tmethod"/>
+        <xsd:attribute name="factory-ref" type="bp:Tidref"/>
+        <xsd:anyAttribute namespace="##other" processContents="strict"/>
+    </xsd:complexType>
+
+
+    <!-- cm-properties -->
+
+    <xsd:element name="cm-properties" type="TcmProperties"/>
+
+    <xsd:complexType name="TcmProperties">
+        <xsd:complexContent>
+            <xsd:extension base="bp:Tcomponent">
+                <xsd:attribute name="persistent-id" type="xsd:string" use="required"/>
+                <xsd:attribute name="update" type="xsd:boolean" use="optional" default="false"/>
+            </xsd:extension>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+</xsd:schema>

Modified: aries/trunk/blueprint/blueprint-cm/src/test/resources/org/apache/aries/blueprint/compendium/cm/ManagedServiceFactoryTest.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-cm/src/test/resources/org/apache/aries/blueprint/compendium/cm/ManagedServiceFactoryTest.xml?rev=1595000&r1=1594999&r2=1595000&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-cm/src/test/resources/org/apache/aries/blueprint/compendium/cm/ManagedServiceFactoryTest.xml
(original)
+++ aries/trunk/blueprint/blueprint-cm/src/test/resources/org/apache/aries/blueprint/compendium/cm/ManagedServiceFactoryTest.xml
Thu May 15 18:13:51 2014
@@ -15,7 +15,8 @@
         License.
     -->
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0">
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+           xmlns:cm1_3="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0">
 
     <cm:managed-service-factory id="managed-service-factory"
                                 factory-pid="blueprint-sample-managed-service-factory"
@@ -74,7 +75,7 @@
     
     <bean id="fooFactory" class="org.apache.aries.blueprint.compendium.cm.FooFactory"
/>
 
-    <cm:managed-service-factory id="managed-service-factory5"
+    <cm1_3:managed-service-factory id="managed-service-factory5"
                                 factory-pid="blueprint-sample-managed-service-factory5"
                                 interface="org.apache.aries.blueprint.compendium.cm.Foo">
         <service-properties>
@@ -85,6 +86,6 @@
             <cm:managed-properties persistent-id="" />
             <property name="a" value="1" />
             <property name="b" value="default" />
-        </cm:managed-component>
-    </cm:managed-service-factory>    
+        </cm1_3:managed-component>
+    </cm1_3:managed-service-factory>    
 </blueprint>



Mime
View raw message