com.ibm.portal.resolver.helper
Class CORLookup

java.lang.Object
  extended by com.ibm.portal.resolver.helper.CORLookup

public class CORLookup
extends java.lang.Object

Convenience class that facilitates the lookup for services that are associates with URIs via the content operations registry

Since:
7.0.0.0

Constructor Summary
CORLookup()
           
 
Method Summary
static
<T> T
getService(java.net.URI uri, java.lang.Class<T> cls, ServiceHandler handler, Context ctx, T defaultService)
          Returns a service from a service handler
static
<T> java.util.Collection<? super T>
getServices(java.util.Collection<? super T> dst, java.lang.Class<T> cls, Context ctx)
          Convenience method to assemble all services for a particular interface
static
<T> java.util.Collection<? super T>
getServices(java.util.Collection<? super T> dst, java.net.URI uri, java.lang.Class<T> cls, Context ctx, T defaultService)
          Assembles all services that implement a particular interface
static
<T> T
lookupService(java.net.URI uri, java.lang.Class<T> cls, Context ctx)
           
static
<T> T
lookupService(java.net.URI uri, java.lang.Class<T> cls, Context ctx, T defaultService)
          Uses the COR to find a service that exposes a particular interface.
static
<T> boolean
serviceHandlerExists(java.net.URI uri, java.lang.Class<T> cls, Context ctx)
          Checks if a service handler for the given service is registered, without throwing an exception
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CORLookup

public CORLookup()
Method Detail

getService

public static <T> T getService(java.net.URI uri,
                               java.lang.Class<T> cls,
                               ServiceHandler handler,
                               Context ctx,
                               T defaultService)
                    throws org.eclipse.core.runtime.CoreException,
                           ServiceNotFoundException
Returns a service from a service handler

Parameters:
uri - the URI, may be null
cls - the class that the service should implement, not null
handler - the handler, may be null
ctx - the COR context
defaultService - an optional default service, may be null
Returns:
the actual service, not null
Throws:
org.eclipse.core.runtime.CoreException
ServiceNotFoundException
Since:
6.1.0.2

getServices

public static <T> java.util.Collection<? super T> getServices(java.util.Collection<? super T> dst,
                                                              java.lang.Class<T> cls,
                                                              Context ctx)
                                                   throws ServiceNotFoundException,
                                                          org.eclipse.core.runtime.CoreException
Convenience method to assemble all services for a particular interface

Parameters:
dst - the target collection
cls - the class object of the service
ctx - the COR context
Returns:
the collection
Throws:
ServiceNotFoundException
org.eclipse.core.runtime.CoreException
Since:
6.1.0.2

getServices

public static <T> java.util.Collection<? super T> getServices(java.util.Collection<? super T> dst,
                                                              java.net.URI uri,
                                                              java.lang.Class<T> cls,
                                                              Context ctx,
                                                              T defaultService)
                                                   throws ServiceNotFoundException,
                                                          org.eclipse.core.runtime.CoreException
Assembles all services that implement a particular interface

Parameters:
dst - target collection that will contain the result
uri - the URI, may be null
cls - the interface class
ctx - the COR context
defaultService - default service
Returns:
the original collection
Throws:
ServiceNotFoundException
org.eclipse.core.runtime.CoreException
Since:
6.1.0.2

lookupService

public static <T> T lookupService(java.net.URI uri,
                                  java.lang.Class<T> cls,
                                  Context ctx)
                       throws org.eclipse.core.runtime.CoreException,
                              ServiceNotFoundException
Parameters:
uri -
cls -
ctx -
Returns:
Throws:
org.eclipse.core.runtime.CoreException
ServiceNotFoundException

lookupService

public static <T> T lookupService(java.net.URI uri,
                                  java.lang.Class<T> cls,
                                  Context ctx,
                                  T defaultService)
                       throws org.eclipse.core.runtime.CoreException,
                              ServiceNotFoundException
Uses the COR to find a service that exposes a particular interface. The fully specified classname of the interface is interpreted as the ID of the service

Parameters:
uri -
cls -
ctx -
Returns:
Throws:
org.eclipse.core.runtime.CoreException - - some COR stuff failed
ServiceNotFoundException - - the service could not be located

serviceHandlerExists

public static <T> boolean serviceHandlerExists(java.net.URI uri,
                                               java.lang.Class<T> cls,
                                               Context ctx)
Checks if a service handler for the given service is registered, without throwing an exception

Parameters:
uri - the URI of the service, not null
cls - the classname of the service handler, not null
ctx - the COR context, not null
Returns:
true if the handler exists, else false
Since:
8.0