Author: sergeyb
Date: Tue Dec 30 09:30:57 2008
New Revision: 730199
URL: http://svn.apache.org/viewvc?rev=730199&view=rev
Log:
DOSGI : adding Discovery classes to cxf dsw as Felix 1.4.1 does not ship them
Added:
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/Discovery.java
(with props)
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/FindServiceCallback.java
(with props)
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java
(with props)
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServiceListener.java
(with props)
cxf/sandbox/dosgi/felix/main/src/main/resources/system.properties (with
props)
Modified:
cxf/sandbox/dosgi/dsw/cxf-dsw/pom.xml
cxf/sandbox/dosgi/felix/main/pom.xml
Modified: cxf/sandbox/dosgi/dsw/cxf-dsw/pom.xml
URL:
http://svn.apache.org/viewvc/cxf/sandbox/dosgi/dsw/cxf-dsw/pom.xml?rev=730199&r1=730198&r2=730199&view=diff
==============================================================================
--- cxf/sandbox/dosgi/dsw/cxf-dsw/pom.xml (original)
+++ cxf/sandbox/dosgi/dsw/cxf-dsw/pom.xml Tue Dec 30 09:30:57 2008
@@ -37,7 +37,8 @@
<bundle.import.package>*</bundle.import.package>
<bundle.export.package>
org.apache.cxf.dosgi.*;version="${pom.version}",
-
org.osgi.service.distribution;version="4.2.0";-split-package:=merge-first
+
org.osgi.service.distribution;version="4.2.0";-split-package:=merge-first,
+
org.osgi.service.discovery;version="4.2.0";-split-package:=merge-first
</bundle.export.package>
</properties>
Added:
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/Discovery.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/Discovery.java?rev=730199&view=auto
==============================================================================
---
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/Discovery.java
(added)
+++
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/Discovery.java
Tue Dec 30 09:30:57 2008
@@ -0,0 +1,202 @@
+/*
+ * 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;
+import java.util.Map;
+
+/**
+ * Interface of the Discovery service. This service allows to publish services
+ * exposed for remote access as well as search for remote services. <BR>
+ * Discovery service implementations usually rely on some discovery protocols
or
+ * other information distribution means.
+ *
+ * @version $Revision$
+ */
+public interface Discovery {
+ /**
+ *
+ */
+ final String OSGI_DISCOVERY = "osgi.discovery";
+
+ /**
+ *
+ */
+ final String OSGI_DISCOVERY_NONE = "none";
+
+ /**
+ *
+ */
+ final String OSGI_DISCOVERY_AUTO_PUBLISH = "auto-publish";
+
+ /**
+ * Add a ServiceListener for a particular service description.
+ *
+ * @param filter
+ * a filter to services to listen for. If filter is
+ * <code>null</code> then all services are considered.
+ * @param listener
+ * which is to call when discovery detects changes in
+ * availability or description of a service. The same listener
+ * object may be used to listen on multiple service filters.
+ * @throws IllegalArgumentException
+ * if listener is null or if filter is invalid
+ */
+ void addServiceListener(ServiceListener listener, String filter);
+
+ /**
+ * This method is the same as calling
+ * <code>Discovery.addServiceListener(ServiceListener listener, String
filter)</code>
+ * with <code>filter</code> set to <code>null</code>.
+ *
+ * @param listener
+ * which is to call when discovery detects changes in
+ * availability or description of a service. The same listener
+ * object may be used to listen on multiple service filters.
+ * @throws IllegalArgumentException
+ * if listener is null
+ * @see #addServiceListener(ServiceListener, String)
+ */
+ void addServiceListener(ServiceListener listener);
+
+ /**
+ * Removes a ServiceListener.
+ *
+ * @param listener
+ * ServiceListener which should be removed. If that listener
+ * object was registered several times then all registrations
+ * will be removed. If that listener object haven't been added
+ * before, then the method returns without throwing exceptions.
+ */
+ void removeServiceListener(ServiceListener listener);
+
+ /**
+ * Searches for services matching the provided interface name and filter.
+ *
+ * @param interfaceName
+ * name of the interface that returned services have to provide.
+ * If name is null then all services are considered to match.
+ * @param filter
+ * an LDAP filter which the service has to satisfy. If filter is
+ * null all services are considered to match.
+ * @return Collection of <code>ServiceEndpointDescription</code> objects
+ * which were found to match interface name and filter. The
+ * collection is empty if none was found. The collection represents
+ * a snapshot and as such is not going to be updated in case other
matching
+ * services become available at a later point of time.
+ */
+ Collection /* <? extends ServiceEndpointDescription> */findService(
+ String interfaceName, String filter);
+
+ /**
+ * Asynchronous version of <code>Discovery.findService(String
interfaceName,
+ * String filter)</code> method.
+ *
+ * @param interfaceName
+ * name of the interface returned services have to provide. If
+ * name is null then all services are considered to match.
+ * @param filter
+ * an LDAP filter which the service has to satisfy. Note that
+ * <code>ServiceEndpointDescription</code> defines some
+ * properties for service url, interface version etc.. If filter
+ * is null all services are considered to match.
+ * @param callback
+ * to notify about the asynchronous response of the find
+ * operation
+ * @throws IllegalArgumentException
+ * if callback is null
+ * @see #findService(String, String)
+ */
+ void findService(String interfaceName, String filter,
+ FindServiceCallback callback);
+
+ /**
+ * Publish the provided service meta-data.
+ *
+ * @param javaInterfacesAndVersions
+ * names of java interfaces offered by the service and their
+ * version. For every interface to publish you have to define
its
+ * version. If you don't have a version, put "0.0.0" in it.
+ * @param javaInterfacesAndEndpointInterfaces
+ * associates java interfaces to general end point interface
+ * names. It is not needed to to have and end point interface
for
+ * a java interface. The map may be null.
+ * @param properties
+ * a bag of service properties (key-value pairs) to be
published.
+ * It may be null. Note that Discovery might make use of certain
+ * standard properties like the ones defined by
+ * {...@link ServiceEndpointDescription} for the publication
process
+ * if they are provided.
+ *
+ * @return an instance of {...@link ServiceEndpointDescription} or null if
the
+ * publishing failed
+ *
+ * @throws IllegalArgumentException
+ * if javaInterfacesAndVersions is null or empty
+ */
+ ServiceEndpointDescription publishService(
+ Map/* <String, String> */javaInterfacesAndVersions,
+ Map/* <String, String> */javaInterfacesAndEndpointInterfaces,
+ Map/* <String, Object> */properties);
+
+ /**
+ * Publish the provided service. The information is published by the
+ * Discovery implementation.<b> If the parameter autopublish=true, the
+ * Discovery implementation actively pushes the information about the
+ * service to the network. Otherwise, it is just available upon request
from
+ * other Discovery implementations. The ServiceEndpointDescription is
+ * matched using the Comparable interface.
+ *
+ * @param javaInterfacesAndVersions
+ * its an association between interfaces and versions. For every
+ * interface to publish you have to define its version. If you
+ * don't have a version, put "0.0.0" in it.
+ * @param javaInterfacesAndEndpointInterfaces
+ * associates java interfaces to general end point interface
+ * names. It is not needed to to have and end point interface
for
+ * a java interface. The map can be null.
+ * @param properties
+ * a bag of properties to be published; can be null
+ * @param autopublish
+ * if true, service information is actively pushed to the
network
+ * for discovery
+ *
+ * @return an instance of {...@link ServiceEndpointDescription} or null if
the
+ * publishing failed
+ *
+ * @throws IllegalArgumentException
+ * if javaInterfacesAndVersions is null or empty
+ */
+ ServiceEndpointDescription publishService(
+ Map/* <String, String> */javaInterfacesAndVersions,
+ Map/* <String, String> */javaInterfacesAndEndpointInterfaces,
+ Map/* <String, Object> */properties, boolean autopublish);
+
+ /**
+ * Make the given service un-discoverable. The previous publish request for
+ * a service is undone. The service information is also removed from the
+ * local or global cache if cached before.
+ *
+ * @param serviceEndpointDescription
+ * ServiceEndpointDescription of the service to unpublish. If
+ * this ServiceEndpointDescription haven't been published
before,
+ * then the method returns without throwing exceptions.
+ * @throws IllegalArgumentException
+ * if serviceEndpointDescription is null or incomplete
+ */
+ void unpublishService(ServiceEndpointDescription
serviceEndpointDescription);
+}
Propchange:
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/Discovery.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/Discovery.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/FindServiceCallback.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/FindServiceCallback.java?rev=730199&view=auto
==============================================================================
---
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/FindServiceCallback.java
(added)
+++
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/FindServiceCallback.java
Tue Dec 30 09:30:57 2008
@@ -0,0 +1,42 @@
+/*
+ * 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 callback objects, which can be provided with an asynchronous
+ * find service operation and which will be called when the operation actually
+ * finished.
+ *
+ * @version $Revision$
+ */
+public interface FindServiceCallback {
+ /**
+ * Callback indicating that a previously started asynchronous find service
+ * operation finished.
+ *
+ * @param serviceEndpointDescriptions
+ * ServiceDescription objects satisfying the provided find
+ * criteria. The collection is never null but may be empty if
+ * none was found. The collection represents a snapshot and as
+ * such is not going to be updated in case other matching
+ * services become available at a later point of time.
+ */
+ void servicesFound(
+ Collection /* <? extends ServiceEndpointDescription>
*/serviceEndpointDescriptions);
+}
Propchange:
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/FindServiceCallback.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/FindServiceCallback.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java?rev=730199&view=auto
==============================================================================
---
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java
(added)
+++
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java
Tue Dec 30 09:30:57 2008
@@ -0,0 +1,116 @@
+/*
+ * 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.net.URL;
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * The ServiceEndpointDescription interface describes an endpoint of a service.
+ * This class can be considered as a wrapper around the property map associated
+ * with a service and its endpoint. It provides an API to conveniently access
+ * the most important properties of the service.
+ *
+ * @version $Revision$
+ */
+public interface ServiceEndpointDescription {
+ /**
+ * If value of <code>getProtocolSpecificInterfaceName</code> needs to be
+ * described as a key-value pair e.g. by the discovery protocol, filter for
+ * discovery etc. and there is no other key standardized for that purpose
+ * yet, then this is the recommended property key to use.
+ */
+ public final String PROP_KEY_PROTOCOL_SPECIFIC_INTERFACE_NAME =
"protocol-specific-interface-name";
+
+ /**
+ * If value of <code>getVersion</code> needs to be described as a key-value
+ * pair e.g. by the discovery protocol, filter for discovery etc. and there
+ * is no other key standardized for that purpose yet, then this is the
+ * recommended property key to use.
+ */
+ public final String PROP_KEY_VERSION = "version";
+
+ /**
+ * If value of <code>getServiceLocation</code> needs to be described as a
+ * key-value pair e.g. by the discovery protocol, filter for discovery etc.
+ * and there is no other key standardized for that purpose yet, then this
is
+ * the recommended property key to use.
+ */
+ public final String PROP_KEY_SERVICE_LOCATION = "location";
+
+ /**
+ * @return full qualified service interface names provided by the
advertised
+ * service (endpoint). The collection is never null or
+ * empty but contains at least one service interface.
+ */
+ Collection /* <? extends String> */getInterfaceNames();
+
+ /**
+ * @param interfaceName
+ * for which its communication protocol specific version should
+ * be returned. It might be for instance a web service interface
+ * name. Though this information is usually contained in
+ * according interface descriptions, e.g. a wsdl file, it can
+ * optionally be provided here as well since discovery usually
+ * doesn't read and interprets such accompanying descriptions.
+ *
+ * @return The protocol specific service interface name.
+ */
+ String getProtocolSpecificInterfaceName(String interfaceName);
+
+ /**
+ * @param interfaceName
+ * for which its version should be returned.
+ * @return The service interface/implementation version.
+ */
+ String getVersion(String interfaceName);
+
+ /**
+ * @return The URL of the service location.
+ */
+ URL getLocation();
+
+ /**
+ * 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
+ */
+ 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.
+ */
+ 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.
+ */
+ Map/* <String, Object> */getProperties();
+}
Propchange:
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServiceListener.java
URL:
http://svn.apache.org/viewvc/cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServiceListener.java?rev=730199&view=auto
==============================================================================
---
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServiceListener.java
(added)
+++
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServiceListener.java
Tue Dec 30 09:30:57 2008
@@ -0,0 +1,58 @@
+/*
+ * 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;
+
+/**
+ * Describes the interface of listeners, which can be registered with
+ * Discovery to be notified on life-cycle changes of remote services.
+ *
+ * @version $Revision$
+ */
+public interface ServiceListener {
+ /**
+ * Callback indicating that a service matching the listening criteria was
+ * discovered and is known to the calling Discovery implementation.
+ *
+ * @param serviceEndpointDescription
+ * meta-data which is known to Discovery regarding the new
+ * service.
+ */
+ void serviceAvailable(ServiceEndpointDescription
serviceEndpointDescription);
+
+ /**
+ * Callback indicating a change in the service endpoint description of a
+ * previously discovered service.
+ *
+ * @param oldDescription
+ * previous service endpoint description
+ * @param newDescription
+ * new service endpoint description
+ */
+ void serviceModified(ServiceEndpointDescription oldDescription,
+ ServiceEndpointDescription newDescription);
+
+ /**
+ * Callback indicating that a previously discovered service endpoint is no
longer
+ * available.
+ *
+ * @param serviceEndpointDescription
+ * ServiceEndpointDescription of the service that is no longer
+ * available
+ */
+ void serviceUnavailable(
+ ServiceEndpointDescription serviceEndpointDescription);
+}
Propchange:
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServiceListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/sandbox/dosgi/dsw/cxf-dsw/src/main/java/org/osgi/service/discovery/ServiceListener.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: cxf/sandbox/dosgi/felix/main/pom.xml
URL:
http://svn.apache.org/viewvc/cxf/sandbox/dosgi/felix/main/pom.xml?rev=730199&r1=730198&r2=730199&view=diff
==============================================================================
--- cxf/sandbox/dosgi/felix/main/pom.xml (original)
+++ cxf/sandbox/dosgi/felix/main/pom.xml Tue Dec 30 09:30:57 2008
@@ -281,6 +281,7 @@
<delete dir="${basedir}/bundle" />
<copy
file="${basedir}/target/org.apache.felix.main-${pom.version}.jar"
tofile="${basedir}/bin/felix.jar" />
<copy file="${basedir}/target/classes/config.properties"
todir="${basedir}/conf" />
+ <copy file="${basedir}/target/classes/system.properties"
todir="${basedir}/conf" />
<move file="${basedir}/target/bundle" todir="${basedir}" />
</tasks>
</configuration>
Added: cxf/sandbox/dosgi/felix/main/src/main/resources/system.properties
URL:
http://svn.apache.org/viewvc/cxf/sandbox/dosgi/felix/main/src/main/resources/system.properties?rev=730199&view=auto
==============================================================================
--- cxf/sandbox/dosgi/felix/main/src/main/resources/system.properties (added)
+++ cxf/sandbox/dosgi/felix/main/src/main/resources/system.properties Tue Dec
30 09:30:57 2008
@@ -0,0 +1 @@
+org.apache.cxf.nofastinfoset=true
Propchange: cxf/sandbox/dosgi/felix/main/src/main/resources/system.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/sandbox/dosgi/felix/main/src/main/resources/system.properties
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: cxf/sandbox/dosgi/felix/main/src/main/resources/system.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain