Bug 250716 - [remotesvcs][api] add asynch method to remote service lookup
Summary: [remotesvcs][api] add asynch method to remote service lookup
Status: RESOLVED FIXED
Alias: None
Product: ECF
Classification: RT
Component: ecf.remoteservices (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.0.0   Edit
Assignee: ecf.core-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted, plan
: 251897 (view as bug list)
Depends on: 258875
Blocks:
  Show dependency tree
 
Reported: 2008-10-14 02:20 EDT by Scott Lewis CLA
Modified: 2009-05-28 19:14 EDT (History)
2 users (show)

See Also:


Attachments
Enhancement to remote service API (5.25 KB, patch)
2008-12-27 15:07 EST, Scott Lewis CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Lewis CLA 2008-10-14 02:20:22 EDT
Currently, remote services lookup is done synchronously by a blocking call IRemoteServicesContainerAdapter.getRemoteServiceReferences().  An asynchronous version of this method (getRemoteServiceReferences()) should be added so that clients can use either blocking or non-blocking retrieval of remote services references.
Comment 1 Scott Lewis CLA 2008-12-09 10:25:14 EST
*** Bug 251897 has been marked as a duplicate of this bug. ***
Comment 2 Scott Lewis CLA 2008-12-09 10:26:13 EST
Here is a possible API using IAsyncResult (future):

org.eclipse.ecf.core.util.IAsyncResult;

public IAsyncResult asyncGetRemoteServiceReferences(ID[] idFilter, String
clazz, String filter) throws InvalidSyntaxException;

Here are some possible javadocs for this method:

        /**
         * Asynchronously returns an array of
<code>IRemoteServiceReference</code> objects. The
         * returned array of <code>IRemoteServiceReference</code> objects
contains
         * services that were registered under the specified class and match
the
         * specified idFilter, and filter criteria.
         * <p>
         * The IAsyncResult is returned immediately, and subsequent calls to
{@link IAsyncResult#get()}
         * or {@link IAsyncResult#get(long)} will return the actual results
received.  The type of
         * the Object returned from {@link IAsyncResult#get()} will be
IRemoteServiceReference [].
         * 
         * <p>
         * The list is valid at the time of the call to this method, however
since
         * the Framework is a very dynamic environment, services can be
modified or
         * unregistered at anytime.
         * 
         * <p>
         * <code>idFilter</code> is used to select a registered services that
were
         * registered by a given set of containers with id in idFilter. Only
         * services exposed by a container with id in idFilter will be
returned.
         * 
         * <p>
         * If <code>idFilter</code> is <code>null</code>, all containers are
         * considered to match the filter.
         * 
         * <p>
         * <code>filter</code> is used to select the registered service whose
         * properties objects contain keys and values which satisfy the filter.
See
         * {@link Filter} for a description of the filter string syntax.
         * 
         * <p>
         * If <code>filter</code> is <code>null</code>, all registered services
         * are considered to match the filter. If <code>filter</code> cannot be
         * parsed, an {@link InvalidSyntaxException} will be thrown with a
human
         * readable message where the filter became unparsable.
         * 
         * @param idFilter
         *            an array of ID instances that will restrict the search
for
         *            matching container ids If null, all remote containers
will be
         *            considered in search for matching IRemoteServiceReference
         *            instances. May be <code>null</code>.
         * 
         * @param clazz
         *            the fully qualified name of the interface class that
describes
         *            the desired service. Must not be <code>null</code>.
         * @param filter
         *            The filter criteria. May be <code>null</code>.
         * @return IAsyncResult that through subsequent calls to
IAsyncResult#get() will return
         *         IRemoteServiceReference [] with IRemoteServiceReferences
matching given search criteria. 
         *         Will not return <code>null</code>.
         * 
         * @throws InvalidSyntaxException If filter contains an invalid filter
string that cannot be parsed.
         */
Comment 3 Scott Lewis CLA 2008-12-09 10:27:09 EST
Adding this one to plan
Comment 4 Scott Lewis CLA 2008-12-27 15:07:36 EST
Created attachment 121272 [details]
Enhancement to remote service API

Added asyncGetRemoteServiceReferences(ID[], String, String) to IRemoteServiceContainerAdapter.  Please comment on this bug about the method name, signature, use of IFutureResult, etc.
Comment 5 Scott Lewis CLA 2008-12-27 15:09:50 EST
Also, here's the new method signature and javadocs in the patch:

	/**
	 * Asynchronously returns an array of <code>IRemoteServiceReference</code> objects. The
	 * returned array of <code>IRemoteServiceReference</code> objects contains
	 * services that were registered under the specified class and match the
	 * specified idFilter, and filter criteria.
	 * <p>
	 * The IFutureStatus is returned immediately, and subsequent calls to {@link IFutureStatus#get()}
	 * or {@link IFutureStatus#get(long)} will return the actual results received.  The type of
	 * the Object returned from {@link IFutureStatus#get()} will be IRemoteServiceReference [].
	 * 
	 * <p>
	 * The list is valid at the time of the call to this method, however since
	 * the Framework is a very dynamic environment, services can be modified or
	 * unregistered at anytime.
	 * 
	 * <p>
	 * <code>idFilter</code> is used to select a registered services that were
	 * registered by a given set of containers with id in idFilter. Only
	 * services exposed by a container with id in idFilter will be returned.
	 * 
	 * <p>
	 * If <code>idFilter</code> is <code>null</code>, all containers are
	 * considered to match the filter.
	 * 
	 * <p>
	 * <code>filter</code> is used to select the registered service whose
	 * properties objects contain keys and values which satisfy the filter. See
	 * {@link Filter} for a description of the filter string syntax.
	 * 
	 * @param idFilter
	 *            an array of ID instances that will restrict the search for
	 *            matching container ids If null, all remote containers will be
	 *            considered in search for matching IRemoteServiceReference
	 *            instances. May be <code>null</code>.
	 * 
	 * @param clazz
	 *            the fully qualified name of the interface class that describes
	 *            the desired service. Must not be <code>null</code>.
	 * @param filter
	 *            The filter criteria. May be <code>null</code>.
	 * @return IFutureStatus that through subsequent calls to IFutureStatus#get() will return
	 *         IRemoteServiceReference [] with IRemoteServiceReferences matching given search criteria. 
	 *         Will not return <code>null</code>.
	 * 
	 * @since 3.0
	 */
	public IFutureStatus asyncGetRemoteServiceReferences(ID[] idFilter, String clazz, String filter);

See also docs on IFutureStatus from org.eclipse.ecf plugin (HEAD/ECF 3.0).
Comment 6 Scott Lewis CLA 2009-05-28 19:14:10 EDT
Completed some time ago.  Resolving as Fixed.