/*
 * JOnAS: Java(TM) Open Application Server
 * Copyright (C) 1999 Bull S.A.
 * Contact: jonas-team@objectweb.org
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id$
 * --------------------------------------------------------------------------
 */


package org.objectweb.jonas_tm;

import java.util.Vector;

/**
 * Log associated to a transaction
 * @author Philippe Durieux
 */
class Log {

    /**
     * Constructor
     */
    public Log() {
	
	TraceTm.debugTm("Log constructor");
    }

    /**
     * add a Resource to the log
     */
    public void addResource(Resource res) {
	ResourceInfo ri = new ResourceInfo(res);
	resourceLogged.addElement(ri);
    }

    /**
     * flush Log with decision about the transaction
     */
    public void flushLog(int decide) {
	
	TraceTm.debugTm("flushLog: "+decide);
	decision = decide;

	// serialize log on disk
	// XXX
    }

    /**
     * forget log
     */
    public void forgetLog() {

	TraceTm.debugTm("forgetLog: ");

	// remove file on disk
	// XXX
    }
	
    /**
     * update log
     */
    public void updateLog() {

	TraceTm.debugTm("updateLog: ");

	// XXX
    }
	
    // Resources registered (Vector of ResourceInfo)
    Vector resourceLogged = new Vector();

    // Decision
    static final int DECISION_TO_COMMIT = 1;
    static final int DECISION_TO_ROLLBACK = 2;
    int decision;

}
