2016/05/28 - Apache Tuscany has been retired.

For more information, please explore the Attic.



org.apache.tuscany.sca.extensibility
Class ServiceDiscovery

java.lang.Object
  extended by org.apache.tuscany.sca.extensibility.ServiceDiscovery

public class ServiceDiscovery
extends java.lang.Object

Service discovery for Tuscany based on J2SE Jar service provider spec. Services are described using configuration files in META-INF/services. Service description specifies a class name followed by optional properties.


Constructor Summary
ServiceDiscovery()
           
 
Method Summary
static ServiceDiscovery getInstance()
          Get an instance of Service discovery, one instance is created per ClassLoader that this class is loaded from
 java.util.Set<ServiceDeclaration> getServiceDeclarations(java.lang.Class<?> serviceInterface)
          Get all service declarations for this interface
 java.util.Set<ServiceDeclaration> getServiceDeclarations(java.lang.String name)
          Get all service declarations for this name
 ServiceDiscoverer getServiceDiscoverer()
           
 java.lang.Class<?> loadFirstServiceClass(java.lang.Class<?> serviceInterface)
          Load one service implementation class for this interface
 java.lang.Object newFactoryClassInstance(java.lang.Class<?> serviceInterface)
          Create a new instance of a factory service class.
 void registerClassLoader(java.lang.ClassLoader classLoader)
          Deprecated. Register a ClassLoader with this discovery mechanism. Tuscany extension ClassLoaders are registered here.
 void setServiceDiscoverer(ServiceDiscoverer sd)
           
 void unregisterClassLoader(java.lang.ClassLoader classLoader)
          Deprecated. Unregister a ClassLoader with this discovery mechanism.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceDiscovery

public ServiceDiscovery()
Method Detail

getInstance

public static ServiceDiscovery getInstance()
Get an instance of Service discovery, one instance is created per ClassLoader that this class is loaded from

Returns:

getServiceDiscoverer

public ServiceDiscoverer getServiceDiscoverer()

setServiceDiscoverer

public void setServiceDiscoverer(ServiceDiscoverer sd)

registerClassLoader

@Deprecated
public void registerClassLoader(java.lang.ClassLoader classLoader)
Deprecated. Register a ClassLoader with this discovery mechanism. Tuscany extension ClassLoaders are registered here.

Parameters:
classLoader -

unregisterClassLoader

@Deprecated
public void unregisterClassLoader(java.lang.ClassLoader classLoader)
Deprecated. Unregister a ClassLoader with this discovery mechanism.

Parameters:
classLoader -

getServiceDeclarations

public java.util.Set<ServiceDeclaration> getServiceDeclarations(java.lang.String name)
                                                         throws java.io.IOException
Get all service declarations for this name

Parameters:
name -
Returns:
set of service declarations
Throws:
java.io.IOException

getServiceDeclarations

public java.util.Set<ServiceDeclaration> getServiceDeclarations(java.lang.Class<?> serviceInterface)
                                                         throws java.io.IOException
Get all service declarations for this interface

Parameters:
serviceInterface -
Returns:
set of service declarations
Throws:
java.io.IOException

loadFirstServiceClass

public java.lang.Class<?> loadFirstServiceClass(java.lang.Class<?> serviceInterface)
                                         throws java.io.IOException,
                                                java.lang.ClassNotFoundException
Load one service implementation class for this interface

Parameters:
serviceInterface -
Returns:
service implementation class
Throws:
java.io.IOException
java.lang.ClassNotFoundException

newFactoryClassInstance

public java.lang.Object newFactoryClassInstance(java.lang.Class<?> serviceInterface)
                                         throws java.lang.SecurityException,
                                                java.lang.NoSuchMethodException,
                                                java.lang.reflect.InvocationTargetException,
                                                java.lang.IllegalAccessException
Create a new instance of a factory service class.

Parameters:
serviceInterface -
Returns:
service implementation class
Throws:
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException