|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.core.api.lifecycle.BaseLifecycle org.kuali.rice.ksb.impl.bus.ServiceBusImpl
public class ServiceBusImpl
Constructor Summary | |
---|---|
ServiceBusImpl()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
void |
destroy()
|
protected Set<RemoteService> |
filterByApplicationId(String applicationId,
Set<RemoteService> remoteServices)
|
List<Endpoint> |
getAllEndpoints()
Returns an unmodifiable list of all available and online endpoints of which the service bus is aware, including both local and remote endpoints. |
Endpoint |
getConfiguredEndpoint(ServiceConfiguration serviceConfiguration)
Returns the endpoint matching the given service configuration, if one exists. |
Endpoint |
getEndpoint(QName serviceName)
Returns an available endpoint for the service with the given name. |
Endpoint |
getEndpoint(QName serviceName,
String applicationId)
Returns an available endpoint for the service with the given name which is hosted by the application with the given application id. |
List<Endpoint> |
getEndpoints(QName serviceName)
Returns an unmodifiable list of accessible endpoints that are available to the service bus with the given service name. |
String |
getInstanceId()
Returns the instance ID which identifies this client application to the service bus. |
Endpoint |
getLocalEndpoint(QName serviceName)
Returns the endpoint for the service with the given name that was published by this service bus client. |
Map<QName,Endpoint> |
getLocalEndpoints()
Returns an unmodifiable list of all services that have been published by this service bus client. |
List<Endpoint> |
getRemoteEndpoints(QName serviceName)
Returns an unmodifiable list of remotely accessible endpoints that are available in the service registry with the given service name. |
Object |
getService(QName serviceName)
Returns a proxy to the service with the given name. |
Object |
getService(QName serviceName,
String applicationId)
Returns a proxy to the service with the given name which is hosted by the application with the given application id. |
protected boolean |
isDevMode()
|
protected void |
processLocalServiceDiff(LocalServicesDiff localServicesDiff)
|
protected void |
processRemoteServiceDiff(RemoteServicesDiff remoteServicesDiff)
|
ServiceConfiguration |
publishService(ServiceDefinition serviceDefinition,
boolean synchronize)
Publish a service with the given ServiceDefinition to the service bus. |
List<ServiceConfiguration> |
publishServices(List<ServiceDefinition> serviceDefinitions,
boolean synchronize)
Functions as per ServiceBus.publishService(ServiceDefinition, boolean) but allows for multiple
services to be published to the bus in a single operation. |
protected void |
rebuildLocalServiceEndpointAfterPublishing(ServiceEndpoint publishedService)
|
protected ServiceEndpoint |
rebuildServiceEndpointForUpdate(ServiceEndpoint originalEndpoint,
ServiceInfo registryServiceInfo)
|
boolean |
removeService(QName serviceName,
boolean synchronize)
Removes the service from the service bus and the service registry with the given service name. |
List<Boolean> |
removeServices(List<QName> serviceNames,
boolean synchronize)
Functions as per ServiceBus.removeService(QName, boolean) but allows for multiple services to
be removed from the bus in a single operation. |
void |
setDiffCalculator(ServiceRegistryDiffCalculator diffCalculator)
|
void |
setInstanceId(String instanceId)
|
void |
setScheduledPool(KSBScheduledPool scheduledPool)
|
void |
setServiceExportManager(ServiceExportManager serviceExportManager)
|
void |
setServiceRegistry(ServiceRegistry serviceRegistry)
|
void |
start()
|
protected void |
startSynchronizationThread()
|
protected void |
stopSynchronizationThread()
|
void |
synchronize()
Synchronizes the current client's service bus with the central service registry. |
Methods inherited from class org.kuali.rice.core.api.lifecycle.BaseLifecycle |
---|
isStarted, setStarted, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ServiceBusImpl()
Method Detail |
---|
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public void start() throws Exception
start
in interface Lifecycle
start
in class BaseLifecycle
Exception
protected boolean isDevMode()
protected void startSynchronizationThread()
public void destroy() throws Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
Exception
protected void stopSynchronizationThread()
public String getInstanceId()
ServiceBus
getInstanceId
in interface ServiceBus
public void setInstanceId(String instanceId)
public List<Endpoint> getEndpoints(QName serviceName)
ServiceBus
getEndpoints
in interface ServiceBus
public List<Endpoint> getRemoteEndpoints(QName serviceName)
ServiceBus
If the service bus client has also deployed a service with this name, a remoted endpoint to this service will likely also be included in this list assuming that endpoint has already been synchronized with the registry.
In most cases, it is preferable to use ServiceBus.getEndpoints(QName)
instead of this method.
Because it will preferably return a local endpoint reference for a given service endpoint if
one is available.
getRemoteEndpoints
in interface ServiceBus
public Endpoint getLocalEndpoint(QName serviceName)
ServiceBus
getLocalEndpoint
in interface ServiceBus
serviceName
- the name of the service represented by the local endpoint
public Map<QName,Endpoint> getLocalEndpoints()
ServiceBus
getLocalEndpoints
in interface ServiceBus
public List<Endpoint> getAllEndpoints()
ServiceBus
getAllEndpoints
in interface ServiceBus
public Endpoint getEndpoint(QName serviceName)
ServiceBus
Based on the nature of this method, if there is more than one endpoint available for the
given name, multiple invocations of this method with the same service name may return
different Endpoint
instances each time.
getEndpoint
in interface ServiceBus
serviceName
- the name of the service for which to locate an available endpoint
public Endpoint getEndpoint(QName serviceName, String applicationId)
ServiceBus
ServiceBus.getEndpoint(QName)
with the exception that it will only consider endpoints with the
given application id.
Invoking this method with a null or blank value for applicationId
is equivalent to
invoking ServiceBus.getEndpoint(QName)
.
getEndpoint
in interface ServiceBus
serviceName
- the name of the service for which to locate an available endpointapplicationId
- the id of the application for which to locate an available endpoint for
the given service name
protected Set<RemoteService> filterByApplicationId(String applicationId, Set<RemoteService> remoteServices)
public Endpoint getConfiguredEndpoint(ServiceConfiguration serviceConfiguration)
ServiceBus
getConfiguredEndpoint
in interface ServiceBus
serviceConfiguration
- the service configuration by which to lookup up the endpoint
public Object getService(QName serviceName)
ServiceBus
This proxy should additionally be thread-safe.
This method is equivalent to invoking #getEndpoint(QName).getService()
.
getService
in interface ServiceBus
serviceName
- the name of the service for which to locate an available proxy
public Object getService(QName serviceName, String applicationId)
ServiceBus
ServiceBus.getService(QName)
with the exception that it will only consider endpoints with the given application id.
Invoking this method with a null or blank value for applicationId
is equivalent to
invoking ServiceBus.getService(QName)
. This method is also equivalent to invoking
#getEndpoint(QName, String).getService()
.
getService
in interface ServiceBus
serviceName
- the name of the service for which to locate an available proxyapplicationId
- the id of the application for which to locate an available proxy for the
given service name
public ServiceConfiguration publishService(ServiceDefinition serviceDefinition, boolean synchronize)
ServiceBus
The method also provides the ability for the service bus to immediately synchronize with the
service registry after registering the service if synchronize
is set to true
.
publishService
in interface ServiceBus
serviceDefinition
- the definition of the service to publish, must not be nullsynchronize
- indicates whether or not this service bus client should immediately
synchronize it's changes with the registry after registering the service.
ServiceBus.synchronize()
public List<ServiceConfiguration> publishServices(List<ServiceDefinition> serviceDefinitions, boolean synchronize)
ServiceBus
ServiceBus.publishService(ServiceDefinition, boolean)
but allows for multiple
services to be published to the bus in a single operation. If the given list of service
definitions is empty then this method will do nothing (including skipping synchronization
with the registry if that was requested).
publishServices
in interface ServiceBus
serviceDefinitions
- the list of definition for the services to publish, must not be
nullsynchronize
- indicates whether or not this service bus client should immediately
synchronize it's changes with the registry after registering the services.
ServiceBus.publishService(ServiceDefinition, boolean)
,
ServiceBus.synchronize()
public boolean removeService(QName serviceName, boolean synchronize)
ServiceBus
This method also provides the ability for the service bus to immediately synchronize with the
service registry after removing the service if synchronize
is set to true
. If
the service is not located and successfully removed, however, the sychronization will not
run.
removeService
in interface ServiceBus
serviceName
- the name of the service to removesynchronize
- indicates whether or not this service bus client should immediately
synchronize after removing the service
ServiceBus.synchronize()
public List<Boolean> removeServices(List<QName> serviceNames, boolean synchronize)
ServiceBus
ServiceBus.removeService(QName, boolean)
but allows for multiple services to
be removed from the bus in a single operation. If the given list of service names is empty
then this method will do nothing (including skipping synchronization with the registry if
that was requested).
If the list returned from the method contains only false responses (meaning that no services were removed) this method will skip synchronization even if it is requested.
removeServices
in interface ServiceBus
serviceNames
- the list of names for the services to remove, must not be nullsynchronize
- indicates whether or not this service bus client should immediately
synchronize it's changes with the registry after removing the services.
ServiceBus.removeService(QName, boolean)
,
ServiceBus.synchronize()
public void synchronize()
ServiceBus
synchronize
in interface ServiceBus
protected void processRemoteServiceDiff(RemoteServicesDiff remoteServicesDiff)
protected void processLocalServiceDiff(LocalServicesDiff localServicesDiff)
protected ServiceEndpoint rebuildServiceEndpointForUpdate(ServiceEndpoint originalEndpoint, ServiceInfo registryServiceInfo)
protected void rebuildLocalServiceEndpointAfterPublishing(ServiceEndpoint publishedService)
public void setServiceRegistry(ServiceRegistry serviceRegistry)
public void setDiffCalculator(ServiceRegistryDiffCalculator diffCalculator)
public void setServiceExportManager(ServiceExportManager serviceExportManager)
public void setScheduledPool(KSBScheduledPool scheduledPool)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |