Modified: cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/Discovery.java URL: http://svn.apache.org/viewvc/cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/Discovery.java?rev=702927&r1=702926&r2=702927&view=diff ============================================================================== --- cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/Discovery.java (original) +++ cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/Discovery.java Wed Oct 8 09:52:52 2008 @@ -1,7 +1,5 @@ /* - * $Date$ - * - * Copyright (c) OSGi Alliance (2004, 2007). All Rights Reserved. + * 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. @@ -18,170 +16,151 @@ package org.osgi.service.discovery; -import java.util.Collection; - - /** * - * TODO: How to update published ServiceDescriptions? How to identify ServiceDescriptions of the same service instance? - * TODO: how about to rename auto-publish to push/pull? + * TODO: How to update published ServiceDescriptions? How to identify + * ServiceDescriptions of the same service instance? <br> + * TODO: how about to rename auto-publish to push/pull?<br> + * TODO: how to propagate exceptions in async findService calls? * * @version $Revision$ */ public interface Discovery { final String ORG_OSGI_DISCOVERY = "org.osgi.discovery"; + final String ORG_OSGI_DISCOVERY_NONE = "none"; + final String ORG_OSGI_DISCOVERY_AUTO_PUBLISH = "auto-publish"; - - - /** - * Add a ServiceListener for a particular service description. - * - * @param serviceDescription describes the service(s) to listen for. If serviceDescription 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 also be used to listen on multiple serviceDescription objects. - */ - void addServiceListener(ServiceListener listener, ServiceDescription serviceDescription); - - + /** - * Add a ServiceListener for a particular service description. + * Add a ServiceListener for a particular service description. * - * @param filter an LDAP filter which the service has to satisfy. - * @param listener which is to call when discovery detects changes in a service's availability or description. - * The same listener object might also be used for multiple serviceDescription objects. + * @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, ServiceDescription serviceDescription)</code> - * with <code>serviceDescription</code> set to <code>null</code>. + * <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 also be used to listen on multiple serviceDescription objects. - * @see #addServiceListener(ServiceListener, ServiceDescription) + * @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 to remove. If that listener object haven't been added before, then the method returns without throwing exceptions. + * 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); - - + /** - * Looks for the given ServiceDescription in the cache. Cache might be local or global depending on the - * cache strategy of the Discovery.<b> - * - * @param serviceDescription to check for its existence in cache - * @return true if a service matching the given serviceDescription is found in the local cache - * @throws IllegalArgumentException if serviceDescription is null or incomplete - */ - boolean isCached(ServiceDescription serviceDescription); - - - /** - * Returns an array of all ServiceDescription objects currently known to the Discovery implementation. - * - * @return A collection of ServiceDescription objects. An empty collection is returned if no service descriptions - * were found. - */ - Collection getCachedServiceDescriptions(); - - - /** - * Searches for services matching the criteria provided with the service description. Matching means in this context - * a containment and not an equality relation though Discovery might choose to ignore some properties if it can't really compare them - * e.g. if a property of the provided service description is a File object (wsdl file for instance). - * For this reason its recommended to provide only simple properties with the service description object. - * Any other, more complex matching operations could be done in the next step and are caller's responsibility. - * - * @param serviceDescription ServiceDescription of the service to locate - * @return Collection of ServiceDescription objects satisfying the find criteria. - * The Collection may be empty if none was found - * @throws IllegalArgumentException if serviceDescription is null. - */ - Collection findService(ServiceDescription serviceDescription); - - - /** - * Find a service based on the provided LDAP filter. - * - * @param filter an LDAP filter which the service has to satisfy. - * @return Collection of ServiceDescription objects matching the service that was found to satisfy the find criteria. - * The Collection may be empty if none was found. - * @throws IllegalArgumentException if serviceDescription is null or incomplete - * @throws UnsupportedOperationException if method is not supported by the implementation - */ - Collection findService(String filter); - - - /** - * Asynchronous version of <code>Discovery.findService(ServiceDescription serviceDescription)</code> method. - * - * @param serviceDescription ServiceDescription of the service to locate - * @param callback to notify about the asynchronous response of the find operation - * @throws IllegalArgumentException if the serviceDescription or callback is null - * @see #findService(ServiceDescription) - */ - void findService(ServiceDescription serviceDescription, FindServiceCallback callback); - - - /** - * Asynchronous interface to initiate the search for an suitable service based on the provided ServiceDescription and filter. - * Discovery implementations might choose to not support this method if the discovery protocol doesn't support filtering. - * The ServiceDescription is matched using the Comparable interface. - * - * @param filter an LDAP filter which the service has to satisfy. - * @param callback Listener object to notify about the asynchronous response of the find operation - * @throws IllegalArgumentException if the serviceDescription is null or incomplete - * @throws UnsupportedOperationException if method is not supported by the implementation - */ - void findService(String filter, FindServiceCallback callback); - - - /** - * Publish the provided service description. - * If the property org.osgi.discovery = auto-publish, the Discovery implementation actively pushes the - * information about the service to the network. Otherwise, it is just available upon request from other - * Discovery implementations. + * Searches for services matching the provided interface name and filter. + * + * @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. + * @return Array of ServiceEndpointDescription objects matching the service + * that was found to satisfy the find criteria. The Collection may + * be empty if none was found. + */ + 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 description. If the property + * org.osgi.discovery = auto-publish, the Discovery implementation actively + * pushes the information about the service to the network. Otherwise, it is + * just available upon request from other Discovery implementations. * - * @param serviceDescription ServiceDescription of the service to publish + * @param serviceEndpointDescription + * ServiceEndpointDescription of the service to publish * @return true if the service was successfully published. - * @throws IllegalArgumentException if serviceDescription is null, incomplete or invalid (e.g. contains - * unknown property types) - */ - boolean publishService(ServiceDescription serviceDescription); - - - /** - * 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 ServiceDescription is matched using the Comparable interface. - * @param serviceDescription ServiceDescription of the service to publish - * @param autopublish if true, service information is actively pushed to the network for discovery + * @throws IllegalArgumentException + * if serviceEndpointDescription is null, incomplete or invalid + * (e.g. contains unknown property types) + */ + boolean publishService(ServiceEndpointDescription serviceEndpointDescription); + + /** + * 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 serviceEndpointDescription + * ServiceEndpointDescription of the service to publish + * @param autopublish + * if true, service information is actively pushed to the network + * for discovery * @return true if the service was successfully published. - * @throws IllegalArgumentException if serviceDescription is null, incomplete or invalid (e.g. contains - * unknown property types) - */ - boolean publishService(ServiceDescription serviceDescription, 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 serviceDescription ServiceDescription of the service to unpublish. If this ServiceDescription - * haven't been published before, then the method returns without throwing exceptions. - * @throws IllegalArgumentException if serviceDescription is null or incomplete + * @throws IllegalArgumentException + * if serviceEndpointDescription is null, incomplete or invalid + * (e.g. contains unknown property types) + */ + boolean publishService( + ServiceEndpointDescription serviceEndpointDescription, + 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(ServiceDescription serviceDescription); + void unpublishService(ServiceEndpointDescription serviceEndpointDescription); }
Modified: cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/FindServiceCallback.java URL: http://svn.apache.org/viewvc/cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/FindServiceCallback.java?rev=702927&r1=702926&r2=702927&view=diff ============================================================================== --- cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/FindServiceCallback.java (original) +++ cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/FindServiceCallback.java Wed Oct 8 09:52:52 2008 @@ -1,7 +1,5 @@ /* - * $Date$ - * - * Copyright (c) OSGi Alliance (2004, 2007). All Rights Reserved. + * 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. @@ -18,17 +16,16 @@ package org.osgi.service.discovery; -import java.util.Collection; - - /** +/** * * * @version $Revision$ */ public interface FindServiceCallback { /** - * @param serviceDescriptions Collection of ServiceDescription objects satisfying the find criteria. - * The Collection may be empty if none was found. + * @param serviceEndpointDescriptions + * Array of ServiceDescription objects satisfying the find criteria. The returned array is never null but + * may be empty if none was found. */ - void servicesFound(Collection serviceDescriptions); + void servicesFound(ServiceEndpointDescription[] serviceEndpointDescriptions); } Copied: cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java (from r702392, cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/ServiceDescription.java) URL: http://svn.apache.org/viewvc/cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java?p2=cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java&p1=cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/ServiceDescription.java&r1=702392&r2=702927&rev=702927&view=diff ============================================================================== --- cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/ServiceDescription.java (original) +++ cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java Wed Oct 8 09:52:52 2008 @@ -1,7 +1,5 @@ /* - * $Date$ - * - * Copyright (c) OSGi Alliance (2004, 2007). All Rights Reserved. + * 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. @@ -23,80 +21,86 @@ import java.util.Map; /** - * The ServiceDescription interface defines the service and its properties. The main information necessary is the - * name of the provided interface.<p/> + * 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. * * It's strongly recommended to override <code>Object.equals<code> method to implement an appropriate equivalence - * comparison for ServiceDescription objects. + * comparison for ServiceEndpointDescription objects. * * @version $Revision$ */ -public interface ServiceDescription { - +public interface ServiceEndpointDescription { /** - * If value of <code>getInterfaceName</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. - */ + * If value of <code>getInterfaceName</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_INTERFACE_NAME = "interface-name"; - + + /** + * 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>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-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. - */ + * 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. - */ + * 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 The full qualified service interface name - */ - String getInterfaceName(); - - /** - * @return The protocol specific service interface name. 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 might be provided here as well since discovery usually doesn't read and interprets such accompanying - * descriptions. + * @return array of full qualified service interface names provided by the advertised service (endpoint). */ - String getProtocolSpecificInterfaceName(); - + 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 getVersion(String interfaceName); + /** * @return The URL of the service location. */ - URL getLocation(); - + URL getLocation(); + /** * Getter method for the property value of a given key. * - * @param key Name of the property + * @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 the property names available in the ServiceDescription */ Collection getPropertyKeys(); - + /** * @return Returns all properties of the service as a <code>java.util.Map</code>. */ Modified: cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/ServiceListener.java URL: http://svn.apache.org/viewvc/cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/ServiceListener.java?rev=702927&r1=702926&r2=702927&view=diff ============================================================================== --- cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/ServiceListener.java (original) +++ cxf/sandbox/dosgi/felix/framework/src/main/java/org/osgi/service/discovery/ServiceListener.java Wed Oct 8 09:52:52 2008 @@ -1,7 +1,5 @@ /* - * $Date$ - * - * Copyright (c) OSGi Alliance (2004, 2007). All Rights Reserved. + * 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. @@ -19,28 +17,36 @@ package org.osgi.service.discovery; /** - * - * TODO: consider whether methods should also contain a source object (the particular discovery service which does the notification) + * + * TODO: consider whether methods should also contain a source object (the particular discovery service which does the + * notification) * * @version $Revision$ */ public interface ServiceListener { /** - * Callback indicating that the specified service was discovered and is known to the calling Discovery implementation. - * @param serviceDescription + * Callback indicating that the specified service was discovered and is known to the calling Discovery + * implementation. + * + * @param serviceEndpointDescription */ - void serviceAvailable(ServiceDescription serviceDescription); - + void serviceAvailable(ServiceEndpointDescription serviceEndpointDescription); + /** - * Callback indicating a change in the service description of a previously discovered service. - * @param oldDescription previous service description - * @param newDescription new service description + * 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(ServiceDescription oldDescription, ServiceDescription newDescription); - + void serviceModified(ServiceEndpointDescription oldDescription, ServiceEndpointDescription newDescription); + /** - * Callback indicating that the specified service is no longer available/ - * @param serviceDescription ServiceDescription of the service that is no longer available + * Callback indicating that the specified service endpoint is no longer available. + * + * @param serviceEndpointDescription + * ServiceEndpointDescription of the service that is no longer available */ - void serviceUnavailable(ServiceDescription serviceDescription); + void serviceUnavailable(ServiceEndpointDescription serviceEndpointDescription); } Modified: cxf/sandbox/dosgi/systests/pom.xml URL: http://svn.apache.org/viewvc/cxf/sandbox/dosgi/systests/pom.xml?rev=702927&r1=702926&r2=702927&view=diff ============================================================================== --- cxf/sandbox/dosgi/systests/pom.xml (original) +++ cxf/sandbox/dosgi/systests/pom.xml Wed Oct 8 09:52:52 2008 @@ -45,7 +45,10 @@ <dependency> <groupId>org.apache.servicemix.kernel.testing</groupId> <artifactId>org.apache.servicemix.kernel.testing.support</artifactId> - <version>1.0.0</version> +<!-- + <version>1.1.0-SNAPSHOT</version> +--> + <version>1.0.0</version> <scope>test</scope> <exclusions> <exclusion> @@ -294,10 +297,23 @@ <name>org.springframework.osgi.test.framework</name> <value>${osgi.test.platform}</value> </property> + <property> <name>spring.validation.mode</name> <value>VALIDATION_NONE</value> </property> +<!-- + <property> + <name>felix.config.properties</name> + <value>file:${basedir}/../etc/felix.config.properties</value> + </property> +--> +<!-- + <property> + <name>-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize</name> + <value></value> + </property> +--> </systemProperties> </configuration> </plugin>
