org.objectweb.jonas_ejb.container.jorm.GenClassImpl Class Reference

Inherited by org.objectweb.jonas_ejb.container.jorm.Collection, and org.objectweb.jonas_ejb.container.jorm.Set.

Inheritance diagram for org.objectweb.jonas_ejb.container.jorm.GenClassImpl:

Inheritance graph
[legend]
Collaboration diagram for org.objectweb.jonas_ejb.container.jorm.GenClassImpl:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GenClassImpl (PClassMapping gcm)
 GenClassImpl ()
void setPClassMapping (PClassMapping gcm)
void reset ()
void setPBinding (PBinding pb)
PBinding gcGetPBinding ()
void read (PName pn, Object connection) throws PException
void write (PName pn, Object connection) throws PException
Object getMemoryInstance ()
void paAdd (PIndexedElem elem, Object conn) throws PException
PIndexedElem createPIndexedElem ()
boolean paDeltaSupported ()
int paGetNbElem ()
Iterator paIterator ()
void paSetNbElem (int nbelem)
void gcClear (boolean delete)

Protected Member Functions

int gcGetRealIndex (int idx)
void gcAdd (PObject element, boolean callListener)
Object gcRemove (Object element, boolean callListener) throws PException
Iterator gcIterator (Object connection) throws PException
PObject gcGetElement (GenClassElement gce, Object connection) throws PException
PName gcObject2ref (PObject value) throws PException

Protected Attributes

ArrayList pIndexedElems = null
int[] deletedLength = null
int size
boolean isModified = false
PClassMapping gcm = null
PBinding pb = null
GenClassListener listener = null

Detailed Description

This class is a basic implementation of the PGenClassAccessor interface usefull for the multivalued relation.

Author:
S.Chassande-Barrioz

Definition at line 56 of file GenClassImpl.java.


Constructor & Destructor Documentation

org.objectweb.jonas_ejb.container.jorm.GenClassImpl.GenClassImpl PClassMapping  gcm  ) 
 

UNUSED ???

Definition at line 115 of file GenClassImpl.java.

org.objectweb.jonas_ejb.container.jorm.GenClassImpl.GenClassImpl  ) 
 

A GenClassImpl object is created for each Multi-Valued CMR field See JEntityCmp2.vm It starts with an empty list.

Definition at line 125 of file GenClassImpl.java.

References org.objectweb.jonas_ejb.container.jorm.GenClassImpl.deletedLength, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.isModified, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.pIndexedElems, and org.objectweb.jonas_ejb.container.jorm.GenClassImpl.size.


Member Function Documentation

PIndexedElem org.objectweb.jonas_ejb.container.jorm.GenClassImpl.createPIndexedElem  ) 
 

The default implementation of the PIndexedElem is GenClassElement. This method may be redefined for different GenClass implementations.

Reimplemented in org.objectweb.jonas_ejb.container.jorm.Collection.

Definition at line 323 of file GenClassImpl.java.

Referenced by org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcAdd().

void org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcAdd PObject  element,
boolean  callListener
[protected]
 

This method add a new element in the collection. A PIndexedElem is built via the 'createPIndexedElem' method. Then this instance is initialized with the element and the staus specified by the parameter 'status'. Before added the element, a checking is done. If the element was previously removed in the same transaction then the status of the removed element is changed to ELEM_UNMODIFIED. This optimization avoid two useless I/O.

Parameters:
element the object to add
callListener indicates if the gen class listener must be call about this action

Definition at line 400 of file GenClassImpl.java.

References org.objectweb.jonas_ejb.container.jorm.GenClassImpl.createPIndexedElem(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.deletedLength, org.objectweb.jonas_ejb.container.jorm.GenClassListener.gcAdd(), org.objectweb.jonas_ejb.container.jorm.PObject.getPName(), org.objectweb.jonas_ejb.container.jorm.GenClassElement.hasBeenCreated, org.objectweb.jonas_ejb.container.jorm.GenClassListener.isLegalElement(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.isModified, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.listener, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.pIndexedElems, org.objectweb.jonas_ejb.container.jorm.GenClassElement.pname, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.size, org.objectweb.jonas_ejb.container.jorm.GenClassElement.status, and org.objectweb.jonas_ejb.container.jorm.GenClassElement.value.

Here is the call graph for this function:

void org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcClear boolean  delete  ) 
 

Clear the GenClass.

Parameters:
delete true if cascade delete must be checked (ONE - MANY)

Definition at line 631 of file GenClassImpl.java.

References org.objectweb.jonas_ejb.container.jorm.GenClassImpl.deletedLength, org.objectweb.jonas_ejb.container.jorm.GenClassListener.gcRemove(), org.objectweb.jonas_ejb.container.jorm.GenClassElement.hasBeenCreated, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.isModified, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.listener, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.pIndexedElems, org.objectweb.jonas_ejb.container.jorm.GenClassElement.pname, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.size, org.objectweb.jonas_ejb.container.jorm.GenClassElement.status, and org.objectweb.jonas_ejb.container.jorm.GenClassElement.value.

Referenced by org.objectweb.jonas_ejb.container.jorm.Set.clear(), and org.objectweb.jonas_ejb.container.jorm.Collection.clear().

Here is the call graph for this function:

PObject org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcGetElement GenClassElement  gce,
Object  connection
throws PException [protected]
 

It dereferences an element if needed

Parameters:
gce is the PIndexedElem which must be dereferenced
connection a connection to use to resolve the PName. If this parameter is null a new connection is allocate via the mapper. This connection is closed just after its use.
Returns:
a reference to the bean (The local interface in fact).

Definition at line 596 of file GenClassImpl.java.

References org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcm.

Referenced by org.objectweb.jonas_ejb.container.jorm.GenClassImpl.ElementIterator.next().

PBinding org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcGetPBinding  ) 
 

Get the PBinding used for this GenClass Used by JEntityCmp2.vm

Returns:
The PBinding for this GenClass

Definition at line 166 of file GenClassImpl.java.

int org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcGetRealIndex int  idx  )  [protected]
 

This method calculates the real index of an element.

Parameters:
idx the index valid in the colllection
Returns:
an index valid into the 'pIndexedElems' ArrayList.

Definition at line 378 of file GenClassImpl.java.

References org.objectweb.jonas_ejb.container.jorm.GenClassImpl.deletedLength.

Iterator org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcIterator Object  connection  )  throws PException [protected]
 

Parameters:
connection the connection to use during the PName resolving (if it has not already dereferenced).
Returns:
an Iterator over the virtual relations (only the existing elements).

Definition at line 584 of file GenClassImpl.java.

Referenced by org.objectweb.jonas_ejb.container.jorm.Set.toArray(), and org.objectweb.jonas_ejb.container.jorm.Collection.toArray().

PName org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcObject2ref PObject  value  )  throws PException [protected]
 

This method permits to find the PName of an object.

Definition at line 685 of file GenClassImpl.java.

References org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcm.

Object org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcRemove Object  element,
boolean  callListener
throws PException [protected]
 

It removes the first occurence of an element from the relation.

Parameters:
element an element which must be removed
callListener indicates if the gen class listener must be call about this action
Returns:
the remove element

Definition at line 468 of file GenClassImpl.java.

References org.objectweb.jonas_ejb.container.jorm.GenClassImpl.deletedLength, org.objectweb.jonas_ejb.container.jorm.GenClassListener.gcRemove(), org.objectweb.jonas_ejb.container.jorm.GenClassElement.hasBeenCreated, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.isModified, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.listener, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.pIndexedElems, org.objectweb.jonas_ejb.container.jorm.GenClassElement.pname, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.size, org.objectweb.jonas_ejb.container.jorm.GenClassElement.status, and org.objectweb.jonas_ejb.container.jorm.GenClassElement.value.

Referenced by org.objectweb.jonas_ejb.container.jorm.Set.removeAll(), org.objectweb.jonas_ejb.container.jorm.Collection.removeAll(), org.objectweb.jonas_ejb.container.jorm.Set.retainAll(), and org.objectweb.jonas_ejb.container.jorm.Collection.retainAll().

Here is the call graph for this function:

Object org.objectweb.jonas_ejb.container.jorm.GenClassImpl.getMemoryInstance  ) 
 

In most of cases this class is extented to personalize to a collection type. Then an instance of this class is often the real collection.

Definition at line 299 of file GenClassImpl.java.

void org.objectweb.jonas_ejb.container.jorm.GenClassImpl.paAdd PIndexedElem  elem,
Object  conn
throws PException
 

It adds the elements in the list. This method is used by the PBinding to load the data. The elements is added at the end of the 'pIndexedElems' then 'deletedLength' is not impacted.

Definition at line 313 of file GenClassImpl.java.

References org.objectweb.jonas_ejb.container.jorm.GenClassImpl.pIndexedElems, and org.objectweb.jonas_ejb.container.jorm.GenClassImpl.size.

boolean org.objectweb.jonas_ejb.container.jorm.GenClassImpl.paDeltaSupported  ) 
 

This implementation is able to isolate the modification by element of the gen class.

Definition at line 331 of file GenClassImpl.java.

int org.objectweb.jonas_ejb.container.jorm.GenClassImpl.paGetNbElem  ) 
 

This method is used by the PBinding to allocated data structure during a write operation. The returned size must then contains also the deleted elements.

Definition at line 340 of file GenClassImpl.java.

References org.objectweb.jonas_ejb.container.jorm.GenClassImpl.pIndexedElems.

Iterator org.objectweb.jonas_ejb.container.jorm.GenClassImpl.paIterator  ) 
 

This method is used by the PBinding to fetch all PIndexedElem.

Definition at line 347 of file GenClassImpl.java.

References org.objectweb.jonas_ejb.container.jorm.GenClassImpl.pIndexedElems.

void org.objectweb.jonas_ejb.container.jorm.GenClassImpl.paSetNbElem int  nbelem  ) 
 

This method is call in first during a read operation in order to indicate the size of the gen class. if the value is equals to -1 then that means the data support is unable to known the size of the relation in advance. Then the previous size is kept. Otherwise the list is initialized to the specified size.

Definition at line 358 of file GenClassImpl.java.

References org.objectweb.jonas_ejb.container.jorm.GenClassImpl.deletedLength, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.pIndexedElems, and org.objectweb.jonas_ejb.container.jorm.GenClassImpl.size.

void org.objectweb.jonas_ejb.container.jorm.GenClassImpl.read PName  pn,
Object  connection
throws PException
 

It loads the data of the gen class.

Parameters:
pn is the PName of the genclass
connection is a connection to access to the support. If it is null a connection is asked to the mapper and closed after its use.

Definition at line 191 of file GenClassImpl.java.

References org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcm, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.isModified, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.pb, and org.objectweb.jonas_ejb.container.jorm.GenClassImpl.reset().

Here is the call graph for this function:

void org.objectweb.jonas_ejb.container.jorm.GenClassImpl.reset  ) 
 

reset the GenClass to its initial state.

Definition at line 145 of file GenClassImpl.java.

References org.objectweb.jonas_ejb.container.jorm.GenClassImpl.deletedLength, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.isModified, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.pIndexedElems, and org.objectweb.jonas_ejb.container.jorm.GenClassImpl.size.

Referenced by org.objectweb.jonas_ejb.container.jorm.GenClassImpl.read().

void org.objectweb.jonas_ejb.container.jorm.GenClassImpl.setPBinding PBinding  pb  ) 
 

Set the PBinding that will be used for this GenClass Used by JEntityCmp2.vm

Parameters:
pb The PBinding for this GenClass

Definition at line 157 of file GenClassImpl.java.

void org.objectweb.jonas_ejb.container.jorm.GenClassImpl.setPClassMapping PClassMapping  gcm  ) 
 

Set the PClassMapping for this GenClass. It's needed to get Connections for read and write operations. Used by JEntityCmp2.vm

Parameters:
gcm the PClassMapping

Definition at line 138 of file GenClassImpl.java.

void org.objectweb.jonas_ejb.container.jorm.GenClassImpl.write PName  pn,
Object  connection
throws PException
 

It writes the data of the gen class if it was modified (see the field isModified).

Parameters:
pn is the PName of the genclass
connection is a connection to access to the support. If it is null a connection is asked to the mapper and closed after its use.

Definition at line 223 of file GenClassImpl.java.

References org.objectweb.jonas_ejb.container.jorm.GenClassImpl.deletedLength, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcm, org.objectweb.jonas_ejb.container.jorm.GenClassElement.hasBeenCreated, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.isModified, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.pb, org.objectweb.jonas_ejb.container.jorm.GenClassImpl.pIndexedElems, and org.objectweb.jonas_ejb.container.jorm.GenClassElement.status.


Member Data Documentation

int [] org.objectweb.jonas_ejb.container.jorm.GenClassImpl.deletedLength = null [protected]
 

This array represents the distance between two deleted elements in the pIndexedElems arraylist. O means there is no element in the middle. The first element is in fact the quantity of existing element before the first deleted element. The size of this array is also the quantity of deleted elements. Then if the array is empty there is no deleted elements.

for example: if this fields is equals to [3, 2] then the elements whith the index 3 and 6 are marked as deleted: [a, b, c, D, d, e, D, ....]

This array is useless to convert an index valid inside the user/virtual collection to an index valid inside the 'pIndexedElems' ArrayList.

Definition at line 78 of file GenClassImpl.java.

Referenced by org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcAdd(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcClear(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcGetRealIndex(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcRemove(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.GenClassImpl(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.paSetNbElem(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.reset(), and org.objectweb.jonas_ejb.container.jorm.GenClassImpl.write().

PClassMapping org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcm = null [protected]
 

This field references the PClassMapping which manages the persistency of this GenClass. (xxxGCM.java) This is actually a GenClassMapping, returned by the bean Factory (PClassMapping)

Definition at line 97 of file GenClassImpl.java.

Referenced by org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcGetElement(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcObject2ref(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.read(), and org.objectweb.jonas_ejb.container.jorm.GenClassImpl.write().

boolean org.objectweb.jonas_ejb.container.jorm.GenClassImpl.isModified = false [protected]
 

true when GenClass has been modified and must be written

Definition at line 90 of file GenClassImpl.java.

Referenced by org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcAdd(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcClear(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcRemove(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.GenClassImpl(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.read(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.reset(), and org.objectweb.jonas_ejb.container.jorm.GenClassImpl.write().

GenClassListener org.objectweb.jonas_ejb.container.jorm.GenClassImpl.listener = null [protected]
 

All the actions are send to this listener. There is 1 Listener for each GenClass, i.e. for each multi-valued CMR field. (See JEntityCmp2.vm) Used mainly for coherence.

Definition at line 110 of file GenClassImpl.java.

Referenced by org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcAdd(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcClear(), and org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcRemove().

PBinding org.objectweb.jonas_ejb.container.jorm.GenClassImpl.pb = null [protected]
 

This fields is the PBinding associated to this instance.

Definition at line 102 of file GenClassImpl.java.

Referenced by org.objectweb.jonas_ejb.container.jorm.GenClassImpl.read(), and org.objectweb.jonas_ejb.container.jorm.GenClassImpl.write().

ArrayList org.objectweb.jonas_ejb.container.jorm.GenClassImpl.pIndexedElems = null [protected]
 

All elements of the gen class (unmodified, modified, created, deleted) This ArrayList contains GenClassElem objects

Definition at line 62 of file GenClassImpl.java.

Referenced by org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcAdd(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcClear(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcRemove(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.GenClassImpl(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.paAdd(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.paGetNbElem(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.paIterator(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.paSetNbElem(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.reset(), and org.objectweb.jonas_ejb.container.jorm.GenClassImpl.write().

int org.objectweb.jonas_ejb.container.jorm.GenClassImpl.size [protected]
 

This is the size of the relation. This field is equal to the pIndexedElems size minus the quantity of deleted element. The value is always right and is updated during each delete or create action.

Definition at line 85 of file GenClassImpl.java.

Referenced by org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcAdd(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcClear(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.gcRemove(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.GenClassImpl(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.paAdd(), org.objectweb.jonas_ejb.container.jorm.GenClassImpl.paSetNbElem(), and org.objectweb.jonas_ejb.container.jorm.GenClassImpl.reset().


The documentation for this class was generated from the following file:
Generated on Tue Feb 15 15:10:59 2005 for JOnAS by  doxygen 1.3.9.1