|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
The service registry can be used by services to search for other services and in also
to start or stop them. All services can be fetched from the the Norna Namespace, as well
as from this class but all action requiring a unique identifier for the service such as start
or stop must use the service Namespace ID.
The registry is available on all implementations on the fixed namespace ID: "/norna/registry". This if is guarantied never to return null by the framework and the path "/nonra" is reserved. The registry namespace ID is also a static identifier on this interface.
The relationship between service context URLs and services IDs is not necessarry one to
one since the framework cannot guarrantee that no two services does not specify the same
public ID. So the getByPublicID method return an iteration if service
Namepsace IDs but getByURL return the service handle of a unique service.
URLs passed to methods of the registry behaves as if the registry is a Context
located at the root of the Norna Namespace. so that a call to getByURL
with the following values are all guarranteed to return the same service given that the framework
is rooted at 'localhost':
services/calculator/
/services/calculator/
norna://localhost/services/calculator/
The registry is also responsible for notifying any listeners of additions and changes to the Norna context in regards to the services themselves. A registry is allowed to transmit any changes made to the Norna namespace but is not required to do so.
Searches on the registry uses regular expression matching on the following service properties:
SoftwareInfo.ServicePermission to guard access to the services
and the controller methods within the registry.
Methods returning iterators of services will not return services the caller do not have access to. This means that the registry must check access permission before returning any values from such methods.
All methods on the service registry is guarrantied to be thread safe.
Context Namespace| Field Summary | |
static java.lang.String |
NAMESPACE_ID
The fixed registry namespace ID, "/norna/registry" |
| Method Summary | |
void |
addRegistryListener(java.util.Properties filter,
RegistryListener listener)
Add a service listener to the registry. |
void |
addRegistryListener(RegistryListener listener)
Add a service listener to the registry. |
java.util.Iterator |
getByPublicID(java.lang.String publicID)
Get an iterator of service context URLs by an public ID. |
ServiceHandle |
getByURL(java.lang.String url)
Get a service handle by context URL. |
Environment |
getEnvironment()
Get the envoronment of the service. |
SoftwareInfo |
getSoftwareInfo(java.lang.String url)
Get service software info. |
java.util.Iterator |
list()
List all available services. |
void |
removeRegistryListener(RegistryListener listener)
Remove a registry listener. |
java.util.Iterator |
search(java.util.Properties attributes)
Seach for a service. |
void |
start(java.lang.String url)
Start a service. |
void |
stop(java.lang.String url)
Stop a service. |
| Field Detail |
public static final java.lang.String NAMESPACE_ID
| Method Detail |
public Environment getEnvironment()
public java.util.Iterator getByPublicID(java.lang.String publicID)
publicID - Service id as returned by getPublicID
public ServiceHandle getByURL(java.lang.String url)
This method return null if the service is not found or the service is not ready.
url - Service context URL
ServiceHandle to the a service, or null if not found or not ready
public java.util.Iterator search(java.util.Properties attributes)
throws java.util.regex.PatternSyntaxException
SoftwareInfo
and it's URL using properties mapping an attrinute to a regular expression. The searchable property and their
corresponding values are:
"url" - Service context URL
"puid" - Service public ID
"name" - Service name
"originator" - Service vendor
"release" - Service release tag
"version" - Service software version
attributes - Search attributes matching property names to regular expressions
java.util.regex.PatternSyntaxException - If any regexp patter is invalidpublic java.util.Iterator list()
public SoftwareInfo getSoftwareInfo(java.lang.String url)
url - Service context URL as a string
SoftwareInfo object for the service, or null if not found
public void start(java.lang.String url)
throws NoSuchServiceException
ServicePermission
object with a "start" action.
url - Service context URL as a string
NoSuchServiceException - If no service with the nuid is found
public void stop(java.lang.String url)
throws NoSuchServiceException
ServicePermission
object with a "stop" action.
url - Service context URL as a string
NoSuchServiceException - If no service with the nuid is foundpublic void addRegistryListener(RegistryListener listener)
listener - Register listener
public void addRegistryListener(java.util.Properties filter,
RegistryListener listener)
The property object maps properties to reguslar expressions that are used to
filter events. Only if all properties and their regular expression match a service
will the event go through. The filter properties are the same as those in
search.
filter - Event filter propertieslistener - Register listenerpublic void removeRegistryListener(RegistryListener listener)
listener - Listener to remove
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||