|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.jorm.naming.lib.BasicPNamingContext
org.objectweb.jorm.naming.lib.AbstractInheritFilteredPNamingContext
This class is abstract implementation of the FilteredPNamingContext interface. The aim is to manage a tree of naming contexts. At each node a filter is able to say if a pname structure matches to the type represented by the PNamingContext. To use this class it is required - to override the right match and decodeXXX methods in according to the PARENT coding type, - to override the right encodeXXX methods in according to the coding type, - to implement the encodeString and decodeString method Example of overriding of a decodeXXX method: ============================================ public PName decodeAbstract(Object en) throws PExceptionNaming { //check coding type asked with the parent coding type if (parentCodingType != CTCOMPOSITE) { throw new PExceptionNaming("Decoding a composite name is not supported: " + en); } //obtain a PName with the 'en' parameter PName pn; if (en instanceof PName) { pn = (PName) en } else if (en instanceof ID1ID2PNG) { pn = new ID1ID2PName(this, ((ID1ID2PNG) en).pnGetId1(), ((ID1ID2PNG) en).pnGetId1()); } else if (en instanceof PNameGetter) { pn = new ID1ID2PName(this, ((PNameGetter) en).pnGetString("id1"), ((PNameGetter) en).pnGetLong("id2") ); } else { throw new PExceptionNaming("Impossible to decode this parameter: " + en); } // resolve the PName try { return resolve(null, pn); } catch (PException e) { throw new PExceptionNaming(e, "Impossible to resolve " + en); } } Example of overriding of a match method: ======================================== public boolean match(Object en) throws PExceptionNaming { if (parentCodingType != CTCOMPOSITE) { throw new PExceptionNaming("Decoding a composite name is not supported: " + en); } String id1 = ((FooPNG) en).getId1(); long id2 = ((FooPNG) en).getId2(); return id2 > 0 && "kangaroo".equals(id1) } Example of overriding of a encodeXXX method: ============================================ public Object encodeAbstract(PName pn) throws PExceptionNaming { return pn; //The PName is a PNameGetter }
Field Summary | |
protected PBinder |
binder
The Binder associated to the current type. |
protected int |
codingType
The codingType of the current PNamingContext |
protected PNameGetterConverter |
converter
|
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 | |
AbstractInheritFilteredPNamingContext()
|
|
AbstractInheritFilteredPNamingContext(int codingType)
|
|
AbstractInheritFilteredPNamingContext(int codingType,
PNameGetterConverter converter)
|
Method Summary | |
void |
bindSubFPNC(FilteredPNamingContext fpnc)
binds a sub filteredPNamingContext to the current. |
boolean |
codingSupported(int codingtype)
It tests if a given coding type is supported by this 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 infoitem)
It associates a PName to an information item within a naming context. |
PName |
export(java.lang.Object conn,
java.lang.Object infoitem,
java.lang.Object hints)
It associates a PName to an information item within a naming context. |
PBinder |
getBinder()
|
PNameGetterConverter |
getConverter()
|
PName |
getNull()
It yields a "null" representation of a name within this naming context. |
PName |
resolve(java.lang.Object conn,
PName pn)
It retrieves the information item associated to the given PName (if any exists). |
void |
setBinder(PBinder binder)
|
void |
setCodingType(int codingType)
|
void |
setConverter(PNameGetterConverter converter)
|
void |
setNullPName(java.lang.Object o)
It assignes a object which defines a null representation of a name within this naming context. |
void |
unbindSubFPNC(FilteredPNamingContext fpnc)
Unbinds a sub PNC from its parent. |
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). |
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.BasicPNamingContext |
decode, decodeAbstract, decodeBigDecimal, decodeBigInteger, decodeByte, decodeChar, decodeCharArray, decodeDate, decodeInt, decodeLong, decodeObyte, decodeOchar, decodeOint, decodeOlong, decodeOshort, decodeShort, encode, encodeAbstract, encodeBigDecimal, encodeBigInteger, encodeByte, encodeChar, encodeCharArray, encodeDate, encodeInt, encodeLong, encodeObyte, encodeOchar, encodeOint, encodeOlong, encodeOshort, encodeShort, getPType, setPType, supportCompositeField, supportDynamicComposite, supportStaticComposite |
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.FilteredPNamingContext |
match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match |
Methods inherited from interface org.objectweb.jorm.naming.api.PNameCoder |
decode, decodeAbstract, decodeBigDecimal, decodeBigInteger, decodeByte, decodeChar, decodeCharArray, decodeDate, decodeInt, decodeLong, decodeObyte, decodeOchar, decodeOint, decodeOlong, decodeOshort, decodeShort, decodeString, encode, encodeAbstract, encodeBigDecimal, encodeBigInteger, encodeByte, encodeChar, encodeCharArray, encodeDate, encodeInt, encodeLong, encodeObyte, encodeOchar, encodeOint, encodeOlong, encodeOshort, encodeShort, getPType, setPType, supportCompositeField, supportDynamicComposite, supportStaticComposite |
Field Detail |
protected PBinder binder
protected int codingType
protected PNameGetterConverter converter
Constructor Detail |
public AbstractInheritFilteredPNamingContext()
public AbstractInheritFilteredPNamingContext(int codingType)
public AbstractInheritFilteredPNamingContext(int codingType, PNameGetterConverter converter)
Method Detail |
public PBinder getBinder()
public void setBinder(PBinder binder)
public void setCodingType(int codingType)
public PNameGetterConverter getConverter()
public void setConverter(PNameGetterConverter converter)
public void bindSubFPNC(FilteredPNamingContext fpnc)
FilteredPNamingContext
bindSubFPNC
in interface FilteredPNamingContext
public void unbindSubFPNC(FilteredPNamingContext fpnc)
FilteredPNamingContext
unbindSubFPNC
in interface FilteredPNamingContext
public boolean codingSupported(int codingtype)
PNameCoder
codingSupported
in interface PNameCoder
codingSupported
in class BasicPNamingContext
public PName getNull()
PNameCoder
getNull
in interface PNameCoder
public void setNullPName(java.lang.Object o) throws PException
PNameCoder
setNullPName
in interface PNameCoder
o
- can be a PNameGetter (generic or generated), a pname, or
a simple value (ex: Integer).
PException
public PName resolve(java.lang.Object conn, PName pn) throws PException
PNamingContext
resolve
in interface PNamingContext
conn
- The connection that can be used to access the data store.pn
- The PName to be looked up.
PException
public PName export(java.lang.Object conn, java.lang.Object infoitem) throws PException
PNameManager
export
in interface PNameManager
conn
- The connection that can be used to access the data store.infoitem
- The information item that must be accessible through a
PName within a naming context.
PName
associated to the given information
item.
PException
public PName export(java.lang.Object conn, java.lang.Object infoitem, java.lang.Object hints) throws PException
PNameManager
export
in interface PNameManager
conn
- The connection that can be used to access the data store.infoitem
- The information item that must be accessible through a
PName within a naming context.hints
- Any information relevant for name creation.
PName
associated to the given information
item.
PException
public void unexport(java.lang.Object conn, PName pn) throws PException
PNameManager
unexport
in interface PNameManager
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.
PException
public void unexport(java.lang.Object conn, PName pn, java.lang.Object hints) throws PException
PNameManager
unexport
in interface PNameManager
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.
PException
public java.lang.String encodeString(PName pn) throws PExceptionNaming
PNameCoder
encodeString
in interface PNameCoder
pn
- The PName to be encoded
PExceptionNaming
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |