public class Reference extends Objectimplements Cloneable , Serializable
Reference provides a way of recording address information about objects which themselves are not directly bound to the naming/directory system.
A Reference consists of an ordered list of addresses and class information about the object being referenced. Each address in the list identifies a communications endpoint for the same conceptual object. The "communications endpoint" is information that indicates how to contact the object. It could be, for example, a network address, a location in memory on the local machine, another process on the same machine, etc. The order of the addresses in the list may be of significance to object factories that interpret the reference.
Multiple addresses may arise for various reasons, such as replication or the object offering interfaces over more than one communication mechanism. The addresses are indexed starting with zero.
A Reference also contains information to assist in creating an instance of the object to which this Reference refers. It contains the class name of that object, and the class name and location of the factory to be used to create the object. The class factory location is a space-separated list of URLs representing the class path used to load the factory. When the factory class (or any class or resource upon which it depends) needs to be loaded, each URL is used (in order) to attempt to load the class.
A Reference instance is not synchronized against concurrent access by multiple threads. Threads that need to access a single Reference concurrently should synchronize amongst themselves and provide the necessary locking.
RefAddr,
StringRefAddr,
BinaryRefAddr,
Serialized Form
| Modifier and Type | Field and Description |
|---|---|
protected Vector |
addrs
Contains the addresses contained in this Reference.
|
protected String |
classFactory
Contains the name of the factory class for creating an instance of the object to which this Reference refers.
|
protected String |
classFactoryLocation
Contains the location of the factory class.
|
protected String |
className
Contains the fully-qualified name of the class of the object to which this Reference refers.
|
| Constructor and Description |
|---|
Reference(String
Constructs a new reference for an object with class name 'className'.
|
Reference(String
Constructs a new reference for an object with class name 'className' and an address.
|
Reference(String
Constructs a new reference for an object with class name 'className', the class name and location of the object's factory, and the address for the object.
|
Reference(String
Constructs a new reference for an object with class name 'className', and the class name and location of the object's factory.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int posn, RefAddr
Adds an address to the list of addresses at index posn.
|
void |
add(RefAddr
Adds an address to the end of the list of addresses.
|
void |
clear()
Deletes all addresses from this reference.
|
Object |
clone()
Makes a copy of this reference using its class name list of addresses, class factory name and class factory location.
|
boolean |
equals(Object
Determines whether obj is a reference with the same addresses (in same order) as this reference.
|
RefAddr |
get(int posn)
Retrieves the address at index posn.
|
RefAddr |
get(String
Retrieves the first address that has the address type 'addrType'.
|
Enumeration |
getAll()
Retrieves an enumeration of the addresses in this reference.
|
String |
getClassName()
Retrieves the class name of the object to which this reference refers.
|
String |
getFactoryClassLocation()
Retrieves the location of the factory of the object to which this reference refers.
|
String |
getFactoryClassName()
Retrieves the class name of the factory of the object to which this reference refers.
|
int |
hashCode()
Computes the hash code of this reference.
|
Object |
remove(int posn)
Deletes the address at index posn from the list of addresses.
|
int |
size()
Retrieves the number of addresses in this reference.
|
String |
toString()
Generates the string representation of this reference.
|
protected StringclassName
Class.getName()
protected Vector<RefAddr > addrs
protected StringclassFactory
protected StringclassFactoryLocation
public Reference(StringclassName)
className - The non-null class name of the object to which this reference refers.
public Reference(StringclassName, RefAddr addr)
className - The non-null class name of the object to which this reference refers.
addr - The non-null address of the object.
public Reference(StringclassName, String factory, String factoryLocation)
className - The non-null class name of the object to which this reference refers.
factory - The possibly null class name of the object's factory.
factoryLocation - The possibly null location from which to load the factory (e.g. URL)
ObjectFactory,
NamingManager.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable<?, ?>)
public Reference(StringclassName, RefAddr addr, String factory, String factoryLocation)
className - The non-null class name of the object to which this reference refers.
factory - The possibly null class name of the object's factory.
factoryLocation - The possibly null location from which to load the factory (e.g. URL)
addr - The non-null address of the object.
ObjectFactory,
NamingManager.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable<?, ?>)
public StringgetClassName()
public StringgetFactoryClassName()
public StringgetFactoryClassLocation()
public RefAddrget(String addrType)
addrType - The non-null address type for which to find the address.
public RefAddrget(int posn)
posn - The index of the address to retrieve.
ArrayIndexOutOfBoundsException - If posn not in the specified range.
public Enumeration<RefAddr > getAll()
public int size()
public void add(RefAddraddr)
addr - The non-null address to add.
public void add(int posn,
RefAddr addr)
posn - The 0-based index of the list to insert addr.
addr - The non-null address to add.
ArrayIndexOutOfBoundsException - If posn not in the specified range.
public Objectremove(int posn)
posn - The 0-based index of in address to delete.
ArrayIndexOutOfBoundsException - If posn not in the specified range.
public void clear()
public boolean equals(Objectobj)
equals in class
Object
obj - The possibly null object to check.
Object.hashCode() ,
HashMap
public int hashCode()
hashCode in class
Object
Object.equals(java.lang.Object) ,
System.identityHashCode(java.lang.Object)
public StringtoString()
public Objectclone()