001: /*
002: * @(#) Log.java
003: *
004: * JOTM: Java Open Transaction Manager
005: *
006: *
007: * This module was originally developed by
008: *
009: * - Bull S.A. as part of the JOnAS application server code released in
010: * July 1999 (www.bull.com)
011: *
012: * --------------------------------------------------------------------------
013: * The original code and portions created by Bull SA are
014: * Copyright (c) 1999 BULL SA
015: * All rights reserved.
016: *
017: * Redistribution and use in source and binary forms, with or without
018: * modification, are permitted provided that the following conditions are met:
019: *
020: * -Redistributions of source code must retain the above copyright notice, this
021: * list of conditions and the following disclaimer.
022: *
023: * -Redistributions in binary form must reproduce the above copyright notice,
024: * this list of conditions and the following disclaimer in the documentation
025: * and/or other materials provided with the distribution.
026: *
027: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
028: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
029: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
030: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
031: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
032: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
033: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
034: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
035: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
036: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
037: * POSSIBILITY OF SUCH DAMAGE.
038: *
039: *
040: * --------------------------------------------------------------------------
041: * $Id: Log.java,v 1.11 2003/12/10 20:06:26 trentshue Exp $
042: * --------------------------------------------------------------------------
043: */
044:
045: package org.objectweb.jotm;
046:
047: import java.util.Vector;
048:
049: /**
050: * Log associated to a transaction
051: */
052: class Log {
053:
054: /**
055: * Constructor
056: */
057: public Log() {
058: if (TraceTm.jotm.isDebugEnabled()) {
059: TraceTm.jotm.debug("Log constructor");
060: }
061: }
062:
063: /**
064: * add a Resource to the log
065: */
066: public void addResource(Resource res) {
067: if (TraceTm.jotm.isDebugEnabled()) {
068: TraceTm.jotm.debug("res=" + res);
069: }
070: ResourceInfo ri = new ResourceInfo(res);
071: resourceLogged.addElement(ri);
072: }
073:
074: /**
075: * flush Log with decision about the transaction
076: */
077: public void flushLog(int decide) {
078: if (TraceTm.jotm.isDebugEnabled()) {
079: TraceTm.jotm.debug("decide=" + decide);
080: }
081: decision = decide;
082:
083: // XXX serialize log on disk
084: }
085:
086: /**
087: * forget log
088: */
089: public void forgetLog() {
090: if (TraceTm.jotm.isDebugEnabled()) {
091: TraceTm.jotm.debug("forget log");
092: }
093:
094: // XXX remove file on disk
095: }
096:
097: /**
098: * update log
099: */
100: public void updateLog() {
101: if (TraceTm.jotm.isDebugEnabled()) {
102: TraceTm.jotm.debug("update log");
103: }
104:
105: // XXX update log
106: }
107:
108: // Resources registered (Vector of ResourceInfo)
109: Vector resourceLogged = new Vector();
110:
111: // Decision
112: static final int DECISION_TO_COMMIT = 1;
113: static final int DECISION_TO_ROLLBACK = 2;
114: int decision;
115:
116: }
|