org.caleigo.service
Class ServiceProvider
java.lang.Object
org.caleigo.service.ServiceProvider
- public class ServiceProvider
- extends java.lang.Object
ServiceProvider is a singleton class that provides a single point of access
for IServices. Local services are added to the ServiceProvider by using the
addService
method. The addTunnel
method is used to
add connections to remote ServiceProviderServers that are used to connect to
remote services.
- Version:
- 1.00
- Author:
- Mattias Hagstrand
Method Summary |
void |
addService(IService service)
Adds a local service to this ServiceProvider. |
void |
addTunnel(ITunnel tunnel)
Adds a tunnel that can be used by this ServiceProvider to access remote
service providers. |
static ServiceProvider |
getInstance()
|
IService |
getService(java.lang.Class serviceInterfaceClass,
java.lang.Object serviceType,
java.lang.Object serviceIdentity)
Returns a service that is identified by the provided parameters, or
null if no service was found.
|
void |
removeService(IService service)
Removes a local service from this ServiceProvider. |
void |
removeTunnel(ITunnel tunnel)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
sInstance
protected static ServiceProvider sInstance
mServices
protected java.util.List mServices
mTunnels
protected java.util.List mTunnels
mProxyHandlers
protected java.util.Hashtable mProxyHandlers
ServiceProvider
protected ServiceProvider()
getInstance
public static ServiceProvider getInstance()
addService
public void addService(IService service)
- Adds a local service to this ServiceProvider.
removeService
public void removeService(IService service)
- Removes a local service from this ServiceProvider.
addTunnel
public void addTunnel(ITunnel tunnel)
- Adds a tunnel that can be used by this ServiceProvider to access remote
service providers.
removeTunnel
public void removeTunnel(ITunnel tunnel)
getService
public IService getService(java.lang.Class serviceInterfaceClass,
java.lang.Object serviceType,
java.lang.Object serviceIdentity)
- Returns a service that is identified by the provided parameters, or
null
if no service was found.
First the ServiceProvider tries to find a local service. If that fails
it tries to locate a remote service by sending out a request for the service
on the tunnels. The request is sent to the tunnels in the order that they
were added.
- Parameters:
serviceInterfaceClass
- the interface class of the serviceserviceType
- the type of the service.serviceIdentity
- the identity of the service.
- Returns:
- the requested service if found, otherwise
null
.
Copyright © 2005 Caleigo. All Rights Reserved.