org.objectweb.jorm.naming.api
Interface PNameCoder

All Known Subinterfaces:
PBinder, PNameManager, PNamingContext

public interface PNameCoder

The PNameCoder defines the external structure of the name it manages, which corresponds to the type involved in the encoding/decoding process. Furthermore, several name format may be supported by a particular name coder.

Author:
R. Basset, P. D?chamboux

Field Summary
static short CTBYTE
          The coding type of the naming context is a byte.
static short CTBYTEARRAY
          The coding type of the naming context is a bytearray.
static short CTCHAR
          The coding type of the naming context is an char.
static short CTCHARARRAY
          The coding type of the naming context is a chararray.
static short CTCOMPOSITE
          The coding type of the naming context is an Object that is composite name (e.g., a multi-fields relational primary key).
static short CTDATE
          The coding type of the naming context is a date.
static short CTINT
          The coding type of the naming context is an int.
static short CTLONG
          The coding type of the naming context is a long.
static short CTOBYTE
          The coding type of the naming context is a byte.
static short CTOCHAR
          The coding type of the naming context is an char.
static short CTOINT
          The coding type of the naming context is an int.
static short CTOLONG
          The coding type of the naming context is a long.
static short CTOSHORT
          The coding type of the naming context is a short.
static short CTSHORT
          The coding type of the naming context is a short.
static short CTSTRING
          The coding type of the naming context is a string.
static short CTSYSTEM
          The coding type of the naming context is an Object that is DS-specific.
 
Method Summary
 boolean codingSupported(short 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 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 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.
 PName decodeString(java.lang.String en)
          The decodeString 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.
 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.
 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.
 java.lang.String encodeString(PName pn)
          The encodeString method produces an encoded representation of a PName within a naming context.
 PName getNull()
          It yields a "null" representation of a name within 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".
 

Field Detail

CTBYTE

public static final short CTBYTE
The coding type of the naming context is a byte.

CTCHAR

public static final short CTCHAR
The coding type of the naming context is an char.

CTSHORT

public static final short CTSHORT
The coding type of the naming context is a short.

CTINT

public static final short CTINT
The coding type of the naming context is an int.

CTLONG

public static final short CTLONG
The coding type of the naming context is a long.

CTOBYTE

public static final short CTOBYTE
The coding type of the naming context is a byte.

CTOCHAR

public static final short CTOCHAR
The coding type of the naming context is an char.

CTOSHORT

public static final short CTOSHORT
The coding type of the naming context is a short.

CTOINT

public static final short CTOINT
The coding type of the naming context is an int.

CTOLONG

public static final short CTOLONG
The coding type of the naming context is a long.

CTSTRING

public static final short CTSTRING
The coding type of the naming context is a string.

CTDATE

public static final short CTDATE
The coding type of the naming context is a date.

CTCHARARRAY

public static final short CTCHARARRAY
The coding type of the naming context is a chararray.

CTBYTEARRAY

public static final short CTBYTEARRAY
The coding type of the naming context is a bytearray.

CTSYSTEM

public static final short CTSYSTEM
The coding type of the naming context is an Object that is DS-specific.

CTCOMPOSITE

public static final short CTCOMPOSITE
The coding type of the naming context is an Object that is composite name (e.g., a multi-fields relational primary key).
Method Detail

codingSupported

public boolean codingSupported(short codingtype)
It tests if a given coding type is supported by this naming context.
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
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.
Parameters:
conn - The connection that can be used to access the data store.
en - The byte to be decoded.
Returns:
The resulting PName.

decodeAbstract

public PName decodeAbstract(java.lang.Object en,
                            java.lang.Object context)
                     throws PExceptionNaming,
                            java.lang.UnsupportedOperationException
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).
Parameters:
context - A context used to decode the related data.
conn - The connection that can be used to access the data store.
en - The Object to be decoded.
Returns:
The resulting PName.

decodeByte

public PName decodeByte(byte en)
                 throws PExceptionNaming,
                        java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
en - The byte to be decoded.
Returns:
The resulting PName.

decodeObyte

public PName decodeObyte(java.lang.Byte en)
                  throws PExceptionNaming,
                         java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
en - The Byte to be decoded.
Returns:
The resulting PName.

decodeChar

public PName decodeChar(char en)
                 throws PExceptionNaming,
                        java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
en - The char to be decoded.
Returns:
The resulting PName.

decodeOchar

public PName decodeOchar(java.lang.Character en)
                  throws PExceptionNaming,
                         java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
en - The Character to be decoded.
Returns:
The resulting PName.

decodeInt

public PName decodeInt(int en)
                throws PExceptionNaming,
                       java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
en - The int to be decoded.
Returns:
The resulting PName.

decodeOint

public PName decodeOint(java.lang.Integer en)
                 throws PExceptionNaming,
                        java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
en - The Integer to be decoded.
Returns:
The resulting PName.

decodeLong

public PName decodeLong(long en)
                 throws PExceptionNaming,
                        java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
en - The long to be decoded.
Returns:
The resulting PName.

decodeOlong

public PName decodeOlong(java.lang.Long en)
                  throws PExceptionNaming,
                         java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
en - The Long to be decoded.
Returns:
The resulting PName.

decodeShort

public PName decodeShort(short en)
                  throws PExceptionNaming,
                         java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
en - The short to be decoded.
Returns:
The resulting PName.

decodeOshort

public PName decodeOshort(java.lang.Short en)
                   throws PExceptionNaming,
                          java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
en - The Short to be decoded.
Returns:
The resulting PName.

decodeString

public PName decodeString(java.lang.String en)
                   throws PExceptionNaming
The decodeString methods recreates PName within a naming context from an encoded representation. In the case of this method, the encoded representation is a String.
Parameters:
conn - The connection that can be used to access the data store.
en - The String to be decoded.
Returns:
The resulting PName.

decodeDate

public PName decodeDate(java.util.Date en)
                 throws PExceptionNaming
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.
Parameters:
conn - The connection that can be used to access the data store.
en - The Date to be decoded.
Returns:
The resulting PName.

encode

public byte[] encode(PName pn)
              throws PExceptionNaming
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.
Parameters:
conn - The connection that can be used to access the data store.
pn - The PName to be encoded
Returns:
The array of bytes corresponding to the encoded representation.

encodeAbstract

public java.lang.Object encodeAbstract(PName pn)
                                throws PExceptionNaming,
                                       java.lang.UnsupportedOperationException
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).
Parameters:
conn - The connection that can be used to access the data store.
pn - The PName to be encoded.
Returns:
The Object corresponding to the encoded representation.

encodeByte

public byte encodeByte(PName pn)
                throws PExceptionNaming,
                       java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
pn - The PName to be encoded
Returns:
The byte corresponding to the encoded representation.

encodeObyte

public java.lang.Byte encodeObyte(PName pn)
                           throws PExceptionNaming,
                                  java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
pn - The PName to be encoded
Returns:
The Byte corresponding to the encoded representation.

encodeChar

public char encodeChar(PName pn)
                throws PExceptionNaming,
                       java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
pn - The PName to be encoded
Returns:
The char corresponding to the encoded representation.

encodeOchar

public java.lang.Character encodeOchar(PName pn)
                                throws PExceptionNaming,
                                       java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
pn - The PName to be encoded
Returns:
The Character corresponding to the encoded representation.

encodeInt

public int encodeInt(PName pn)
              throws PExceptionNaming,
                     java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
pn - The PName to be encoded
Returns:
The int corresponding to the encoded representation.

encodeOint

public java.lang.Integer encodeOint(PName pn)
                             throws PExceptionNaming,
                                    java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
pn - The PName to be encoded
Returns:
The Integer corresponding to the encoded representation.

encodeLong

public long encodeLong(PName pn)
                throws PExceptionNaming,
                       java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
pn - The PName to be encoded
Returns:
The long corresponding to the encoded representation.

encodeOlong

public java.lang.Long encodeOlong(PName pn)
                           throws PExceptionNaming,
                                  java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
pn - The PName to be encoded
Returns:
The Long corresponding to the encoded representation.

encodeShort

public short encodeShort(PName pn)
                  throws PExceptionNaming,
                         java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
pn - The PName to be encoded
Returns:
The short corresponding to the encoded representation.

encodeOshort

public java.lang.Short encodeOshort(PName pn)
                             throws PExceptionNaming,
                                    java.lang.UnsupportedOperationException
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.
Parameters:
conn - The connection that can be used to access the data store.
pn - The PName to be encoded
Returns:
The Short corresponding to the encoded representation.

encodeString

public java.lang.String encodeString(PName pn)
                              throws PExceptionNaming
The encodeString method produces an encoded representation of a PName within a naming context. The encoding format in the case of this method is a String.
Parameters:
conn - The connection that can be used to access the data store.
pn - The PName to be encoded
Returns:
The String corresponding to the encoded representation.

encodeDate

public java.util.Date encodeDate(PName pn)
                          throws PExceptionNaming
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.
Parameters:
conn - The connection that can be used to access the data store.
pn - The PName to be encoded
Returns:
The Date corresponding to the encoded representation.

getNull

public PName getNull()
It yields a "null" representation of a name within this naming context.
Returns:
The "null" PName associated with this naming context.

supportDynamicComposite

public 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.
Returns:
true if dynamic getter is supported by composite name coding.

supportCompositeField

public 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. 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.
Returns:
true if the proposed field is supported by this composite name.

supportStaticComposite

public 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".
Returns:
true if static getter is supported by composite name coding.