API java : Reference


javax.naming
Class Reference

java.lang.Object
  extended by javax.naming.Reference
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
LinkRef

public class Reference
extends Object
implements Cloneable, Serializable

This class represents a reference to an object that is found outside of the naming/directory system.

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.

Since:
1.3
See Also:
RefAddr, StringRefAddr, BinaryRefAddr, Serialized Form

Field Summary
protected  Vector<RefAddr> 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 Summary
Reference(String className)
          Constructs a new reference for an object with class name 'className'.
Reference(String className, RefAddr addr)
          Constructs a new reference for an object with class name 'className' and an address.
Reference(String className, RefAddr addr, String factory, String factoryLocation)
          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 className, String factory, String factoryLocation)
          Constructs a new reference for an object with class name 'className', and the class name and location of the object's factory.
 
Method Summary
 void add(int posn, RefAddr addr)
          Adds an address to the list of addresses at index posn.
 void add(RefAddr addr)
          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 obj)
          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 addrType)
          Retrieves the first address that has the address type 'addrType'.
 Enumeration<RefAddr> 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.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

className

protected String className
Contains the fully-qualified name of the class of the object to which this Reference refers.

See Also:
Class.getName()

addrs

protected Vector<RefAddr> addrs
Contains the addresses contained in this Reference. Initialized by constructor.


classFactory

protected String classFactory
Contains the name of the factory class for creating an instance of the object to which this Reference refers. Initialized to null.


classFactoryLocation

protected String classFactoryLocation
Contains the location of the factory class. Initialized to null.

Constructor Detail

Reference

public Reference(String className)
Constructs a new reference for an object with class name 'className'. Class factory and class factory location are set to null. The newly created reference contains zero addresses.

Parameters:
className - The non-null class name of the object to which this reference refers.

Reference

public Reference(String className,
                 RefAddr addr)
Constructs a new reference for an object with class name 'className' and an address. Class factory and class factory location are set to null.

Parameters:
className - The non-null class name of the object to which this reference refers.
addr - The non-null address of the object.

Reference

public Reference(String className,
                 String factory,
                 String factoryLocation)
Constructs a new reference for an object with class name 'className', and the class name and location of the object's factory.

Parameters:
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)
See Also:
ObjectFactory, NamingManager.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)

Reference

public Reference(String className,
                 RefAddr addr,
                 String factory,
                 String factoryLocation)
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.

Parameters:
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.
See Also:
ObjectFactory, NamingManager.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)
Method Detail

getClassName

public String getClassName()
Retrieves the class name of the object to which this reference refers.

Returns:
The non-null fully-qualified class name of the object. (e.g. "java.lang.String")

getFactoryClassName

public String getFactoryClassName()
Retrieves the class name of the factory of the object to which this reference refers.

Returns:
The possibly null fully-qualified class name of the factory. (e.g. "java.lang.String")

getFactoryClassLocation

public String getFactoryClassLocation()
Retrieves the location of the factory of the object to which this reference refers. If it is a codebase, then it is an ordered list of URLs, separated by spaces, listing locations from where the factory class definition should be loaded.

Returns:
The possibly null string containing the location for loading in the factory's class.

get

public RefAddr get(String addrType)
Retrieves the first address that has the address type 'addrType'. String.compareTo() is used to test the equality of the address types.

Parameters:
addrType - The non-null address type for which to find the address.
Returns:
The address in this reference with address type 'addrType; null if no such address exist.

get

public RefAddr get(int posn)
Retrieves the address at index posn.

Parameters:
posn - The index of the address to retrieve.
Returns:
The address at the 0-based index posn. It must be in the range [0,getAddressCount()).
Throws:
ArrayIndexOutOfBoundsException - If posn not in the specified range.

getAll

public Enumeration<RefAddr> getAll()
Retrieves an enumeration of the addresses in this reference. When addresses are added, changed or removed from this reference, its effects on this enumeration are undefined.

Returns:
An non-null enumeration of the addresses (RefAddr) in this reference. If this reference has zero addresses, an enumeration with zero elements is returned.

size

public int size()
Retrieves the number of addresses in this reference.

Returns:
The nonnegative number of addresses in this reference.

add

public void add(RefAddr addr)
Adds an address to the end of the list of addresses.

Parameters:
addr - The non-null address to add.

add

public void add(int posn,
                RefAddr addr)
Adds an address to the list of addresses at index posn. All addresses at index posn or greater are shifted up the list by one (away from index 0).

Parameters:
posn - The 0-based index of the list to insert addr.
addr - The non-null address to add.
Throws:
ArrayIndexOutOfBoundsException - If posn not in the specified range.

remove

public Object remove(int posn)
Deletes the address at index posn from the list of addresses. All addresses at index greater than posn are shifted down the list by one (towards index 0).

Parameters:
posn - The 0-based index of in address to delete.
Returns:
The address removed.
Throws:
ArrayIndexOutOfBoundsException - If posn not in the specified range.

clear

public void clear()
Deletes all addresses from this reference.


equals

public boolean equals(Object obj)
Determines whether obj is a reference with the same addresses (in same order) as this reference. The addresses are checked using RefAddr.equals(). In addition to having the same addresses, the Reference also needs to have the same class name as this reference. The class factory and class factory location are not checked. If obj is null or not an instance of Reference, null is returned.

Overrides:
equals in class Object
Parameters:
obj - The possibly null object to check.
Returns:
true if obj is equal to this reference; false otherwise.
See Also:
Object.hashCode(), Hashtable

hashCode

public int hashCode()
Computes the hash code of this reference. The hash code is the sum of the hash code of its addresses.

Overrides:
hashCode in class Object
Returns:
A hash code of this reference as an int.
See Also:
Object.equals(java.lang.Object), Hashtable

toString

public String toString()
Generates the string representation of this reference. The string consists of the class name to which this reference refers, and the string representation of each of its addresses. This representation is intended for display only and not to be parsed.

Overrides:
toString in class Object
Returns:
The non-null string representation of this reference.

clone

public Object clone()
Makes a copy of this reference using its class name list of addresses, class factory name and class factory location. Changes to the newly created copy does not affect this Reference and vice versa.

Overrides:
clone in class Object
Returns:
a clone of this instance.
See Also:
Cloneable

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :

Quels sont les motivations de cette démarche?

Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.

Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.

Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.

Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.

Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

6 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-1276
Document créé le 29/08/06 22:37, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http://www.gaudry.be/java-api-rf-javax/naming/Reference.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
2,98 secondes

Mises à jour :
Mises à jour du site
Citation (masquer)
L'Internet serait une toile comme les autres si elle n'avait ses millions d'araignées...

Maxime Allain
 
l'infobrol
Nous sommes le Samedi 02 Juin 2012, 01:45, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)