org.objectweb.jorm.naming.lib
Class CompositePBinder

java.lang.Object
  extended byorg.objectweb.jorm.naming.lib.BasicPNamingContext
      extended byorg.objectweb.jorm.naming.lib.BasicPBinder
          extended byorg.objectweb.jorm.naming.lib.CompositePBinder
All Implemented Interfaces:
PBinder, PNameCoder, PNameManager, PNamingContext

public abstract class CompositePBinder
extends BasicPBinder

This class helps the implementation of PBinder for composite name.

Author:
S.Chassande-Barrioz

Field Summary
 
Fields inherited from class org.objectweb.jorm.naming.lib.BasicPBinder
cache, nullPName, pcm
 
Fields inherited from class org.objectweb.jorm.naming.lib.BasicPNamingContext
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
CompositePBinder()
           
CompositePBinder(PClassMapping _pcm)
           
CompositePBinder(PName nullPName)
           
 
Method Summary
 PName decodeAbstract(java.lang.Object png, java.lang.Object ctx)
          The decodeAbstract methods recreates PName within a naming context from an encoded representation.
 java.lang.Object encodeAbstract(PName pn)
          The encodeAbstract 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 export(java.lang.Object conn, java.lang.Object en)
          It associates a PName to an information item within a naming context.
 PName export(java.lang.Object conn, java.lang.Object en, java.lang.Object hints)
          It associates a PName to an information item within a naming context.
protected abstract  void fillStringCoder(PNCStringCoder cnsc, PName pn)
           
protected abstract  PName getPNameFrom(java.lang.Object png, java.lang.Object ctx, java.lang.Object connection, boolean computeACF)
          Try to build a PName from a java object.
protected  boolean isAllAutoCalculated()
           
protected abstract  boolean isManagedPName(java.lang.Object pn)
          Indicates if the PName can be managed by this Binder
protected abstract  boolean isNull(java.lang.Object png, java.lang.Object ctx)
          Indicates if value encapsulated into a pname getter (generic or specific) represents a null PName
protected abstract  PName newPName(PName oldpn)
          Allocate a new PName instance with values containing in existing one.
 PName resolve(java.lang.Object conn, PName pn)
          It retrieves the information item associated to the given PName (if any exists).
 void setNullPName(java.lang.Object o)
          It assignes a object which defines a null representation of a name within this naming context.
 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".
 void unexport(java.lang.Object conn, PName pn)
          It removes the PName and all the associated information within a naming context (i.e., the association between the PName and its information item). in the case of the StrBinder, the unexport operation do nothing more than the unbind operation.
 void unexport(java.lang.Object conn, PName pn, java.lang.Object hints)
          It removes the PName and all the associated information within a naming context (i.e., the association between the PName and its information item).
 
Methods inherited from class org.objectweb.jorm.naming.lib.BasicPBinder
bind, getBinderClassMapping, getCacheManager, getClassName, getNull, lookup, setCacheManager, setPClassMapping, unbind
 
Methods inherited from class org.objectweb.jorm.naming.lib.BasicPNamingContext
codingSupported, decode, decodeBigDecimal, decodeBigInteger, decodeByte, decodeChar, decodeCharArray, decodeDate, decodeInt, decodeLong, decodeObyte, decodeOchar, decodeOint, decodeOlong, decodeOshort, decodeShort, encode, encodeBigDecimal, encodeBigInteger, encodeByte, encodeChar, encodeCharArray, encodeDate, encodeInt, encodeLong, encodeObyte, encodeOchar, encodeOint, encodeOlong, encodeOshort, encodeShort, getPType, setPType, supportCompositeField
 
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.PNameCoder
codingSupported, decode, decodeBigDecimal, decodeBigInteger, decodeByte, decodeChar, decodeCharArray, decodeDate, decodeInt, decodeLong, decodeObyte, decodeOchar, decodeOint, decodeOlong, decodeOshort, decodeShort, decodeString, encode, encodeBigDecimal, encodeBigInteger, encodeByte, encodeChar, encodeCharArray, encodeDate, encodeInt, encodeLong, encodeObyte, encodeOchar, encodeOint, encodeOlong, encodeOshort, encodeShort, getPType, setPType, supportCompositeField
 

Constructor Detail

CompositePBinder

public CompositePBinder()

CompositePBinder

public CompositePBinder(PClassMapping _pcm)

CompositePBinder

public CompositePBinder(PName nullPName)
Method Detail

isManagedPName

protected abstract boolean isManagedPName(java.lang.Object pn)
Indicates if the PName can be managed by this Binder


isNull

protected abstract boolean isNull(java.lang.Object png,
                                  java.lang.Object ctx)
                           throws PException
Indicates if value encapsulated into a pname getter (generic or specific) represents a null PName

Parameters:
png - is the pname getter containing values
ctx - is a hints to pass to the pnGet methods
Throws:
PException

fillStringCoder

protected abstract void fillStringCoder(PNCStringCoder cnsc,
                                        PName pn)
                                 throws PExceptionNameCoding
Throws:
PExceptionNameCoding

isAllAutoCalculated

protected boolean isAllAutoCalculated()

setNullPName

public void setNullPName(java.lang.Object o)
                  throws PException
Description copied from interface: PNameCoder
It assignes a object which defines a null representation of a name within this naming context.

Specified by:
setNullPName in interface PNameCoder
Overrides:
setNullPName in class BasicPBinder
Throws:
PException

getPNameFrom

protected abstract PName getPNameFrom(java.lang.Object png,
                                      java.lang.Object ctx,
                                      java.lang.Object connection,
                                      boolean computeACF)
                               throws PException
Try to build a PName from a java object. The java object can be a generic or specific PNameGetter implementation

Parameters:
png - is a pname getter (generic or specific)
ctx - is a context to pass on the pnGet method
connection - is a connection to the un derlying data store in case of the value has to be fetch from the data store (ex: sequence)
Returns:
a PName corresponding to the PNameGetter, maybe fill with value from the data store.
Throws:
PException

newPName

protected abstract PName newPName(PName oldpn)
                           throws PException
Allocate a new PName instance with values containing in existing one.

Parameters:
oldpn - is the existing PName containg value to pick
Returns:
a new PName instance associated to this PBinder
Throws:
PException

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
Overrides:
encodeAbstract in class BasicPNamingContext
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

decodeAbstract

public PName decodeAbstract(java.lang.Object png,
                            java.lang.Object ctx)
                     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
Overrides:
decodeAbstract in class BasicPNamingContext
Throws:
PExceptionNaming
java.lang.UnsupportedOperationException

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
Overrides:
supportDynamicComposite in class BasicPNamingContext

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
Overrides:
supportStaticComposite in class BasicPNamingContext

resolve

public PName resolve(java.lang.Object conn,
                     PName pn)
              throws PException
It retrieves the information item associated to the given PName (if any exists). The pname must be a StrName and must support the hashcode method.

Parameters:
conn - The connection that can be used to access the data store.
pn - The PName to be looked up.
Returns:
The PBinding associated with the given PName within this binder
Throws:
PExceptionNaming - Raised if the Pname is not registered into this binder.
PException
See Also:
PNamingContext

export

public PName export(java.lang.Object conn,
                    java.lang.Object en)
             throws PException
Description copied from interface: PNameManager
It associates a PName to an information item within a naming context.

Parameters:
conn - The connection that can be used to access the data store.
en - The information item that must be accessible through a PName within a naming context.
Returns:
The PName associated to the given information item.
Throws:
PException

export

public PName export(java.lang.Object conn,
                    java.lang.Object en,
                    java.lang.Object hints)
             throws PException
Description copied from interface: PNameManager
It associates a PName to an information item within a naming context.

Parameters:
conn - The connection that can be used to access the data store.
en - The information item that must be accessible through a PName within a naming context.
hints - Any information relevant for name creation.
Returns:
The PName associated to the given information item.
Throws:
PException

unexport

public void unexport(java.lang.Object conn,
                     PName pn)
              throws PException
It removes the PName and all the associated information within a naming context (i.e., the association between the PName and its information item). in the case of the StrBinder, the unexport operation do nothing more than the unbind operation.

Parameters:
conn - The connection that can be used to access the data store.
pn - A PName valid in this naming context.
Throws:
PExceptionNaming - Raised in case of problem within the naming context.
PException
See Also:
PNamingContext

unexport

public void unexport(java.lang.Object conn,
                     PName pn,
                     java.lang.Object hints)
              throws PException
Description copied from interface: PNameManager
It removes the PName and all the associated information within a naming context (i.e., the association between the PName and its information item).

Parameters:
conn - The connection that can be used to access the data store.
pn - A PName valid in this naming context. In case of a PBinder, export is done on a PBinding.
hints - Any information relevant for name removing.
Throws:
PException

encodeString

public java.lang.String encodeString(PName pn)
                              throws PExceptionNaming
Description copied from interface: PNameCoder
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:
pn - The PName to be encoded
Returns:
The String corresponding to the encoded representation.
Throws:
PExceptionNaming