org.objectweb.jorm.lib
Class PBindingImpl

java.lang.Object
  extended byorg.objectweb.jorm.lib.PBindingImpl
All Implemented Interfaces:
PBinding, PBindingCtrl, java.io.Serializable
Direct Known Subclasses:
LongGenIncr

public class PBindingImpl
extends java.lang.Object
implements PBinding, PBindingCtrl, java.io.Serializable

This class is the default implementation of the PBinding interface.

Author:
S.Chassande-Barrioz
See Also:
Serialized Form

Field Summary
 PClassMapping pClassMapping
           
protected  PName pname
           
protected  byte status
           
 
Fields inherited from interface org.objectweb.jorm.api.PBinding
ACTION_BIND, ACTION_EXIST, ACTION_EXPORT, ACTION_READ, ACTION_UNBIND, ACTION_UNEXPORT, ACTION_WRITE, LIFECYCLE_ACTIVEFORIO, LIFECYCLE_DELTOWRITE, LIFECYCLE_ERROR, LIFECYCLE_NEWTOWRITE, LIFECYCLE_NOTBOUND
 
Constructor Summary
PBindingImpl()
           
PBindingImpl(PClassMapping pcm)
           
 
Method Summary
 void bind(PName pn)
          It assigns a DSI represented by the PName passed as a parameter to this PBinding.
 boolean exist(java.lang.Object conn)
          It verifies if the DSI attached to this binding exists within the DS.
 PName export(java.lang.Object conn)
          It creates a new PName for this binding, the binding state is normally changed to LIFECYCLE_NEWTOWRITE, and the link to a data store instance if it existed is removed.
 PName export(java.lang.Object conn, java.lang.Object hints)
          It creates a new PName for this binding, the binding state is normally changed to LIFECYCLE_NEWTOWRITE, and the link to a data store instance if it existed is removed.
 PClassMapping getPClassMapping()
          It gives access to the PClassMapping which manages this binding.
 PName getPName()
          It gives access to the PName, which designate a particular DSI, associated to this binding.
 byte getStatus()
          It yields the current status associated with this PBinding.
 void init(PClassMapping pcm)
          It initialises a PBinding.
 void read(java.lang.Object conn, PAccessor pa)
          It reads the data store instance designated by the PName of this binding and transfers each attribute value to the accessor object.
 void read(java.lang.Object conn, PAccessor pa, java.lang.Object txctx)
          It reads the data store instance designated by the PName of this binding and transfers each attribute value to the accessor object.
 void read(java.lang.Object conn, PAccessor pa, java.lang.Object txctx, boolean forUpdate)
           
 void setPName(PName pn)
          It assigns the current PName associated with this PBinding.
 void setStatus(byte s)
          It assigns the current status associated with this PBinding.
 void unbind()
          It remove the association between a PName and a PBinding.
 void unexport(java.lang.Object conn)
          It prepares this PBinding to remove the data store instance from the data store.
 void write(java.lang.Object conn, PAccessor pa)
          It transfers each attribute value taken from the PAccessor object to the data store instance designated by the PName associated with this binding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

status

protected transient byte status

pClassMapping

public transient PClassMapping pClassMapping

pname

protected transient PName pname
Constructor Detail

PBindingImpl

public PBindingImpl()

PBindingImpl

public PBindingImpl(PClassMapping pcm)
Method Detail

bind

public void bind(PName pn)
          throws PException
Description copied from interface: PBinding
It assigns a DSI represented by the PName passed as a parameter to this PBinding. This thus changes the link to the data store instance if one has been already assigned. The state changed to LIFECYCLE_ACTIVEFORIO.

Specified by:
bind in interface PBinding
Parameters:
pn - The new PName to associate to this binding. This name must belong to the binder associated to this binding.
Throws:
PException

exist

public boolean exist(java.lang.Object conn)
              throws PException
Description copied from interface: PBinding
It verifies if the DSI attached to this binding exists within the DS.

Specified by:
exist in interface PBinding
Parameters:
conn - The connection that can be used to refer to the DS.
Returns:
It returns true if the DSI exists.
Throws:
PException

export

public PName export(java.lang.Object conn)
             throws PException
Description copied from interface: PBinding
It creates a new PName for this binding, the binding state is normally changed to LIFECYCLE_NEWTOWRITE, and the link to a data store instance if it existed is removed.

Specified by:
export in interface PBinding
Parameters:
conn - The connection that can be used to refer to the DS.
Returns:
The new PName assigned to this binding.
Throws:
PException

export

public PName export(java.lang.Object conn,
                    java.lang.Object hints)
             throws PException
Description copied from interface: PBinding
It creates a new PName for this binding, the binding state is normally changed to LIFECYCLE_NEWTOWRITE, and the link to a data store instance if it existed is removed.

Specified by:
export in interface PBinding
Parameters:
conn - The connection that can be used to refer to the DS.
hints - Any information relevant for name creation.
Returns:
The new PName assigned to this binding.
Throws:
PException

getPClassMapping

public PClassMapping getPClassMapping()
Description copied from interface: PBinding
It gives access to the PClassMapping which manages this binding.

Specified by:
getPClassMapping in interface PBinding
Returns:
The PClassMapping which creates this binding.

getPName

public PName getPName()
Description copied from interface: PBinding
It gives access to the PName, which designate a particular DSI, associated to this binding. It returns null if the binding has not been given a PName using a bind or export method.

Specified by:
getPName in interface PBinding
Returns:
The PName associated to this binding.

getStatus

public byte getStatus()
Description copied from interface: PBinding
It yields the current status associated with this PBinding.

Specified by:
getStatus in interface PBinding
Returns:
The corresponding status.

setPName

public void setPName(PName pn)
Description copied from interface: PBindingCtrl
It assigns the current PName associated with this PBinding.

Specified by:
setPName in interface PBindingCtrl

setStatus

public void setStatus(byte s)
Description copied from interface: PBindingCtrl
It assigns the current status associated with this PBinding.

Specified by:
setStatus in interface PBindingCtrl

init

public void init(PClassMapping pcm)
          throws PException
Description copied from interface: PBinding
It initialises a PBinding.

Specified by:
init in interface PBinding
Parameters:
pcm - The PBinding to initialise.
Throws:
PException

read

public void read(java.lang.Object conn,
                 PAccessor pa)
          throws PException
Description copied from interface: PBinding
It reads the data store instance designated by the PName of this binding and transfers each attribute value to the accessor object.

Specified by:
read in interface PBinding
Parameters:
conn - The connection that can be used to refer to the DS.
pa - The PAccessor used to access memory variables.
Throws:
PException

read

public void read(java.lang.Object conn,
                 PAccessor pa,
                 java.lang.Object txctx)
          throws PException
Description copied from interface: PBinding
It reads the data store instance designated by the PName of this binding and transfers each attribute value to the accessor object. This read method should be used when prefetching is requested.

Specified by:
read in interface PBinding
Parameters:
conn - The connection that can be used to refer to the DS.
pa - The PAccessor used to access memory variables.
txctx - The transaction context that can be used in case of prefetching.
Throws:
PException

read

public void read(java.lang.Object conn,
                 PAccessor pa,
                 java.lang.Object txctx,
                 boolean forUpdate)
          throws PException
Specified by:
read in interface PBinding
Throws:
PException

unbind

public void unbind()
            throws PException
Description copied from interface: PBinding
It remove the association between a PName and a PBinding. No more PName is associated with this binding (it has no more link with a DSI).

Specified by:
unbind in interface PBinding
Throws:
PException

unexport

public void unexport(java.lang.Object conn)
              throws PException
Description copied from interface: PBinding
It prepares this PBinding to remove the data store instance from the data store. In order to actually remove this DSI, a call to write must follow.

Specified by:
unexport in interface PBinding
Parameters:
conn - The connection that can be used to refer to the DS.
Throws:
PException

write

public void write(java.lang.Object conn,
                  PAccessor pa)
           throws PException
Description copied from interface: PBinding
It transfers each attribute value taken from the PAccessor object to the data store instance designated by the PName associated with this binding.

Specified by:
write in interface PBinding
Parameters:
conn - The connection that can be used to refer to the DS.
pa - The PAccessor used to access memory variables.
Throws:
PException