/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001-2006 The Mir-coders group
*
* This file is part of Mir.
*
*
* In addition, as a special exception, The Mir-coders gives permission to link
* the code of this program with any library licensed under the Apache Software License,
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
- * (or with modified versions of the above that use the same license as the above),
* and distribute linked combinations including the two. You must obey the
* GNU General Public License in all respects for all of the code used other than
* the above mentioned libraries. If you modify this file, you may extend this
*/
package mir.producer;
-import java.util.HashMap;
-import java.util.Map;
-
-import mir.log.LoggerWrapper;
+/**
+ * <p>A NodedProducer is the root of a tree of ProducerNodes.</p>
+ *
+ * <p>There used to be a time when there were Producers that weren't
+ * NodedProducers, however they have been phased out.</p>
+ */
public class NodedProducer implements Producer {
private ProducerNode rootNode;
- private String verb;
- private Map baseValues;
private boolean isAborted;
private boolean isFinished;
protected final static String PRODUCER_KEY = "$producer";
- public NodedProducer( ProducerNode aRootNode, String aVerb, Map aBaseValues) {
+ public NodedProducer(ProducerNode aRootNode) {
rootNode = aRootNode;
- verb = aVerb;
- baseValues = aBaseValues;
isAborted = false;
}
- public boolean produce( LoggerWrapper aLogger ) throws ProducerFailure, ProducerExc {
- Map valueMap;
-
- valueMap = new HashMap();
- valueMap.putAll(baseValues);
- valueMap.put(PRODUCER_KEY, this);
-
- rootNode.produce(valueMap, verb, aLogger);
+ public boolean execute(ProductionContext aProductionContext) throws ProducerFailure, ProducerExc {
+ rootNode.produce(aProductionContext);
synchronized(this) {
isFinished=true;
+
return !isAborted;
}
- };
+ }
- public void abort() {
+ public void abort(ProductionContext aContext) {
synchronized(this) {
if (!isFinished)
isAborted=true;
return isAborted;
}
}
-
- public boolean getIsFinished() {
- synchronized(this) {
- return isFinished;
- }
- }
}