001: /**
002: * Copyright (C) 2001-2005 France Telecom R&D
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2 of the License, or (at your option) any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */package org.objectweb.speedo.genclass;
018:
019: import org.objectweb.jorm.api.PIndexedElem;
020: import org.objectweb.speedo.mim.api.StateItf;
021: import org.objectweb.speedo.pm.api.POManagerItf;
022:
023: import java.io.Serializable;
024:
025: /**
026: * Represents a element of a gen class. It matches to a reference element or
027: * a primitive element.
028: *
029: * @author S.Chassande-Barrioz
030: */
031: public interface GenClassElement extends PIndexedElem, Serializable {
032:
033: /**
034: * @return the index of this gen class element, possibly wrapped in an object.
035: */
036: Object getIndex();
037:
038: /**
039: * Assignes the index of the element of the gen class. It is a user object.
040: * @param index to add, it cannot be null.
041: */
042: void setIndex(Object index);
043:
044: /**
045: * @return the element of the gen class. It is a user object.
046: */
047: Object getElement();
048:
049: /**
050: * Assignes the element of the gen class. It is a user object.
051: * @param element to add, it cannot be null.
052: */
053: void setElement(Object element);
054:
055: /**
056: * @param pm is the persistence manager which permits to resolve the PName
057: * into a java reference.
058: * @return the element of the gen class. The element is a reference
059: * (PersistentObjectItf).
060: */
061: Object getElement(POManagerItf pm);
062:
063: /**
064: * Assignes the jorm status of the PIndexedElement
065: * @param s the new status
066: */
067: void setStatus(byte s);
068:
069: /**
070: * Retrieves the Speedo accessor associated to this gen class element.
071: */
072: StateItf getSpeedoAccessor();
073:
074: /**
075: * In case of the element of the generic class is a persistent class. The
076: * implementation of this method should replace the direct reference to
077: * the persistent object by its identifier (PName). The aim of the
078: * unswizzling feature is to permit to the cache to garbage unused instance.
079: * This unswizzling is done at commit time usualy.
080: */
081: void unSwizzle();
082:
083: /**
084: * When thin lock is enabled (locking managed at genclass element level
085: * instead of at genclass level), this method store the current status of
086: * the genclass element into another variable. This status is in fact the
087: * status of the genclass element during the working set. If the element
088: * is modified, the change(delta) has to be report on the reference state
089: * (cache) at commit time.
090: * @return a byte indicating the retained status
091: */
092: byte retainStatusForMerge();
093:
094: /**
095: * Forget the retained status.
096: * @see #retainStatusForMerge()
097: */
098: void cleanStatusForMerge();
099:
100: /**
101: * @return the retained status
102: * @see #retainStatusForMerge()
103: */
104: byte getStatusForMerge();
105:
106: /**
107: * @return a clone of the current gen class element.
108: */
109: GenClassElement cloneGCE();
110: }
|