|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ServiceRegistry
Defines the interface for a remotely accessible service registry. Applications can query for information about available services through the apis provided as well as publishing their own services.
The ServiceRegistry
deals primarily with the concept of a
ServiceEndpoint
which holds a ServiceInfo
and a ServiceDescriptor
. These pieces include information about the
service and it's configuration which might be needed by applications wishing to
invoke those services.
Many of the operations on the ServiceRegistry
only return the
ServiceInfo
. This is because retrieving the full ServiceDescriptor
is a more expensive operation (since it consists of a serialized XML
representation of the service's configuration which needs to be unmarshaled
and processed) and typically the descriptor is only needed when the client
application actually wants to connect to the service.
The ServiceInfo
provides two important pieces of information which
help the registry (and the applications which interact with it) understand
who the owner of a service is. The first of these is the "application id"
which identifies the application which owns the service. In terms of
Kuali Rice, an "application" is an abstract concept and consist of multiple
instances of an application which are essentially mirrors of each other and
publish the same set of services. Each of these individuals instances of
an application is identified by the "instance id" which is also available
from the ServiceInfo
.
ServiceEndpoint
,
ServiceInfo
,
ServiceDescriptor
Method Summary | |
---|---|
List<ServiceInfo> |
getAllOnlineServices()
Returns an unmodifiable list of ServiceInfo for all services in
the registry that have a status of ServiceEndpointStatus.ONLINE . |
List<ServiceInfo> |
getAllServices()
Returns an unmodifiable list of ServiceInfo for all services in
the registry. |
List<ServiceInfo> |
getAllServicesForApplication(String applicationId)
Returns an unmodifiable list of ServiceInfo for all services that
have an application id which matches the given application id, regardless of
their status. |
List<ServiceInfo> |
getAllServicesForInstance(String instanceId)
Returns an unmodifiable list of ServiceInfo for all services that
have an instance id which matches the given instance id, regardless of
their status. |
List<ServiceInfo> |
getOnlineServicesByName(QName serviceName)
Returns an unmodifiable list of ServiceInfo for all services that have a status
of ServiceEndpointStatus.ONLINE with the given name. |
ServiceDescriptor |
getServiceDescriptor(String serviceDescriptorId)
Returns the ServiceDescriptor which has the given id. |
List<ServiceDescriptor> |
getServiceDescriptors(List<String> serviceDescriptorIds)
Returns an unmodifiable list of ServiceDescriptor which match the
given list of service descriptor ids. |
ServiceEndpoint |
publishService(ServiceEndpoint serviceEndpoint)
Publishes the given ServiceEndpoint to the registry. |
List<ServiceEndpoint> |
publishServices(List<ServiceEndpoint> serviceEndpoints)
Publishes the list of ServiceEndpoint s to the registry. |
RemoveAndPublishResult |
removeAndPublish(List<String> removeServiceIds,
List<ServiceEndpoint> publishServiceEndpoints)
Performs a single atomic operation of removing and publishing a set of services in the registry. |
ServiceEndpoint |
removeServiceEndpoint(String serviceId)
Removes the service from the registry with the given service id if it exists. |
List<ServiceEndpoint> |
removeServiceEndpoints(List<String> serviceIds)
As removeServiceEndpoint(String) but removes all services that
match the given list of service ids. |
void |
takeInstanceOffline(String instanceId)
Flips the status of all services that match the given instance id to the status of {@link ServiceEndpointStatus#OFFLINE. |
boolean |
updateStatus(String serviceId,
ServiceEndpointStatus status)
Updates the status for the service with the given id to the given ServiceEndpointStatus . |
List<String> |
updateStatuses(List<String> serviceIds,
ServiceEndpointStatus status)
As per updateStatus(String, ServiceEndpointStatus) but updates
mutliple statuses as part of a single operation. |
Method Detail |
---|
List<ServiceInfo> getOnlineServicesByName(QName serviceName) throws RiceIllegalArgumentException
ServiceInfo
for all services that have a status
of ServiceEndpointStatus.ONLINE
with the given name. If there
are no services with the given name, this method should return an empty
list.
It is typical in clustered environments and other situations that more than one online service might be available for a given service name. It is intended that a client of the registry will use an available endpoint of their choosing to connect to and invoke the service.
serviceName
- the name of the service to locate
ServiceInfo
for online services with the given name.
If no services were found, an empty list will be returned, but this method should never
return null.
RiceIllegalArgumentException
- if serviceName is nullList<ServiceInfo> getAllOnlineServices()
ServiceInfo
for all services in
the registry that have a status of ServiceEndpointStatus.ONLINE
.
If there are no online services in the registry, this method will return
an empty list.
ServiceInfo
for all online services
in the registry. If no services were found, an empty list will be
returned, but this method should never return null.List<ServiceInfo> getAllServices()
ServiceInfo
for all services in
the registry. If there are no services in the registry, this method will
return an empty list.
ServiceInfo
for all services in the
registry. If no services were found, an empty list will be returned, but
this method should never return null.List<ServiceInfo> getAllServicesForInstance(String instanceId) throws RiceIllegalArgumentException
ServiceInfo
for all services that
have an instance id which matches the given instance id, regardless of
their status. If there are no services published for the given instance,
this method should return an empty list.
instanceId
- the instance id of the services to locate
ServiceInfo
for all services in the
registry for the given instance id
RiceIllegalArgumentException
- if instanceId is a null or blank valueList<ServiceInfo> getAllServicesForApplication(String applicationId) throws RiceIllegalArgumentException
ServiceInfo
for all services that
have an application id which matches the given application id, regardless of
their status. If there are no services published for the given application,
this method should return an empty list.
applicationId
- the application id of the services to locate
ServiceInfo
for all services in the
registry for the given application id
RiceIllegalArgumentException
- if applicationId is a null or blank valueServiceDescriptor getServiceDescriptor(String serviceDescriptorId) throws RiceIllegalArgumentException
ServiceDescriptor
which has the given id. If there
is no descriptor for the id, this method will return null.
serviceDescriptorId
-
RiceIllegalArgumentException
List<ServiceDescriptor> getServiceDescriptors(List<String> serviceDescriptorIds) throws RiceIllegalArgumentException
ServiceDescriptor
which match the
given list of service descriptor ids. The list that is returned from this
method may be smaller than the list of ids that were supplied. This
happens in cases where a service descriptor for a given id in the list
could not be found.
serviceDescriptorIds
- the list of service descriptor ids for which to
locate the corresponding service descriptor
RiceIllegalArgumentException
- if serviceDescriptorIds is nullServiceEndpoint publishService(ServiceEndpoint serviceEndpoint) throws RiceIllegalArgumentException
ServiceEndpoint
to the registry. If there
is no service id on the ServiceInfo
then this constitutes a new
registry endpoint, so it will be added to the registry. If the given
endpoint already has a ServiceInfo
with a service id, then the
corresponding entry in the registry will be updated instead.
serviceEndpoint
- the service endpoint to publish
RiceIllegalArgumentException
- if serviceEndpoint is nullList<ServiceEndpoint> publishServices(List<ServiceEndpoint> serviceEndpoints) throws RiceIllegalArgumentException
ServiceEndpoint
s to the registry. This
functions the same way as executing publishService(ServiceEndpoint)
on each individual ServiceEndpoint
. However, it performs this as
an atomic operation, so if there is an error when publishing one service
endpoint in the list, then none of the endpoints will be published.
serviceEndpoints
- the list of service endpoints to publish
publishService(ServiceEndpoint)
for details). This list will always be the same size and in the same
order as the list of service endpoints that were supplied for publshing.
RiceIllegalArgumentException
- if serviceEndpoints is null or if any
ServiceEndpoint
within the list is nullServiceEndpoint removeServiceEndpoint(String serviceId) throws RiceIllegalArgumentException
ServiceEndpoint
entry will be
returned. Otherwise, this method will return null.
serviceId
- the id of the service to remove
ServiceEndpoint
if a service with the given
id exists in the registry, if no such service exists, this method will
return null
RiceIllegalArgumentException
- if serviceId is null or a blank valueList<ServiceEndpoint> removeServiceEndpoints(List<String> serviceIds) throws RiceIllegalArgumentException
removeServiceEndpoint(String)
but removes all services that
match the given list of service ids. It could be the case that some of
the given ids do not match a service in the registry, in this case that
ServiceEndpoint
would not be included in the resulting list of
services that were removed. Because of this, the list that is returned
from this method may be smaller then the list of ids that were supplied.
serviceIds
- the list of service ids to remove from the registry
RiceIllegalArgumentException
- if serviceIds is null or if one of
the ids in the list is null or blankRemoveAndPublishResult removeAndPublish(List<String> removeServiceIds, List<ServiceEndpoint> publishServiceEndpoints)
Behaviorally, this operation is equivalent to performing a
removeServiceEndpoints(List)
followed by a
publishServices(List)
, except that a null list is valid for
either removeServiceIds
or publishServiceEndpoints
. In
the case that a null or empty list is passed for either of these, that
particular portion of the operation will not be performed.
This method returns a RemoveAndPublishResult
which contains
a list of the services that were successfully removed as well as those
that were published.
removeServiceIds
- the list of ids of the services to remove, if
this parameter is null or an empty list, then no remove operation will
be executedpublishServiceEndpoints
- the list of service endpoints to publish,
if this parameter is null or an empty list, then no publish operation
will be executed
boolean updateStatus(String serviceId, ServiceEndpointStatus status) throws RiceIllegalArgumentException
ServiceEndpointStatus
.
serviceId
- the id of the service for which to update the statusstatus
- the status to update this service to
RiceIllegalArgumentException
- if serviceId is null or a blank value
RiceIllegalArgumentException
- if status is nullList<String> updateStatuses(List<String> serviceIds, ServiceEndpointStatus status) throws RiceIllegalArgumentException
updateStatus(String, ServiceEndpointStatus)
but updates
mutliple statuses as part of a single operation.
This method returns a List of ids of the services that were updated. If a given service id does not exist in the registry, that id won't be included in the result. So the resuling list of updated ids may be smaller than the given list of service ids (though it will never be null).
serviceIds
- the list of ids of the services for which to update the statusstatus
- the status to update the services to
RiceIllegalArgumentException
- if serviceIds is null or if any of
the entries in the list is null or has a blank value
RiceIllegalArgumentException
- if status is nullvoid takeInstanceOffline(String instanceId) throws RiceIllegalArgumentException
instanceId
- the id of the instance for which to set all services to
the offline status
RiceIllegalArgumentException
- if instanceId is null or a blank value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |