org.objectweb.jorm.naming.lib
Class BasicPNamingContext

java.lang.Object
  extended byorg.objectweb.jorm.naming.lib.BasicPNamingContext
All Implemented Interfaces:
PNameCoder, PNameManager, PNamingContext
Direct Known Subclasses:
AbstractInheritFilteredPNamingContext, AbstractInheritKeyFilteredPNamingContext, BasicPBinder, PolymorphRefNC

public abstract class BasicPNamingContext
extends java.lang.Object
implements PNamingContext

Default implementation for a PNamingContext with no coding support.

Author:
P. D?chamboux

Field Summary
protected  PType ptype
           
 
Fields inherited from interface org.objectweb.jorm.naming.api.PNameCoder
CTBIGDECIMAL, CTBIGINTEGER, CTBYTE, CTBYTEARRAY, CTCHAR, CTCHARARRAY, CTCOMPOSITE, CTDATE, CTINT, CTLONG, CTOBYTE, CTOCHAR, CTOINT, CTOLONG, CTOSHORT, CTSHORT, CTSTRING, CTSYSTEM
 
Constructor Summary
BasicPNamingContext()
           
 
Method Summary
 boolean codingSupported(int codingtype)
          It tests if a given coding type is supported by this naming context.
 PName decode(byte[] en)
          The decode methods recreates PName within a naming context from an encoded representation.
 PName decodeAbstract(java.lang.Object en, java.lang.Object context)
          The decodeAbstract methods recreates PName within a naming context from an encoded representation.
 PName decodeBigDecimal(java.math.BigDecimal en)
          The decodeBigDecimal methods recreates PName within a naming context from an encoded representation.
 PName decodeBigInteger(java.math.BigInteger en)
          The decodeBigInteger methods recreates PName within a naming context from an encoded representation.
 PName decodeByte(byte en)
          The decodeByte methods recreates PName within a naming context from an encoded representation.
 PName decodeChar(char en)
          The decodeChar methods recreates PName within a naming context from an encoded representation.
 PName decodeCharArray(char[] en)
          The decodeCharArray methods recreates PName within a naming context from an encoded representation.
 PName decodeDate(java.util.Date en)
          The decodeDate methods recreates PName within a naming context from an encoded representation.
 PName decodeInt(int en)
          The decodeInt methods recreates PName within a naming context from an encoded representation.
 PName decodeLong(long en)
          The decodeLong methods recreates PName within a naming context from an encoded representation.
 PName decodeObyte(java.lang.Byte en)
          The decodeObyte methods recreates PName within a naming context from an encoded representation.
 PName decodeOchar(java.lang.Character en)
          The decodeOchar methods recreates PName within a naming context from an encoded representation.
 PName decodeOint(java.lang.Integer en)
          The decodeOint methods recreates PName within a naming context from an encoded representation.
 PName decodeOlong(java.lang.Long en)
          The decodeOlong methods recreates PName within a naming context from an encoded representation.
 PName decodeOshort(java.lang.Short en)
          The decodeOshort methods recreates PName within a naming context from an encoded representation.
 PName decodeShort(short en)
          The decodeShort methods recreates PName within a naming context from an encoded representation.
 byte[] encode(PName pn)
          The encode method produces an encoded representation of a PName within a naming context.
 java.lang.Object encodeAbstract(PName pn)
          The encodeAbstract method produces an encoded representation of a PName within a naming context.
 java.math.BigDecimal encodeBigDecimal(PName pn)
          The encodeBigDecimal method produces an encoded representation of a PName within a naming context.
 java.math.BigInteger encodeBigInteger(PName pn)
          The encodeBigInteger method produces an encoded representation of a PName within a naming context.
 byte encodeByte(PName pn)
          The encodeByte method produces an encoded representation of a PName within a naming context.
 char encodeChar(PName pn)
          The encodeChar method produces an encoded representation of a PName within a naming context.
 char[] encodeCharArray(PName pn)
          The encodeCharArray method produces an encoded representation of a PName within a naming context.
 java.util.Date encodeDate(PName pn)
          The encodeDate method produces an encoded representation of a PName within a naming context.
 int encodeInt(PName pn)
          The encodeInt method produces an encoded representation of a PName within a naming context.
 long encodeLong(PName pn)
          The encodeLong method produces an encoded representation of a PName within a naming context.
 java.lang.Byte encodeObyte(PName pn)
          The encodeObyte method produces an encoded representation of a PName within a naming context.
 java.lang.Character encodeOchar(PName pn)
          The encodeOchar method produces an encoded representation of a PName within a naming context.
 java.lang.Integer encodeOint(PName pn)
          The encodeOint method produces an encoded representation of a PName within a naming context.
 java.lang.Long encodeOlong(PName pn)
          The encodeOlong method produces an encoded representation of a PName within a naming context.
 java.lang.Short encodeOshort(PName pn)
          The encodeOshort method produces an encoded representation of a PName within a naming context.
 short encodeShort(PName pn)
          The encodeShort method produces an encoded representation of a PName within a naming context.
 PType getPType()
          Retrieves the PType associated to the JORM class which is the type of the name managed by this naming context.
 void setPType(PType pt)
          Assigns the PType associated to the JORM class which is the type of the name managed by this naming context.
 boolean supportCompositeField(java.lang.String fn, PType ft)
          In case of a naming context that supports composite names (i.e., names composed of several typed fields, whose type is limited to scalar ones), it tests if a particular field is defined by this composite name.
 boolean supportDynamicComposite()
          Tests if this naming context supports comosite name through a dynamic approach, which means that encodingAbstract/decodingAbstract use getter objects that implement the PNameGetter interface.
 boolean supportStaticComposite()
          Tests if this naming context supports comosite name through a static approach, which means that encodingAbstract/decodingAbstract use getter objects that implement specific NsFieldGetter interface generated for a particular field "Field" within a particular NameDef space "Ns".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.jorm.naming.api.PNamingContext
resolve
 
Methods inherited from interface org.objectweb.jorm.naming.api.PNameManager
export, export, unexport, unexport
 
Methods inherited from interface org.objectweb.jorm.naming.api.PNameCoder
decodeString, encodeString, getNull, setNullPName
 

Field Detail

ptype

protected PType ptype
Constructor Detail

BasicPNamingContext

public BasicPNamingContext()
Method Detail

getPType

public PType getPType()
Description copied from interface: PNameCoder
Retrieves the PType associated to the JORM class which is the type of the name managed by this naming context.

Specified by:
getPType in interface PNameCoder
Returns:
The related PType.

setPType

public void setPType(PType pt)
Description copied from interface: PNameCoder
Assigns the PType associated to the JORM class which is the type of the name managed by this naming context.

Specified by:
setPType in interface PNameCoder
Parameters:
pt - The PType of the JORM class reference managed by this naming context.

codingSupported

public boolean codingSupported(int codingtype)
Description copied from interface: PNameCoder
It tests if a given coding type is supported by this naming context.

Specified by:
codingSupported in interface PNameCoder
Parameters:
codingtype - One of the coding type defined by CTxxx constants defined within this interface.
Returns:
It returns true if the coding type is supported by this naming context.

decode

public PName decode(byte[] en)
             throws PExceptionNaming
Description copied from interface: PNameCoder
The decode methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is an array of bytes. It must always be supported by a naming context.

Specified by:
decode in interface PNameCoder
Parameters:
en - The byte to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming

decodeCharArray

public PName decodeCharArray(char[] en)
                      throws PExceptionNaming
Description copied from interface: PNameCoder
The decodeCharArray methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a String.

Specified by:
decodeCharArray in interface PNameCoder
Parameters:
en - The char[] to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming

decodeAbstract

public PName decodeAbstract(java.lang.Object en,
                            java.lang.Object context)
                     throws PExceptionNaming,
                            java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The decodeAbstract methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is abstract, which means that this is a Java object of any complexity. One example of such object is a getter interface representing a relational primary key (also called composite names).

Specified by:
decodeAbstract in interface PNameCoder
Parameters:
context - A context used to decode the related data.
en - The Object to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeByte

public PName decodeByte(byte en)
                 throws PExceptionNaming,
                        java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The decodeByte methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a byte.

Specified by:
decodeByte in interface PNameCoder
Parameters:
en - The byte to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeObyte

public PName decodeObyte(java.lang.Byte en)
                  throws PExceptionNaming,
                         java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The decodeObyte methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a byte.

Specified by:
decodeObyte in interface PNameCoder
Parameters:
en - The Byte to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeChar

public PName decodeChar(char en)
                 throws PExceptionNaming,
                        java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The decodeChar methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a char.

Specified by:
decodeChar in interface PNameCoder
Parameters:
en - The char to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeOchar

public PName decodeOchar(java.lang.Character en)
                  throws PExceptionNaming,
                         java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The decodeOchar methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a Character.

Specified by:
decodeOchar in interface PNameCoder
Parameters:
en - The Character to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeInt

public PName decodeInt(int en)
                throws PExceptionNaming,
                       java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The decodeInt methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is an int.

Specified by:
decodeInt in interface PNameCoder
Parameters:
en - The int to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeOint

public PName decodeOint(java.lang.Integer en)
                 throws PExceptionNaming,
                        java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The decodeOint methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is an Integer.

Specified by:
decodeOint in interface PNameCoder
Parameters:
en - The Integer to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeLong

public PName decodeLong(long en)
                 throws PExceptionNaming,
                        java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The decodeLong methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a long.

Specified by:
decodeLong in interface PNameCoder
Parameters:
en - The long to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeOlong

public PName decodeOlong(java.lang.Long en)
                  throws PExceptionNaming,
                         java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The decodeOlong methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a Long.

Specified by:
decodeOlong in interface PNameCoder
Parameters:
en - The Long to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeShort

public PName decodeShort(short en)
                  throws PExceptionNaming,
                         java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The decodeShort methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a short.

Specified by:
decodeShort in interface PNameCoder
Parameters:
en - The short to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeOshort

public PName decodeOshort(java.lang.Short en)
                   throws PExceptionNaming,
                          java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The decodeOshort methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a Short.

Specified by:
decodeOshort in interface PNameCoder
Parameters:
en - The Short to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeDate

public PName decodeDate(java.util.Date en)
                 throws PExceptionNaming
Description copied from interface: PNameCoder
The decodeDate methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a Date.

Specified by:
decodeDate in interface PNameCoder
Parameters:
en - The Date to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming

decodeBigInteger

public PName decodeBigInteger(java.math.BigInteger en)
                       throws PExceptionNaming
Description copied from interface: PNameCoder
The decodeBigInteger methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a BigInteger.

Specified by:
decodeBigInteger in interface PNameCoder
Parameters:
en - The BigInteger to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming

decodeBigDecimal

public PName decodeBigDecimal(java.math.BigDecimal en)
                       throws PExceptionNaming
Description copied from interface: PNameCoder
The decodeBigDecimal methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a BigDecimal.

Specified by:
decodeBigDecimal in interface PNameCoder
Parameters:
en - The BigDecimal to be decoded.
Returns:
The resulting PName.
Throws:
PExceptionNaming

encode

public byte[] encode(PName pn)
              throws PExceptionNaming
Description copied from interface: PNameCoder
The encode method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is an array of bytes. It must be always supported by a naming context.

Specified by:
encode in interface PNameCoder
Parameters:
pn - The PName to be encoded
Returns:
The array of bytes corresponding to the encoded representation.
Throws:
PExceptionNaming

encodeCharArray

public char[] encodeCharArray(PName pn)
                       throws PExceptionNaming
Description copied from interface: PNameCoder
The encodeCharArray method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a char[].

Specified by:
encodeCharArray in interface PNameCoder
Parameters:
pn - The PName to be encoded
Returns:
The char[] corresponding to the encoded representation.
Throws:
PExceptionNaming

encodeAbstract

public java.lang.Object encodeAbstract(PName pn)
                                throws PExceptionNaming,
                                       java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The encodeAbstract method produces an encoded representation of a PName within a naming context. The encoding format is the case of this method is a Java object of any complexity. Example of such object is a getter interface giving access of the fields of a relational primary key (also called composite names).

Specified by:
encodeAbstract in interface PNameCoder
Parameters:
pn - The PName to be encoded.
Returns:
The Object corresponding to the encoded representation.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeByte

public byte encodeByte(PName pn)
                throws PExceptionNaming,
                       java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The encodeByte method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a byte.

Specified by:
encodeByte in interface PNameCoder
Parameters:
pn - The PName to be encoded
Returns:
The byte corresponding to the encoded representation.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeObyte

public java.lang.Byte encodeObyte(PName pn)
                           throws PExceptionNaming,
                                  java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The encodeObyte method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a Byte.

Specified by:
encodeObyte in interface PNameCoder
Parameters:
pn - The PName to be encoded
Returns:
The Byte corresponding to the encoded representation.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeChar

public char encodeChar(PName pn)
                throws PExceptionNaming,
                       java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The encodeChar method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a char.

Specified by:
encodeChar in interface PNameCoder
Parameters:
pn - The PName to be encoded
Returns:
The char corresponding to the encoded representation.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeOchar

public java.lang.Character encodeOchar(PName pn)
                                throws PExceptionNaming,
                                       java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The encodeOchar method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a Character.

Specified by:
encodeOchar in interface PNameCoder
Parameters:
pn - The PName to be encoded
Returns:
The Character corresponding to the encoded representation.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeInt

public int encodeInt(PName pn)
              throws PExceptionNaming,
                     java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The encodeInt method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a int.

Specified by:
encodeInt in interface PNameCoder
Parameters:
pn - The PName to be encoded
Returns:
The int corresponding to the encoded representation.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeOint

public java.lang.Integer encodeOint(PName pn)
                             throws PExceptionNaming,
                                    java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The encodeOint method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a Integer.

Specified by:
encodeOint in interface PNameCoder
Parameters:
pn - The PName to be encoded
Returns:
The Integer corresponding to the encoded representation.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeLong

public long encodeLong(PName pn)
                throws PExceptionNaming,
                       java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The encodeLong method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a long.

Specified by:
encodeLong in interface PNameCoder
Parameters:
pn - The PName to be encoded
Returns:
The long corresponding to the encoded representation.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeOlong

public java.lang.Long encodeOlong(PName pn)
                           throws PExceptionNaming,
                                  java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The encodeOlong method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a Long.

Specified by:
encodeOlong in interface PNameCoder
Parameters:
pn - The PName to be encoded
Returns:
The Long corresponding to the encoded representation.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeShort

public short encodeShort(PName pn)
                  throws PExceptionNaming,
                         java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The encodeShort method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a short.

Specified by:
encodeShort in interface PNameCoder
Parameters:
pn - The PName to be encoded
Returns:
The short corresponding to the encoded representation.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeOshort

public java.lang.Short encodeOshort(PName pn)
                             throws PExceptionNaming,
                                    java.lang.UnsupportedOperationException
Description copied from interface: PNameCoder
The encodeOshort method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a Short.

Specified by:
encodeOshort in interface PNameCoder
Parameters:
pn - The PName to be encoded
Returns:
The Short corresponding to the encoded representation.
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

encodeDate

public java.util.Date encodeDate(PName pn)
                          throws PExceptionNaming
Description copied from interface: PNameCoder
The encodeDate method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a Date.

Specified by:
encodeDate in interface PNameCoder
Parameters:
pn - The PName to be encoded
Returns:
The Date corresponding to the encoded representation.
Throws:
PExceptionNaming

encodeBigInteger

public java.math.BigInteger encodeBigInteger(PName pn)
                                      throws PExceptionNaming
Description copied from interface: PNameCoder
The encodeBigInteger method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a BigInteger.

Specified by:
encodeBigInteger in interface PNameCoder
Parameters:
pn - The PName to be encoded
Returns:
The BigInteger corresponding to the encoded representation.
Throws:
PExceptionNaming

encodeBigDecimal

public java.math.BigDecimal encodeBigDecimal(PName pn)
                                      throws PExceptionNaming
Description copied from interface: PNameCoder
The encodeBigDecimal method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a BigDecimal.

Specified by:
encodeBigDecimal in interface PNameCoder
Parameters:
pn - The PName to be encoded
Returns:
The BigDecimal corresponding to the encoded representation.
Throws:
PExceptionNaming

supportDynamicComposite

public boolean supportDynamicComposite()
Description copied from interface: PNameCoder
Tests if this naming context supports comosite name through a dynamic approach, which means that encodingAbstract/decodingAbstract use getter objects that implement the PNameGetter interface.

Specified by:
supportDynamicComposite in interface PNameCoder
Returns:
true if dynamic getter is supported by composite name coding.

supportCompositeField

public boolean supportCompositeField(java.lang.String fn,
                                     PType ft)
Description copied from interface: PNameCoder
In case of a naming context that supports composite names (i.e., names composed of several typed fields, whose type is limited to scalar ones), it tests if a particular field is defined by this composite name. It should be used by PClassMapping objects in order to verify, at deployment time, that naming contexts that are defined to manage the various references supports the same encoding name structure.

Specified by:
supportCompositeField in interface PNameCoder
Returns:
true if the proposed field is supported by this composite name.

supportStaticComposite

public boolean supportStaticComposite()
Description copied from interface: PNameCoder
Tests if this naming context supports comosite name through a static approach, which means that encodingAbstract/decodingAbstract use getter objects that implement specific NsFieldGetter interface generated for a particular field "Field" within a particular NameDef space "Ns".

Specified by:
supportStaticComposite in interface PNameCoder
Returns:
true if static getter is supported by composite name coding.