cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r924371 - in /cxf/dosgi/trunk: discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/ discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/ discovery/local/src/test/resources/ samples/greeter/client/src/main/resou...
Date Wed, 17 Mar 2010 17:15:27 GMT
Author: davidb
Date: Wed Mar 17 17:15:27 2010
New Revision: 924371

URL: http://svn.apache.org/viewvc?rev=924371&view=rev
Log:
Update the syntax of the endpoint description XML file to be compliant with the RSA spec.

Modified:
    cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java
    cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtils.java
    cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryTest.java
    cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtilsTest.java
    cxf/dosgi/trunk/discovery/local/src/test/resources/ed1.xml
    cxf/dosgi/trunk/discovery/local/src/test/resources/ed2.xml
    cxf/dosgi/trunk/discovery/local/src/test/resources/ed3.xml
    cxf/dosgi/trunk/discovery/local/src/test/resources/ed4.xml
    cxf/dosgi/trunk/samples/greeter/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml
    cxf/dosgi/trunk/systests2/common/src/main/resources/rs-test1.xml

Modified: cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java?rev=924371&r1=924370&r2=924371&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java
(original)
+++ cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java
Wed Mar 17 17:15:27 2010
@@ -170,7 +170,8 @@ public class LocalDiscovery implements B
         case BundleEvent.STARTED:
             findDeclaredRemoteServices(be.getBundle());
             break;
-        case BundleEvent.STOPPING:
+        case BundleEvent.STOPPED:
+            System.out.println("#### Bundle Stopped: " + be.getBundle().getSymbolicName());
             removeServicesDeclaredInBundle(be.getBundle());
             break;
         }

Modified: cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtils.java?rev=924371&r1=924370&r2=924371&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtils.java
(original)
+++ cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtils.java
Wed Mar 17 17:15:27 2010
@@ -96,7 +96,8 @@ public final class LocalDiscoveryUtils {
     private static EndpointDescription getEndpointDescription(Element endpointDescriptionElement)
{
         Map<String, Object> map = new HashMap<String, Object>();
         
-        List<Element> properties = endpointDescriptionElement.getChildren(PROPERTY_ELEMENT);
+        List<Element> properties = endpointDescriptionElement.getChildren(PROPERTY_ELEMENT,
+                Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS));
         for (Element prop : properties) {
             boolean handled = handleArray(prop, map);
             if (handled) {
@@ -168,12 +169,13 @@ public final class LocalDiscoveryUtils {
 
     @SuppressWarnings("unchecked")
     private static boolean handleArray(Element prop, Map<String, Object> map) {
-        Element arrayEl = prop.getChild("array");
+        Element arrayEl = prop.getChild("array", Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS));
         if (arrayEl == null) {
             return false;
         }
         
-        List<Element> values = arrayEl.getChildren(PROPERTY_VALUE_ATTRIBUTE);
+        List<Element> values = arrayEl.getChildren(PROPERTY_VALUE_ATTRIBUTE, 
+                Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS));
         String type = getTypeName(prop);
         Class<?> cls = null;
         if ("long".equals(type)) {
@@ -216,11 +218,12 @@ public final class LocalDiscoveryUtils {
     @SuppressWarnings("unchecked")
     private static boolean handleCollection(Element prop, Map<String, Object> map)
{
         Collection<Object> col = null;        
-        Element el = prop.getChild("list");
+        Element el = prop.getChild("list",
+                Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS));
         if (el != null) {
             col = new ArrayList<Object>();
         } else {
-            el = prop.getChild("set");
+            el = prop.getChild("set", Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS));
             if (el != null) {
                 col = new HashSet<Object>();
             }
@@ -231,7 +234,8 @@ public final class LocalDiscoveryUtils {
         }
         
         String type = getTypeName(prop);
-        List<Element> values = el.getChildren(PROPERTY_VALUE_ATTRIBUTE);
+        List<Element> values = el.getChildren(PROPERTY_VALUE_ATTRIBUTE, 
+                Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS));
         for (Element val : values) {
             Object obj = handleValue(val, type);
             col.add(obj);
@@ -255,7 +259,7 @@ public final class LocalDiscoveryUtils {
 
     @SuppressWarnings("unchecked")
     private static String readXML(Element prop) {
-        Element el = prop.getChild("xml");
+        Element el = prop.getChild("xml", Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS));
         if (el == null) {
             return null;
         }
@@ -314,10 +318,14 @@ public final class LocalDiscoveryUtils {
         }
         String javaType = "java.lang." + boxedType;
         
-        try {            
-            Class<?> cls = ClassLoader.getSystemClassLoader().loadClass(javaType);
-            Constructor<?> ctor = cls.getConstructor(String.class);
-            return ctor.newInstance(value);
+        try {
+            if (boxedType.equals("Character")) {
+                return new Character(value.charAt(0));
+            } else {
+                Class<?> cls = ClassLoader.getSystemClassLoader().loadClass(javaType);
+                Constructor<?> ctor = cls.getConstructor(String.class);
+                return ctor.newInstance(value);
+            }
         } catch (Exception e) {
             LOG.warning("Could not create Endpoint Property of type " + type + " and value
" + value);
             return null;
@@ -363,7 +371,8 @@ public final class LocalDiscoveryUtils {
             try {
                 Document d = new SAXBuilder().build(resourceURL.openStream());
                 if (d.getRootElement().getNamespaceURI().equals(REMOTE_SERVICES_ADMIN_NS))
{
-                    elements.addAll(d.getRootElement().getChildren(ENDPOINT_DESCRIPTION_ELEMENT));
+                    elements.addAll(d.getRootElement().getChildren(ENDPOINT_DESCRIPTION_ELEMENT,
+                            Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS)));
                 }
                 
                 Namespace nsOld = Namespace.getNamespace(REMOTE_SERVICES_NS);

Modified: cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryTest.java?rev=924371&r1=924370&r2=924371&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryTest.java
(original)
+++ cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryTest.java
Wed Mar 17 17:15:27 2010
@@ -134,6 +134,7 @@ public class LocalDiscoveryTest extends 
         LocalDiscovery ld = getLocalDiscovery();
 
         Bundle bundle = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(bundle.getSymbolicName()).andReturn("testing.bundle").anyTimes();
         EasyMock.expect(bundle.getState()).andReturn(Bundle.ACTIVE);
         Dictionary<String, Object> headers = new Hashtable<String, Object>();
         headers.put("Remote-Service", "OSGI-INF/rsa/");
@@ -181,7 +182,7 @@ public class LocalDiscoveryTest extends 
         EasyMock.expectLastCall();
         EasyMock.replay(el);
         
-        BundleEvent be1 = new BundleEvent(BundleEvent.STOPPING, bundle);
+        BundleEvent be1 = new BundleEvent(BundleEvent.STOPPED, bundle);
         ld.bundleChanged(be1);
         assertEquals(0, ld.endpointDescriptions.size());
         

Modified: cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtilsTest.java?rev=924371&r1=924370&r2=924371&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtilsTest.java
(original)
+++ cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtilsTest.java
Wed Mar 17 17:15:27 2010
@@ -122,7 +122,7 @@ public class LocalDiscoveryUtilsTest ext
             "org.apache.cxf.ws".equals(props.get("service.exported.configs")));
         assertEquals("org.apache.cxf.ws", props.get("service.exported.configs").toString().trim());
         
-        assertEquals(normXML("<other:t1 xmlns:other='http://www.acme.org/xmlns/other/v1.0.0'><foo
type='bar'>haha</foo></other:t1>"), 
+        assertEquals(normXML("<other:t1 xmlns:other='http://www.acme.org/xmlns/other/v1.0.0'
xmlns='http://www.acme.org/xmlns/other/v1.0.0'><foo type='bar'>haha</foo></other:t1>"),

             normXML((String) props.get("someXML")));
         
         assertEquals(Long.MAX_VALUE, props.get("long"));
@@ -139,6 +139,9 @@ public class LocalDiscoveryUtilsTest ext
         assertEquals(new Boolean(true), props.get("Boolean2"));
         assertEquals(new Short((short) 99), props.get("short"));
         assertEquals(new Short((short) -99), props.get("Short2"));
+        assertEquals(new Character('@'), props.get("char"));
+        assertEquals(new Character('X'), props.get("Character2"));
+        
         int [] intArray = (int []) props.get("int-array");
         assertTrue(Arrays.equals(new int[] {1, 2}, intArray));
         

Modified: cxf/dosgi/trunk/discovery/local/src/test/resources/ed1.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/test/resources/ed1.xml?rev=924371&r1=924370&r2=924371&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/test/resources/ed1.xml (original)
+++ cxf/dosgi/trunk/discovery/local/src/test/resources/ed1.xml Wed Mar 17 17:15:27 2010
@@ -19,7 +19,7 @@
   under the License.
 -->
 
-<rsa:endpoint-descriptions xmlns:rsa="http://www.osgi.org/xmlns/rsa/v1.0.0"
+<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0"
   xmlns:other="http://www.acme.org/xmlns/other/v1.0.0">
   <endpoint-description>
     <property name="objectClass">
@@ -69,5 +69,5 @@
     <property name="endpoint.id" value-type="String">http://somewhere:1/2/3/4?5</property>
     <property name="service.imported.configs" value="org.apache.cxf.ws"/>
   </endpoint-description>
-</rsa:endpoint-descriptions>
+</endpoint-descriptions>
   

Modified: cxf/dosgi/trunk/discovery/local/src/test/resources/ed2.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/test/resources/ed2.xml?rev=924371&r1=924370&r2=924371&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/test/resources/ed2.xml (original)
+++ cxf/dosgi/trunk/discovery/local/src/test/resources/ed2.xml Wed Mar 17 17:15:27 2010
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<rsa:endpoint-descriptions xmlns:rsa="http://www.osgi.org/xmlns/rsa/v1.0.0"
+<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0"
   xmlns:other="http://www.acme.org/xmlns/other/v1.0.0">
   <endpoint-description>
     <property name="objectClass">
@@ -25,7 +25,7 @@
     <property name="someXML" value-type="String">
       <!-- Literal XML to be parsed into the String -->
       <xml>
-        <other:t1>
+        <other:t1 xmlns="http://www.acme.org/xmlns/other/v1.0.0">
           <foo type="bar">haha</foo>
         </other:t1>
       </xml>
@@ -45,6 +45,8 @@
     <property name="Boolean2" value-type="Boolean" value="true"/>
     <property name="short" value-type="short">99</property>
     <property name="Short2" value-type="Short" value="-99"/>
+    <property name="char" value-type="char">@</property>
+    <property name="Character2" value-type="Character" value="X"/>
     
     <property name="bool-list" value-type="boolean">
       <list>
@@ -87,6 +89,6 @@
       </list>
       <!-- This is a custom extension -->
       <other:t1/>                    
-    </property>
+    </property>    
   </endpoint-description>
-</rsa:endpoint-descriptions>
+</endpoint-descriptions>

Modified: cxf/dosgi/trunk/discovery/local/src/test/resources/ed3.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/test/resources/ed3.xml?rev=924371&r1=924370&r2=924371&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/test/resources/ed3.xml (original)
+++ cxf/dosgi/trunk/discovery/local/src/test/resources/ed3.xml Wed Mar 17 17:15:27 2010
@@ -19,7 +19,7 @@
   under the License.
 -->
 
-<rsa:endpoint-descriptions xmlns:rsa="http://www.osgi.org/xmlns/rsa/v1.0.0"
+<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0"
   xmlns:other="http://www.acme.org/xmlns/other/v1.0.0">
   <endpoint-description>
     <property name="objectClass">
@@ -30,5 +30,5 @@
     <property name="endpoint.id">http://somewhere:12345</property>
     <property name="service.imported.configs" value="org.apache.cxf.ws"/>
   </endpoint-description>
-</rsa:endpoint-descriptions>
+</endpoint-descriptions>
   

Modified: cxf/dosgi/trunk/discovery/local/src/test/resources/ed4.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/test/resources/ed4.xml?rev=924371&r1=924370&r2=924371&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/test/resources/ed4.xml (original)
+++ cxf/dosgi/trunk/discovery/local/src/test/resources/ed4.xml Wed Mar 17 17:15:27 2010
@@ -19,7 +19,7 @@
   under the License.
 -->
 
-<rsa:endpoint-descriptions xmlns:rsa="http://www.osgi.org/xmlns/rsa/v1.0.0"
+<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0"
   xmlns:other="http://www.acme.org/xmlns/other/v1.0.0">
   <endpoint-description>
     <property name="objectClass">
@@ -40,5 +40,5 @@
     <property name="endpoint.id">http://somewhere:1</property>
     <property name="service.imported.configs" value="org.apache.cxf.ws"/>
   </endpoint-description>
-</rsa:endpoint-descriptions>
+</endpoint-descriptions>
   

Modified: cxf/dosgi/trunk/samples/greeter/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml?rev=924371&r1=924370&r2=924371&view=diff
==============================================================================
--- cxf/dosgi/trunk/samples/greeter/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml
(original)
+++ cxf/dosgi/trunk/samples/greeter/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml
Wed Mar 17 17:15:27 2010
@@ -13,7 +13,7 @@
     License for the specific language governing permissions and
     limitations under the License.
   -->
-<rsa:endpoint-descriptions xmlns:rsa="http://www.osgi.org/xmlns/rsa/v1.0.0"
+<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0"
   xmlns:other="http://www.acme.org/xmlns/other/v1.0.0">
   <endpoint-description>
     <property name="objectClass">
@@ -24,5 +24,5 @@
     <property name="endpoint.id">http://localhost:9090/greeter</property>
     <property name="service.imported.configs">org.apache.cxf.ws</property>
   </endpoint-description>
-</rsa:endpoint-descriptions>
+</endpoint-descriptions>
 

Modified: cxf/dosgi/trunk/systests2/common/src/main/resources/rs-test1.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/common/src/main/resources/rs-test1.xml?rev=924371&r1=924370&r2=924371&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests2/common/src/main/resources/rs-test1.xml (original)
+++ cxf/dosgi/trunk/systests2/common/src/main/resources/rs-test1.xml Wed Mar 17 17:15:27 2010
@@ -13,7 +13,7 @@
     License for the specific language governing permissions and
     limitations under the License.
   -->
-<rsa:endpoint-descriptions xmlns:rsa="http://www.osgi.org/xmlns/rsa/v1.0.0"
+<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0"
   xmlns:other="http://www.acme.org/xmlns/other/v1.0.0">
   <endpoint-description>
     <property name="objectClass">
@@ -24,5 +24,5 @@
     <property name="endpoint.id">http://localhost:9191/grrr</property>
     <property name="service.imported.configs">org.apache.cxf.ws</property>
   </endpoint-description>
-</rsa:endpoint-descriptions>
+</endpoint-descriptions>
 



Mime
View raw message