/** * Declaration for OctFacet object * * @version a1 Oct 1996 * @author Francis Chan */ public class OctFacet extends OctObject{ // class name and number of fields public static final String className= "OctFacet"; public static final int octFields = 5; // have to figure out provacy granularity public String cell; public String view; public String facet; public int version; //String mode; // takes the value of "r", "w" or "a" public int mode; // changed to take values // READ, WRITE, APPEND instead // OctSystem OctSys; // int port; // hard coding port number in right now!! /** * * Constructor of an OctFacet (for dynamic creation) * @param octCell The OctCell that the object resides in * @param cell The cell which contains this facet * @param view The view of the cell * @param facet The facet of the cell * @param version The version of the cell(should set to OCT.CURRENT_VERSION) * @param mode The mode of the cell (READ, WRITE or APPEND) * */ public OctFacet(OctCell octCell, String cellName, String viewName, String facetName, int version, int mode) { cell = new String(cellName); view = new String(viewName); facet = new String(facetName); this.version = version; this.mode = mode; this.port = octCell.port; this.octCell = octCell; octCell.AddElement(this); // for data backend management OctObjSetup(port, octFields, className); } /*----------------------------------------------------------- * * the code below is for data backend management * *-----------------------------------------------------------*/ /** * Constructor of an OctFacet (for loading from data back-end server) * @param octCell The OctCell that the object resides in */ public OctFacet(OctCell octCell) { this.octCell = octCell; this.port = octCell.port; OctObjSetup(port, octFields, className); // testNoNet = !(octSys.network); } /** * Performs the neccessary overhead to allow this object to be * manipulated over the network */ protected void SetObjFields() { SetField(0, this.cell, PersistentObject.STRING); SetField(1, this.view, PersistentObject.STRING); SetField(2, this.facet, PersistentObject.STRING); SetField(3, this.version, PersistentObject.INT); SetField(4, this.mode, PersistentObject.INT); OctSetField(octFields); // SetField(5, this.mode, PersistentObject.OBJECT); // SetField(6, this.mode, PersistentObject.OBJECT); } /** * Loads the fields of an OctFacet from data back-end * @param objectId The String Id for the object (may not be applicable) * @param intId The integer (unique) Id for the object */ public boolean Load(int intId) { if (LoadObject(this.objectClassName, null, intId) == false) { System.out.println("Couldn't load object " + className + " with intId " + intId); return false; } // sets up paramVector so it's ready for field assignment // this.cell = GetField(0, PersistentObject.STRING_INDICATOR); this.view = GetField(1, PersistentObject.STRING_INDICATOR); this.facet = GetField(2, PersistentObject.STRING_INDICATOR); this.version = GetField(3, PersistentObject.INT_INDICATOR); this.mode = GetField(4, PersistentObject.INT_INDICATOR); OctGetField(octFields); octCell.AddElement(this); OctObjSetup(octCell.port, octFields, className); return succeedTransmit; } /** * Should not be called */ public boolean Load(String strId) { return false; } /** * Does not require filling since the object has no object fields */ protected int GetObjFields() { return OCT.OK; } }