|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.infoengine.au.NamingService
This class provides a registry that associates Info*Engine services with their network addresses and/or implementation classes. It obtains information from static property files and/or network resources accessed via HTTP or LDAP. Standalone applications should use one of its static factory methods at startup time to initialize the registry.
Field Summary | |
private int |
cacheTTL
|
private static String |
DEFAULT_NS_NAME
|
private static String |
DEFAULT_SOCKET_FACTORY
|
private String |
directoryProvider
|
private static IEProperties |
ieProperties
|
private String |
localHost
|
private static Hashtable |
localServices
|
private String |
namingServiceName
|
private static String |
NS_NS
|
private String |
propertySource
|
private static String |
RESOURCE
|
private ObjectServiceCache |
serviceCache
|
private Vector |
serviceDNs
|
private String |
serviceDomainBase
|
private String |
serviceName
|
private String |
serviceSearchBase
|
private Hashtable |
socketFactories
|
private static String |
VMNAME
|
Constructor Summary | |
protected |
NamingService()
Protected constructor. |
Method Summary | |
private static NamingService |
_getInstance()
|
private static NamingService |
_getInstance(boolean create)
|
private static void |
_registered()
|
static void |
addService(String serviceName,
ObjectDestination dest)
Adds an entry to the service registry. |
private static Socket |
createSocket(String serviceName,
String host,
int port)
|
static Enumeration |
getAllAddresses(String serviceName)
Return all of the registry entries associated with a named service. |
static Socket |
getConnection(String serviceName)
Returns a socket connected to a named service. |
static String |
getDirectoryProvider()
Returns the URI of the directory service provider currently being used by the naming service. |
static String |
getDomainBase()
Returns the directory service domain base currently being used by the naming service. |
static IEProperties |
getIEProperties()
Obtain, and create if necessary, the IEProperties object used by this JVM. |
static NamingService |
getInstance()
Return the naming service instance most recently created by one of the static factory methods. |
private static String |
getLocalHost()
|
static String |
getLocalServiceDN(String serviceName)
Returns the distinguished name of the directory entry registered for a local service. |
Properties |
getProperties()
Returns the properties object currently being used by the NamingService instance. |
static String |
getPropertySource()
Returns the URI specifying the source of the configuration properties currently being used by the naming service. |
static String |
getSearchBase()
Returns the directory service search base currently being used by the naming service. |
static ObjectDestination |
getService(String serviceName)
Return one of the registry entries associated with a named service. |
private static void |
getServiceDNs()
Finds the distinguished names of all directory entries that match the name of this virtual machine. |
static Enumeration |
getServicePropertyNames(String serviceName)
Returns an enumeration of the service-specific property names defined for a specific service. |
static String |
getVMName()
Returns the name currently set for this virtual machine. |
protected void |
initialize(String propPrefix)
Initializes the naming service instance. |
static boolean |
isLocalService(String dn)
Determines whether a specific directory distinguished name references a service registered in this virtual machine. |
static void |
main(String[] args)
When initiated via command line, the naming service operates as a utility that can initiate other programs defined by naming service launch properties. |
static NamingService |
newInstance()
Return a naming service instance with an uninitialized registry. |
static NamingService |
newInstance(String resource)
Return a naming service instance providing access to a registry that is initialized from a static properties file and/or a network resource obtained using HTTP or LDAP. |
static NamingService |
newInstance(String serviceName,
Properties props)
Deprecated. |
static NamingService |
newInstance(String serviceName,
String resource)
Return a naming service instance providing access to a registry that is initialized from a static properties file and/or a network resource obtained using HTTP or LDAP. |
static NamingService |
newInstance(String serviceName,
String resource,
String[] args)
Return a naming service instance providing access to a registry that is initialized from a static properties file and/or a network resource obtained using HTTP or LDAP. |
void |
refreshProperties()
|
static void |
registerLocalService(String serviceName,
String dn)
Registers a service name and the distinguished name of its directory entry as a local service. |
void |
reinitialize()
|
static void |
setGlobalProperties()
Sets global properties for the VM based upon the VM name. |
static void |
setGlobalProperties(String propPrefix)
Deprecated. |
private static void |
setProperties(String[] args,
String resource)
Updates the System Properties object by adding properties defined in a String array plus properties defined in a specified resource. |
static void |
setVMName(String name)
Set the name of this virtual machine. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final String DEFAULT_SOCKET_FACTORY
private static final String DEFAULT_NS_NAME
private static final String NS_NS
private static final String RESOURCE
private static final String VMNAME
private int cacheTTL
private String directoryProvider
private String localHost
private String namingServiceName
private String propertySource
private ObjectServiceCache serviceCache
private Vector serviceDNs
private String serviceDomainBase
private String serviceSearchBase
private Hashtable socketFactories
private String serviceName
private static IEProperties ieProperties
private static Hashtable localServices
Constructor Detail |
protected NamingService()
Method Detail |
private static void _registered()
private static NamingService _getInstance()
private static NamingService _getInstance(boolean create)
public static NamingService newInstance()
public static NamingService newInstance(String resource) throws IOException, FileNotFoundException, MalformedURLException, NamingServiceException
resource
- A file pathname or file URL referencing a property
file in the local file system, or an HTTP or LDAP URL
referencing a network resource containing property
definitions.
IOException
- if an I/O error prevents properties from
being accessed or read.
FileNotFoundException
- if a specified property file or
network resource does not exist.
MalformedURLException
- if an HTTP or LDAP URL has incorrect
syntax.
NamingServiceException
- if no service-specific properties
are defined.public static NamingService newInstance(String serviceName, String resource) throws IOException, FileNotFoundException, MalformedURLException, NamingServiceException
serviceName
- The name of the naming service itself. This name
is used as the prefix of property names defined
in a property file or network property resource.resource
- A file pathname or file URL referencing a property
file in the local file system, or an HTTP or LDAP URL
referencing a network resource containing property
definitions.
IOException
- if an I/O error prevents properties from
being accessed or read.
FileNotFoundException
- if a specified property file or
network resource does not exist.
MalformedURLException
- if an HTTP or LDAP URL has incorrect
syntax.
NamingServiceException
- if no service-specific properties
are defined.public static NamingService newInstance(String serviceName, String resource, String[] args) throws IOException, FileNotFoundException, MalformedURLException, NamingServiceException
serviceName
- The name of the naming service itself. This name
is used as the prefix of property names defined
in a property file or network property resource.resource
- A file pathname or file URL referencing a property
file in the local file system, or an HTTP or LDAP URL
referencing a network resource containing property
definitions.args
- An array of String arguments, usually passed from
a command line to the main method of a program.
IOException
- if an I/O error prevents properties from
being accessed or read.
FileNotFoundException
- if a specified property file or
network resource does not exist.
MalformedURLException
- if an HTTP or LDAP URL has incorrect
syntax.
NamingServiceException
- if no service-specific properties are defined.public static NamingService newInstance(String serviceName, Properties props) throws NamingServiceException
serviceName
- The name of the naming service itself. This name
is used as the prefix of property names defined
in a Properties object.props
- The Properties object from which to initialize the
registry.
NamingServiceException
- if no service-specific properties
are defined.public static void setVMName(String name)
name
- The new name to set for the virtual machine.public static String getVMName()
public static NamingService getInstance()
public static String getDirectoryProvider()
public static String getSearchBase()
public static String getDomainBase()
public static String getPropertySource()
public static Enumeration getServicePropertyNames(String serviceName)
serviceName
- The name of the service for which to return
property names
public static ObjectDestination getService(String serviceName) throws NamingServiceException
serviceName
- The name of the service.
NamingServiceException
- if the service is unknown or
some other exception prevents it from being looked up.public static void registerLocalService(String serviceName, String dn)
serviceName
- The name of the local service.dn
- The distinguished name of the directory entry that describes
the service.public static String getLocalServiceDN(String serviceName)
serviceName
- The name of the local service.
public static boolean isLocalService(String dn) throws NamingServiceException
dn
- The distinguished name to test.
NamingServiceException
- if it can not be determined whether
or not a distinguished name matches a locally registered
service.private static void getServiceDNs() throws NamingServiceException
NamingServiceException
public static Enumeration getAllAddresses(String serviceName) throws NamingServiceException
serviceName
- The name of the service for which to return all
registry entries.
NamingServiceException
- if the service is unknown or
some other exception prevents it from being looked up.public static Socket getConnection(String serviceName) throws NamingServiceException
serviceName
- The name of the service to which a network
connection is requested.
NamingServiceException
- if the specified service name is
unknown or a network connection can not be established
to the service.public static void addService(String serviceName, ObjectDestination dest)
serviceName
- The name of the service for which to add a
registry entry.dest
- The registry entry.public static void setGlobalProperties()
public static void setGlobalProperties(String propPrefix)
propPrefix
- The property name prefix of service-specific
properties.public void reinitialize() throws NamingServiceException
NamingServiceException
protected void initialize(String propPrefix) throws NamingServiceException
propPrefix
- The property name prefix of the instance.
NamingServiceException
private static String getLocalHost()
private static Socket createSocket(String serviceName, String host, int port) throws Exception
Exception
private static void setProperties(String[] args, String resource) throws IOException
args
- A String array containing name=value pairs.resource
- The pathname of a local file, or an HTTP or LDAP
URL reference a network resource that defines
properties.
IOException
- if an I/O error prevents the resource
from being accessed or read.public Properties getProperties()
public static IEProperties getIEProperties()
public static void main(String[] args)
public void refreshProperties()
refreshProperties
in interface PropertyListener
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |