You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by da...@apache.org on 2009/04/24 14:49:20 UTC
svn commit: r768288 [1/2] - 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...
Author: davidb
Date: Fri Apr 24 12:49:19 2009
New Revision: 768288
URL: http://svn.apache.org/viewvc?rev=768288&view=rev
Log:
Update to the latest version of the RFC 119 constants.
Modified:
cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/FindInZooKeeperCustomizer.java
cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/PublishToZooKeeperCustomizer.java
cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/FindInZooKeeperCustomizerTest.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/LocalDiscoveryService.java
cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/ServiceEndpointDescriptionImpl.java
cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/DiscoveredServiceNotification.java
cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/DiscoveredServiceTracker.java
cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/Discovery.java
cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java
cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/ServicePublication.java
cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryServiceTest.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/OsgiUtils.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/AbstractClientHook.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/CxfListenerHook.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHook.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtils.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ServiceEndpointDescriptionImpl.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/DiscoveredServiceNotification.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/DiscoveredServiceTracker.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/Discovery.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServicePublication.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/osgi/service/distribution/DistributionConstants.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/osgi/service/distribution/DistributionProvider.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceConfigurationTypeHandlerTest.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/CxfListenerHookTest.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHookTest.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtilsTest.java
Modified: cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/FindInZooKeeperCustomizer.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/FindInZooKeeperCustomizer.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/FindInZooKeeperCustomizer.java (original)
+++ cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/FindInZooKeeperCustomizer.java Fri Apr 24 12:49:19 2009
@@ -56,7 +56,7 @@
removedService(sr, dst);
Collection<String> interfaces = Util.getMultiValueProperty(
- sr.getProperty(DiscoveredServiceTracker.PROP_KEY_MATCH_CRITERIA_INTERFACES));
+ sr.getProperty(DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA));
List<InterfaceMonitor> dmList = new ArrayList<InterfaceMonitor>(interfaces.size());
for (String intf : interfaces) {
Modified: cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/PublishToZooKeeperCustomizer.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/PublishToZooKeeperCustomizer.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/PublishToZooKeeperCustomizer.java (original)
+++ cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/PublishToZooKeeperCustomizer.java Fri Apr 24 12:49:19 2009
@@ -53,8 +53,9 @@
public Object addingService(ServiceReference sr) {
try {
Object obj = bundleContext.getService(sr);
- Collection<String> interfaces = Util.getMultiValueProperty(sr.getProperty("service.interface"));
- String endpointKey = getKey(sr.getProperty("osgi.remote.endpoint.location").toString());
+ Collection<String> interfaces = Util.getMultiValueProperty(
+ sr.getProperty(ServicePublication.SERVICE_INTERFACE_NAME));
+ String endpointKey = getKey(sr.getProperty(ServicePublication.ENDPOINT_LOCATION).toString());
for (String name : interfaces) {
String path = Util.getZooKeeperPath(name);
@@ -79,8 +80,9 @@
public void removedService(ServiceReference sr, Object obj) {
try {
- Collection<String> interfaces = Util.getMultiValueProperty(sr.getProperty("service.interface"));
- String endpointKey = getKey(sr.getProperty("osgi.remote.endpoint.location").toString());
+ Collection<String> interfaces = Util.getMultiValueProperty(
+ sr.getProperty(ServicePublication.SERVICE_INTERFACE_NAME));
+ String endpointKey = getKey(sr.getProperty(ServicePublication.ENDPOINT_LOCATION).toString());
for (String name : interfaces) {
String path = Util.getZooKeeperPath(name);
@@ -114,15 +116,15 @@
static byte[] getData(ServiceReference sr) throws IOException {
Properties p = new Properties();
- Map<String, Object> serviceProps = (Map<String, Object>) sr.getProperty("service.properties");
+ Map<String, Object> serviceProps = (Map<String, Object>) sr.getProperty(ServicePublication.SERVICE_PROPERTIES);
if (serviceProps != null) {
for (Map.Entry<String, Object> prop : serviceProps.entrySet()) {
p.setProperty(prop.getKey(), prop.getValue().toString());
}
}
- copyProperty(ServicePublication.PROP_KEY_ENDPOINT_ID, sr, p);
- copyProperty(ServicePublication.PROP_KEY_ENDPOINT_LOCATION, sr, p);
+ copyProperty(ServicePublication.ENDPOINT_ID, sr, p);
+ copyProperty(ServicePublication.ENDPOINT_LOCATION, sr, p);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
p.store(baos, "");
Modified: cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/FindInZooKeeperCustomizerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/FindInZooKeeperCustomizerTest.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/FindInZooKeeperCustomizerTest.java (original)
+++ cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/FindInZooKeeperCustomizerTest.java Fri Apr 24 12:49:19 2009
@@ -44,7 +44,7 @@
};
ServiceReference sr = EasyMock.createMock(ServiceReference.class);
- EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.PROP_KEY_MATCH_CRITERIA_INTERFACES)).
+ EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA)).
andReturn(Collections.singleton(String.class.getName()));
EasyMock.replay(sr);
@@ -56,7 +56,7 @@
};
ServiceReference sr2 = EasyMock.createMock(ServiceReference.class);
- EasyMock.expect(sr2.getProperty(DiscoveredServiceTracker.PROP_KEY_MATCH_CRITERIA_INTERFACES)).
+ EasyMock.expect(sr2.getProperty(DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA)).
andReturn(Arrays.asList(Integer.class.getName(), Comparable.class.getName()));
EasyMock.replay(sr2);
@@ -113,7 +113,7 @@
EasyMock.replay(zk);
EasyMock.reset(sr);
- EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.PROP_KEY_MATCH_CRITERIA_INTERFACES)).
+ EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA)).
andReturn(Collections.singleton(List.class.getName()));
EasyMock.replay(sr);
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=768288&r1=768287&r2=768288&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 Fri Apr 24 12:49:19 2009
@@ -50,10 +50,10 @@
String location = "http://somehost.someorg:80/abc/def";
String eid = UUID.randomUUID().toString();
ServiceReference sr = EasyMock.createMock(ServiceReference.class);
- EasyMock.expect(sr.getProperty("service.interface")).andReturn(Arrays.asList("java.lang.String", "org.example.interface.AnInterface"));
- EasyMock.expect(sr.getProperty("osgi.remote.endpoint.location")).andReturn(location).atLeastOnce();
- EasyMock.expect(sr.getProperty("osgi.remote.endpoint.id")).andReturn(eid).atLeastOnce();
- EasyMock.expect(sr.getProperty("service.properties")).andReturn(srProps).anyTimes();
+ 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.SERVICE_PROPERTIES)).andReturn(srProps).anyTimes();
EasyMock.replay(sr);
final Properties expected = new Properties();
@@ -120,8 +120,8 @@
String endpoint = "http://localhost:2991/123";
ServiceReference sr = EasyMock.createMock(ServiceReference.class);
- EasyMock.expect(sr.getProperty("service.interface")).andReturn(Runnable.class.getName());
- EasyMock.expect(sr.getProperty("osgi.remote.endpoint.location")).andReturn(endpoint);
+ EasyMock.expect(sr.getProperty(ServicePublication.SERVICE_INTERFACE_NAME)).andReturn(Runnable.class.getName());
+ EasyMock.expect(sr.getProperty(ServicePublication.ENDPOINT_LOCATION)).andReturn(endpoint);
EasyMock.replay(sr);
ZooKeeper zk = EasyMock.createMock(ZooKeeper.class);
@@ -197,12 +197,12 @@
String eid = UUID.randomUUID().toString();
HashMap<String, Object> expected = new HashMap<String, Object>(initial);
- expected.put(ServicePublication.PROP_KEY_ENDPOINT_ID, eid);
+ expected.put(ServicePublication.ENDPOINT_ID, eid);
ServiceReference sr = EasyMock.createMock(ServiceReference.class);
- EasyMock.expect(sr.getProperty("service.properties")).andReturn(initial);
- EasyMock.expect(sr.getProperty(ServicePublication.PROP_KEY_ENDPOINT_ID)).andReturn(eid);
- EasyMock.expect(sr.getProperty(ServicePublication.PROP_KEY_ENDPOINT_LOCATION)).andReturn(null);
+ EasyMock.expect(sr.getProperty(ServicePublication.SERVICE_PROPERTIES)).andReturn(initial);
+ EasyMock.expect(sr.getProperty(ServicePublication.ENDPOINT_ID)).andReturn(eid);
+ EasyMock.expect(sr.getProperty(ServicePublication.ENDPOINT_LOCATION)).andReturn(null);
EasyMock.replay(sr);
byte[] data = PublishToZooKeeperCustomizer.getData(sr);
Modified: cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryService.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryService.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryService.java (original)
+++ cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryService.java Fri Apr 24 12:49:19 2009
@@ -21,9 +21,8 @@
import static org.osgi.service.discovery.DiscoveredServiceNotification.AVAILABLE;
import static org.osgi.service.discovery.DiscoveredServiceNotification.UNAVAILABLE;
-import static org.osgi.service.discovery.DiscoveredServiceTracker.PROP_KEY_MATCH_CRITERIA_FILTERS;
-import static org.osgi.service.discovery.DiscoveredServiceTracker.PROP_KEY_MATCH_CRITERIA_INTERFACES;
-import static org.osgi.service.discovery.ServicePublication.PROP_KEY_SERVICE_INTERFACE_NAME;
+import static org.osgi.service.discovery.DiscoveredServiceTracker.FILTER_MATCH_CRITERIA;
+import static org.osgi.service.discovery.DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA;
import java.util.ArrayList;
import java.util.Collection;
@@ -42,7 +41,6 @@
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleListener;
-import org.osgi.framework.Constants;
import org.osgi.framework.Filter;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
@@ -166,13 +164,13 @@
Collection<String> interfaces =
addTracker(reference,
tracker,
- PROP_KEY_MATCH_CRITERIA_INTERFACES,
+ INTERFACE_MATCH_CRITERIA,
interfacesToTrackers,
trackersToInterfaces);
Collection<String> filters =
addTracker(reference,
tracker,
- PROP_KEY_MATCH_CRITERIA_FILTERS,
+ FILTER_MATCH_CRITERIA,
filtersToTrackers,
trackersToFilters);
@@ -197,13 +195,13 @@
Collection<String> newInterfaces =
addTracker(reference,
tracker,
- PROP_KEY_MATCH_CRITERIA_INTERFACES,
+ INTERFACE_MATCH_CRITERIA,
interfacesToTrackers,
trackersToInterfaces);
Collection<String> newFilters =
addTracker(reference,
tracker,
- PROP_KEY_MATCH_CRITERIA_FILTERS,
+ FILTER_MATCH_CRITERIA,
filtersToTrackers,
trackersToFilters);
@@ -426,7 +424,7 @@
String[] interfaceNames = getProvidedInterfaces(sd, interfaceName);
if (interfaceNames != null) {
- d.put(PROP_KEY_SERVICE_INTERFACE_NAME, interfaceNames);
+ d.put(INTERFACE_MATCH_CRITERIA, interfaceNames);
}
return d;
}
Modified: cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/ServiceEndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/ServiceEndpointDescriptionImpl.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/ServiceEndpointDescriptionImpl.java (original)
+++ cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/ServiceEndpointDescriptionImpl.java Fri Apr 24 12:49:19 2009
@@ -18,8 +18,10 @@
*/
package org.apache.cxf.dosgi.discovery.local;
-import java.net.MalformedURLException;
-import java.net.URL;
+import static org.osgi.service.discovery.ServicePublication.ENDPOINT_LOCATION;
+
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
@@ -30,8 +32,6 @@
import org.osgi.service.discovery.ServiceEndpointDescription;
-import static org.osgi.service.discovery.ServicePublication.PROP_KEY_ENDPOINT_LOCATION;
-
public class ServiceEndpointDescriptionImpl implements ServiceEndpointDescription {
private static final Logger LOG =
@@ -85,15 +85,15 @@
&& properties.equals(other.getProperties());
}
- public URL getLocation() {
- Object value = properties.get(PROP_KEY_ENDPOINT_LOCATION);
+ public URI getLocation() {
+ Object value = properties.get(ENDPOINT_LOCATION);
if (value == null) {
return null;
}
try {
- return new URL(value.toString());
- } catch (MalformedURLException ex) {
+ return new URI(value.toString());
+ } catch (URISyntaxException ex) {
LOG.warning("Service document URL is malformed : " + value.toString());
}
Modified: cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/DiscoveredServiceNotification.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/DiscoveredServiceNotification.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/DiscoveredServiceNotification.java (original)
+++ cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/DiscoveredServiceNotification.java Fri Apr 24 12:49:19 2009
@@ -1,102 +1,108 @@
-/*
- * Copyright (c) OSGi Alliance (2008). All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.osgi.service.discovery;
-
-import java.util.Collection;
-
-/**
- * Interface for notification on discovered services.
- *
- * @version $Revision: 6510 $
- */
-public interface DiscoveredServiceNotification {
-
- /**
- * Notification indicating that a service matching the listening criteria has been
- * discovered.
- * <p>
- * The value of <code>AVAILABLE</code> is 0x00000001.
- */
- public final static int AVAILABLE = 0x00000001;
-
- /**
- * Notification indicating that the properties of a previously discovered service
- * have changed.
- * <p>
- * The value of <code>MODIFIED</code> is 0x00000002.
- */
- public final static int MODIFIED = 0x00000002;
-
- /**
- * Notification indicating that a previously discovered service is no longer known
- * to discovery.
- * <p>
- * The value of <code>UNAVAILABLE</code> is 0x00000004.
- */
- public final static int UNAVAILABLE = 0x00000004;
-
- /**
- * Notification indicating that the properties of a previously discovered service
- * have changed and the new properties no longer match the listener's
- * filter.
- * <p>
- * The value of <code>MODIFIED_ENDMATCH</code> is 0x00000008.
- */
- public final static int MODIFIED_ENDMATCH = 0x00000008;
-
- /**
- * Returns information currently known to Discovery regarding the service
- * endpoint.
- * <p>
- *
- * @return metadata of the service this Discovery notifies about.
- */
- ServiceEndpointDescription getServiceEndpointDescription();
-
- /**
- * Returns the type of notification. The type values are:
- * <ul>
- * <li>{@link #AVAILABLE}</li>
- * <li>{@link #MODIFIED}</li>
- * <li>{@link #MODIFIED_ENDMATCH}</li>
- * <li>{@link #UNAVAILABLE}</li>
- * </ul>
- *
- * @return Type of notification regarding known service metadata.
- */
- int getType();
-
- /**
- * Returns interface name criteria of the {@link DiscoveredServiceTracker}
- * object matching with the interfaces of the ServiceEndpointDescription and
- * thus caused the notification.
- *
- * @return matching interface name criteria of the
- * {@link DiscoveredServiceTracker} object being notified.
- */
- Collection/* <String> */getInterfaces();
-
- /**
- * Returns filters of the {@link DiscoveredServiceTracker} object matching
- * with the ServiceEndpointDescription and thus caused the notification.
- *
- * @return matching filters of the {@link DiscoveredServiceTracker} object
- * being notified.
- */
- Collection/* <String> */getFilters();
-}
-
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.discovery;
+
+import java.util.Collection;
+
+/**
+ * Interface for notification on discovered services.
+ * <p>
+ * <code>DiscoveredServiceNotification</code> objects are immutable.
+ *
+ * @Immutable
+ * @version $Revision: 6821 $
+ */
+public interface DiscoveredServiceNotification {
+
+ /**
+ * Notification indicating that a service matching the listening criteria
+ * has been discovered.
+ * <p>
+ * The value of <code>AVAILABLE</code> is 0x00000001.
+ */
+ public final static int AVAILABLE = 0x00000001;
+
+ /**
+ * Notification indicating that the properties of a previously discovered
+ * service have changed.
+ * <p>
+ * The value of <code>MODIFIED</code> is 0x00000002.
+ */
+ public final static int MODIFIED = 0x00000002;
+
+ /**
+ * Notification indicating that a previously discovered service is no longer
+ * known to <code>Discovery</code>.
+ * <p>
+ * The value of <code>UNAVAILABLE</code> is 0x00000004.
+ */
+ public final static int UNAVAILABLE = 0x00000004;
+
+ /**
+ * Notification indicating that the properties of a previously discovered
+ * service have changed and the new properties no longer match the
+ * listener's filter.
+ * <p>
+ * The value of <code>MODIFIED_ENDMATCH</code> is 0x00000008.
+ */
+ public final static int MODIFIED_ENDMATCH = 0x00000008;
+
+ /**
+ * Returns information currently known to <code>Discovery</code> regarding
+ * the service endpoint.
+ *
+ * @return metadata of the service <code>Discovery</code> notifies about. Is
+ * never <code>null</code>.
+ */
+ ServiceEndpointDescription getServiceEndpointDescription();
+
+ /**
+ * Returns the type of notification. The type values are:
+ * <ul>
+ * <li>{@link #AVAILABLE}</li>
+ * <li>{@link #MODIFIED}</li>
+ * <li>{@link #MODIFIED_ENDMATCH}</li>
+ * <li>{@link #UNAVAILABLE}</li>
+ * </ul>
+ *
+ * @return Type of notification regarding known service metadata.
+ */
+ int getType();
+
+ /**
+ * Returns interface name criteria of the {@link DiscoveredServiceTracker}
+ * object matching with the interfaces of the
+ * <code>ServiceEndpointDescription</code> and thus caused the notification.
+ *
+ * @return <code>Collection (<? extends String>)</code> of matching interface name criteria of the
+ * <code>DiscoveredServiceTracker</code> object being notified, or
+ * an empty collection if notification hasn't been caused by a
+ * matching interface name criteria.
+ */
+ Collection/* <? extends String> */getInterfaces();
+
+ /**
+ * Returns filters of the <code>DiscoveredServiceTracker</code> object
+ * matching with the properties of the
+ * <code>ServiceEndpointDescription</code> and thus caused the notification.
+ *
+ * @return <code>Collection (<? extends String>)</code> of matching filters of the <code>DiscoveredServiceTracker</code>
+ * object being notified, or an empty collection if notification
+ * hasn't been caused by a matching filter criteria.
+ */
+ Collection/* <? extends String> */getFilters();
+}
\ No newline at end of file
Modified: cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/DiscoveredServiceTracker.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/DiscoveredServiceTracker.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/DiscoveredServiceTracker.java (original)
+++ cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/DiscoveredServiceTracker.java Fri Apr 24 12:49:19 2009
@@ -1,72 +1,82 @@
-/*
- * Copyright (c) OSGi Alliance (2008). All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.osgi.service.discovery;
-
-/**
- * Interface of trackers for discovered remote services. <br>
- * When such a service is registered with the framework, then {@link Discovery}
- * will notify it about remote services matching one of the provided criteria
- * and will keep notifying it on changes of information known to Discovery
- * regarding this services.
- *
- * <code>Discovery</code> may deliver notifications on discovered services to a
- * <code>DiscoveredServiceTracker</code> out of order and may concurrently call
- * and/or reenter a <code>DiscoveredServiceTracker</code>.
- *
- * @version $Revision: 6553 $
- */
-public interface DiscoveredServiceTracker {
-
- /**
- * Optional ServiceRegistration property which contains service interfaces
- * this tracker is interested in. Value of this property is of type
- * Collection (<? extends String>). <br>
- * Property is optional, may be null.
- */
- public static final String PROP_KEY_MATCH_CRITERIA_INTERFACES = "osgi.discovery.interest.interfaces";
-
- /**
- * Optional ServiceRegistration property which contains filters for services
- * this tracker is interested in. <br>
- * Note that these filters need to take into account service publication
- * properties which are not necessarily the same as properties under which a
- * service is registered. See {@link ServicePublication} for some standard
- * properties used to publish service metadata. <br>
- * The following sample filter will make Discovery notify the
- * DiscoveredServiceTracker about services providing interface
- * 'my.company.foo' of version '1.0.1.3':<br>
- * "(&(service.interface=my.company.foo)(service.interface.version=my.company.foo|1.0.1.3))". <br>
- * Value of this property is of type Collection (<? extends String%gt;).
- * Property is optional, may be null.
- */
- public static final String PROP_KEY_MATCH_CRITERIA_FILTERS = "osgi.discovery.interest.filters";
-
- /**
- * Receives notification that information known to Discovery regarding a
- * remote service has changed. <br>
- * The tracker is only notified about remote services which fulfill the
- * matching criteria, either one of the interfaces or one of the filters,
- * provided as properties of this service. <br>
- * If multiple criteria match, then the tracker is notified about each of
- * them. This can be done either by a single notification callback or by
- * multiple subsequent ones.
- *
- * @param notification the <code>DiscoveredServiceNotification</code> object
- * describing the change.
- */
- void serviceChanged(DiscoveredServiceNotification notification);
-}
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.discovery;
+
+/**
+ * Interface of trackers for discovered remote services.
+ * <p>
+ * When a service implementing this interface is registered with the framework,
+ * then <code>Discovery</code> will notify it about remote services matching one
+ * of the provided criteria and will keep notifying it on changes of information
+ * known to Discovery regarding this services.
+ *
+ * <code>Discovery</code> may deliver notifications on discovered services to a
+ * <code>DiscoveredServiceTracker</code> out of order and may concurrently call
+ * and/or reenter a <code>DiscoveredServiceTracker</code>.
+ *
+ * @ThreadSafe
+ * @version $Revision: 6845 $
+ */
+public interface DiscoveredServiceTracker {
+
+ /**
+ * Optional ServiceRegistration property which contains service interfaces
+ * this tracker is interested in.
+ * <p>
+ * Value of this property is of type
+ * <code>Collection (<? extends String>)</code>. May be
+ * <code>null</code> or empty.
+ */
+ public static final String INTERFACE_MATCH_CRITERIA = "osgi.remote.discovery.interest.interfaces";
+
+ /**
+ * Optional ServiceRegistration property which contains filters for services
+ * this tracker is interested in.
+ * <p>
+ * Note that these filters need to take into account service publication
+ * properties which are not necessarily the same as properties under which a
+ * service is registered. See {@link ServicePublication} for some standard
+ * properties used to publish service metadata.
+ * <p>
+ * The following sample filter will make <code>Discovery</code> notify the
+ * <code>DiscoveredServiceTracker</code> about services providing interface
+ * 'my.company.foo' of version '1.0.1.3':
+ * <code>"(&(service.interface=my.company.foo)(service.interface.version=my.company.foo|1.0.1.3))"</code>.
+ * <p>
+ * Value of this property is of type
+ * <code>Collection (<? extends String>)</code>. May be
+ * <code>null</code>. or empty
+ */
+ public static final String FILTER_MATCH_CRITERIA = "osgi.remote.discovery.interest.filters";
+
+ /**
+ * Receives notification that information known to <code>Discovery</code>
+ * regarding a remote service has changed.
+ * <p>
+ * The tracker is only notified about remote services which fulfill the
+ * matching criteria, either one of the interfaces or one of the filters,
+ * provided as properties of this service.
+ * <p>
+ * If multiple criteria match, then the tracker is notified about each of
+ * them. This can be done either by a single notification callback or by
+ * multiple subsequent ones.
+ *
+ * @param notification the <code>DiscoveredServiceNotification</code> object
+ * describing the change. Is never <code>null</code>.
+ */
+ void serviceChanged(DiscoveredServiceNotification notification);
+}
Modified: cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/Discovery.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/Discovery.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/Discovery.java (original)
+++ cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/Discovery.java Fri Apr 24 12:49:19 2009
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,41 +17,51 @@
package org.osgi.service.discovery;
/**
- * Discovery registers a service implementing this interface. This service is
- * registered with extra properties identified at the beginning of this
- * interface to denote the name of the product providing Discovery
- * functionality, its version, vendor, used protocols etc..
- *
+ * Every Discovery Provider registers a service implementing this interface.
+ * This service is registered with extra properties identified at the beginning
+ * of this interface to denote the name of the product providing Discovery
+ * functionality, its version, vendor, used protocols etc..
+ * <p>
* Discovery allows to publish services exposed for remote access as well as to
* search for remote services. Register a {@link ServicePublication} service in
* order to publish service metadata and or a {@link DiscoveredServiceTracker}
- * service in order to search for remote services.<BR>
+ * service in order to search for remote services.
+ * <p>
* Discovery service implementations usually rely on some discovery protocols or
* other information distribution means.
*
+ * @ThreadSafe
* @version $Revision$
*/
public interface Discovery {
/**
- * Service Registration property for the name of the Discovery product.
+ * ServiceRegistration property for the name of the Discovery product.
+ * <p>
+ * Value of this property is of type <code>String</code>.
*/
- static final String PROP_KEY_PRODUCT_NAME = "osgi.remote.discovery.product";
+ static final String PRODUCT_NAME = "osgi.remote.discovery.product";
/**
- * Service Registration property for the version of the Discovery product.
+ * ServiceRegistration property for the version of the Discovery product.
+ * <p>
+ * Value of this property is of type <code>String</code>.
*/
- static final String PROP_KEY_PRODUCT_VERSION = "osgi.remote.discovery.product.version";
+ static final String PRODUCT_VERSION = "osgi.remote.discovery.product.version";
/**
- * Service Registration property for the Discovery product vendor name.
+ * ServiceRegistration property for the Discovery product vendor name.
+ * <p>
+ * Value of this property is of type <code>String</code>.
*/
- static final String PROP_KEY_VENDOR_NAME = "osgi.remote.discovery.vendor";
+ static final String VENDOR_NAME = "osgi.remote.discovery.vendor";
/**
- * Service Registration property that lists the discovery protocols used by
- * this Discovery service. Value of this property is of type Collection (<?
- * extends String>).
+ * ServiceRegistration property that lists the discovery protocols used by
+ * this Discovery service.
+ * <p>
+ * Value of this property is of type
+ * <code>Collection (<? extends String>)</code>.
*/
- static final String PROP_KEY_SUPPORTED_PROTOCOLS = "osgi.remote.discovery.supported_protocols";
+ static final String SUPPORTED_PROTOCOLS = "osgi.remote.discovery.supported_protocols";
}
Modified: cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java (original)
+++ cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java Fri Apr 24 12:49:19 2009
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
package org.osgi.service.discovery;
-import java.net.URL;
+import java.net.URI;
import java.util.Collection;
import java.util.Map;
@@ -25,91 +25,105 @@
* considered as a wrapper around the property map of a published service and
* its endpoint. It provides an API to conveniently access the most important
* properties of the service.
+ * <p>
+ * <code>ServiceEndpointDescription</code> objects are immutable.
*
+ * @Immutable
* @version $Revision$
*/
public interface ServiceEndpointDescription {
/**
* Returns the value of the property with key
- * {@link ServicePublication#PROP_KEY_SERVICE_INTERFACE_NAME}.
+ * {@link ServicePublication#SERVICE_INTERFACE_NAME}.
*
- * @return service interface names provided by the advertised service
- * (endpoint). The collection is never null or empty but contains at
+ * @return <code>Collection (<? extends String>)</code> of service
+ * interface names provided by the advertised service endpoint. The
+ * collection is never <code>null</code> or empty but contains at
* least one service interface.
*/
Collection /* <? extends String> */getProvidedInterfaces();
/**
* Returns non-Java endpoint interface name associated with the given
- * interface. Value of the property with key
- * {@link ServicePublication#PROP_KEY_ENDPOINT_INTERFACE_NAME} is used by
- * this operation.
- *
- * @param interfaceName
- * for which its non-Java endpoint interface name should be
- * returned.
- *
- * @return non-Java endpoint interface name. Null, if it hasn't been
- * provided.
+ * interface.
+ * <p>
+ * Value of the property with key
+ * {@link ServicePublication#ENDPOINT_INTERFACE_NAME} is used by this
+ * operation.
+ *
+ * @param interfaceName for which its non-Java endpoint interface name
+ * should be returned.
+ * @return non-Java endpoint interface name, or <code>null</code> if it
+ * hasn't been provided or if given interface name is
+ * <code>null</code>.
*/
String getEndpointInterfaceName(String interfaceName);
/**
- * Returns version of the given interface. Value of the property with key
- * {@link ServicePublication#PROP_KEY_SERVICE_INTERFACE_VERSION} is used by
- * this operation.
- *
- * @param interfaceName
- * for which its version should be returned.
- * @return Version of given service interface. Null, if it hasn't been
- * provided.
+ * Returns version of the given interface.
+ * <p>
+ * Value of the property with key
+ * {@link ServicePublication#SERVICE_INTERFACE_VERSION} is used by this
+ * operation.
+ *
+ * @param interfaceName for which its version should be returned.
+ * @return Version of given service interface, or <code>null</code> if it
+ * hasn't been provided or if given interface name is
+ * <code>null</code>.
*/
String getVersion(String interfaceName);
/**
* Returns the value of the property with key
- * {@link ServicePublication#PROP_KEY_ENDPOINT_LOCATION}.
+ * {@link ServicePublication#ENDPOINT_LOCATION}.
*
- * @return The URL of the service location. Null, if it hasn't been
- * provided.
+ * @return The url of the service location, or <code>null</code> if it
+ * hasn't been provided.
*/
- URL getLocation();
+ URI getLocation();
/**
* Returns the value of the property with key
- * {@link ServicePublication#PROP_KEY_ENDPOINT_ID}.
+ * {@link ServicePublication#ENDPOINT_ID}.
*
- * @return Unique id of service endpoint. Null, if it hasn't been provided.
+ * @return Unique id of service endpoint, or <code>null</code> if it hasn't
+ * been provided.
*/
String getEndpointID();
/**
* Getter method for the property value of a given key.
*
- * @param key
- * Name of the property
- * @return The property value, null if none is found for the given key
+ * @param key Name of the property
+ * @return The property value, or <code>null</code> if none is found for the
+ * given key or if provided key is <code>null</code>.
*/
Object getProperty(String key);
/**
- * @return <code>java.util.Collection</code> of property names available in
- * the ServiceEndpointDescription. The collection is never null or
- * empty but contains at least basic properties like objectClass for
- * the service interface. The collection represents a snapshot and
- * as such is not going to be updated in case properties were added
- * or removed at a later point of time.
+ * Returns all names of service endpoint properties.
+ *
+ * @return a <code>Collection (<? extends String>)</code> of property
+ * names available in the ServiceEndpointDescription. The collection
+ * is never <code>null</code> or empty but contains at least names
+ * of mandatory <code>ServicePublication</code> properties. Since
+ * <code>ServiceEndpointDescription</code> objects are immutable,
+ * the returned collection is also not going to be updated at a
+ * later point of time.
*/
Collection/* <? extends String> */getPropertyKeys();
/**
- * @return Returns all properties of the service as a
- * <code>java.util.Map</code>. The map is never null or empty but
- * contains at least basic properties like objectClass for the
- * service interface. The collection represents a snapshot and as
- * such is not going to be updated in case properties were added or
- * removed at a later point of time.
+ * Returns all service endpoint properties.
+ *
+ * @return all properties of the service as a
+ * <code>Map (<String, Object>)</code>. The map is never
+ * <code>null</code> or empty but contains at least mandatory
+ * <code>ServicePublication</code> properties. Since
+ * <code>ServiceEndpointDescription</code> objects are immutable,
+ * the returned map is also not going to be updated at a later point
+ * of time.
*/
Map/* <String, Object> */getProperties();
}
Modified: cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/ServicePublication.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/ServicePublication.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/ServicePublication.java (original)
+++ cxf/dosgi/trunk/discovery/local/src/main/java/org/osgi/service/discovery/ServicePublication.java Fri Apr 24 12:49:19 2009
@@ -1,116 +1,148 @@
-/*
- * Copyright (c) OSGi Alliance (2008). All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.osgi.service.discovery;
-
-/**
- * Register a service implementing the <code>ServicePublication</code> interface
- * in order to publish metadata of a particular service (endpoint) via
- * Discovery. Metadata which has to be published is given in form of properties
- * at registration. <br>
- * In order to update published service metadata, update the properties
- * registered with the <code>ServicePublication</code> service. Depending on
- * Discovery's implementation and underlying protocol it may result in an update
- * or new re-publication of the service. <br>
- * In order to unpublish the previously published service metadata, unregister
- * the <code>ServicePublication</code> service.<br>
- *
- * Please note that providing the {@link #PROP_KEY_SERVICE_INTERFACE_NAME}
- * property is mandatory when a <code>ServicePublication</code> service is
- * registered. Note also that a Discovery implementation may require provision
- * of additional properties, e.g. some of the standard properties defined below,
- * or may make special use of them in case they are provided. For example an
- * SLP-based Discovery might use the value provided with the
- * {@link #PROP_KEY_ENDPOINT_LOCATION} property for construction of a SLP-URL
- * used to publish the service.<br>
- *
- * Also important is that it's not guaranteed that after registering a
- * <code>ServicePublication</code> object its service metadata is actually
- * published. Beside the fact that at least one Discovery service has to be
- * present, the provided properties have to be valid, e.g. shouldn't contain
- * case variants of the same key name, and the actual publication via Discovery
- * mechanisms has to succeed.
- *
- * @version $Revision: 6485 $
- */
-public interface ServicePublication {
-
- /**
- * Mandatory ServiceRegistration property which contains a collection of
- * full qualified interface names offered by the advertised service
- * endpoint. Value of this property is of type Collection (<? extends
- * String>).
- */
- public static final String PROP_KEY_SERVICE_INTERFACE_NAME = "service.interface";
-
- /**
- * Optional ServiceRegistration property which contains a collection of
- * interface names with their associated version attributes separated by
- * {@link #SEPARATOR} e.g. 'my.company.foo|1.3.5 my.company.zoo|2.3.5'. In
- * case no version has been provided for an interface, Discovery may use the
- * String-value of <code>org.osgi.framework.Version.emptyVersion</code>
- * constant. <br>
- * Value of this property is of type Collection (<? extends String>).
- */
- public static final String PROP_KEY_SERVICE_INTERFACE_VERSION = "service.interface.version";
-
- /**
- * Optional ServiceRegistration property which contains a collection of
- * interface names with their associated (non-Java) endpoint interface names
- * separated by {@link #SEPARATOR} e.g.:<br>
- * 'my.company.foo|MyWebService my.company.zoo|MyWebService'.<br>
- * This (non-Java) endpoint interface name is usually a communication
- * protocol specific interface, for instance a web service interface name.
- * Though this information is usually contained in accompanying properties
- * e.g. a wsdl file, Discovery usually doesn't read and interprets such
- * service meta-data. Providing this information explicitly, might allow
- * external non-Java applications find services based on this endpoint
- * interface.
- *
- * Value of this property is of type Collection (<? extends String>).
- */
- public static final String PROP_KEY_ENDPOINT_INTERFACE_NAME = "osgi.remote.endpoint.interface";
-
- /**
- * Optional ServiceRegistration property which contains a map of properties
- * of the published service. <br>
- * Property keys are handled in a case insensitive manner (as OSGi Framework
- * does). <br>
- * Value of this property is of type <code>java.util.Map<code>.
- */
- public static final String PROP_KEY_SERVICE_PROPERTIES = "service.properties";
-
- /**
- * Optional property of the published service identifying its location.
- * Value of this property is of type <code>java.net.URL<code>.
- */
- public static final String PROP_KEY_ENDPOINT_LOCATION = "osgi.remote.endpoint.location";
-
- /**
- * Optional property of the published service uniquely identifying its
- * endpoint. Value of this property is of type <code>String<code>.
- */
- public static final String PROP_KEY_ENDPOINT_ID = "osgi.remote.endpoint.id";
-
- /**
- * Separator constant for association of interface-specific values with the
- * particular interface name. See also
- * {@link #PROP_KEY_SERVICE_INTERFACE_VERSION} and
- * {@link #PROP_KEY_ENDPOINT_INTERFACE_NAME} properties which describe such
- * interface-specific values.
- */
- public static final String SEPARATOR = "|";
-}
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.service.discovery;
+
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Register a service implementing the <code>ServicePublication</code> interface
+ * in order to publish metadata of a particular service (endpoint) via
+ * Discovery. Metadata which has to be published is given in form of properties
+ * at registration.
+ * <p>
+ * In order to update published service metadata, update the properties
+ * registered with the <code>ServicePublication</code> service. Depending on
+ * Discovery's implementation and underlying protocol it may result in an update
+ * or new re-publication of the service.
+ * <p>
+ * In order to unpublish the previously published service metadata, unregister
+ * the <code>ServicePublication</code> service.
+ * <p>
+ * Please note that providing the {@link #SERVICE_INTERFACE_NAME} property is
+ * mandatory when a <code>ServicePublication</code> service is registered. Note
+ * also that a Discovery implementation may require provision of additional
+ * properties, e.g. some of the standard properties defined below, or may make
+ * special use of them in case they are provided. For example an SLP-based
+ * Discovery might use the value provided with the {@link #ENDPOINT_LOCATION}
+ * property for construction of a SLP-URL used to publish the service.
+ * <p>
+ * Also important is that it's not guaranteed that after registering a
+ * <code>ServicePublication</code> object its service metadata is actually
+ * published. Beside the fact that at least one Discovery service has to be
+ * present, the provided properties have to be valid, e.g. shouldn't contain
+ * case variants of the same key name, and the actual publication via Discovery
+ * mechanisms has to succeed.
+ *
+ * @ThreadSafe
+ * @version $Revision: 6845 $
+ */
+public interface ServicePublication {
+
+ /**
+ * Mandatory ServiceRegistration property which contains a collection of
+ * full qualified interface names offered by the advertised service
+ * endpoint.
+ * <p>
+ * Value of this property is of type
+ * <code>Collection (<? extends String>)</code>.
+ */
+ public static final String SERVICE_INTERFACE_NAME = "osgi.remote.interfaces";
+
+ /**
+ * Optional ServiceRegistration property which contains a collection of
+ * interface names with their associated version attributes separated by
+ * {@link #SEPARATOR} e.g. ["my.company.foo|1.3.5", "my.company.zoo|2.3.5"].
+ * In case no version has been provided for an interface, Discovery may use
+ * the String-value of <code>org.osgi.framework.Version.emptyVersion</code>
+ * constant.
+ * <p>
+ * Value of this property is of type
+ * <code>Collection (<? extends String>)</code>, may be
+ * <code>null</code> or empty.
+ */
+ public static final String SERVICE_INTERFACE_VERSION = "osgi.remote.interfaces.version";
+
+ /**
+ * Optional ServiceRegistration property which contains a collection of
+ * interface names with their associated (non-Java) endpoint interface names
+ * separated by {@link #SEPARATOR} e.g.:<br>
+ * ["my.company.foo|MyWebService", "my.company.zoo|MyWebService"].
+ * <p>
+ * This (non-Java) endpoint interface name is usually a communication
+ * protocol specific interface, for instance a web service interface name.
+ * Though this information is usually contained in accompanying properties
+ * e.g. a wsdl file, Discovery usually doesn't read and interprets such
+ * service meta-data. Providing this information explicitly, might allow
+ * external non-Java applications find services based on this endpoint
+ * interface.
+ * <p>
+ * Value of this property is of type
+ * <code>Collection (<? extends String>)</code>, may be
+ * <code>null</code> or empty.
+ */
+ public static final String ENDPOINT_INTERFACE_NAME = "osgi.remote.endpoint.interfaces";
+
+ /**
+ * Optional ServiceRegistration property which contains a map of properties
+ * of the published service.
+ * <p>
+ * Property keys are handled in a case insensitive manner (as OSGi Framework
+ * does).
+ * <p>
+ * Value of this property is of type <code>Map (String, Object)</code>, may
+ * be <code>null</code> or empty.
+ */
+ public static final String SERVICE_PROPERTIES = "osgi.remote.discovery.publication.service.properties";
+
+ /**
+ * Optional property of the published service identifying its location. This
+ * property is provided as part of the service property map referenced by
+ * the {@link #SERVICE_PROPERTIES} ServiceRegistration property.
+ * <p>
+ * Value of this property is of type <code>java.net.URI</code>, may be
+ * <code>null</code>.
+ */
+ public static final String ENDPOINT_LOCATION = "osgi.remote.endpoint.location";
+
+ /**
+ * Optional property of the published service uniquely identifying its
+ * endpoint. This property is provided as part of the service property map
+ * referenced by the {@link #SERVICE_PROPERTIES} ServiceRegistration
+ * property.
+ * <p>
+ * Value of this property is of type <code>String</code>, may be
+ * <code>null</code>.
+ */
+ public static final String ENDPOINT_ID = "osgi.remote.endpoint.id";
+
+ /**
+ * Separator constant for association of interface-specific values with the
+ * particular interface name. See also {@link #SERVICE_INTERFACE_VERSION}
+ * and {@link #ENDPOINT_INTERFACE_NAME} properties which describe such
+ * interface-specific values.
+ */
+ public static final String SEPARATOR = "|";
+
+ /**
+ * Returns the <code>ServiceReference</code> this publication metadata is
+ * associated with.
+ *
+ * @return the <code>ServiceReference</code> being published. Is never
+ * <code>null</code>.
+ */
+ ServiceReference getReference();
+}
Modified: cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryServiceTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryServiceTest.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryServiceTest.java (original)
+++ cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryServiceTest.java Fri Apr 24 12:49:19 2009
@@ -24,9 +24,9 @@
import java.util.Collections;
import java.util.Dictionary;
import java.util.Enumeration;
-import java.util.Iterator;
import java.util.HashMap;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -66,7 +66,7 @@
TestDiscoveredServiceTracker dst = new TestDiscoveredServiceTracker();
EasyMock.expect(bc.getBundles()).andReturn(new Bundle[] {b0}).anyTimes();
- EasyMock.expect(sr.getProperty("osgi.discovery.interest.interfaces")).
+ EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA)).
andReturn(Collections.singleton("org.example.SomeService")).anyTimes();
EasyMock.expect(bc.getService(sr)).andReturn(dst).anyTimes();
@@ -190,7 +190,7 @@
EasyMock.expect(bc.getBundles()).andReturn(new Bundle[] {b0}).anyTimes();
EasyMock.expect(bc.createFilter("(blah <= 5)")).andReturn(mockFilter).anyTimes();
- EasyMock.expect(sr.getProperty("osgi.discovery.interest.filters")).
+ EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.FILTER_MATCH_CRITERIA)).
andReturn(Collections.singleton("(blah <= 5)")).anyTimes();
EasyMock.expect(bc.getService(sr)).andReturn(dst).anyTimes();
@@ -296,7 +296,7 @@
TestDiscoveredServiceTracker dst = new TestDiscoveredServiceTracker();
ServiceReference sr = EasyMock.createNiceMock(ServiceReference.class);
- EasyMock.expect(sr.getProperty("osgi.discovery.interest.interfaces")).
+ EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA)).
andReturn(Collections.singleton("org.example.SomeService")).anyTimes();
EasyMock.replay(sr);
@@ -328,7 +328,7 @@
verifyNotification(dsn, 0, 1, "org.example.SomeService");
EasyMock.reset(sr);
- EasyMock.expect(sr.getProperty("osgi.discovery.interest.interfaces")).
+ EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA)).
andReturn(Arrays.asList("org.example.SomeService", "SomeOtherService")).anyTimes();
EasyMock.replay(sr);
@@ -366,7 +366,7 @@
TestDiscoveredServiceTracker dst = new TestDiscoveredServiceTracker();
EasyMock.expect(bc.getBundles()).andReturn(new Bundle[] {b0, b1}).anyTimes();
- EasyMock.expect(sr.getProperty("osgi.discovery.interest.interfaces")).
+ EasyMock.expect(sr.getProperty(DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA)).
andReturn(Collections.singleton("org.example.SomeService")).anyTimes();
EasyMock.expect(bc.getService(sr)).andReturn(dst).anyTimes();
@@ -432,7 +432,7 @@
assertNotNull(dsn.getInterfaces());
assertEquals(filterCount, dsn.getFilters().size());
assertEquals(interfaceCount, dsn.getInterfaces().size());
- Iterator i = filterCount > 0
+ Iterator<?> i = filterCount > 0
? dsn.getFilters().iterator()
: dsn.getInterfaces().iterator();
assertEquals(expected, i.next());
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java Fri Apr 24 12:49:19 2009
@@ -77,13 +77,13 @@
DistributionProviderImpl dpService = new DistributionProviderImpl(bc);
Hashtable<String, Object> props = new Hashtable<String, Object>();
- props.put(DistributionProvider.PROP_KEY_PRODUCT_NAME, getHeader("Bundle-Name"));
- props.put(DistributionProvider.PROP_KEY_PRODUCT_VERSION, getHeader("Bundle-Version"));
- props.put(DistributionProvider.PROP_KEY_VENDOR_NAME, getHeader("Bundle-Vendor"));
+ props.put(DistributionProvider.PRODUCT_NAME, getHeader("Bundle-Name"));
+ props.put(DistributionProvider.PRODUCT_VERSION, getHeader("Bundle-Version"));
+ props.put(DistributionProvider.VENDOR_NAME, getHeader("Bundle-Vendor"));
String supportedIntents = OsgiUtils.formatIntents(
getIntentMap().getIntents().keySet().toArray(new String [] {}));
- props.put(DistributionProvider.PROP_KEY_SUPPORTED_INTENTS, supportedIntents);
+ props.put(DistributionProvider.SUPPORTED_INTENTS, supportedIntents);
bc.registerService(DistributionProvider.class.getName(), dpService, props);
return dpService;
@@ -124,7 +124,7 @@
private void checkExistingServices() throws InvalidSyntaxException {
ServiceReference[] references = bc.getServiceReferences(null,
- "(" + DistributionConstants.PROP_KEY_SERVICE_REMOTE_INTERFACES + "=*)");
+ "(" + DistributionConstants.REMOTE_INTERFACES + "=*)");
if (references != null) {
for (ServiceReference sref : references) {
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/OsgiUtils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/OsgiUtils.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/OsgiUtils.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/OsgiUtils.java Fri Apr 24 12:49:19 2009
@@ -91,7 +91,7 @@
Map<String, Object> userProperties = new HashMap<String, Object>();
for (String key : sref.getPropertyKeys()) {
// we're after remote properties only
- if (key.startsWith(DistributionConstants.PROP_KEY_REMOTE_SERVICE)) {
+ if (key.startsWith(DistributionConstants.REMOTE)) {
userProperties.put(key, sref.getProperty(key));
}
}
@@ -156,7 +156,7 @@
list = new ServiceEndpointDescription[iNames.length];
for (int i = 0; i < iNames.length; i++) {
Map<String, Object> props = excludeProperty(sd.getProperties(),
- DistributionConstants.PROP_KEY_SERVICE_REMOTE_INTERFACES);
+ DistributionConstants.REMOTE_INTERFACES);
String keys[] = props.keySet().toArray(new String[props.size()]);
for (int j = 0; j < keys.length; j++) {
@@ -265,7 +265,7 @@
String interfaceName, Filter filter, boolean matchAll) {
Dictionary props = new Hashtable();
for (Object key : sd.getPropertyKeys()) {
- if (matchAll || key.toString().startsWith(DistributionConstants.PROP_KEY_REMOTE_SERVICE)) {
+ if (matchAll || key.toString().startsWith(DistributionConstants.REMOTE)) {
props.put(key, sd.getProperty(key.toString()));
}
}
@@ -470,7 +470,7 @@
public static String[] getPublishableInterfaces(ServiceEndpointDescription sd,
ServiceReference sref) {
Object publishProperty =
- sd.getProperty(DistributionConstants.PROP_KEY_SERVICE_REMOTE_INTERFACES);
+ sd.getProperty(DistributionConstants.REMOTE_INTERFACES);
String[] actualInterfaces =
(String[])sref.getProperty(org.osgi.framework.Constants.OBJECTCLASS);
String[] publishableInterfaces = null;
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java Fri Apr 24 12:49:19 2009
@@ -18,7 +18,7 @@
*/
package org.apache.cxf.dosgi.dsw.handlers;
-import static org.osgi.service.discovery.ServicePublication.PROP_KEY_ENDPOINT_LOCATION;
+import static org.osgi.service.discovery.ServicePublication.ENDPOINT_LOCATION;
import java.util.ArrayList;
import java.util.Arrays;
@@ -70,12 +70,12 @@
Map<String, String> registerPublication(Server server, String[] intents) {
Map<String, String> publicationProperties = new HashMap<String, String>();
- publicationProperties.put(DistributionConstants.PROP_KEY_SERVICE_REMOTE_CONFIG_TYPE,
+ publicationProperties.put(DistributionConstants.REMOTE_CONFIGURATION_TYPE,
Constants.POJO_CONFIG_TYPE);
String intentsValue = OsgiUtils.formatIntents(intents);
if (intentsValue.length() > 0) {
- publicationProperties.put(DistributionConstants.PROP_KEY_DEPLOYMENT_INTENTS, intentsValue);
+ publicationProperties.put(DistributionConstants.DEPLOYMENT_INTENTS, intentsValue);
}
return publicationProperties;
}
@@ -179,7 +179,7 @@
private static String[] getRequestedIntents(ServiceEndpointDescription sd) {
String property = OsgiUtils.getProperty(sd,
- DistributionConstants.PROP_KEY_SERVICE_REMOTE_REQUIRES_INTENTS);
+ DistributionConstants.REMOTE_REQUIRES_INTENTS);
String[] intents = OsgiUtils.parseIntents(property);
for (int i = 0; i < intents.length; i++) {
@@ -212,7 +212,7 @@
protected void addAddressProperty(Map props, String address) {
if (props != null) {
- props.put(PROP_KEY_ENDPOINT_LOCATION, address);
+ props.put(ENDPOINT_LOCATION, address);
}
}
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java Fri Apr 24 12:49:19 2009
@@ -42,7 +42,7 @@
public ConfigurationTypeHandler getHandler(BundleContext dswBC, ServiceEndpointDescription sd,
CxfDistributionProvider dp,
Map<String, Object> handlerProperties) {
- String type = OsgiUtils.getProperty(sd, DistributionConstants.PROP_KEY_SERVICE_REMOTE_CONFIG_TYPE);
+ String type = OsgiUtils.getProperty(sd, DistributionConstants.REMOTE_CONFIGURATION_TYPE);
if (type == null || Constants.POJO_CONFIG_TYPE.equalsIgnoreCase(type)) {
if (type == null) {
LOG.info("Defaulting to pojo configuration type ");
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/AbstractClientHook.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/AbstractClientHook.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/AbstractClientHook.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/AbstractClientHook.java Fri Apr 24 12:49:19 2009
@@ -21,10 +21,10 @@
import static org.osgi.service.discovery.DiscoveredServiceNotification.AVAILABLE;
import static org.osgi.service.discovery.DiscoveredServiceNotification.MODIFIED;
import static org.osgi.service.discovery.DiscoveredServiceNotification.UNAVAILABLE;
-import static org.osgi.service.discovery.DiscoveredServiceTracker.PROP_KEY_MATCH_CRITERIA_FILTERS;
-import static org.osgi.service.discovery.DiscoveredServiceTracker.PROP_KEY_MATCH_CRITERIA_INTERFACES;
-import static org.osgi.service.discovery.ServicePublication.PROP_KEY_ENDPOINT_ID;
-import static org.osgi.service.discovery.ServicePublication.PROP_KEY_SERVICE_INTERFACE_NAME;
+import static org.osgi.service.discovery.DiscoveredServiceTracker.FILTER_MATCH_CRITERIA;
+import static org.osgi.service.discovery.DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA;
+import static org.osgi.service.discovery.ServicePublication.ENDPOINT_ID;
+import static org.osgi.service.discovery.ServicePublication.SERVICE_INTERFACE_NAME;
import java.util.ArrayList;
import java.util.Collection;
@@ -73,9 +73,9 @@
ServiceEndpointDescription sd =
notification.getServiceEndpointDescription();
- if (sd.getProperty(DistributionConstants.PROP_KEY_SERVICE_REMOTE_INTERFACES) == null) {
+ if (sd.getProperty(DistributionConstants.REMOTE_INTERFACES) == null) {
LOG.info("not proxifying service, enabling property not set: "
- + DistributionConstants.PROP_KEY_SERVICE_REMOTE_INTERFACES);
+ + DistributionConstants.REMOTE_INTERFACES);
return;
}
@@ -177,7 +177,7 @@
String key = (String)keys.next();
ret.put(key, properties.get(key));
}
- ret.put(PROP_KEY_SERVICE_INTERFACE_NAME, interfaceName);
+ ret.put(SERVICE_INTERFACE_NAME, interfaceName);
return ret;
}
@@ -186,7 +186,7 @@
Map<String, Object> props = new HashMap<String, Object>();
props.putAll(sd.getProperties());
props.put(Constants.DSW_CLIENT_ID, getIdentificationProperty());
- props.put(DistributionConstants.PROP_KEY_REMOTE_SERVICE, "true");
+ props.put(DistributionConstants.REMOTE, "true");
return props;
}
@@ -196,13 +196,13 @@
if (interfaceName != null) {
append(trackerProperties,
- PROP_KEY_MATCH_CRITERIA_INTERFACES,
+ INTERFACE_MATCH_CRITERIA,
interfaceName);
}
if (filterValue != null) {
append(trackerProperties,
- PROP_KEY_MATCH_CRITERIA_FILTERS,
+ FILTER_MATCH_CRITERIA,
filterValue);
}
@@ -223,7 +223,7 @@
* @pre called with discoveredServices mutex held
*/
private boolean unknownEndpointId(ServiceEndpointDescription notified) {
- String endpointId = (String)notified.getProperty(PROP_KEY_ENDPOINT_ID);
+ String endpointId = (String)notified.getProperty(ENDPOINT_ID);
if (endpointId != null) {
boolean duplicate = discoveredServices.containsKey(endpointId);
if (!duplicate) {
@@ -243,7 +243,7 @@
* @pre called with discoveredServices mutex held
*/
private void cacheEndpointId(ServiceEndpointDescription notified, ServiceRegistration registration) {
- String endpointId = (String)notified.getProperty(PROP_KEY_ENDPOINT_ID);
+ String endpointId = (String)notified.getProperty(ENDPOINT_ID);
if (endpointId != null) {
discoveredServices.put(endpointId, registration);
LOG.info("caching proxy registration for endpoint ID: " + endpointId);
@@ -253,7 +253,7 @@
}
private void unCacheEndpointId(ServiceEndpointDescription notified) {
- String endpointId = (String)notified.getProperty(PROP_KEY_ENDPOINT_ID);
+ String endpointId = (String)notified.getProperty(ENDPOINT_ID);
ServiceRegistration proxyRegistration = null;
if (endpointId != null) {
synchronized (discoveredServices) {
@@ -277,7 +277,7 @@
LOG.info("Notified - AVAILABLE: "
+ notified.getProvidedInterfaces()
+ " endpoint id: "
- + notification.getServiceEndpointDescription().getProperty(PROP_KEY_ENDPOINT_ID));
+ + notification.getServiceEndpointDescription().getProperty(ENDPOINT_ID));
processNotification(notification, getContext());
break;
@@ -285,7 +285,7 @@
LOG.info("Notified - UNAVAILABLE: " + notified.getProvidedInterfaces()
+ notified.getProvidedInterfaces()
+ " endpoint id: "
- + notification.getServiceEndpointDescription().getProperty(PROP_KEY_ENDPOINT_ID));
+ + notification.getServiceEndpointDescription().getProperty(ENDPOINT_ID));
unCacheEndpointId(notified);
break;
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/CxfListenerHook.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/CxfListenerHook.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/CxfListenerHook.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/CxfListenerHook.java Fri Apr 24 12:49:19 2009
@@ -31,7 +31,7 @@
import org.osgi.framework.Constants;
import org.osgi.framework.hooks.service.ListenerHook;
-import static org.osgi.service.discovery.ServicePublication.PROP_KEY_SERVICE_INTERFACE_NAME;
+import static org.osgi.service.discovery.ServicePublication.SERVICE_INTERFACE_NAME;
public class CxfListenerHook extends AbstractClientHook implements ListenerHook {
@@ -83,7 +83,7 @@
lookupDiscoveryService(className, null);
} else {
String filter = listener.getFilter().replaceAll("objectClass",
- PROP_KEY_SERVICE_INTERFACE_NAME);
+ SERVICE_INTERFACE_NAME);
lookupDiscoveryService(null, filter);
}
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHook.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHook.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHook.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/CxfPublishHook.java Fri Apr 24 12:49:19 2009
@@ -80,7 +80,7 @@
Server server = createServer(sref, flatList[i]);
if (server != null) {
ServiceRegistration publication =
- ServiceHookUtils.publish(getContext(), flatList[i]);
+ ServiceHookUtils.publish(getContext(), sref, flatList[i]);
publications.put(sref, publication);
isPublished = publication != null;
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtils.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtils.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/ServiceHookUtils.java Fri Apr 24 12:49:19 2009
@@ -18,10 +18,10 @@
*/
package org.apache.cxf.dosgi.dsw.hooks;
-import static org.osgi.service.discovery.ServicePublication.PROP_KEY_ENDPOINT_ID;
-import static org.osgi.service.discovery.ServicePublication.PROP_KEY_ENDPOINT_LOCATION;
-import static org.osgi.service.discovery.ServicePublication.PROP_KEY_SERVICE_INTERFACE_NAME;
-import static org.osgi.service.discovery.ServicePublication.PROP_KEY_SERVICE_PROPERTIES;
+import static org.osgi.service.discovery.ServicePublication.ENDPOINT_ID;
+import static org.osgi.service.discovery.ServicePublication.ENDPOINT_LOCATION;
+import static org.osgi.service.discovery.ServicePublication.SERVICE_INTERFACE_NAME;
+import static org.osgi.service.discovery.ServicePublication.SERVICE_PROPERTIES;
import java.util.Dictionary;
import java.util.HashMap;
@@ -51,12 +51,13 @@
}
- public static ServiceRegistration publish(BundleContext bc, ServiceEndpointDescription sd) {
-
- ServiceRegistration publication =
- bc.registerService(ServicePublication.class.getName(),
- new ServicePublication() {},
- getPublicationProperties(sd));
+ public static ServiceRegistration publish(BundleContext bc, final ServiceReference sr, ServiceEndpointDescription sd) {
+ ServiceRegistration publication = bc.registerService(
+ ServicePublication.class.getName(), new ServicePublication() {
+ public ServiceReference getReference() {
+ return sr;
+ }
+ }, getPublicationProperties(sd));
if (publication != null) {
LOG.info("Remote " + sd.getProvidedInterfaces().toArray()[0]
@@ -147,11 +148,11 @@
@SuppressWarnings("unchecked")
private static Dictionary getPublicationProperties(ServiceEndpointDescription sd) {
Dictionary props = new Hashtable();
- props.put(PROP_KEY_SERVICE_INTERFACE_NAME, sd.getProvidedInterfaces());
- props.put(PROP_KEY_SERVICE_PROPERTIES, getServiceProperties(sd));
- props.put(PROP_KEY_ENDPOINT_ID, UUID.randomUUID().toString());
+ props.put(SERVICE_INTERFACE_NAME, sd.getProvidedInterfaces());
+ props.put(SERVICE_PROPERTIES, getServiceProperties(sd));
+ props.put(ENDPOINT_ID, UUID.randomUUID().toString());
if (sd.getLocation() != null) {
- props.put(PROP_KEY_ENDPOINT_LOCATION, sd.getLocation());
+ props.put(ENDPOINT_LOCATION, sd.getLocation());
}
LOG.info("publication properties: " + props);
return props;
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ServiceEndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ServiceEndpointDescriptionImpl.java?rev=768288&r1=768287&r2=768288&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ServiceEndpointDescriptionImpl.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ServiceEndpointDescriptionImpl.java Fri Apr 24 12:49:19 2009
@@ -18,8 +18,10 @@
*/
package org.apache.cxf.dosgi.dsw.service;
-import java.net.MalformedURLException;
-import java.net.URL;
+import static org.osgi.service.discovery.ServicePublication.ENDPOINT_LOCATION;
+
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
@@ -30,8 +32,6 @@
import org.osgi.service.discovery.ServiceEndpointDescription;
-import static org.osgi.service.discovery.ServicePublication.PROP_KEY_ENDPOINT_LOCATION;
-
public class ServiceEndpointDescriptionImpl implements ServiceEndpointDescription {
private static final Logger LOG =
@@ -45,7 +45,6 @@
this(Collections.singletonList(interfaceName), Collections.EMPTY_MAP);
}
- @SuppressWarnings("unchecked")
public ServiceEndpointDescriptionImpl(String interfaceName,
Map<String, Object> remoteProperties) {
this(Collections.singletonList(interfaceName), remoteProperties);
@@ -71,10 +70,10 @@
return properties;
}
+ @SuppressWarnings("unchecked")
public Collection getPropertyKeys() {
return getProperties().keySet();
}
-
@Override
public int hashCode() {
@@ -96,15 +95,15 @@
&& properties.equals(other.getProperties());
}
- public URL getLocation() {
- Object value = properties.get(PROP_KEY_ENDPOINT_LOCATION);
+ public URI getLocation() {
+ Object value = properties.get(ENDPOINT_LOCATION);
if (value == null) {
return null;
}
try {
- return new URL(value.toString());
- } catch (MalformedURLException ex) {
+ return new URI(value.toString());
+ } catch (URISyntaxException ex) {
LOG.warning("Service document URL is malformed : " + value.toString());
}