cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r896896 - in /cxf/dosgi/trunk: discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/ discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/ discovery/local/src/main/...
Date Thu, 07 Jan 2010 14:56:45 GMT
Author: davidb
Date: Thu Jan  7 14:49:43 2010
New Revision: 896896

URL: http://svn.apache.org/viewvc?rev=896896&view=rev
Log:
Applying patch new_rsa_interfaces.patch on behalf of Marc Schaaf
For more details see DOSGI-13

Removed:
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RenoteServiceAdminCoreTest.java
Modified:
    cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/EndpointListenerImpl.java
    cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceDataMonitorListenerImpl.java
    cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/PublishToZooKeeperCustomizerTest.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/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/OsgiUtilsTest.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java
    cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
    cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java
    cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointPermission.java
    cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/RemoteConstants.java
    cxf/dosgi/trunk/samples/discovery/impl/src/main/java/org/apache/cxf/dosgi/samples/discovery/impl/Activator.java

Modified: cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/EndpointListenerImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/EndpointListenerImpl.java?rev=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/EndpointListenerImpl.java (original)
+++ cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/EndpointListenerImpl.java Thu Jan  7 14:49:43 2010
@@ -85,7 +85,7 @@
             try {
 
                 Collection<String> interfaces = endpoint.getInterfaces();
-                String endpointKey = getKey(endpoint.getRemoteURI());
+                String endpointKey = getKey(endpoint.getRemoteID());
 
                 ZooKeeper zk = getZooKeeper();
                 for (String name : interfaces) {
@@ -130,7 +130,7 @@
     private void removeEndpoint(EndpointDescription endpoint) throws UnknownHostException,
         URISyntaxException, InterruptedException, KeeperException {
         Collection<String> interfaces = endpoint.getInterfaces();
-        String endpointKey = getKey(endpoint.getRemoteURI());
+        String endpointKey = getKey(endpoint.getRemoteID());
 
         ZooKeeper zk = getZooKeeper();
         for (String name : interfaces) {
@@ -183,7 +183,7 @@
         }
 
         // Marc: FIXME: What is/was ths good for ??!?!?
-        // copyProperty(ServicePublication.ENDPOINT_ID, sr, p, host);
+        // copyProperty(ServicePublication.ENDPOINT_SERVICE_ID, sr, p, host);
         // copyProperty(ServicePublication.ENDPOINT_LOCATION, sr, p, host);
 
         ByteArrayOutputStream baos = new ByteArrayOutputStream();

Modified: cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceDataMonitorListenerImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceDataMonitorListenerImpl.java?rev=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceDataMonitorListenerImpl.java (original)
+++ cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceDataMonitorListenerImpl.java Thu Jan  7 14:49:43 2010
@@ -97,10 +97,10 @@
                 
                 
                 // the Endpoint.id must be a Long and can't be a string .... 
-                if(m.get(RemoteConstants.ENDPOINT_ID) instanceof String){
-                    String s = (String)m.get(RemoteConstants.ENDPOINT_ID);
+                if(m.get(RemoteConstants.ENDPOINT_SERVICE_ID) instanceof String){
+                    String s = (String)m.get(RemoteConstants.ENDPOINT_SERVICE_ID);
                     Long l = Long.parseLong(s);
-                    m.put(RemoteConstants.ENDPOINT_ID, l);
+                    m.put(RemoteConstants.ENDPOINT_SERVICE_ID, l);
                 }
                 
                 

Modified: cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/PublishToZooKeeperCustomizerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/PublishToZooKeeperCustomizerTest.java?rev=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/PublishToZooKeeperCustomizerTest.java (original)
+++ cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/PublishToZooKeeperCustomizerTest.java Thu Jan  7 14:49:43 2010
@@ -35,7 +35,7 @@
 //        ServiceReference sr = EasyMock.createMock(ServiceReference.class);
 //        EasyMock.expect(sr.getProperty(ServicePublication.SERVICE_INTERFACE_NAME)).andReturn(Arrays.asList("java.lang.String", "org.example.interface.AnInterface"));
 //        EasyMock.expect(sr.getProperty(ServicePublication.ENDPOINT_LOCATION)).andReturn(location).atLeastOnce();
-//        EasyMock.expect(sr.getProperty(ServicePublication.ENDPOINT_ID)).andReturn(eid).atLeastOnce();
+//        EasyMock.expect(sr.getProperty(ServicePublication.ENDPOINT_SERVICE_ID)).andReturn(eid).atLeastOnce();
 //        EasyMock.expect(sr.getProperty(ServicePublication.SERVICE_PROPERTIES)).andReturn(srProps).anyTimes();
 //        EasyMock.replay(sr);
 //
@@ -181,7 +181,7 @@
 //        String eid = UUID.randomUUID().toString();
 //        String epLoc = "http://localhost:9090/ps";
 //        HashMap<String, Object> expected = new HashMap<String, Object>(initial);
-//        expected.put(ServicePublication.ENDPOINT_ID, eid);
+//        expected.put(ServicePublication.ENDPOINT_SERVICE_ID, eid);
 //        expected.put(ServicePublication.ENDPOINT_LOCATION, 
 //            "http://" + InetAddress.getLocalHost().getHostAddress() + ":9090/ps");
 //        expected.put("osgi.remote.configuration.pojo.address", "http://" + 
@@ -189,7 +189,7 @@
 //                
 //        ServiceReference sr = EasyMock.createMock(ServiceReference.class);
 //        EasyMock.expect(sr.getProperty(ServicePublication.SERVICE_PROPERTIES)).andReturn(initial);
-//        EasyMock.expect(sr.getProperty(ServicePublication.ENDPOINT_ID)).andReturn(eid);
+//        EasyMock.expect(sr.getProperty(ServicePublication.ENDPOINT_SERVICE_ID)).andReturn(eid);
 //        EasyMock.expect(sr.getProperty(ServicePublication.ENDPOINT_LOCATION)).andReturn(epLoc);
 //        EasyMock.replay(sr);
 //        

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=896896&r1=896895&r2=896896&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 Thu Jan  7 14:49:43 2010
@@ -94,7 +94,7 @@
 //                remoteProps.put(ServicePublication.SERVICE_INTERFACE_NAME, iNames); 
 //                
 //                if (addEndpointID) {
-//                    remoteProps.put(ServicePublication.ENDPOINT_ID, UUID.randomUUID().toString());
+//                    remoteProps.put(ServicePublication.ENDPOINT_SERVICE_ID, UUID.randomUUID().toString());
 //                }
                 // @@@@ TODO
                 // srefs.add(new ServiceEndpointDescriptionImpl(iNames, remoteProps));                

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=896896&r1=896895&r2=896896&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 Thu Jan  7 14:49:43 2010
@@ -125,7 +125,7 @@
         Set<String> actual = new HashSet<String>();
         for (Map.Entry<EndpointDescription, Bundle> entry : ld.endpointDescriptions.entrySet()) {
             assertSame(b2, entry.getValue());
-            actual.add(entry.getKey().getRemoteURI());
+            actual.add(entry.getKey().getRemoteID());
         }
         assertEquals(expected, actual);
     }
@@ -170,7 +170,7 @@
         ld.bundleChanged(be);
         assertEquals(1, ld.endpointDescriptions.size());
         EndpointDescription ed = ld.endpointDescriptions.keySet().iterator().next();
-        assertEquals("http://somewhere:12345", ed.getRemoteURI());
+        assertEquals("http://somewhere:12345", ed.getRemoteID());
         assertSame(bundle, ld.endpointDescriptions.get(ed));
         
         EasyMock.verify(el);

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=896896&r1=896895&r2=896896&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 Thu Jan  7 14:49:43 2010
@@ -124,7 +124,7 @@
         List<String> interfaces = Arrays.asList("SomeService");
         Map<String, Object> sed1Props = new HashMap<String, Object>();
         sed1Props.put("osgi.remote.requires.intents", "confidentiality");
-        sed1Props.put(ServicePublication.ENDPOINT_ID, eids.get(
+        sed1Props.put(ServicePublication.ENDPOINT_SERVICE_ID, eids.get(
                 Collections.singleton("SomeService")));
         sed1Props.put(ServicePublication.SERVICE_INTERFACE_NAME, interfaces);
         ServiceEndpointDescription sed1 = 
@@ -132,7 +132,7 @@
 
         List<String> interfaces2 = Arrays.asList("SomeOtherService", "WithSomeSecondInterface");
         Map<String, Object> sed2Props = new HashMap<String, Object>();
-        sed2Props.put(ServicePublication.ENDPOINT_ID, eids.get(
+        sed2Props.put(ServicePublication.ENDPOINT_SERVICE_ID, eids.get(
                 new HashSet<String>(interfaces2)));
         sed2Props.put(ServicePublication.SERVICE_INTERFACE_NAME, interfaces2);
         ServiceEndpointDescription sed2 = 
@@ -180,22 +180,22 @@
         List<EndpointDescription> eds = LocalDiscoveryUtils.getAllEndpointDescriptions(b);
         assertEquals(4, eds.size());
         EndpointDescription ed0 = eds.get(0);
-        assertEquals("http://somewhere:12345", ed0.getRemoteURI());
+        assertEquals("http://somewhere:12345", ed0.getRemoteID());
         assertEquals(Arrays.asList("SomeService"), ed0.getInterfaces());
         assertEquals(Arrays.asList("confidentiality"), 
             ed0.getProperties().get("osgi.remote.requires.intents"));
         assertEquals("testValue", ed0.getProperties().get("testKey"));
         
         EndpointDescription ed1 = eds.get(1);
-        assertEquals("myScheme://somewhere:12345", ed1.getRemoteURI());
+        assertEquals("myScheme://somewhere:12345", ed1.getRemoteID());
         assertEquals(Arrays.asList("SomeOtherService", "WithSomeSecondInterface"), ed1.getInterfaces());
         
         EndpointDescription ed2 = eds.get(2);
-        assertEquals("http://somewhere", ed2.getRemoteURI());
+        assertEquals("http://somewhere", ed2.getRemoteID());
         assertEquals(Arrays.asList("SomeOtherService", "WithSomeSecondInterface"), ed2.getInterfaces());
 
         EndpointDescription ed3 = eds.get(3);
-        assertEquals("http://somewhere:1/2/3/4?5", ed3.getRemoteURI());
+        assertEquals("http://somewhere:1/2/3/4?5", ed3.getRemoteID());
         assertEquals(Arrays.asList("SomeOtherService", "WithSomeSecondInterface"), ed3.getInterfaces());
     }
     
@@ -213,10 +213,11 @@
         List<EndpointDescription> eds = LocalDiscoveryUtils.getAllEndpointDescriptions(b);
         assertEquals(2, eds.size());
         EndpointDescription ed0 = eds.get(0);
-        assertEquals("foo:bar", ed0.getRemoteURI());
+        assertEquals("foo:bar", ed0.getRemoteID());
         assertEquals(Arrays.asList("com.acme.HelloService"), ed0.getInterfaces());
         assertEquals(Arrays.asList("SOAP"), ed0.getIntents());
-        assertEquals("org.apache.cxf.ws", ed0.getProperties().get("service.exported.configs"));
+        // changed from exported to imported 
+        assertEquals("org.apache.cxf.ws", ed0.getProperties().get("service.imported.configs"));
         
         EndpointDescription ed1 = eds.get(1);
         Map<String, Object> props = ed1.getProperties();

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=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/test/resources/ed1.xml (original)
+++ cxf/dosgi/trunk/discovery/local/src/test/resources/ed1.xml Thu Jan  7 14:49:43 2010
@@ -33,7 +33,8 @@
       </list>    
     </property>
     <property name="testKey" value="testValue"/>
-    <property name="endpoint.uri">http://somewhere:12345</property>
+    <property name="endpoint.id">http://somewhere:12345</property>
+    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
   </endpoint-description>
   
   <endpoint-description>
@@ -43,7 +44,8 @@
         <value>WithSomeSecondInterface</value>
       </array>
     </property>
-    <property name="endpoint.uri" value-type="String" value="myScheme://somewhere:12345" />
+    <property name="endpoint.id" value-type="String" value="myScheme://somewhere:12345" />
+    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
   </endpoint-description>
 
   <endpoint-description>
@@ -53,7 +55,8 @@
         <value>WithSomeSecondInterface</value>
       </array>
     </property>
-    <property name="endpoint.uri" value="http://somewhere" />
+    <property name="endpoint.id" value="http://somewhere" />
+    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
   </endpoint-description>
 
   <endpoint-description>
@@ -63,7 +66,8 @@
         <value>WithSomeSecondInterface</value>
       </array>
     </property>
-    <property name="endpoint.uri" value-type="String">http://somewhere:1/2/3/4?5</property>
+    <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>
   

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=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/test/resources/ed2.xml (original)
+++ cxf/dosgi/trunk/discovery/local/src/test/resources/ed2.xml Thu Jan  7 14:49:43 2010
@@ -8,11 +8,13 @@
       </array>
     </property>
     <property name="service.intents">SOAP</property>
-    <property name="service.exported.configs" value="org.apache.cxf.ws"/>
-    <property name="endpoint.uri">foo:bar</property>
+    <!-- Marc: Changed to from exported to imported  -->
+    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
+    <property name="endpoint.id">foo:bar</property>
   </endpoint-description>
   <endpoint-description>
-    <property name="endpoint.uri">foo:bar</property>
+    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
+    <property name="endpoint.id">foo:bar</property>
     <property name="objectClass" value-type="String">
       <array>
         <value>com.acme.HelloService</value>

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=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/test/resources/ed3.xml (original)
+++ cxf/dosgi/trunk/discovery/local/src/test/resources/ed3.xml Thu Jan  7 14:49:43 2010
@@ -27,7 +27,8 @@
         <value>SomeService</value>
       </array>
     </property>
-    <property name="endpoint.uri">http://somewhere:12345</property>
+    <property name="endpoint.id">http://somewhere:12345</property>
+    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
   </endpoint-description>
 </rsa: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=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/test/resources/ed4.xml (original)
+++ cxf/dosgi/trunk/discovery/local/src/test/resources/ed4.xml Thu Jan  7 14:49:43 2010
@@ -27,7 +27,8 @@
         <value>org.example.ClassA</value>
       </array>
     </property>
-    <property name="endpoint.uri">http://somewhere</property>
+    <property name="endpoint.id">http://somewhere</property>
+    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
   </endpoint-description>
 
   <endpoint-description>
@@ -36,7 +37,8 @@
         <value>org.example.ClassB</value>
       </array>
     </property>
-    <property name="endpoint.uri">http://somewhere:1</property>
+    <property name="endpoint.id">http://somewhere:1</property>
+    <property name="service.imported.configs" value="org.apache.cxf.ws"/>
   </endpoint-description>
 </rsa:endpoint-descriptions>
   

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java?rev=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java Thu Jan  7 14:49:43 2010
@@ -116,7 +116,7 @@
         // endpointProps.put(RemoteConstants.SERVICE_REMOTE_ID, "TODO");
 
         // FIXME: This key is not defined in the spec but is required by the EndpointDescription !!!!!
-        endpointProps.put(RemoteConstants.ENDPOINT_ID, 123L);
+        endpointProps.put(RemoteConstants.ENDPOINT_SERVICE_ID, 123L);
 
         endpointProps.put(RemoteConstants.ENDPOINT_FRAMEWORK_UUID, OsgiUtils.getUUID(getBundleContext()));
         endpointProps.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, Constants.WS_CONFIG_TYPE);
@@ -146,7 +146,7 @@
 
             Thread.currentThread().setContextClassLoader(ServerFactoryBean.class.getClassLoader());
             Server server = factory.create();
-            endpointProps.put(RemoteConstants.ENDPOINT_URI, address);
+            endpointProps.put(RemoteConstants.ENDPOINT_ID, address);
 
             exportRegistration.setServer(server);
 
@@ -188,7 +188,7 @@
 //    }
 
     protected String getPojoAddress(Map sd, Class<?> iClass) {
-        String address = OsgiUtils.getProperty(sd, RemoteConstants.ENDPOINT_URI);
+        String address = OsgiUtils.getProperty(sd, RemoteConstants.ENDPOINT_ID);
         if (address == null) {
             address = OsgiUtils.getProperty(sd, Constants.WS_ADDRESS_PROPERTY);
         }

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java?rev=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java Thu Jan  7 14:49:43 2010
@@ -71,7 +71,7 @@
         if (epd != null) {
             setIfNotNull(props, "service.remote.id", epd.getRemoteServiceID());
             setIfNotNull(props, "service.remote.uuid", epd.getRemoteFrameworkUUID());
-            setIfNotNull(props, "service.remote.uri", epd.getRemoteURI());
+            setIfNotNull(props, "service.remote.uri", epd.getRemoteID());
             // FIXME: correct ?!?
             setIfNotNull(props, "objectClass", epd.getInterfaces().toArray());
             setIfNotNull(props, "service.imported.configs", epd.getConfigurationTypes());

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/OsgiUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/OsgiUtilsTest.java?rev=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/OsgiUtilsTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/OsgiUtilsTest.java Thu Jan  7 14:49:43 2010
@@ -434,13 +434,15 @@
     public void testGetProperty(){
         
         Map<String, Object> p = new HashMap<String, Object>();
-        p.put(RemoteConstants.ENDPOINT_URI, "http://google.de");
+        p.put(RemoteConstants.ENDPOINT_ID, "http://google.de");
         p.put("notAString",new Object());
+        p.put(org.osgi.framework.Constants.OBJECTCLASS, new String[]{"my.class"});
+        p.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, new String[]{"my.config"});
         
         EndpointDescription ep = new EndpointDescription(p);
         
         assertNull(OsgiUtils.getProperty(ep, "unkownProp"));
-        assertEquals(p.get(RemoteConstants.ENDPOINT_URI),OsgiUtils.getProperty(ep, RemoteConstants.ENDPOINT_URI));
+        assertEquals(p.get(RemoteConstants.ENDPOINT_ID),OsgiUtils.getProperty(ep, RemoteConstants.ENDPOINT_ID));
         assertEquals(null, OsgiUtils.getProperty(ep, "notAString"));
     }
 }

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java?rev=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java Thu Jan  7 14:49:43 2010
@@ -18,22 +18,13 @@
   */
 package org.apache.cxf.dosgi.dsw.handlers;
 
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import junit.framework.TestCase;
 
-import org.apache.cxf.binding.BindingConfiguration;
 import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.TestUtils;
-import org.apache.cxf.dosgi.dsw.qos.IntentMap;
-import org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore;
-import org.apache.cxf.dosgi.dsw.service.ServiceEndpointDescriptionImpl;
 import org.apache.cxf.endpoint.AbstractEndpointFactory;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.feature.AbstractFeature;
@@ -48,10 +39,6 @@
 import org.easymock.classextension.IMocksControl;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
-import org.osgi.service.discovery.ServiceEndpointDescription;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventAdmin;
-import org.osgi.service.event.EventConstants;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
 import org.osgi.service.remoteserviceadmin.RemoteConstants;
 
@@ -62,7 +49,7 @@
         PojoConfigurationTypeHandler handler = new PojoConfigurationTypeHandler(null, hp);
         Map<String, Object> sd = new HashMap<String, Object>();
         String url = "http://somewhere:1234/blah";
-        sd.put(RemoteConstants.ENDPOINT_URI, url);
+        sd.put(RemoteConstants.ENDPOINT_ID, url);
         assertEquals(url, handler.getPojoAddress(sd, String.class));
     }
     
@@ -129,12 +116,13 @@
         
         Map props = new HashMap();
         
-        props.put(RemoteConstants.ENDPOINT_URI, "http://google.de/");
-        
+        props.put(RemoteConstants.ENDPOINT_ID, "http://google.de/");
+        props.put(org.osgi.framework.Constants.OBJECTCLASS, new String[]{"my.class"});
+        props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, new String[]{"my.config"});
         EndpointDescription endpoint = new EndpointDescription(props);
         
         
-        cpfb.setAddress((String)EasyMock.eq(props.get(RemoteConstants.ENDPOINT_URI)));
+        cpfb.setAddress((String)EasyMock.eq(props.get(RemoteConstants.ENDPOINT_ID)));
         EasyMock.expectLastCall().atLeastOnce();
         
         cpfb.setServiceClass(EasyMock.eq(CharSequence.class));

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java?rev=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java Thu Jan  7 14:49:43 2010
@@ -107,8 +107,8 @@
 //                        assertTrue(EasyMock.getCurrentArguments()[1] instanceof ServicePublication);
 //                        Dictionary<?, ?> actualProps = 
 //                            (Dictionary<?, ?>) EasyMock.getCurrentArguments()[2];
-//                        UUID uuid = UUID.fromString(actualProps.get(ServicePublication.ENDPOINT_ID).toString());
-//                        expectedProps.put(ServicePublication.ENDPOINT_ID, uuid.toString());
+//                        UUID uuid = UUID.fromString(actualProps.get(ServicePublication.ENDPOINT_SERVICE_ID).toString());
+//                        expectedProps.put(ServicePublication.ENDPOINT_SERVICE_ID, uuid.toString());
 //                        assertEquals(expectedProps, actualProps);
 //                        return EasyMock.createMock(ServiceRegistration.class);
 //                    }                

Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java?rev=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java Thu Jan  7 14:49:43 2010
@@ -89,8 +89,9 @@
         };
         
         Map p = new HashMap();
-        p.put(RemoteConstants.ENDPOINT_URI, "http://google.de");
-        
+        p.put(RemoteConstants.ENDPOINT_ID, "http://google.de");
+        p.put(Constants.OBJECTCLASS, new String[] {"es.schaaf.my.class"});
+        p.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, "unsupportetConfiguration");
         EndpointDescription endpoint = new EndpointDescription(p);
         
         
@@ -105,15 +106,6 @@
         p.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, "org.apache.cxf.ws");
         endpoint = new EndpointDescription(p);
         
-        // must be null as the endpoint has no interface
-        assertNull(rsaCore.importService(endpoint));
-        // must be empty ... 
-        assertEquals(rsaCore.getImportedEndpoints().size(),0);
-        
-        
-        p.put(Constants.OBJECTCLASS, new String[] {"es.schaaf.my.class"});
-        endpoint = new EndpointDescription(p);
-        
         
         ImportRegistration ireg = rsaCore.importService(endpoint);
         assertNotNull(ireg);

Modified: cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java?rev=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java Thu Jan  7 14:49:43 2010
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2010). 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.
@@ -42,18 +42,21 @@
  * A description of an endpoint that provides sufficient information for a
  * compatible distribution provider to create a connection to this endpoint
  * 
- * An Endpoint Description is easy to transfer between different systems. This
- * allows it to be used as a communications device to convey available endpoint
- * information to nodes in a network.
+ * An Endpoint Description is easy to transfer between different systems because
+ * it is property based where the property keys are strings and the values are
+ * simple types. This allows it to be used as a communications device to convey
+ * available endpoint information to nodes in a network.
  * 
- * An Endpoint Description reflects the perspective of an importer. That is, the
- * property keys have been chosen to match filters that are created by client
- * bundles that need a service. Therefore the map must not contain any
- * service.exported.* property and must contain the service.imported.* ones.
+ * An Endpoint Description reflects the perspective of an <i>importer</i>. That
+ * is, the property keys have been chosen to match filters that are created by
+ * client bundles that need a service. Therefore the map must not contain any
+ * <code>service.exported.*</code> property and must contain the corresponding
+ * <code>service.imported.*</code> ones.
  * 
- * The service.intents property contains the intents provided by the service
- * itself combined with the intents added by the exporting distribution
- * provider. Qualified intents appear expanded on this property.
+ * The <code>service.intents</code> property must contain the intents provided
+ * by the service itself combined with the intents added by the exporting
+ * distribution provider. Qualified intents appear fully expanded on this
+ * property.
  * 
  * @Immutable
  * @version $Revision$
@@ -62,15 +65,17 @@
 public class EndpointDescription {
 	private final Map<String, Object>	properties;
 	private final List<String>			interfaces;
-	private final long					remoteServiceId;
+	private final long					remoteServiceID;
 	private final String				remoteFrameworkUUID;
-	private final String				remoteUri;
+	private final String				remoteID;
 
 	/**
-	 * Create an Endpoint Description based on a Map.
+	 * Create an Endpoint Description from a Map.
 	 * 
 	 * <p>
-	 * The {@link RemoteConstants#ENDPOINT_URI} property must be set.
+	 * The {@link RemoteConstants#ENDPOINT_ID endpoint.id},
+	 * {@link RemoteConstants#SERVICE_IMPORTED_CONFIGS service.imported.configs}
+	 * and <code>objectClass</code> properties must be set.
 	 * 
 	 * @param properties The map from which to create the Endpoint Description.
 	 *        The keys in the map must be type <code>String</code> and, since
@@ -94,28 +99,46 @@
 		}
 		if (props.size() < properties.size()) {
 			throw new IllegalArgumentException(
-					"duplicate keys with different cases in properties");
+					"duplicate keys with different cases in properties: "
+							+ new ArrayList<String>(props.keySet())
+									.removeAll(properties.keySet()));
 		}
 
+		if (!props.containsKey(SERVICE_IMPORTED)) {
+			props.put(SERVICE_IMPORTED, Boolean.toString(true));
+		}
 		this.properties = Collections.unmodifiableMap(props);
 		/* properties must be initialized before calling the following methods */
 		interfaces = verifyObjectClassProperty();
-		remoteServiceId = verifyLongProperty(ENDPOINT_ID);
+		remoteServiceID = verifyLongProperty(ENDPOINT_SERVICE_ID);
 		remoteFrameworkUUID = verifyStringProperty(ENDPOINT_FRAMEWORK_UUID);
-		remoteUri = verifyStringProperty(ENDPOINT_URI);
-		if (remoteUri == null) {
-			throw new IllegalArgumentException(ENDPOINT_URI
+		remoteID = verifyStringProperty(ENDPOINT_ID);
+		if (remoteID == null) {
+			throw new IllegalArgumentException(ENDPOINT_ID
 					+ " property must be set");
 		}
+		if (getConfigurationTypes().isEmpty()) {
+			throw new IllegalArgumentException(SERVICE_IMPORTED_CONFIGS
+					+ " property must be set and non-empty");
+		}
 	}
 
 	/**
-	 * Create an Endpoint Description based on a service reference and a map of
+	 * Create an Endpoint Description based on a Service Reference and a Map of
 	 * properties. The properties in the map take precedence over the properties
-	 * in the service reference.
+	 * in the Service Reference.
 	 * 
 	 * <p>
-	 * The {@link RemoteConstants#ENDPOINT_URI} property must be set.
+	 * This method will automatically set the
+	 * {@link RemoteConstants#ENDPOINT_FRAMEWORK_UUID endpoint.framework.uuid}
+	 * and {@link RemoteConstants#ENDPOINT_SERVICE_ID endpoint.service.id}
+	 * properties based on the specified Service Reference as well as the
+	 * {@link RemoteConstants#SERVICE_IMPORTED service.imported} property if
+	 * they are not specified as properties.
+	 * <p>
+	 * The {@link RemoteConstants#ENDPOINT_ID endpoint.id},
+	 * {@link RemoteConstants#SERVICE_IMPORTED_CONFIGS service.imported.configs}
+	 * and <code>objectClass</code> properties must be set.
 	 * 
 	 * @param reference A service reference that can be exported.
 	 * @param properties Map of properties. This argument can be
@@ -142,7 +165,9 @@
 			}
 			if (props.size() < properties.size()) {
 				throw new IllegalArgumentException(
-						"duplicate keys with different cases in properties");
+						"duplicate keys with different cases in properties: "
+								+ new ArrayList<String>(props.keySet())
+										.removeAll(properties.keySet()));
 			}
 		}
 
@@ -152,8 +177,8 @@
 			}
 		}
 
-		if (!props.containsKey(ENDPOINT_ID)) {
-			props.put(ENDPOINT_ID, reference.getProperty(Constants.SERVICE_ID));
+		if (!props.containsKey(ENDPOINT_SERVICE_ID)) {
+			props.put(ENDPOINT_SERVICE_ID, reference.getProperty(Constants.SERVICE_ID));
 		}
 		if (!props.containsKey(ENDPOINT_FRAMEWORK_UUID)) {
 			String uuid = null;
@@ -173,36 +198,43 @@
 				props.put(ENDPOINT_FRAMEWORK_UUID, uuid);
 			}
 		}
+		if (!props.containsKey(SERVICE_IMPORTED)) {
+			props.put(SERVICE_IMPORTED, Boolean.toString(true));
+		}
 		this.properties = Collections.unmodifiableMap(props);
 		/* properties must be initialized before calling the following methods */
 		interfaces = verifyObjectClassProperty();
-		remoteServiceId = verifyLongProperty(ENDPOINT_ID);
+		remoteServiceID = verifyLongProperty(ENDPOINT_SERVICE_ID);
 		remoteFrameworkUUID = verifyStringProperty(ENDPOINT_FRAMEWORK_UUID);
-		remoteUri = verifyStringProperty(ENDPOINT_URI);
-		if (remoteUri == null) {
-			throw new IllegalArgumentException(ENDPOINT_URI
+		remoteID = verifyStringProperty(ENDPOINT_ID);
+		if (remoteID == null) {
+			throw new IllegalArgumentException(ENDPOINT_ID
 					+ " property must be set");
 		}
+		if (getConfigurationTypes().isEmpty()) {
+			throw new IllegalArgumentException(SERVICE_IMPORTED_CONFIGS
+					+ " property must be set and non-empty");
+		}
 	}
 
 	/**
 	 * Verify and obtain the interface list from the properties.
 	 * 
 	 * @return A list with the interface names.
-	 * @throws IllegalArgumentException When the properties do not contain the
-	 *         right values for and interface list.
-	 * 
+	 * @throws IllegalArgumentException If the objectClass property is not set
+	 *         or is empty or if the package version property values are
+	 *         malformed.
 	 */
 	private List<String> verifyObjectClassProperty() {
 		Object o = properties.get(Constants.OBJECTCLASS);
-		if (o == null) {
-			return Collections.EMPTY_LIST;
-		}
 		if (!(o instanceof String[])) {
 			throw new IllegalArgumentException(
 					"objectClass value must be of type String[]");
 		}
 		String[] objectClass = (String[]) o;
+		if (objectClass.length < 1) {
+			throw new IllegalArgumentException("objectClass is empty");
+		}
 		for (String interf : objectClass) {
 			int index = interf.lastIndexOf('.');
 			if (index == -1) {
@@ -269,19 +301,19 @@
 	}
 
 	/**
-	 * Returns the endpoint's URI.
+	 * Returns the endpoint's id.
 	 * 
-	 * The URI is an opaque id for an endpoint in URI form. No two different
-	 * endpoints must have the same URI, two Endpoint Descriptions with the same
-	 * URI must represent the same endpoint.
+	 * The id is an opaque id for an endpoint. No two different endpoints must
+	 * have the same id. Two Endpoint Descriptions with the same id must
+	 * represent the same endpoint.
 	 * 
-	 * The value of the URI is stored in the
-	 * {@link RemoteConstants#ENDPOINT_URI} property.
+	 * The value of the id is stored in the
+	 * {@link RemoteConstants#ENDPOINT_ID} property.
 	 * 
-	 * @return The URI of the endpoint, never <code>null</code>.
+	 * @return The id of the endpoint, never <code>null</code>.
 	 */
-	public String getRemoteURI() {
-		return remoteUri;
+	public String getRemoteID() {
+		return remoteID;
 	}
 
 	/**
@@ -344,14 +376,14 @@
 	 * id for a service.
 	 * 
 	 * The value of the remote service id is stored in the
-	 * {@link RemoteConstants#ENDPOINT_ID} endpoint property.
+	 * {@link RemoteConstants#ENDPOINT_SERVICE_ID} endpoint property.
 	 * 
 	 * @return Service id of a service or 0 if this Endpoint Description does
-	 *         not relate to an OSGi service
+	 *         not relate to an OSGi service.
 	 * 
 	 */
 	public long getRemoteServiceID() {
-		return remoteServiceId;
+		return remoteServiceID;
 	}
 
 	/**
@@ -426,7 +458,7 @@
 			List<String> result = new ArrayList<String>(values.size());
 			for (Iterator< ? > iter = values.iterator(); iter.hasNext();) {
 				Object v = iter.next();
-				if ((v != null) && (v instanceof String)) {
+				if (v instanceof String) {
 					result.add((String) v);
 				}
 			}
@@ -464,7 +496,7 @@
 	 * as the given Endpoint Description.
 	 * 
 	 * Two Endpoint Descriptions point to the same service if they have the same
-	 * URI or their framework UUIDs and remote service ids are equal.
+	 * id or their framework UUIDs and remote service ids are equal.
 	 * 
 	 * @param other The Endpoint Description to look at
 	 * @return True if this endpoint description points to the same service as
@@ -490,7 +522,7 @@
 	 * @return An integer which is a hash code value for this object.
 	 */
 	public int hashCode() {
-		return getRemoteURI().hashCode();
+		return getRemoteID().hashCode();
 	}
 
 	/**
@@ -498,7 +530,7 @@
 	 * 
 	 * <p>
 	 * An Endpoint Description is considered to be <b>equal to</b> another
-	 * Endpoint Description if their URIs are equal.
+	 * Endpoint Description if their ids are equal.
 	 * 
 	 * @param other The <code>EndpointDescription</code> object to be compared.
 	 * @return <code>true</code> if <code>object</code> is a
@@ -512,13 +544,13 @@
 		if (!(other instanceof EndpointDescription)) {
 			return false;
 		}
-		return getRemoteURI().equals(
-				((EndpointDescription) other).getRemoteURI());
+		return getRemoteID().equals(
+				((EndpointDescription) other).getRemoteID());
 	}
 
 	/**
-	 * Tests the properties of this <code>EndpointDescription</code> against the
-	 * given filter using a case insensitive match.
+	 * Tests the properties of this <code>EndpointDescription</code> against
+	 * the given filter using a case insensitive match.
 	 * 
 	 * @param filter The filter to test.
 	 * @return <code>true</code> If the properties of this
@@ -548,9 +580,10 @@
 	}
 
 	/**
-	 * Unmodifiable Dictionary wrapper for a Map.
+	 * Unmodifiable Dictionary wrapper for a Map. This class is also used by
+	 * EndpointPermission.
 	 */
-	private static class UnmodifiableDictionary<K, V> extends Dictionary<K, V> {
+	static class UnmodifiableDictionary<K, V> extends Dictionary<K, V> {
 		private final Map<K, V>	wrapped;
 
 		UnmodifiableDictionary(Map<K, V> wrapped) {
@@ -584,5 +617,9 @@
 		public int size() {
 			return wrapped.size();
 		}
+
+		public String toString() {
+			return wrapped.toString();
+		}
 	}
 }

Modified: cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointPermission.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointPermission.java?rev=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointPermission.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointPermission.java Thu Jan  7 14:49:43 2010
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2010). 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.
@@ -16,14 +16,13 @@
 
 package org.osgi.service.remoteserviceadmin;
 
-// TODO Hacked from ServiePermission
+import static org.osgi.service.remoteserviceadmin.RemoteConstants.*;
 
 import java.io.IOException;
 import java.io.NotSerializableException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.ObjectStreamField;
-import java.security.BasicPermission;
 import java.security.Permission;
 import java.security.PermissionCollection;
 import java.util.ArrayList;
@@ -32,205 +31,166 @@
 import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.TreeMap;
 
-import org.osgi.framework.Constants;
 import org.osgi.framework.Filter;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.InvalidSyntaxException;
 
 /**
- * <pre>
- * -------------------------------------------------------------
- * THIS CLASS IS A PLACEHOLDER (COPIED FROM SERVICE PERMISSION)!
- * -------------------------------------------------------------
- * </pre>
- * 
- * A bundle's authority to register or get a service.
+ * A bundle's authority to export, import or read an Endpoint.
  * <ul>
- * <li>The <code>register</code> action allows a bundle to register a service on
- * the specified names.
- * <li>The <code>get</code> action allows a bundle to detect a service and get
- * it.
+ * <li>The <code>export</code> action allows a bundle to export a service as an
+ * Endpoint.</li>
+ * <li>The <code>import</code> action allows a bundle to import a service from
+ * an Endpoint.</li>
+ * <li>The <code>read</code> action allows a bundle to read references to an
+ * Endpoint.</li>
  * </ul>
- * Permission to get a service is required in order to detect events regarding
- * the service. Untrusted bundles should not be able to detect the presence of
- * certain services unless they have the appropriate
- * <code>EndpointPermission</code> to get the specific service.
+ * Permission to read an Endpoint is required in order to detect events
+ * regarding an Endpoint. Untrusted bundles should not be able to detect the
+ * presence of certain Endpoints unless they have the appropriate
+ * <code>EndpointPermission</code> to read the specific service.
  * 
  * @ThreadSafe
  * @version $Revision$
  */
 
-public final class EndpointPermission extends BasicPermission {
-	static final long						serialVersionUID	= -7662148639076511574L;
+public final class EndpointPermission extends Permission {
+	static final long					serialVersionUID	= -7662148639076511574L;
 	/**
-	 * The action string <code>export</code>.
+	 * The action string <code>read</code>.
 	 */
-	public final static String				EXPORT				= "export";
+	public final static String			READ				= "read";
 	/**
-	 * The action string <code>import</code>.
+	 * The action string <code>import</code>. The <code>import</code> action
+	 * implies the <code>read</code> action.
 	 */
-	public final static String				IMPORT				= "import";
+	public final static String			IMPORT				= "import";
 	/**
-	 * The action string <code>read</code>.
+	 * The action string <code>export</code>. The <code>export</code> action
+	 * implies the <code>read</code> action.
 	 */
-	public final static String				READ				= "read";
+	public final static String			EXPORT				= "export";
 
-	private final static int				ACTION_EXPORT		= 0x00000001;
-	private final static int				ACTION_IMPORT		= 0x00000002;
-	private final static int				ACTION_READ			= 0x00000004;
-	private final static int				ACTION_ALL			= ACTION_EXPORT
-																		| ACTION_IMPORT
-																		| ACTION_READ;
-	final static int						ACTION_NONE			= 0;
+	private final static int			ACTION_READ			= 0x00000001;
+	private final static int			ACTION_IMPORT		= 0x00000002;
+	private final static int			ACTION_EXPORT		= 0x00000004;
+	private final static int			ACTION_ALL			= ACTION_EXPORT
+																	| ACTION_IMPORT
+																	| ACTION_READ;
+	final static int					ACTION_NONE			= 0;
 
 	/**
 	 * The actions mask.
 	 */
-	transient int							action_mask;
+	transient int						action_mask;
 
 	/**
 	 * The actions in canonical form.
 	 * 
 	 * @serial
 	 */
-	private volatile String					actions				= null;
-
-	/**
-	 * The service used by this EndpointPermission. Must be null if not
-	 * constructed with a service.
-	 */
-	transient final EndpointDescription		endpoint;
-
-	/**
-	 * The object classes for this EndpointPermission. Must be null if not
-	 * constructed with a service.
-	 */
-	transient final String[]				objectClass;
+	private volatile String				actions				= null;
 
 	/**
-	 * If this EndpointPermission was constructed with a filter, this holds a
-	 * Filter matching object used to evaluate the filter in implies.
+	 * The endpoint used by this EndpointPermission. Must be null if not
+	 * constructed with a endpoint.
 	 */
-	transient Filter						filter;
-
+	transient final EndpointDescription					endpoint;
+	
 	/**
 	 * This dictionary holds the properties of the permission, used to match a
-	 * filter in implies. This is not initialized until necessary, and then
-	 * cached in this object.
+	 * filter in implies.
 	 */
-	private transient volatile Dictionary	properties;
+	private transient final Dictionary<String, Object>	properties;
 
 	/**
-	 * True if constructed with a name and the name is "*" or ends with ".*".
+	 * If this EndpointPermission was not constructed with an
+	 * EndpointDescription, this holds a Filter matching object used to evaluate
+	 * the filter in implies or null for wildcard.
 	 */
-	private transient boolean				wildcard;
+	transient Filter					filter;
 
 	/**
-	 * If constructed with a name and the name ends with ".*", this contains the
-	 * name without the final "*".
-	 */
-	private transient String				prefix;
-
-	/**
-	 * Create a new EndpointPermission.
+	 * Create a new EndpointPermission with the specified filter.
 	 * 
 	 * <p>
-	 * The name of the service is specified as a fully qualified class name.
-	 * Wildcards may be used.
-	 * 
-	 * <pre>
-	 * name ::= &lt;class name&gt; | &lt;class name ending in &quot;.*&quot;&gt; | *
-	 * </pre>
-	 * 
-	 * Examples:
-	 * 
-	 * <pre>
-	 * org.osgi.service.http.HttpService
-	 * org.osgi.service.http.*
-	 * *
-	 * </pre>
-	 * 
-	 * For the <code>get</code> action, the name can also be a filter
-	 * expression. The filter gives access to the service properties as well as
-	 * the following attributes:
-	 * <ul>
-	 * <li>signer - A Distinguished Name chain used to sign the bundle
-	 * publishing the service. Wildcards in a DN are not matched according to
-	 * the filter string rules, but according to the rules defined for a DN
-	 * chain.</li>
-	 * <li>location - The location of the bundle publishing the service.</li>
-	 * <li>id - The bundle ID of the bundle publishing the service.</li>
-	 * <li>name - The symbolic name of the bundle publishing the service.</li>
-	 * </ul>
-	 * Since the above attribute names may conflict with service property names
-	 * used by a service, you can prefix an attribute name with '@' in the
-	 * filter expression to match against the service property and not one of
-	 * the above attributes. Filter attribute names are processed in a case
-	 * sensitive manner unless the attribute references a service property.
-	 * Service properties names are case insensitive.
+	 * The filter will be evaluated against the endpoint properties of a
+	 * requested EndpointPermission.
 	 * 
 	 * <p>
-	 * There are two possible actions: <code>get</code> and
-	 * <code>register</code>. The <code>get</code> permission allows the owner
-	 * of this permission to obtain a service with this name. The
-	 * <code>register</code> permission allows the bundle to register a service
-	 * under that name.
-	 * 
-	 * @param name The service class name
-	 * @param actions <code>get</code>,<code>register</code> (canonical order)
-	 * @throws IllegalArgumentException If the specified name is a filter
-	 *         expression and either the specified action is not
-	 *         <code>get</code> or the filter has an invalid syntax.
-	 */
-	public EndpointPermission(String name, String actions) {
-		this(name, parseActions(actions));
-		if ((filter != null) && ((action_mask & ACTION_ALL) != ACTION_EXPORT)) {
-			throw new IllegalArgumentException(
-					"invalid action string for filter expression");
-		}
+	 * There are three possible actions: <code>read</code>, <code>import</code>
+	 * and <code>export</code>. The <code>read</code> action allows the owner of
+	 * this permission to see the presence of distributed services. The
+	 * <code>import</code> action allows the owner of this permission to import
+	 * an endpoint. The <code>export</code> action allows the owner of this
+	 * permission to export a service.
+	 * 
+	 * @param filterString The filter string or &quot;*&quot; to match all
+	 *        endpoints.
+	 * @param actions The actions <code>read</code>, <code>import</code>, or
+	 *        <code>export</code>.
+	 * @throws IllegalArgumentException If the filter has an invalid syntax or
+	 *         the actions are not valid.
+	 */
+	public EndpointPermission(String filterString, String actions) {
+		this(filterString, parseActions(actions));
 	}
 
 	/**
 	 * Creates a new requested <code>EndpointPermission</code> object to be used
-	 * by code that must perform <code>checkPermission</code> for the
-	 * <code>get</code> action. <code>EndpointPermission</code> objects created
-	 * with this constructor cannot be added to a
-	 * <code>EndpointPermission</code> permission collection.
-	 * 
-	 * @param endpoint The requested service.
-	 * @param actions The action <code>get</code>.
-	 * @throws IllegalArgumentException If the specified action is not
-	 *         <code>get</code> or reference is <code>null</code>.
-	 * @since 1.5
+	 * by code that must perform <code>checkPermission</code>.
+	 * <code>EndpointPermission</code> objects created with this constructor
+	 * cannot be added to an <code>EndpointPermission</code> permission
+	 * collection.
+	 * 
+	 * @param endpoint The requested endpoint.
+	 * @param localFrameworkUUID The UUID of the local framework. This is used
+	 *        to support matching the
+	 *        {@link RemoteConstants#ENDPOINT_FRAMEWORK_UUID
+	 *        endpoint.framework.uuid} endpoint property to the
+	 *        <code>&lt;&lt;LOCAL&gt;&gt;</code> value in the filter expression.
+	 * @param actions The actions <code>read</code>, <code>import</code>, or
+	 *        <code>export</code>.
+	 * @throws IllegalArgumentException If the endpoint is <code>null</code> or
+	 *         the actions are not valid.
 	 */
-	public EndpointPermission(EndpointDescription endpoint, String actions) {
+	public EndpointPermission(EndpointDescription endpoint,
+			String localFrameworkUUID, String actions) {
 		super(createName(endpoint));
 		setTransients(null, parseActions(actions));
-		this.endpoint = endpoint;
-		this.objectClass = (String[]) endpoint.getProperties().get(
-				Constants.OBJECTCLASS);
-		if ((action_mask & ACTION_ALL) != ACTION_EXPORT) {
-			throw new IllegalArgumentException("invalid action string");
+		Map<String, Object> props;
+		if ((localFrameworkUUID != null)
+				&& localFrameworkUUID.equals(endpoint.getRemoteFrameworkUUID())) {
+			props = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
+			props.putAll(endpoint.getProperties());
+			props.put(ENDPOINT_FRAMEWORK_UUID, new String[] {
+					endpoint.getRemoteFrameworkUUID(), "<<LOCAL>>"});
 		}
+		else {
+			props = endpoint.getProperties();
+		}
+		this.endpoint = endpoint;
+		this.properties = new EndpointDescription.UnmodifiableDictionary<String, Object>(
+				props);
 	}
 
 	/**
-	 * Create a permission name from a EndpointDescription TODO Needs work
+	 * Create a permission name from a EndpointDescription.
 	 * 
 	 * @param endpoint EndpointDescription to use to create permission name.
 	 * @return permission name.
 	 */
 	private static String createName(EndpointDescription endpoint) {
 		if (endpoint == null) {
-			throw new IllegalArgumentException("reference must not be null");
+			throw new IllegalArgumentException("invalid endpoint: null");
 		}
-		StringBuffer sb = new StringBuffer("(service.id=");
-		// TODO sb.append(endpoint.getProperty(Constants.SERVICE_ID));
+		StringBuffer sb = new StringBuffer("(" + ENDPOINT_ID + "=");
+		sb.append(endpoint.getRemoteID());
 		sb.append(")");
 		return sb.toString();
 	}
@@ -245,7 +205,7 @@
 		super(name);
 		setTransients(parseFilter(name), mask);
 		this.endpoint = null;
-		this.objectClass = null;
+		this.properties = null;
 	}
 
 	/**
@@ -259,16 +219,6 @@
 		}
 		action_mask = mask;
 		filter = f;
-		if (f == null) {
-			String name = getName();
-			int l = name.length();
-			/* if "*" or endsWith ".*" */
-			wildcard = ((name.charAt(l - 1) == '*') && ((l == 1) || (name
-					.charAt(l - 2) == '.')));
-			if (wildcard && (l > 1)) {
-				prefix = name.substring(0, l - 1);
-			}
-		}
 	}
 
 	/**
@@ -304,34 +254,45 @@
 			// check for the known strings
 			int matchlen;
 
-			if (i >= 2 && (a[i - 2] == 'g' || a[i - 2] == 'G')
-					&& (a[i - 1] == 'e' || a[i - 1] == 'E')
+			if (i >= 5 && (a[i - 5] == 'i' || a[i - 5] == 'I')
+					&& (a[i - 4] == 'm' || a[i - 4] == 'M')
+					&& (a[i - 3] == 'p' || a[i - 3] == 'P')
+					&& (a[i - 2] == 'o' || a[i - 2] == 'O')
+					&& (a[i - 1] == 'r' || a[i - 1] == 'R')
 					&& (a[i] == 't' || a[i] == 'T')) {
-				matchlen = 3;
-				mask |= ACTION_EXPORT;
+				matchlen = 6;
+				mask |= ACTION_IMPORT | ACTION_READ;
 
 			}
 			else
-				if (i >= 7 && (a[i - 7] == 'r' || a[i - 7] == 'R')
-						&& (a[i - 6] == 'e' || a[i - 6] == 'E')
-						&& (a[i - 5] == 'g' || a[i - 5] == 'G')
-						&& (a[i - 4] == 'i' || a[i - 4] == 'I')
-						&& (a[i - 3] == 's' || a[i - 3] == 'S')
-						&& (a[i - 2] == 't' || a[i - 2] == 'T')
-						&& (a[i - 1] == 'e' || a[i - 1] == 'E')
-						&& (a[i] == 'r' || a[i] == 'R')) {
-					matchlen = 8;
-					mask |= ACTION_IMPORT;
+				if (i >= 5 && (a[i - 5] == 'e' || a[i - 5] == 'E')
+						&& (a[i - 4] == 'x' || a[i - 4] == 'X')
+						&& (a[i - 3] == 'p' || a[i - 3] == 'P')
+						&& (a[i - 2] == 'o' || a[i - 2] == 'O')
+						&& (a[i - 1] == 'r' || a[i - 1] == 'R')
+						&& (a[i] == 't' || a[i] == 'T')) {
+					matchlen = 6;
+					mask |= ACTION_EXPORT | ACTION_READ;
 
 				}
 				else {
-					// parse error
-					throw new IllegalArgumentException("invalid permission: "
-							+ actions);
+					if (i >= 3 && (a[i - 3] == 'r' || a[i - 3] == 'R')
+							&& (a[i - 2] == 'e' || a[i - 2] == 'E')
+							&& (a[i - 1] == 'a' || a[i - 1] == 'A')
+							&& (a[i] == 'd' || a[i] == 'D')) {
+						matchlen = 4;
+						mask |= ACTION_READ;
+
+					}
+					else {
+						// parse error
+						throw new IllegalArgumentException(
+								"invalid permission: " + actions);
+					}
 				}
 
 			// make sure we didn't just match the tail of a word
-			// like "ackbarfregister". Also, skip to the comma.
+			// like "ackbarfread". Also, skip to the comma.
 			seencomma = false;
 			while (i >= matchlen && !seencomma) {
 				switch (a[i - matchlen]) {
@@ -366,16 +327,17 @@
 	 * Parse filter string into a Filter object.
 	 * 
 	 * @param filterString The filter string to parse.
-	 * @return a Filter for this bundle. If the specified filterString is not a
-	 *         filter expression, then <code>null</code> is returned.
+	 * @return a Filter for this bundle.
 	 * @throws IllegalArgumentException If the filter syntax is invalid.
 	 */
 	private static Filter parseFilter(String filterString) {
+		if (filterString == null) {
+			throw new IllegalArgumentException("invalid filter: null");
+		}
 		filterString = filterString.trim();
-		if (filterString.charAt(0) != '(') {
-			return null;
+		if (filterString.equals("*")) {
+			return null; // wildcard
 		}
-
 		try {
 			return FrameworkUtil.createFilter(filterString);
 		}
@@ -428,46 +390,19 @@
 		if ((effective & desired) != desired) {
 			return false;
 		}
-		/* we have name of "*" */
-		if (wildcard && (prefix == null)) {
-			return true;
-		}
-		/* if we have a filter */
+		/* if we have no filter */
 		Filter f = filter;
-		if (f != null) {
-			return f.matchCase(requested.getProperties());
-		}
-		/* if requested permission not created with EndpointDescription */
-		String[] requestedNames = requested.objectClass;
-		if (requestedNames == null) {
-			return super.implies(requested);
-		}
-		/* requested permission created with EndpointDescription */
-		if (wildcard) {
-			int pl = prefix.length();
-			for (int i = 0, l = requestedNames.length; i < l; i++) {
-				String requestedName = requestedNames[i];
-				if ((requestedName.length() > pl)
-						&& requestedName.startsWith(prefix)) {
-					return true;
-				}
-			}
-		}
-		else {
-			String name = getName();
-			for (int i = 0, l = requestedNames.length; i < l; i++) {
-				if (requestedNames[i].equals(name)) {
-					return true;
-				}
-			}
+		if (f == null) {
+			// it's "*"
+			return true;
 		}
-		return false;
+		return f.matchCase(requested.getProperties());
 	}
 
 	/**
 	 * Returns the canonical string representation of the actions. Always
-	 * returns present actions in the following order: <code>get</code>,
-	 * <code>register</code>.
+	 * returns present actions in the following canonical order:
+	 * <code>read</code>, <code>import</code>, <code>export</code>.
 	 * 
 	 * @return The canonical string representation of the actions.
 	 */
@@ -478,8 +413,8 @@
 			boolean comma = false;
 
 			int mask = action_mask;
-			if ((mask & ACTION_EXPORT) == ACTION_EXPORT) {
-				sb.append(EXPORT);
+			if ((mask & ACTION_READ) == ACTION_READ) {
+				sb.append(READ);
 				comma = true;
 			}
 
@@ -489,6 +424,12 @@
 				sb.append(IMPORT);
 			}
 
+			if ((mask & ACTION_EXPORT) == ACTION_EXPORT) {
+				if (comma)
+					sb.append(',');
+				sb.append(EXPORT);
+			}
+
 			actions = result = sb.toString();
 		}
 
@@ -509,12 +450,12 @@
 	/**
 	 * Determines the equality of two EndpointPermission objects.
 	 * 
-	 * Checks that specified object has the same class name and action as this
-	 * <code>EndpointPermission</code>.
+	 * Checks that specified object has the same name, actions and endpoint as
+	 * this <code>EndpointPermission</code>.
 	 * 
 	 * @param obj The object to test for equality.
 	 * @return true if obj is a <code>EndpointPermission</code>, and has the
-	 *         same class name and actions as this
+	 *         same name, actions and endpoint as this
 	 *         <code>EndpointPermission</code> object; <code>false</code>
 	 *         otherwise.
 	 */
@@ -527,13 +468,13 @@
 			return false;
 		}
 
-		EndpointPermission sp = (EndpointPermission) obj;
+		EndpointPermission ep = (EndpointPermission) obj;
 
-		return (action_mask == sp.action_mask)
-				&& getName().equals(sp.getName())
-				&& ((endpoint == sp.endpoint) || ((endpoint != null)
-						&& (sp.endpoint != null) && endpoint
-						.equals(sp.endpoint)));
+		return (action_mask == ep.action_mask)
+				&& getName().equals(ep.getName())
+				&& ((endpoint == ep.endpoint) || ((endpoint != null)
+						&& (ep.endpoint != null) && endpoint
+						.equals(ep.endpoint)));
 	}
 
 	/**
@@ -561,8 +502,9 @@
 		}
 		// Write out the actions. The superclass takes care of the name
 		// call getActions to make sure actions field is initialized
-		if (actions == null)
+		if (actions == null) {
 			getActions();
+		}
 		s.defaultWriteObject();
 	}
 
@@ -582,109 +524,8 @@
 	 * 
 	 * @return a dictionary of properties for this permission.
 	 */
-	private Dictionary/* <String,Object> */getProperties() {
-		Dictionary/* <String, Object> */result = properties;
-		if (result != null) {
-			return result;
-		}
-		if (endpoint == null) {
-			result = new Hashtable/* <String, Object> */(1);
-			if (filter == null) {
-				result.put(Constants.OBJECTCLASS, new String[] {getName()});
-			}
-			return properties = result;
-		}
-		final Map props = new HashMap(4);
-		// TODO needs work
-		/*
-		 * final Bundle bundle = endpoint.getBundle(); if (bundle != null) {
-		 * AccessController.doPrivileged(new PrivilegedAction() { public Object
-		 * run() { props.put("id", new Long(bundle.getBundleId()));
-		 * props.put("location", bundle.getLocation()); String name =
-		 * bundle.getSymbolicName(); if (name != null) { props.put("name",
-		 * name); } SignerProperty signer = new SignerProperty(bundle); if
-		 * (signer.isBundleSigned()) { props.put("signer", signer); } return
-		 * null; } }); }
-		 */
-		return properties = new Properties(props, endpoint);
-	}
-
-	private static class Properties extends Dictionary {
-		private final Map					properties;
-		private final EndpointDescription	service;
-
-		Properties(Map properties, EndpointDescription service) {
-			this.properties = properties;
-			this.service = service;
-		}
-
-		public Object get(Object k) {
-			if (!(k instanceof String)) {
-				return null;
-			}
-			String key = (String) k;
-			if (key.charAt(0) == '@') {
-				return service.getProperties().get(key.substring(1));
-			}
-			Object value = properties.get(key);
-			if (value != null) { // fall back to service properties
-				return value;
-			}
-			return service.getProperties().get(key);
-		}
-
-		public int size() {
-			return properties.size() + service.getProperties().size();
-		}
-
-		public boolean isEmpty() {
-			// we can return false because this must never be empty
-			return false;
-		}
-
-		public Enumeration keys() {
-			Collection pk = properties.keySet();
-			String spk[] = (String[]) service.getProperties().keySet().toArray(
-					new String[service.getProperties().size()]);
-			List all = new ArrayList(pk.size() + spk.length);
-			all.addAll(pk);
-			add: for (int i = 0, length = spk.length; i < length; i++) {
-				String key = spk[i];
-				for (Iterator iter = pk.iterator(); iter.hasNext();) {
-					if (key.equalsIgnoreCase((String) iter.next())) {
-						continue add;
-					}
-				}
-				all.add(key);
-			}
-			return Collections.enumeration(all);
-		}
-
-		public Enumeration elements() {
-			Collection pk = properties.keySet();
-			String spk[] = (String[]) service.getProperties().keySet().toArray(
-					new String[service.getProperties().size()]);
-			List all = new ArrayList(pk.size() + spk.length);
-			all.addAll(properties.values());
-			add: for (int i = 0, length = spk.length; i < length; i++) {
-				String key = spk[i];
-				for (Iterator iter = pk.iterator(); iter.hasNext();) {
-					if (key.equalsIgnoreCase((String) iter.next())) {
-						continue add;
-					}
-				}
-				all.add(service.getProperties().get(key));
-			}
-			return Collections.enumeration(all);
-		}
-
-		public Object put(Object key, Object value) {
-			throw new UnsupportedOperationException();
-		}
-
-		public Object remove(Object key) {
-			throw new UnsupportedOperationException();
-		}
+	private Dictionary<String, Object> getProperties() {
+		return properties;
 	}
 }
 
@@ -696,35 +537,28 @@
  * @see java.security.PermissionCollection
  */
 final class EndpointPermissionCollection extends PermissionCollection {
-	static final long		serialVersionUID	= 662615640374640621L;
+	static final long						serialVersionUID	= 662615640374640621L;
 	/**
 	 * Table of permissions.
 	 * 
-	 * @GuardedBy this
-	 */
-	private transient Map	permissions;
-
-	/**
-	 * Boolean saying if "*" is in the collection.
-	 * 
 	 * @serial
 	 * @GuardedBy this
 	 */
-	private boolean			all_allowed;
+	private Map<String, EndpointPermission>	permissions;
 
 	/**
-	 * Table of permissions with filter expressions.
+	 * Boolean saying if "*" is in the collection.
 	 * 
 	 * @serial
 	 * @GuardedBy this
 	 */
-	private Map				filterPermissions;
+	private boolean							all_allowed;
 
 	/**
 	 * Creates an empty EndpointPermissions object.
 	 */
 	public EndpointPermissionCollection() {
-		permissions = new HashMap();
+		permissions = new HashMap<String, EndpointPermission>();
 		all_allowed = false;
 	}
 
@@ -748,39 +582,29 @@
 					+ "readonly PermissionCollection");
 		}
 
-		final EndpointPermission sp = (EndpointPermission) permission;
-		if (sp.endpoint != null) {
+		final EndpointPermission ep = (EndpointPermission) permission;
+		if (ep.endpoint != null) {
 			throw new IllegalArgumentException("cannot add to collection: "
-					+ sp);
+					+ ep);
 		}
 
-		final String name = sp.getName();
-		final Filter f = sp.filter;
+		final String name = ep.getName();
 		synchronized (this) {
 			/* select the bucket for the permission */
-			Map pc;
-			if (f != null) {
-				pc = filterPermissions;
-				if (pc == null) {
-					filterPermissions = pc = new HashMap();
-				}
-			}
-			else {
-				pc = permissions;
-			}
+			Map<String, EndpointPermission> pc = permissions;
 			final EndpointPermission existing = (EndpointPermission) pc
 					.get(name);
 
 			if (existing != null) {
 				final int oldMask = existing.action_mask;
-				final int newMask = sp.action_mask;
+				final int newMask = ep.action_mask;
 				if (oldMask != newMask) {
 					pc.put(name,
 							new EndpointPermission(name, oldMask | newMask));
 				}
 			}
 			else {
-				pc.put(name, sp);
+				pc.put(name, ep);
 			}
 
 			if (!all_allowed) {
@@ -808,50 +632,27 @@
 		if (requested.filter != null) {
 			return false;
 		}
-
 		int effective = EndpointPermission.ACTION_NONE;
-		Collection perms;
+		Collection<EndpointPermission> perms;
 		synchronized (this) {
 			final int desired = requested.action_mask;
 			/* short circuit if the "*" Permission was added */
 			if (all_allowed) {
-				EndpointPermission sp = (EndpointPermission) permissions
-						.get("*");
-				if (sp != null) {
-					effective |= sp.action_mask;
+				EndpointPermission ep = permissions.get("*");
+				if (ep != null) {
+					effective |= ep.action_mask;
 					if ((effective & desired) == desired) {
 						return true;
 					}
 				}
 			}
-
-			String[] requestedNames = requested.objectClass;
-			/* if requested permission not created with EndpointDescription */
-			if (requestedNames == null) {
-				effective |= effective(requested.getName(), desired, effective);
-				if ((effective & desired) == desired) {
-					return true;
-				}
-			}
-			/* requested permission created with EndpointDescription */
-			else {
-				for (int i = 0, l = requestedNames.length; i < l; i++) {
-					if ((effective(requestedNames[i], desired, effective) & desired) == desired) {
-						return true;
-					}
-				}
-			}
-			Map pc = filterPermissions;
-			if (pc == null) {
-				return false;
-			}
-			perms = pc.values();
+			perms = permissions.values();
 		}
 
-		/* iterate one by one over filteredPermissions */
-		for (Iterator iter = perms.iterator(); iter.hasNext();) {
-			if (((EndpointPermission) iter.next()).implies0(requested,
-					effective)) {
+		/* iterate one by one over permissions */
+		for (Iterator<EndpointPermission> iter = perms.iterator(); iter
+				.hasNext();) {
+			if (iter.next().implies0(requested, effective)) {
 				return true;
 			}
 		}
@@ -859,85 +660,34 @@
 	}
 
 	/**
-	 * Consult permissions map to compute the effective permission for the
-	 * requested permission name.
-	 * 
-	 * @param requestedName The requested service name.
-	 * @param desired The desired actions.
-	 * @param effective The effective actions.
-	 * @return The new effective actions.
-	 */
-	private int effective(String requestedName, final int desired, int effective) {
-		final Map pc = permissions;
-		EndpointPermission sp = (EndpointPermission) pc.get(requestedName);
-		// strategy:
-		// Check for full match first. Then work our way up the
-		// name looking for matches on a.b.*
-		if (sp != null) {
-			// we have a direct hit!
-			effective |= sp.action_mask;
-			if ((effective & desired) == desired) {
-				return effective;
-			}
-		}
-		// work our way up the tree...
-		int last;
-		int offset = requestedName.length() - 1;
-		while ((last = requestedName.lastIndexOf(".", offset)) != -1) {
-			requestedName = requestedName.substring(0, last + 1) + "*";
-			sp = (EndpointPermission) pc.get(requestedName);
-			if (sp != null) {
-				effective |= sp.action_mask;
-				if ((effective & desired) == desired) {
-					return effective;
-				}
-			}
-			offset = last - 1;
-		}
-		/*
-		 * we don't have to check for "*" as it was already checked before we
-		 * were called.
-		 */
-		return effective;
-	}
-
-	/**
 	 * Returns an enumeration of all the <code>EndpointPermission</code> objects
 	 * in the container.
 	 * 
 	 * @return Enumeration of all the EndpointPermission objects.
 	 */
-	public synchronized Enumeration elements() {
-		List all = new ArrayList(permissions.values());
-		Map pc = filterPermissions;
-		if (pc != null) {
-			all.addAll(pc.values());
-		}
+	public synchronized Enumeration<Permission> elements() {
+		List<Permission> all = new ArrayList<Permission>(permissions.values());
 		return Collections.enumeration(all);
 	}
 
 	/* serialization logic */
 	private static final ObjectStreamField[]	serialPersistentFields	= {
-			new ObjectStreamField("permissions", Hashtable.class),
-			new ObjectStreamField("all_allowed", Boolean.TYPE),
-			new ObjectStreamField("filterPermissions", HashMap.class)	};
+			new ObjectStreamField("permissions", HashMap.class),
+			new ObjectStreamField("all_allowed", Boolean.TYPE)			};
 
 	private synchronized void writeObject(ObjectOutputStream out)
 			throws IOException {
-		Hashtable hashtable = new Hashtable(permissions);
 		ObjectOutputStream.PutField pfields = out.putFields();
-		pfields.put("permissions", hashtable);
+		pfields.put("permissions", permissions);
 		pfields.put("all_allowed", all_allowed);
-		pfields.put("filterPermissions", filterPermissions);
 		out.writeFields();
 	}
 
 	private synchronized void readObject(java.io.ObjectInputStream in)
 			throws IOException, ClassNotFoundException {
 		ObjectInputStream.GetField gfields = in.readFields();
-		Hashtable hashtable = (Hashtable) gfields.get("permissions", null);
-		permissions = new HashMap(hashtable);
+		permissions = (HashMap<String, EndpointPermission>) gfields.get(
+				"permissions", new HashMap<String, EndpointPermission>());
 		all_allowed = gfields.get("all_allowed", false);
-		filterPermissions = (HashMap) gfields.get("filterPermissions", null);
 	}
 }

Modified: cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/RemoteConstants.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/RemoteConstants.java?rev=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/RemoteConstants.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/RemoteConstants.java Thu Jan  7 14:49:43 2010
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2010). 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.
@@ -30,10 +30,9 @@
 	 * Service property identifying the configuration types supported by a
 	 * distribution provider. Registered by the distribution provider on one of
 	 * its services to indicate the supported configuration types.
-	 * 
 	 * <p>
 	 * The value of this property must be of type <code>String</code>,
-	 * <code>String[]</code>, or <code>Collection</code> of <code>String</code>.
+	 * <code>String[]</code>, or <code>Collection&lt;String&gt;</code>.
 	 */
 	public static final String	REMOTE_CONFIGS_SUPPORTED		= "remote.configs.supported";
 
@@ -44,7 +43,7 @@
 	 * 
 	 * <p>
 	 * The value of this property must be of type <code>String</code>,
-	 * <code>String[]</code>, or <code>Collection</code> of <code>String</code>.
+	 * <code>String[]</code>, or <code>Collection&lt;String&gt;</code>.
 	 */
 	public static final String	REMOTE_INTENTS_SUPPORTED		= "remote.intents.supported";
 
@@ -59,7 +58,7 @@
 	 * <code>Dictionary</code> object passed to the
 	 * <code>BundleContext.registerService</code> method. The value of this
 	 * property must be of type <code>String</code>, <code>String[]</code>, or
-	 * <code>Collection</code> of <code>String</code>.
+	 * <code>Collection&lt;String&gt;</code>.
 	 */
 	public static final String	SERVICE_EXPORTED_CONFIGS		= "service.exported.configs";
 
@@ -75,7 +74,7 @@
 	 * <code>Dictionary</code> object passed to the
 	 * <code>BundleContext.registerService</code> method. The value of this
 	 * property must be of type <code>String</code>, <code>String[]</code>, or
-	 * <code>Collection</code> of <code>String</code>.
+	 * <code>Collection&lt;String&gt;</code>.
 	 */
 	public static final String	SERVICE_EXPORTED_INTENTS		= "service.exported.intents";
 
@@ -94,7 +93,7 @@
 	 * <code>Dictionary</code> object passed to the
 	 * <code>BundleContext.registerService</code> method. The value of this
 	 * property must be of type <code>String</code>, <code>String[]</code>, or
-	 * <code>Collection</code> of <code>String</code>.
+	 * <code>Collection&lt;String&gt;</code>.
 	 */
 	public static final String	SERVICE_EXPORTED_INTENTS_EXTRA	= "service.exported.intents.extra";
 
@@ -113,7 +112,7 @@
 	 * <code>Dictionary</code> object passed to the
 	 * <code>BundleContext.registerService</code> method. The value of this
 	 * property must be of type <code>String</code>, <code>String[]</code>, or
-	 * <code>Collection</code> of <code>String</code>.
+	 * <code>Collection&lt;String&gt;</code>.
 	 */
 	public static final String	SERVICE_EXPORTED_INTERFACES		= "service.exported.interfaces";
 
@@ -139,7 +138,7 @@
 	 * 
 	 * <p>
 	 * The value of this property must be of type <code>String</code>,
-	 * <code>String[]</code>, or <code>Collection</code> of <code>String</code>.
+	 * <code>String[]</code>, or <code>Collection&lt;String&gt;</code>.
 	 * 
 	 * @see #SERVICE_EXPORTED_CONFIGS
 	 */
@@ -153,34 +152,30 @@
 	 * provider that these intents are already implemented by the exported
 	 * service object.</li>
 	 * <li>A distribution provider must use this property to convey the combined
-	 * intents of:</li>
-	 * <ul>
-	 * <li>The exporting service, and</li>
-	 * <li>the intents that the exporting distribution provider adds, and</li>
-	 * <li>the intents that the importing distribution provider adds.</li>
+	 * intents of: The exporting service, and, the intents that the exporting
+	 * distribution provider adds, and the intents that the importing
+	 * distribution provider adds.</li>
 	 * </ul>
-	 * <i></i>
-	 * 
-	 * </ul> To export a service, a distribution provider must expand any
-	 * qualified intents. Both the exporting and importing distribution
-	 * providers must recognize all intents before a service can be distributed.
+	 * To export a service, a distribution provider must expand any qualified
+	 * intents. Both the exporting and importing distribution providers must
+	 * recognize all intents before a service can be distributed.
 	 * 
 	 * <p>
 	 * The value of this property must be of type <code>String</code>,
-	 * <code>String[]</code>, or <code>Collection</code> of <code>String</code>.
+	 * <code>String[]</code>, or <code>Collection&lt;String&gt;</code>.
 	 */
 	public static final String	SERVICE_INTENTS					= "service.intents";
 
 	/* above are from Ch 13 Remote Service spec. */
 
 	/**
-	 * Endpoint property identifying the URI for this endpoint. This service
+	 * Endpoint property identifying the id for this endpoint. This service
 	 * property must always be set.
 	 * 
 	 * <p>
 	 * The value of this property must be of type <code>String</code>.
 	 */
-	public final static String	ENDPOINT_URI					= "endpoint.uri";
+	public final static String	ENDPOINT_ID						= "endpoint.id";
 
 	/**
 	 * Endpoint property identifying the service id of the exported service. Can
@@ -189,7 +184,7 @@
 	 * <p>
 	 * The value of this property must be of type <code>Long</code>.
 	 */
-	public final static String	ENDPOINT_ID						= "endpoint.id";
+	public final static String	ENDPOINT_SERVICE_ID				= "endpoint.service.id";
 
 	/**
 	 * Endpoint property identifying the universally unique id of the exporting

Modified: cxf/dosgi/trunk/samples/discovery/impl/src/main/java/org/apache/cxf/dosgi/samples/discovery/impl/Activator.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/discovery/impl/src/main/java/org/apache/cxf/dosgi/samples/discovery/impl/Activator.java?rev=896896&r1=896895&r2=896896&view=diff
==============================================================================
--- cxf/dosgi/trunk/samples/discovery/impl/src/main/java/org/apache/cxf/dosgi/samples/discovery/impl/Activator.java (original)
+++ cxf/dosgi/trunk/samples/discovery/impl/src/main/java/org/apache/cxf/dosgi/samples/discovery/impl/Activator.java Thu Jan  7 14:49:43 2010
@@ -42,7 +42,7 @@
         props.put("service.exported.interfaces", "*");
         props.put("service.exported.configs", "org.apache.cxf.ws");
         props.put("org.apache.cxf.ws.address", getAddress(host, port)); // old obsolete value
-        props.put("endpoint.uri", getAddress(host, port));
+        props.put("endpoint.id", getAddress(host, port));
 
         reg = bc.registerService(DisplayService.class.getName(), 
                 new DisplayServiceImpl(host + ":" + port), props);



Mime
View raw message