|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sapia.regis.RegistryContext
public class RegistryContext
An instance of this class internally uses a given RegistryFactory class
to instantiate a Registry; it expects the org.sapia.regis.factory
property to correspond to the name of the RegistryFactory implementation
to use.
Additionally, an instance of this class allows setting a property indicating one or multiple
Java property resources to load within this instance's given properties (which are passed at
instantiation time). That property is: org.sapia.regis.boostrap, and allows
setting a comma-delimited list of resources are to be exclusively loaded. Each resource is
interpreted as being either (whichever matches first):
Note that specified resource names can contain variables of the form ${var_name}. These
variables are resolved using the properties passed to the instance of this class at construction
time, or using system properties.
The properties in the resource that was found will be added to the ones passed to the instance of this class at contruction time, prior to the actual registry factory being instantiated.
This feature was introduced to allow connecting to different registries, depending on the environment.
For example, imagine that a registry.properties file is kept in the user home directory on developer
workstations. That file contains the properties necessary to connect to a LocalRegistry
(in order to avoid dealing with remote connections when developing). But let's say that when in other environments
(dev, QA, prod...), the registry.properties file to use is stored by convention in the classpath, under the
path regis/conf/registry.properties, and holds properties used to connect to a remote registry, shared by
distributed applications (see RemoteRegistry).
In order to load the appropriate registry.properties, we could set a property (in the Properties passed to the
constructor of this class) :
org.sapia.regis.bootstrap=${user.home}/regis/registry.properties, regis/conf/registry.properties
Then, upon its connect() method being called, the instance of this class resolves the boostrap properties (according
to the above-described algorithm), which add themselves to the properties that were passed in at construction time. Thus, the
boostrap properties are additive, and are used just as the others when instantiation registry factory.
RegistryFactory| Field Summary | |
|---|---|
static String |
BOOTSTRAP
This constant corresponds to the property that indicates which Java propertis (file, URL, classpath resource) to use to initialiase an instance of this class. |
static String |
FACTORY_CLASS
This constant corresponds to the property that indicates which RegistryFactory
to use to instantiate a Registry. |
| Constructor Summary | |
|---|---|
RegistryContext(Properties props)
|
|
| Method Summary | |
|---|---|
Registry |
connect()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String FACTORY_CLASS
RegistryFactory
to use to instantiate a Registry.
public static final String BOOTSTRAP
| Constructor Detail |
|---|
public RegistryContext(Properties props)
props - the Properties to used to connect to the desired
Registry.| Method Detail |
|---|
public Registry connect()
throws Exception
Registry.
Exception - if a problem occurs while attempting to connect.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||