|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectelectric.registry.Registry
Registry is a class that exposes static methods for publishing, binding and invoking services. It manages a collection of underlying IRegistries, and iterates through each registry to satisfy a particular operation. Registry is created with a single default IRegistry whose name is "root" and type is DirectoryRegistry. When an object that does not implement IService is published, it is automatically wrapped in a service whose default class is "electric.service.object.ObjectService".
Constructor Summary | |
Registry()
|
Method Summary | |
static IRegistryListener |
addListener(java.lang.String name,
IRegistryListener listener)
Add the specified listener to the collection of listeners. |
static void |
addRegistry(java.lang.String name,
IRegistry registry)
Add the specified registry to the collection of registries with the default priority of 5. |
static void |
addRegistry(java.lang.String name,
IRegistry registry,
float priority)
Add the specified registry to the collection of registries. |
static java.lang.Object |
bind(java.lang.Class type)
Return a proxy to a service that implements the specified interface. |
static java.lang.Object |
bind(java.lang.Class[] types)
Return a proxy to a service that implements the specified interfaces. |
static java.lang.Object |
bind(java.lang.Class[] types,
Context context)
Return a proxy to a service that implements the specified interfaces. |
static java.lang.Object |
bind(java.lang.Class type,
Context context)
Return a proxy to a service that implements the specified interface. |
static IProxy |
bind(java.lang.String path)
Return an IProxy to the service with the specified path. |
static java.lang.Object |
bind(java.lang.String path,
java.lang.Class type)
Return a proxy to the service at the specified path. |
static java.lang.Object |
bind(java.lang.String path,
java.lang.Class[] types)
Return a proxy to the service at the specified path. |
static java.lang.Object |
bind(java.lang.String path,
java.lang.Class[] types,
Context context)
Return a proxy to the service at the specified path. |
static java.lang.Object |
bind(java.lang.String path,
java.lang.Class type,
Context context)
Return a proxy to the service at the specified path. |
static IProxy |
bind(java.lang.String path,
Context context)
Return an IProxy to the service with the specified path. |
static java.lang.Object |
get(java.lang.String path)
Return the object with the specified path in the root registry, or null if not found. |
static java.lang.String[] |
getAllPaths(java.lang.Object object)
|
static CompoundRegistry |
getCompoundRegistry()
Return my underlying compound registry. |
static IDirectory |
getDirectory(java.lang.String path)
Return the subdirectory of the root registry with the specified path. |
static IRegistryListener |
getListener(java.lang.String name)
Return the specified listener from the collection of listeners, or null if not found. |
static java.lang.String |
getPath(IServer server,
java.lang.Object object)
|
static java.lang.String |
getPath(java.lang.Object object)
|
static java.lang.String |
getPath(java.lang.String name,
java.lang.Object object)
Return the path of the specified object relative to a named server or directory. |
static IReference |
getReference(java.lang.String path,
java.lang.Class[] interfaces,
Context context)
Return an IReference to the service at the specified path. |
static IReference |
getReference(java.lang.String path,
java.lang.Class type,
Context context)
Return an IReference to the service at the specified path. |
static IRegistry |
getRegistry(java.lang.String name)
Return the specified registry from the collection of registries, or null if not found. |
static java.lang.String |
getRegistryPath(java.lang.Object object)
|
static java.lang.String[] |
getRegistryPaths(java.lang.Object object)
Return the path to the object in the registry. |
static IService |
getService(java.lang.String path)
Return the service with the specified path in the root registry, or null if not found. |
static IServiceFactory |
getServiceFactory()
Return the service factory. |
static java.lang.Object |
newProxy(Proxy proxy,
java.lang.Class[] types)
Return a dynamic proxy that implements the specified interfaces. |
static void |
publish(java.lang.String path,
java.lang.Object object)
Publish the object to the specified path. |
static void |
publish(java.lang.String path,
java.lang.Object object,
java.lang.Class type)
Publish the object to the specified path. |
static void |
publish(java.lang.String path,
java.lang.Object object,
java.lang.Class[] types)
Publish the object to the specified path. |
static void |
publish(java.lang.String path,
java.lang.Object object,
java.lang.Class[] types,
Context context)
Publish the object to the specified path. |
static void |
publish(java.lang.String path,
java.lang.Object object,
java.lang.Class type,
Context context)
Publish the object to the specified path. |
static void |
publish(java.lang.String path,
java.lang.Object object,
Context context)
Publish the object to the specified path. |
static IRegistryListener |
removeListener(java.lang.String name)
Remove and return the specified listener from the collection of listeners, or do nothing if not found. |
static IRegistry |
removeRegistry(java.lang.String name)
Remove and return the specified registry from the collection of registries, or do nothing if not found. |
static void |
setDirectory(java.lang.String path,
IDirectory directory)
Set a subdirectory of the root registry to the specified directory. |
static void |
setServiceFactory(IServiceFactory serviceFactory)
Set the service factory. |
static void |
startup()
Called by the platform startup. |
static void |
unpublish(java.lang.String path)
Unpublish the object from the specified path. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Registry()
Method Detail |
public static void startup()
public static void setDirectory(java.lang.String path, IDirectory directory) throws DirectoryException
path
- The path within the root registry.directory
- The directory.
DirectoryException
- If the root registry throws an exception.public static IDirectory getDirectory(java.lang.String path) throws DirectoryException
path
- The path within the root registry.
DirectoryException
- If the root registry throws an exception.public static void addRegistry(java.lang.String name, IRegistry registry)
name
- The name of the registry.registry
- The registry to add.public static void addRegistry(java.lang.String name, IRegistry registry, float priority)
name
- The name of the registry.registry
- The registry to add.priority
- The priority, 1=highest, tried firstpublic static IRegistry getRegistry(java.lang.String name)
name
- The name of the registry.public static IRegistry removeRegistry(java.lang.String name)
name
- The name of the registry.public static CompoundRegistry getCompoundRegistry()
public static java.lang.Object bind(java.lang.String path, java.lang.Class type) throws RegistryException
path
- The path of the service.type
- The interface that the proxy should implement.
RegistryException
- If any of the registries throws an exception.public static java.lang.Object bind(java.lang.String path, java.lang.Class[] types) throws RegistryException
path
- The path of the service.types
- The interfaces that the proxy should implement.
RegistryException
- If any of the registries throws an exception.public static java.lang.Object bind(java.lang.String path, java.lang.Class type, Context context) throws RegistryException
path
- The path of the service.type
- The interface that the proxy should implement.context
- The context.
RegistryException
- If any of the registries throws an exception.public static java.lang.Object bind(java.lang.String path, java.lang.Class[] types, Context context) throws RegistryException
path
- The path of the service.types
- The interfaces that the proxy should implement.context
- The context.
RegistryException
- If any of the registries throws an exception.public static java.lang.Object bind(java.lang.Class type) throws RegistryException
type
- The interface that the proxy should implement.
RegistryException
- If any of the registries throws an exception.public static java.lang.Object bind(java.lang.Class type, Context context) throws RegistryException
type
- The interface that the proxy should implement.context
- The context.
RegistryException
- If any of the registries throws an exception.public static java.lang.Object bind(java.lang.Class[] types) throws RegistryException
types
- The interfaces that the proxy should implement.
RegistryException
- If any of the registries throws an exception.public static java.lang.Object bind(java.lang.Class[] types, Context context) throws RegistryException
types
- The interfaces that the proxy should implement.context
- The context.
RegistryException
- If any of the registries throws an exception.public static IProxy bind(java.lang.String path) throws RegistryException
path
- The path of the service.
RegistryException
- If any of the registries throws an exception.public static IProxy bind(java.lang.String path, Context context) throws RegistryException
path
- The path of the service.context
- The context.
RegistryException
- If any of the registries throws an exception.public static IReference getReference(java.lang.String path, java.lang.Class type, Context context) throws RegistryException
path
- The path of the service.type
- The interface.context
- The context.
RegistryException
- If any of the registries throws an exception.public static IReference getReference(java.lang.String path, java.lang.Class[] interfaces, Context context) throws RegistryException
path
- The path of the service.interfaces
- The interfaces.context
- The context.
RegistryException
- If any of the registries throws an exception.public static java.lang.Object newProxy(Proxy proxy, java.lang.Class[] types)
proxy
- The underlying proxy.types
- The interfaces to implement.public static void publish(java.lang.String path, java.lang.Object object) throws RegistryException
path
- The path.object
- The object.
RegistryException
- If any of the registries throws an exception.public static void publish(java.lang.String path, java.lang.Object object, Context context) throws RegistryException
path
- The path.object
- The object.context
- The context.
RegistryException
- If any of the registries throws an exception.public static void publish(java.lang.String path, java.lang.Object object, java.lang.Class type) throws RegistryException
path
- The path.object
- The object.type
- The interface to expose.
RegistryException
- If any of the registries throws an exception.public static void publish(java.lang.String path, java.lang.Object object, java.lang.Class type, Context context) throws RegistryException
path
- The path.object
- The object.type
- The interface to expose.context
- The context.
RegistryException
- If any of the registries throws an exception.public static void publish(java.lang.String path, java.lang.Object object, java.lang.Class[] types) throws RegistryException
path
- The path.object
- The object.types
- The interfaces to expose.
RegistryException
- If any of the registries throws an exception.public static void publish(java.lang.String path, java.lang.Object object, java.lang.Class[] types, Context context) throws RegistryException
path
- The path.object
- The object.types
- The interfaces to expose.context
- The context.
RegistryException
- If any of the registries throws an exception.public static void unpublish(java.lang.String path) throws RegistryException
path
- The path.
RegistryException
- If any of the registries throws an exception or if
an object was not found.public static IServiceFactory getServiceFactory()
public static void setServiceFactory(IServiceFactory serviceFactory)
serviceFactory
- The new value.public static java.lang.Object get(java.lang.String path) throws RegistryException
path
- The path.
RegistryException
- If the root registry threw an exception.public static IService getService(java.lang.String path) throws RegistryException
path
- The path.
RegistryException
- If the root registry threw an exception.public static IRegistryListener addListener(java.lang.String name, IRegistryListener listener)
name
- The name of the listener.listener
- The listener to add.public static IRegistryListener getListener(java.lang.String name)
name
- The name of the listener.public static IRegistryListener removeListener(java.lang.String name)
name
- The name of the listener.public static java.lang.String getPath(java.lang.String name, java.lang.Object object)
name
- The name of a server or path within the root registry.object
- The object.public static java.lang.String getPath(IServer server, java.lang.Object object)
server
- object
- public static java.lang.String getPath(java.lang.Object object)
object
- public static java.lang.String[] getAllPaths(java.lang.Object object)
object
- public static java.lang.String getRegistryPath(java.lang.Object object) throws RegistryException
object
-
RegistryException
public static java.lang.String[] getRegistryPaths(java.lang.Object object) throws RegistryException
object
- The object that was published into the registry.
RegistryException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |