Commit in java/trunk/record-util/src on MAIN
main/java/org/hps/record/EndRunException.java+1-4947 -> 948
main/java/org/hps/record/composite/CompositeEtAdapter.java+65added 948
                                  /CompositeEvioAdapter.java+160added 948
                                  /CompositeLcioAdapter.java+86added 948
                                  /CompositeLoop.java+21-18947 -> 948
                                  /CompositeLoopAdapter.java+5-13947 -> 948
                                  /CompositeSource.java+3947 -> 948
main/java/org/hps/record/et/EtAdapter.java+6-1947 -> 948
                           /EtConnection.java+120-4947 -> 948
main/java/org/hps/record/processing/EtProcessingStep.java-57947 removed
                                   /EvioEndEventProcessor.java-25947 removed
                                   /EvioProcessingStep.java-146947 removed
                                   /LcioProcessingStep.java-128947 removed
                                   /MaxRecordsProcessor.java+1947 -> 948
                                   /ProcessingChain.java+76-80947 -> 948
                                   /ProcessingConfiguration.java+2947 -> 948
                                   /ProcessingThread.java+4-1947 -> 948
test/java/org/hps/record/processing/ProcessingChainTest.java-81947 removed
+550-558
3 added + 5 removed + 10 modified, total 18 files
Add simplified record processing API for use in monitoring application.  Remove a few classes that are replaced.

java/trunk/record-util/src/main/java/org/hps/record
EndRunException.java 947 -> 948
--- java/trunk/record-util/src/main/java/org/hps/record/EndRunException.java	2014-09-03 21:00:22 UTC (rev 947)
+++ java/trunk/record-util/src/main/java/org/hps/record/EndRunException.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -1,12 +1,9 @@
 package org.hps.record;
 
-import java.io.IOException;
-
 /**
  * An Exception thrown when an end run occurs.
  */
-// TODO: Add run number to this class.
-public class EndRunException extends IOException {
+public class EndRunException extends RuntimeException {
     
     int runNumber;
     

java/trunk/record-util/src/main/java/org/hps/record/composite
CompositeEtAdapter.java added at 948
--- java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeEtAdapter.java	                        (rev 0)
+++ java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeEtAdapter.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -0,0 +1,65 @@
+package org.hps.record.composite;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.freehep.record.loop.LoopEvent;
+import org.freehep.record.loop.RecordEvent;
+import org.freehep.record.source.NoSuchRecordException;
+import org.hps.record.RecordProcessingException;
+import org.hps.record.et.EtProcessor;
+import org.hps.record.et.EtSource;
+import org.jlab.coda.et.EtEvent;
+
+/**
+ * An adapter for directly using the CompositeLoop to supply and process EtEvents.
+ */
+public class CompositeEtAdapter extends CompositeLoopAdapter {
+
+    EtSource source;
+    List<EtProcessor> processors = new ArrayList<EtProcessor>();
+    
+    public CompositeEtAdapter(EtSource source) {
+        this.source = source;
+    }
+    
+    public void addProcessor(EtProcessor processor) {
+        processors.add(processor);
+    }
+    
+    public void process(EtEvent event) {
+        for (EtProcessor processor : processors) {
+            processor.process(event);
+        }
+    }
+    
+    public void finish(LoopEvent event) {
+        for (EtProcessor processor : processors) {
+            processor.endJob();
+        }
+    }
+    
+    public void start(LoopEvent event) {
+        for (EtProcessor processor : processors) {
+            processor.startJob();
+        }
+    }
+    
+    public void recordSupplied(RecordEvent record) {
+        //System.out.println("CompositeEtAdapter.recordSupplied");
+        System.out.flush();
+        CompositeRecord compositeRecord = (CompositeRecord) record.getRecord();
+        try {
+            source.next();
+            if (source.getCurrentRecord() != null) {
+                compositeRecord.setEtEvent((EtEvent) source.getCurrentRecord());                
+            } else {
+                throw new NoSuchRecordException("No ET current record available from EtSource.");
+            }            
+            process(compositeRecord.getEtEvent());
+        } catch (IOException | NoSuchRecordException e) {
+            throw new RecordProcessingException("Error getting next ET record.", e);
+        }
+    }
+}

java/trunk/record-util/src/main/java/org/hps/record/composite
CompositeEvioAdapter.java added at 948
--- java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeEvioAdapter.java	                        (rev 0)
+++ java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeEvioAdapter.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -0,0 +1,160 @@
+package org.hps.record.composite;
+
+import java.io.IOException;
+import java.nio.BufferUnderflowException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.freehep.record.loop.LoopEvent;
+import org.freehep.record.loop.RecordEvent;
+import org.freehep.record.source.AbstractRecordSource;
+import org.freehep.record.source.NoSuchRecordException;
+import org.hps.evio.EventConstants;
+import org.hps.record.EndRunException;
+import org.hps.record.RecordProcessingException;
+import org.hps.record.evio.EvioProcessor;
+import org.jlab.coda.et.EtEvent;
+import org.jlab.coda.jevio.BaseStructure;
+import org.jlab.coda.jevio.EvioEvent;
+import org.jlab.coda.jevio.EvioException;
+import org.jlab.coda.jevio.EvioReader;
+
+/**
+ * An adapter for directly using the CompositeLoop to supply and process EvioEvents.
+ */
+public class CompositeEvioAdapter extends CompositeLoopAdapter {
+    
+    AbstractRecordSource source;
+    List<EvioProcessor> processors = new ArrayList<EvioProcessor>();
+    boolean stopOnEndRun = true;
+       
+    public CompositeEvioAdapter(AbstractRecordSource source) {
+        this.source = source;
+    }
+    
+    public CompositeEvioAdapter() {
+    }
+    
+    public void addProcessor(EvioProcessor processor) {
+        processors.add(processor);
+    }
+    
+    public void setStopOnEndRun(boolean stopOnEndRun) {
+        this.stopOnEndRun = stopOnEndRun;
+    }
+    
+    public void recordSupplied(RecordEvent record) {
+        //System.out.println("CompositeEvioAdapter.recordSupplied");
+        System.out.flush();
+        CompositeRecord compositeRecord = (CompositeRecord) record.getRecord();
+        try {
+            EvioEvent evioEvent;
+            // Using ET system?
+            if (compositeRecord.getEtEvent() != null) {
+                try {
+                    // Create EVIO from ET byte buffer.
+                    evioEvent = createEvioEvent(compositeRecord.getEtEvent());
+                } catch (BufferUnderflowException | EvioException e) {
+                    // There was a problem creating EVIO from ET.
+                    throw new RecordProcessingException("Failed to create EvioEvent from EtEvent.", e);
+                }
+            } else {
+                // Load the next record from the EVIO record source. 
+                source.next();                
+                evioEvent = (EvioEvent)source.getCurrentRecord();
+            }
+            // Failed to create an EvioEvent?
+            if (evioEvent == null) {
+                throw new NoSuchRecordException("Failed to get next EVIO record.");
+            }
+            
+            // Set event number on the EvioEvent.
+            setEventNumber(evioEvent);
+            
+            // Is pre start event?
+            if (EventConstants.isPreStartEvent(evioEvent)) {
+                // Activate start of run hook on processors.
+                startRun(evioEvent);
+            // Is end run event?
+            } else if (EventConstants.isEndEvent(evioEvent)) {
+                // Activate end of run hook on processors.
+                endRun(evioEvent);
+                
+                // Stop on end run enabled?
+                if (stopOnEndRun) {
+                    throw new EndRunException("EVIO end event received.", evioEvent.getIntData()[1]);
+                }             
+            // Is physics event?
+            } else if (EventConstants.isPhysicsEvent(evioEvent)) {
+                // Process a single physics EvioEvent.
+                process(evioEvent);
+            }
+            
+            // Set EvioEvent on CompositeRecord.
+            compositeRecord.setEvioEvent(evioEvent);
+        } catch (IOException | NoSuchRecordException e) {
+            throw new RecordProcessingException("No next EVIO record available from source.", e);
+        }  
+    }
+    
+    void process(EvioEvent event) {
+        for (EvioProcessor processor : processors) {
+            processor.process(event);
+        }
+    }
+    
+    void startRun(EvioEvent event) {
+        for (EvioProcessor processor : processors) {
+            processor.startRun(event);
+        }
+    }
+    
+    void endRun(EvioEvent event) {
+        for (EvioProcessor processor : processors) {
+            processor.endRun(event);
+        }
+    }     
+        
+    public void finish(LoopEvent event) {
+        for (EvioProcessor processor : processors) {
+            processor.endJob();
+        }
+    }
+    
+    public void start(LoopEvent event) {
+        for (EvioProcessor processor : processors) {
+            processor.startJob();
+        }
+    }    
+    
+    /**
+     * Create an EvioEvent from an EtEvent byte buffer.
+     * @param etEvent The input EtEvent.
+     * @return The EvioEvent created from the EtEvent.
+     * @throws IOException
+     * @throws EvioException
+     * @throws BufferUnderflowException
+     */
+    private EvioEvent createEvioEvent(EtEvent etEvent) 
+            throws IOException, EvioException, BufferUnderflowException {
+        return (new EvioReader(etEvent.getDataBuffer())).parseNextEvent();
+    }    
+    
+    /**
+     * Set the EVIO event number manually from the event ID bank.
+     * @param evioEvent The <tt>EvioEvent</tt> on which to set the event number.
+     */
+    private void setEventNumber(EvioEvent evioEvent) {
+        int eventNumber = -1;
+        if (evioEvent.getChildren() != null) {
+            for (BaseStructure bank : evioEvent.getChildren()) {
+                if (bank.getHeader().getTag() == EventConstants.EVENTID_BANK_TAG) {
+                    eventNumber = bank.getIntData()[0];
+                    break;
+                }
+            }
+        }
+        if (eventNumber != -1)
+            evioEvent.setEventNumber(eventNumber);
+    }   
+}

java/trunk/record-util/src/main/java/org/hps/record/composite
CompositeLcioAdapter.java added at 948
--- java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeLcioAdapter.java	                        (rev 0)
+++ java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeLcioAdapter.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -0,0 +1,86 @@
+package org.hps.record.composite;
+
+import java.io.IOException;
+
+import org.freehep.record.loop.LoopEvent;
+import org.freehep.record.loop.RecordEvent;
+import org.freehep.record.source.AbstractRecordSource;
+import org.freehep.record.source.NoSuchRecordException;
+import org.hps.evio.EventConstants;
+import org.hps.evio.LCSimEventBuilder;
+import org.hps.record.RecordProcessingException;
+import org.jlab.coda.jevio.EvioEvent;
+import org.lcsim.event.EventHeader;
+import org.lcsim.util.Driver;
+import org.lcsim.util.DriverAdapter;
+
+/**
+ * An adapter to supply and process LCSim EventHeader objects using 
+ * an (optional) LCSimEventBuilder and the existing DriverAdapter class.
+ */
+public class CompositeLcioAdapter extends CompositeLoopAdapter {
+
+    DriverAdapter drivers;
+    Driver top = new Driver();
+    LCSimEventBuilder builder;
+    AbstractRecordSource source;
+
+    public CompositeLcioAdapter(AbstractRecordSource source) {
+        this.source = source;
+        drivers = new DriverAdapter(top);
+    }
+
+    public CompositeLcioAdapter() {
+        drivers = new DriverAdapter(top);
+    }
+
+    public void addDriver(Driver driver) {
+        top.add(driver);
+    }
+
+    public void setLCSimEventBuilder(LCSimEventBuilder builder) {
+        this.builder = builder;
+    }
+
+    public void recordSupplied(RecordEvent record) {
+        //System.out.println("CompositeLcioAdapter.recordSupplied");
+        System.out.flush();
+        CompositeRecord compositeRecord = (CompositeRecord) record.getRecord();
+        EventHeader lcioEvent = null;
+        try {
+            // Is there an EVIO event?
+            if (compositeRecord.getEvioEvent() != null) {
+                // Create the EVIO event.
+                EvioEvent evioEvent = compositeRecord.getEvioEvent();
+                // Is this a physics EvioEvent?
+                if (EventConstants.isPhysicsEvent(evioEvent)) {
+                    // Use the builder to create the LCIO event.
+                    lcioEvent = builder.makeLCSimEvent(compositeRecord.getEvioEvent());
+                } else {
+                    // Non-physics events are ignored.
+                    return;                    
+                }
+            } else {
+                // Try to use an event source to get the next LCIO event.
+                source.next();
+                lcioEvent = (EventHeader) source.getCurrentRecord();
+            }
+            
+            // Supply the EventHeader to the DriverAdapter.
+            RecordEvent recordEvent = new RecordEvent(null, lcioEvent);
+            drivers.recordSupplied(recordEvent);
+            
+            compositeRecord.setLcioEvent(lcioEvent);
+        } catch (IOException | NoSuchRecordException e) {
+            throw new RecordProcessingException("Error creating LCIO event.", e);
+        }
+    }
+
+    public void finish(LoopEvent loopEvent) {
+        drivers.finish(loopEvent);
+    }
+
+    public void start(LoopEvent loopEvent) {
+        drivers.start(loopEvent);
+    }
+}

java/trunk/record-util/src/main/java/org/hps/record/composite
CompositeLoop.java 947 -> 948
--- java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeLoop.java	2014-09-03 21:00:22 UTC (rev 947)
+++ java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeLoop.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -1,6 +1,11 @@
 package org.hps.record.composite;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.freehep.record.loop.DefaultRecordLoop;
+import org.freehep.record.loop.RecordEvent;
+import org.freehep.record.loop.RecordListener;
 import org.freehep.record.source.NoSuchRecordException;
 import org.freehep.record.source.RecordSource;
 import org.hps.record.EndRunException;
@@ -14,20 +19,24 @@
 public final class CompositeLoop extends DefaultRecordLoop {
 
     CompositeSource recordSource = new CompositeSource();
-    CompositeLoopAdapter adapter = new CompositeLoopAdapter();
-    
+            
     boolean stopOnErrors = true;
     boolean done = false;
     
+    List<CompositeLoopAdapter> adapters = new ArrayList<CompositeLoopAdapter>();
+            
     public CompositeLoop() {
         setRecordSource(recordSource);
-        addLoopListener(adapter);
-        addRecordListener(adapter);
     }
     
     public void setStopOnErrors(boolean stopOnErrors) {
         this.stopOnErrors = stopOnErrors;
     }
+    
+    public void addAdapter(CompositeLoopAdapter adapter) {
+        addLoopListener(adapter);
+        addRecordListener(adapter);
+    }
         
     /**
      * Set the <code>RecordSource</code> which provides <code>CompositeRecord</code> objects.
@@ -38,23 +47,16 @@
         }        
         super.setRecordSource(source);
     }
-    
+                
     /**
-     * Add a <code>CompositeRecordProcessor</code> which will receive <code>CompositeRecord</code>
-     * objects.
-     * @param processor The <code>CompositeRecordProcessor</code> to add.
-     */
-    public void addProcessor(CompositeProcessor processor) {
-        adapter.addProcessor(processor);
-    }
-            
-    /**
      * Handle errors in the client such as adapters.
      * If the loop is setup to try and continue on errors, 
      * only non-fatal record processing exceptions are ignored.
      */
     protected void handleClientError(Throwable x) {      
-                
+        
+        x.printStackTrace();
+        
         // Is the error ignorable?
         if (isIgnorable(x)) {
             // Ignore the error!
@@ -70,7 +72,9 @@
     }
 
     protected void handleSourceError(Throwable x) {
-                
+
+        x.printStackTrace();
+
         // Is the error ignorable?
         if (isIgnorable(x)) {
             // Ignore the error!
@@ -128,5 +132,4 @@
     public Throwable getLastError() {
         return _exception;
     }
-}
- 
\ No newline at end of file
+}
\ No newline at end of file

java/trunk/record-util/src/main/java/org/hps/record/composite
CompositeLoopAdapter.java 947 -> 948
--- java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeLoopAdapter.java	2014-09-03 21:00:22 UTC (rev 947)
+++ java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeLoopAdapter.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -12,7 +12,7 @@
 /**
  * Adapter for listening on the {@link CompositeLoop} for records and loop events.
  */
-public final class CompositeLoopAdapter extends AbstractLoopListener implements RecordListener {
+public class CompositeLoopAdapter extends AbstractLoopListener implements RecordListener {
 
     List<CompositeProcessor> processors = new ArrayList<CompositeProcessor>();
 
@@ -20,7 +20,7 @@
      * Add a <tt>CompositeRecordProcessor</tt> that will listen to this loop.
      * @param processor The composite record processor to add.
      */
-    void addProcessor(CompositeProcessor processor) {
+    public void addProcessor(CompositeProcessor processor) {
         processors.add(processor);
     }
     
@@ -45,23 +45,15 @@
             processor.startJob();
         }
     }
-    
+            
     /**
-     * Suspend the loop.
-     * @param loopEvent
-     */
-    public void suspend(LoopEvent loopEvent) { 
-        if (loopEvent.getException() != null) {
-            loopEvent.getException().printStackTrace();
-        }
-    }
-        
-    /**
      * Process one record.
      * @param record 
      */
     @Override
     public void recordSupplied(RecordEvent record) {
+        System.out.println("CompositeLoopAdapter.recordSupplied");
+        System.out.flush();
         for (CompositeProcessor processor : processors) {
             try {
                 // Activate the processing step on the CompositeRecord.

java/trunk/record-util/src/main/java/org/hps/record/composite
CompositeSource.java 947 -> 948
--- java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeSource.java	2014-09-03 21:00:22 UTC (rev 947)
+++ java/trunk/record-util/src/main/java/org/hps/record/composite/CompositeSource.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -14,6 +14,9 @@
     int sequenceNumber = 1;
             
     public void next() throws IOException, NoSuchRecordException {
+        //System.out.println("CompositeSource.next");
+        //System.out.println("  record #" + sequenceNumber);
+        //System.out.flush();
         currentRecord = new CompositeRecord();
         currentRecord.setSequenceNumber(sequenceNumber);
         ++sequenceNumber;

java/trunk/record-util/src/main/java/org/hps/record/et
EtAdapter.java 947 -> 948
--- java/trunk/record-util/src/main/java/org/hps/record/et/EtAdapter.java	2014-09-03 21:00:22 UTC (rev 947)
+++ java/trunk/record-util/src/main/java/org/hps/record/et/EtAdapter.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -32,8 +32,13 @@
     
     @Override
     public void suspend(LoopEvent event) {
-        if (event.getException() != null)
+        if (event.getException() != null) {
             throw new RecordProcessingException("ET system error.", event.getException());
+            //System.out.println("DEBUG");
+            //System.out.println("ET system error...");
+            //event.getException().printStackTrace();
+            //System.exit(1);
+        }
     }
     
     @Override

java/trunk/record-util/src/main/java/org/hps/record/et
EtConnection.java 947 -> 948
--- java/trunk/record-util/src/main/java/org/hps/record/et/EtConnection.java	2014-09-03 21:00:22 UTC (rev 947)
+++ java/trunk/record-util/src/main/java/org/hps/record/et/EtConnection.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -3,9 +3,12 @@
 import java.io.IOException;
 
 import org.jlab.coda.et.EtAttachment;
+import org.jlab.coda.et.EtConstants;
 import org.jlab.coda.et.EtEvent;
 import org.jlab.coda.et.EtStation;
+import org.jlab.coda.et.EtStationConfig;
 import org.jlab.coda.et.EtSystem;
+import org.jlab.coda.et.EtSystemOpenConfig;
 import org.jlab.coda.et.enums.Mode;
 import org.jlab.coda.et.enums.Modify;
 import org.jlab.coda.et.exception.EtBusyException;
@@ -13,7 +16,9 @@
 import org.jlab.coda.et.exception.EtDeadException;
 import org.jlab.coda.et.exception.EtEmptyException;
 import org.jlab.coda.et.exception.EtException;
+import org.jlab.coda.et.exception.EtExistsException;
 import org.jlab.coda.et.exception.EtTimeoutException;
+import org.jlab.coda.et.exception.EtTooManyException;
 import org.jlab.coda.et.exception.EtWakeUpException;
 
 /**
@@ -36,8 +41,13 @@
      * @param att The ET attachment.
      * @param stat The ET station.
      */
-    public EtConnection(EtSystem sys, EtAttachment att, EtStation stat, 
-            Mode waitMode, int waitTime, int chunkSize) {
+    public EtConnection(
+            EtSystem sys, 
+            EtAttachment att, 
+            EtStation stat, 
+            Mode waitMode, 
+            int waitTime, 
+            int chunkSize) {
         this.sys = sys;
         this.att = att;
         this.stat = stat;
@@ -110,7 +120,113 @@
             waitMode,
             Modify.NOTHING,
             waitTime,
-            chunkSize);
-        
+            chunkSize);        
     }     
+    
+    /**
+     * Create an EtConnection with full list of configuration parameters.
+     * @param name The name of the ET system e.g. the buffer file on disk.
+     * @param host The name of the network host.
+     * @param port The port of the network host.
+     * @param blocking True for blocking behavior.
+     * @param queueSize The queue size.
+     * @param prescale The event prescale or 0 for none.
+     * @param stationName The name of the ET station.
+     * @param stationPosition The position of the ET station.
+     * @param waitMode The wait mode.
+     * @param waitTime The wait time if using timed wait.
+     * @param chunkSize The number of ET events to return at once.
+     * @return The EtConnection created from the parameters.
+     */
+    public static EtConnection createConnection(
+            String name,
+            String host,
+            int port,
+            boolean blocking,
+            int queueSize,
+            int prescale,
+            String stationName,
+            int stationPosition,
+            Mode waitMode,
+            int waitTime,
+            int chunkSize) {
+        try {
+            
+            // make a direct connection to ET system's tcp server            
+            EtSystemOpenConfig etConfig = new EtSystemOpenConfig(
+                    name, 
+                    host, 
+                    port);
+
+            // create ET system object with verbose debugging output
+            EtSystem sys = new EtSystem(etConfig, EtConstants.debugInfo);
+            sys.open();
+
+            // configuration of a new station
+            EtStationConfig stationConfig = new EtStationConfig();
+            //statConfig.setFlowMode(cn.flowMode);
+            // FIXME: Flow mode hard-coded.
+            stationConfig.setFlowMode(EtConstants.stationSerial);
+            if (!blocking) {
+                stationConfig.setBlockMode(EtConstants.stationNonBlocking);
+                if (queueSize > 0) {
+                    stationConfig.setCue(queueSize);
+                }
+            }
+            // Set prescale.
+            if (prescale > 0) {
+                //System.out.println("setting prescale to " + cn.prescale);
+                stationConfig.setPrescale(prescale);
+            }
+
+            // Create the station.
+            EtStation stat = sys.createStation(
+                    stationConfig, 
+                    stationName,
+                    stationPosition);
+
+            // attach to new station
+            EtAttachment att = sys.attach(stat);
+
+            // Return new connection.
+            EtConnection connection = new EtConnection(
+                    sys, 
+                    att, 
+                    stat,
+                    waitMode,
+                    waitTime,
+                    chunkSize
+                    );
+            
+            return connection;
+
+        } catch (IOException | 
+                EtException | 
+                EtExistsException | 
+                EtClosedException | 
+                EtDeadException | 
+                EtTooManyException e) {
+            throw new RuntimeException("Failed to create ET connection.", e);
+        }
+    }
+    
+    /**
+     * Create an EtConnection with a set of default parameters.
+     * @return An EtConnection with default parameters.
+     */
+    public static EtConnection createDefaultConnection() {
+        return createConnection(
+                "ETBuffer",
+                "localhost",
+                11111,
+                false,
+                0,
+                0,
+                "MY_STATION",
+                1,
+                Mode.TIMED,
+                5000000,
+                1);                
+    }
+    
 }
\ No newline at end of file

java/trunk/record-util/src/main/java/org/hps/record/processing
EtProcessingStep.java removed after 947
--- java/trunk/record-util/src/main/java/org/hps/record/processing/EtProcessingStep.java	2014-09-03 21:00:22 UTC (rev 947)
+++ java/trunk/record-util/src/main/java/org/hps/record/processing/EtProcessingStep.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -1,57 +0,0 @@
-package org.hps.record.processing;
-
-import static org.freehep.record.loop.RecordLoop.Command.NEXT;
-
-import org.freehep.record.loop.RecordLoop.Command;
-import org.freehep.record.source.NoSuchRecordException;
-import org.hps.record.composite.CompositeRecord;
-import org.hps.record.composite.CompositeProcessor;
-import org.hps.record.et.EtLoop;
-import org.jlab.coda.et.EtEvent;
-
- /**
-  * ET processing step to load an <tt>EtEvent</tt> from the ET ring
-  * using a {@link org.hps.EtLoop.record.etevent.EtEventLoop}.
-  */
-class EtProcessingStep extends CompositeProcessor {
- 
-    EtLoop loop = new EtLoop();
-    
-    EtProcessingStep() {
-    }
-    
-    EtLoop getLoop() {
-        return loop;
-    }
-    
-    public void startJob() {        
-        if (loop == null)
-            throw new RuntimeException();
-    }
-    
-    public void process(CompositeRecord record) throws Exception {
-            
-        // Load the next EtEvent, which calls getEvents() on the ET connection
-        // and feeds records to any loop listeners like status monitors.
-        loop.execute(NEXT);
-        
-        // Did an error occur while getting ET events from the network?
-        if (loop.getErrorState().hasError())
-            // Rethrow the error.
-            loop.getErrorState().rethrow();
-            
-        // Get the current EtEvent from the loop, which should have been cached.
-        EtEvent nextEtEvent = (EtEvent) loop.getRecordSource().getCurrentRecord();
-            
-        // Failed to read an EtEvent from the ET server.
-        if (nextEtEvent == null)
-            throw new NoSuchRecordException("No current EtEvent is available.");
-            
-        // Update the CompositeRecord with reference to the current EtEvent.
-        record.setEtEvent(nextEtEvent);
-     }
-    
-    public void endJob() {
-        loop.execute(Command.STOP);
-    }        
-}
\ No newline at end of file

java/trunk/record-util/src/main/java/org/hps/record/processing
EvioEndEventProcessor.java removed after 947
--- java/trunk/record-util/src/main/java/org/hps/record/processing/EvioEndEventProcessor.java	2014-09-03 21:00:22 UTC (rev 947)
+++ java/trunk/record-util/src/main/java/org/hps/record/processing/EvioEndEventProcessor.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -1,25 +0,0 @@
-package org.hps.record.processing;
-
-import org.hps.evio.EventConstants;
-import org.hps.record.EndRunException;
-import org.hps.record.composite.CompositeRecord;
-import org.hps.record.composite.CompositeProcessor;
-
-/**
- * This is a CompositeRecordProcessor for ending the run when an EVIO
- * end event is received.  It should be placed last in the chain of
- * processors so that all the other registered processors are executed
- * beforehand because it throws an Exception.
- */
-public class EvioEndEventProcessor extends CompositeProcessor {
-    
-    @Override
-    public void process(CompositeRecord event) throws EndRunException {
-        if (event.getEvioEvent() != null)
-            if (EventConstants.isEndEvent(event.getEvioEvent()))
-                throw new EndRunException(
-                        "EVIO end run event received.",
-                        event.getEvioEvent().getIntData()[1]); // FIXME: Is this the right index number in array?
-
-    }
-}

java/trunk/record-util/src/main/java/org/hps/record/processing
EvioProcessingStep.java removed after 947
--- java/trunk/record-util/src/main/java/org/hps/record/processing/EvioProcessingStep.java	2014-09-03 21:00:22 UTC (rev 947)
+++ java/trunk/record-util/src/main/java/org/hps/record/processing/EvioProcessingStep.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -1,146 +0,0 @@
-package org.hps.record.processing;
-
-import static org.freehep.record.loop.RecordLoop.Command.NEXT;
-
-import java.io.IOException;
-import java.nio.BufferUnderflowException;
-
-import org.freehep.record.loop.RecordLoop.Command;
-import org.freehep.record.source.NoSuchRecordException;
-import org.hps.evio.EventConstants;
-import org.hps.record.composite.CompositeRecord;
-import org.hps.record.composite.CompositeProcessor;
-import org.hps.record.evio.EvioLoop;
-import org.hps.record.evio.EvioRecordQueue;
-import org.jlab.coda.et.EtEvent;
-import org.jlab.coda.jevio.BaseStructure;
-import org.jlab.coda.jevio.EvioEvent;
-import org.jlab.coda.jevio.EvioException;
-import org.jlab.coda.jevio.EvioReader;
-
-/**
- * EVIO processing step to build an <tt>EvioEvent</tt> from the <tt>EtEvent</tt>
- * or load the next <tt>EvioEvent</tt> from a file, if using an EVIO file source.
- */
-class EvioProcessingStep extends CompositeProcessor {
-   
-    EvioLoop loop = new EvioLoop();
-    DataSourceType sourceType;
-    EvioRecordQueue evioEventQueue;
-    boolean stopOnEndRun;
-    
-    /**
-     * Get the <tt>EvioEventLoop</tt> associated with this processing step.
-     * @return The <tt>EvioEventLoop</tt> associated with this processing step.
-     */
-    EvioLoop getLoop() {
-        return loop;
-    }
-
-    /**
-     * Set the EVIO event queue.
-     * @param evioEventQueue The EVIO event queue.
-     */
-    void setEvioEventQueue(EvioRecordQueue evioEventQueue) {
-        this.evioEventQueue = evioEventQueue;
-        loop.setRecordSource(this.evioEventQueue);
-    }
-    
-    /**
-     * Set whether an end of run record will throw a control Exception.
-     */
-    void setStopOnEndRun() {
-        stopOnEndRun = true;
-    }
-    
-    /**
-     * Set the <tt>EvioEventLoop</tt> for this processing step.
-     * @param loop The <tt>EvioEventLoop</tt> for this processing step.
-     */
-    void setEvioEventLoop(EvioLoop loop) {
-        this.loop = loop;
-    }
-    
-    /**
-     * Set the type of event source.
-     * @param sourceType The type of event source.
-     */
-    void setSourceType(DataSourceType sourceType) {
-        this.sourceType = sourceType;
-    }
-    
-    /**
-     * Load the next <tt>EvioEvent</tt>, either from a record source
-     * or from the <tt>EtEvent</tt> data.
-     */
-    public void process(CompositeRecord record) throws Exception {
-                
-        if (evioEventQueue != null) {
-            EvioEvent evioEvent = null;
-            try {
-                evioEvent = createEvioEvent(record.getEtEvent());                    
-                if (evioEvent == null)
-                    throw new IOException("Failed to create EvioEvent from current EtEvent.");
-                setEventNumber(evioEvent);
-            } catch (EvioException e) {
-                throw new IOException(e);
-            }
-        
-            // Add EvioEvent to the queue for loop.
-            evioEventQueue.addRecord(evioEvent);
-        }
-
-        // Process one EvioEvent.
-        loop.execute(NEXT);
-        if (loop.getErrorState().hasError())
-            loop.getErrorState().rethrow();
-        
-        EvioEvent nextEvioEvent = (EvioEvent) loop.getRecordSource().getCurrentRecord();
-        
-        // The call to loop did not create a current record.
-        if (nextEvioEvent == null)
-            throw new NoSuchRecordException("No current EVIO event.");
-        
-        // Update the CompositeRecord.
-        record.setEvioEvent(nextEvioEvent);
-        record.setEventNumber(nextEvioEvent.getEventNumber());
-    }
-    
-    /**
-     * Create an <tt>EvioEvent</tt> from the current <tt>EtEvent</tt>.
-     * @param etEvent
-     * @return The created EVIO event.
-     * @throws IOException
-     * @throws EvioException
-     * @throws BufferUnderflowException
-     */
-    private EvioEvent createEvioEvent(EtEvent etEvent) 
-            throws IOException, EvioException, BufferUnderflowException {
-        return (new EvioReader(etEvent.getDataBuffer())).parseNextEvent();
-    }
-    
-    /**
-     * Set the EVIO event number manually from the event ID bank.
-     * @param evioEvent The <tt>EvioEvent</tt> on which to set the event number.
-     */
-    private void setEventNumber(EvioEvent evioEvent) {
-        int eventNumber = -1;
-        if (evioEvent.getChildren() != null) {
-            for (BaseStructure bank : evioEvent.getChildren()) {
-                if (bank.getHeader().getTag() == EventConstants.EVENTID_BANK_TAG) {
-                    eventNumber = bank.getIntData()[0];
-                    break;
-                }
-            }
-        }
-        if (eventNumber != -1)
-            evioEvent.setEventNumber(eventNumber);
-    }
-    
-    /**
-     * End the job by calling stop on the EVIO processing loop.
-     */
-    public void endJob() {
-        this.loop.execute(Command.STOP);
-    }
-}
\ No newline at end of file

java/trunk/record-util/src/main/java/org/hps/record/processing
LcioProcessingStep.java removed after 947
--- java/trunk/record-util/src/main/java/org/hps/record/processing/LcioProcessingStep.java	2014-09-03 21:00:22 UTC (rev 947)
+++ java/trunk/record-util/src/main/java/org/hps/record/processing/LcioProcessingStep.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -1,128 +0,0 @@
-package org.hps.record.processing;
-
-import static org.freehep.record.loop.RecordLoop.Command.NEXT;
-
-import org.freehep.record.loop.RecordLoop;
-import org.freehep.record.loop.RecordLoop.Command;
-import org.freehep.record.source.NoSuchRecordException;
-import org.hps.evio.LCSimEventBuilder;
-import org.hps.record.composite.CompositeRecord;
-import org.hps.record.composite.CompositeProcessor;
-import org.hps.record.lcio.LcioRecordQueue;
-import org.hps.record.lcio.LcioLoop;
-import org.jlab.coda.jevio.EvioEvent;
-import org.lcsim.event.EventHeader;
-import org.lcsim.util.loop.LCSimLoop;
-
-/**
- * Processing step for building LCIO events from EVIO
- * or reading them directly from an input event file.
- */
-class LcioProcessingStep extends CompositeProcessor {
-
-    LcioLoop loop = new LcioLoop();
-    LCSimEventBuilder builder;
-    LcioRecordQueue lcioEventQueue;
-    
-    /**
-     * Get the <code>LcioLoop</code> associated with this processing step.
-     * @return The <code>LcioLoop</code> associated with this processing step.
-     */
-    LCSimLoop getLoop() {
-        return this.loop;
-    }
-        
-    /**
-     * Set the <code>LCSimEventBuilder</code> for converting from EVIO to LCIO.
-     * @param builder The converter for EVIO to LCIO.
-     */
-    void setEventBuilder(LCSimEventBuilder builder) {
-        this.builder = builder;
-    }
-    
-    /**
-     * Set the <code>LcioEventQueue</code> event source, to be used when there
-     * is no direct LCIO record source from a file.
-     * @param lcioEventQueue The <code>LcioEventQueue</code> to be used as a record source.
-     */
-    void setLcioEventQueue(LcioRecordQueue lcioEventQueue) {
-        this.lcioEventQueue = lcioEventQueue;
-        loop.setRecordSource(lcioEventQueue);
-    }
-    
-    /**
-     * Start of job hook.
-     */
-    public void startJob() {
-        if (builder == null)
-            throw new RuntimeException("No LCSimEventBuilder was setup.");
-    }
-    
-    /**
-     * Process a <code>CompositeRecord</code> event by creating an LCIO event
-     * and adding it to the record.
-     */
-    public void process(CompositeRecord record) throws Exception {
-        
-        // When the loop does not have a direct LCIO file source, 
-        // the events need to be built from the EVIO input.
-        if (lcioEventQueue != null) {
-            
-            EvioEvent currentEvioEvent = record.getEvioEvent();
-            
-            // Set state on LCIO event builder.
-            builder.readEvioEvent(currentEvioEvent);
-            
-            // The LCIO event will be built if processing an EVIO physics event.
-            if (builder.isPhysicsEvent(currentEvioEvent)) {
-                
-                // Use the event builder to create the next LCIO event.
-                EventHeader lcioEvent = builder.makeLCSimEvent(currentEvioEvent);
-    
-                // Add LCIO event to the queue.
-                lcioEventQueue.addRecord(lcioEvent);
-            } else {
-                // The LCIO processing ignores non-physics events coming from EVIO.
-                return;
-            }
-        }
-            
-        // Is there a next record?
-        if (!loop.getRecordSource().hasNext())
-            // The next record does not exist.
-            throw new NoSuchRecordException("No next LCIO event.");
-        
-        // Load the next LCIO event, triggering Driver process methods.
-        loop.execute(NEXT);
-        
-        // Did an error occur?
-        if (loop.getErrorState().hasError())
-            // Rethrow any record processing errors that occurred so the top-level loop can handle properly.
-            loop.getErrorState().rethrow();
-            
-        // Is there a current record?
-        if (loop.getRecordSource().getCurrentRecord() == null) {
-            // The last call to the loop did not create a current record.
-            throw new NoSuchRecordException("No current LCIO event.");
-        }
-        
-        // Get the current LCIO event.
-        EventHeader lcioEvent = (EventHeader) loop.getRecordSource().getCurrentRecord();
-                
-        // Update the CompositeRecord with a reference to the LCIO event.
-        record.setLcioEvent(lcioEvent);
-        // Was there an EVIO event set?
-        if (record.getEvioEvent() == null) {
-            // Set event number from LCIO if no EVIO event was set.
-            record.setEventNumber(lcioEvent.getEventNumber());
-        }
-    }
-    
-    /**
-     * End of job hook.
-     */
-    public void endJob() {
-        // Execute STOP on the LCIO record loop.
-        loop.execute(Command.STOP);
-    }
-}
\ No newline at end of file

java/trunk/record-util/src/main/java/org/hps/record/processing
MaxRecordsProcessor.java 947 -> 948
--- java/trunk/record-util/src/main/java/org/hps/record/processing/MaxRecordsProcessor.java	2014-09-03 21:00:22 UTC (rev 947)
+++ java/trunk/record-util/src/main/java/org/hps/record/processing/MaxRecordsProcessor.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -9,6 +9,7 @@
  * A @{link CompositeProcessor} for throwing an error when the 
  * maximum number of records is reached or exceeded.
  */
+// TODO: Handle max record counting in CompositeRecordAdapter.
 public class MaxRecordsProcessor extends CompositeProcessor {
     
     int maxRecords;

java/trunk/record-util/src/main/java/org/hps/record/processing
ProcessingChain.java 947 -> 948
--- java/trunk/record-util/src/main/java/org/hps/record/processing/ProcessingChain.java	2014-09-03 21:00:22 UTC (rev 947)
+++ java/trunk/record-util/src/main/java/org/hps/record/processing/ProcessingChain.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -4,16 +4,20 @@
 import java.io.IOException;
 
 import org.freehep.record.loop.RecordLoop.Command;
+import org.hps.record.composite.CompositeEtAdapter;
+import org.hps.record.composite.CompositeEvioAdapter;
+import org.hps.record.composite.CompositeLcioAdapter;
 import org.hps.record.composite.CompositeLoop;
+import org.hps.record.composite.CompositeLoopAdapter;
 import org.hps.record.composite.CompositeProcessor;
 import org.hps.record.et.EtProcessor;
 import org.hps.record.et.EtSource;
 import org.hps.record.evio.EvioFileSource;
 import org.hps.record.evio.EvioProcessor;
-import org.hps.record.evio.EvioRecordQueue;
-import org.hps.record.lcio.LcioRecordQueue;
+import org.lcsim.conditions.ConditionsManager;
 import org.lcsim.util.Driver;
 import org.lcsim.util.loop.LCIOEventSource;
+import org.lcsim.util.loop.LCSimConditionsManagerImplementation;
 
 /**
  * This class provides a serial implementation of the event processing chain
@@ -29,16 +33,18 @@
  * can be registered with the three different loops for processing the different 
  * record types, in order to plot, update a GUI component, or analyze the events.
  */
+// TODO: Replace the short loop control methods with direct calls to loop in code using this class.
 public class ProcessingChain {
                     
-    protected boolean paused;
-    protected int maxRecords = -1;
+    boolean paused;
+    int maxRecords = -1;
     
-    protected EtProcessingStep etStep = new EtProcessingStep();
-    protected EvioProcessingStep evioStep = new EvioProcessingStep();
-    protected LcioProcessingStep lcioStep = new LcioProcessingStep();
-    protected CompositeLoop compositeLoop = new CompositeLoop();
-                  
+    CompositeLoop compositeLoop = new CompositeLoop();
+    CompositeEtAdapter etAdapter;
+    CompositeEvioAdapter evioAdapter;
+    CompositeLcioAdapter lcioAdapter;
+    CompositeLoopAdapter compositeAdapter;
+                                
     /**
      * A configuration object must be supplied to use this class.
      * @param configuration The configuration of the event processing.
@@ -46,149 +52,135 @@
     public ProcessingChain(ProcessingConfiguration configuration) {                
         configure(configuration);
     }
-
+    
     private void configure(ProcessingConfiguration configuration) {
-                
         // Was there no RecordSource provided explicitly?
         if (configuration.recordSource == null) {
             // Using an ET server connection?
             if (configuration.sourceType.equals(DataSourceType.ET_SERVER)) {
                 if (configuration.connection != null)
-                    etStep.getLoop().setRecordSource(new EtSource(configuration.connection));
+                    etAdapter = new CompositeEtAdapter(new EtSource(configuration.connection));
                 else
                     throw new IllegalArgumentException("Configuration is missing a valid ET connection.");
             // Using an EVIO file?
             } else if (configuration.sourceType.equals(DataSourceType.EVIO_FILE)) {
-                if (configuration.filePath != null)
-                    evioStep.getLoop().setRecordSource(new EvioFileSource(new File(configuration.filePath)));
-                else
+                if (configuration.filePath != null) {
+                    evioAdapter = new CompositeEvioAdapter(new EvioFileSource(new File(configuration.filePath)));
+                } else {
                     throw new IllegalArgumentException("Configuration is missing a file path.");
+                }
             // Using an LCIO file?
             } else if (configuration.sourceType.equals(DataSourceType.LCIO_FILE)) {
                 if (configuration.filePath != null)
                     try {
-                        lcioStep.getLoop().setLCIORecordSource(new LCIOEventSource(new File(configuration.filePath)));
+                        lcioAdapter = new CompositeLcioAdapter(new LCIOEventSource(new File(configuration.filePath)));
                     } catch (IOException e) {
                         throw new RuntimeException("Error configuring LCIOEventSource.", e);
                     }
                 else
                     throw new IllegalArgumentException("Configuration is missing a file path.");
             }
-        } else {           
-            // User provided an EtEventSource?
-            if (configuration.recordSource instanceof EtSource) {
-                etStep.getLoop().setRecordSource((EtSource) configuration.recordSource);
-            // User provided an EvioFileSource?
-            } else if (configuration.recordSource instanceof EvioFileSource) {
-                evioStep.getLoop().setRecordSource((EvioFileSource) configuration.recordSource);
-            // User provided an LCIOEventSource?
-            } else if (configuration.recordSource instanceof LCIOEventSource) {
-                try {
-                    lcioStep.getLoop().setLCIORecordSource((LCIOEventSource)configuration.recordSource);
-                } catch (IOException e) {
-                    throw new RuntimeException("Error setting up LCIORecordSource.", e);
-                }
-            } else {
-                throw new IllegalArgumentException("Unknown RecordSource type was supplied.");
-            }
         }
-                
-        // Using the ET server for events?
+        
+        // Configure ET system.
         if (configuration.sourceType == DataSourceType.ET_SERVER) {
-            // Add the ET event processing step.
-            compositeLoop.addProcessor(etStep);
+            //System.out.println("compositeLoop.addAdapter(etAdapter)");
+            compositeLoop.addAdapter(etAdapter);
         }
-   
-        // Building EVIO events?
+        
+        // Configure EVIO processing.
         if (configuration.processingStage.ordinal() >= ProcessingStage.EVIO.ordinal()) {
-            // Using EVIO event source?
             if (configuration.sourceType.ordinal() <= DataSourceType.EVIO_FILE.ordinal()) {
-                // Using ET event source?
-                if (configuration.sourceType == DataSourceType.ET_SERVER) {
-                    // Use dynamic event queue.
-                    evioStep.setEvioEventQueue(new EvioRecordQueue());
-                }
-                // Add EVIO processing step.
-                compositeLoop.addProcessor(evioStep);
+                if (evioAdapter == null)
+                    evioAdapter = new CompositeEvioAdapter();
+                //System.out.println("compositeLoop.addAdapter(evioAdapter)");
+                compositeLoop.addAdapter(evioAdapter);
             }
         }
         
-        // Building LCIO events?
+        // Configure LCIO processing.
         if (configuration.processingStage.ordinal() >= ProcessingStage.LCIO.ordinal()) {
-            // Set detector on event builder.
-            if (configuration.eventBuilder != null) 
-                configuration.eventBuilder.setDetectorName(configuration.detectorName);
-            else
-                throw new IllegalArgumentException("The eventBuilder was not set in the configuration.");
-            
-            if (configuration.sourceType.ordinal() != DataSourceType.LCIO_FILE.ordinal()) {
-                // Use dynamic event queue.
-                lcioStep.setLcioEventQueue(new LcioRecordQueue());
+            if (lcioAdapter == null)
+                lcioAdapter = new CompositeLcioAdapter();
+            //System.out.println("compositeLoop.addAdapter(lcioAdapter)");
+            compositeLoop.addAdapter(lcioAdapter);
+            if (configuration.eventBuilder != null) {
+                if (configuration.detectorName != null) {
+                    // Is LCSim ConditionsManager installed yet?
+                    if (!ConditionsManager.isSetup())
+                        // Setup LCSim conditions system if not already.
+                        LCSimConditionsManagerImplementation.register();
+                    configuration.eventBuilder.setDetectorName(configuration.detectorName);
+                } else {
+                    throw new IllegalArgumentException("Missing detectorName in configuration.");
+                }
+                lcioAdapter.setLCSimEventBuilder(configuration.eventBuilder);
+            } else {
+                throw new IllegalArgumentException("Missing an LCSimEventBuilder in configuration.");
             }
-            // Set event builder.
-            lcioStep.setEventBuilder(configuration.eventBuilder);
-            
-            // Add LCIO processing step.
-            compositeLoop.addProcessor(lcioStep);
         }
-        
+                                                                                    
         // Set whether to stop on event processing errors.
         compositeLoop.setStopOnErrors(configuration.stopOnErrors);
         
         // Add EtEventProcessors to loop.
         for (EtProcessor processor : configuration.etProcessors) {
-            etStep.getLoop().addEtEventProcessor(processor);
+            etAdapter.addProcessor(processor);
         }
-        
+                
         // Add EvioEventProcessors to loop.
         for (EvioProcessor processor : configuration.evioProcessors) {
-            evioStep.getLoop().addEvioEventProcessor(processor);
+            evioAdapter.addProcessor(processor);
         }
         
         // Add Drivers to loop.
         for (Driver driver : configuration.drivers) {
-            lcioStep.getLoop().add(driver);
+            lcioAdapter.addDriver(driver);
         }
         
+        // Add CompositeLoopAdapter which should execute last.
+        CompositeLoopAdapter compositeAdapter = new CompositeLoopAdapter();
+        //System.out.println("compositeLoop.addAdapter(compositeAdapter)");
+        compositeLoop.addAdapter(compositeAdapter);
+        
         // Add CompositeRecordProcessors to loop.
         for (CompositeProcessor processor : configuration.compositeProcessors) {
-            compositeLoop.addProcessor(processor);
+            compositeAdapter.addProcessor(processor);
         }
-
-        // Stop on end run?
-        if (configuration.stopOnEndRun) {
-            // Add the CompositeRecordProcessor that will throw the EndRunException.
-            compositeLoop.addProcessor(new EvioEndEventProcessor());
-        }
         
         // Max records was set?
         if (configuration.maxRecords != -1) {            
-            compositeLoop.addProcessor(new MaxRecordsProcessor(configuration.maxRecords));
-        }
+            compositeAdapter.addProcessor(new MaxRecordsProcessor(configuration.maxRecords));
+        }         
     }
                                             
     /**
      * Loop over events until processing ends for some reason.
      */
     public void run() {
+        
+        if (ConditionsManager.defaultInstance() == null)
+            LCSimConditionsManagerImplementation.register();
+        
         // Keep looping until the event processing is flagged as done.
         while (true) {
-            // Is the processing unpaused?
+            // Is the processing unpaused?            
             if (!paused) {
-                // Loop until done, error occurs, or pause is requested.
+                // Loop until done, error occurs, or pause is requested.                
                 compositeLoop.execute(Command.GO, true);
                 
                 // Is loop done?
                 if (compositeLoop.isDone()) {
                     // Stop record processing.
                     break;
-                }
+                } 
             }
             try {
                 Thread.sleep(10);
             } catch (InterruptedException e) {
                 e.printStackTrace();
             }
+            //System.out.println("bottom of run loop");
         }
     }
     
@@ -227,5 +219,9 @@
      */
     public void next() {
         compositeLoop.execute(Command.GO_N, 1L, true);
-    }                      
+    }
+    
+    public CompositeLoop getLoop() {
+        return compositeLoop;
+    }
 }
\ No newline at end of file

java/trunk/record-util/src/main/java/org/hps/record/processing
ProcessingConfiguration.java 947 -> 948
--- java/trunk/record-util/src/main/java/org/hps/record/processing/ProcessingConfiguration.java	2014-09-03 21:00:22 UTC (rev 947)
+++ java/trunk/record-util/src/main/java/org/hps/record/processing/ProcessingConfiguration.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -9,6 +9,8 @@
 import org.hps.record.et.EtConnection;
 import org.hps.record.et.EtProcessor;
 import org.hps.record.evio.EvioProcessor;
+import org.hps.record.processing.DataSourceType;
+import org.hps.record.processing.ProcessingStage;
 import org.lcsim.util.Driver;
 
 /**

java/trunk/record-util/src/main/java/org/hps/record/processing
ProcessingThread.java 947 -> 948
--- java/trunk/record-util/src/main/java/org/hps/record/processing/ProcessingThread.java	2014-09-03 21:00:22 UTC (rev 947)
+++ java/trunk/record-util/src/main/java/org/hps/record/processing/ProcessingThread.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -18,10 +18,13 @@
     
     @Override
     public void run() {
-        try {
+        //System.out.println("ProcessingThread.run");
+        try {            
             processing.run();
         } catch (Exception e) {
+            //System.out.println("Exception in ProcessingThread...");
             throw new RuntimeException("Error in event processing.", e);
         } 
+        //System.out.println("ProcessingThread.run - done!");
     }
 }
\ No newline at end of file

java/trunk/record-util/src/test/java/org/hps/record/processing
ProcessingChainTest.java removed after 947
--- java/trunk/record-util/src/test/java/org/hps/record/processing/ProcessingChainTest.java	2014-09-03 21:00:22 UTC (rev 947)
+++ java/trunk/record-util/src/test/java/org/hps/record/processing/ProcessingChainTest.java	2014-09-04 01:31:54 UTC (rev 948)
@@ -1,81 +0,0 @@
-package org.hps.record.processing;
-
-import org.hps.evio.LCSimTestRunEventBuilder;
-import org.hps.record.evio.EvioProcessor;
-import org.hps.record.processing.DataSourceType;
-import org.hps.record.processing.ProcessingChain;
-import org.hps.record.processing.ProcessingConfiguration;
-import org.jlab.coda.jevio.EvioEvent;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.EventHeader.LCMetaData;
-import org.lcsim.util.Driver;
-
-public class ProcessingChainTest {
-    
-    //static String evioFilePath = "/work/data/hps/hps_001351.evio.0";
-    static String evioFilePath = "/nfs/slac/g/hps3/data/testrun/runs/evio/hps_001351.evio.0";
-    //static String lcioFilePath = "/work/data/hps/hps_001351.evio.0_recon.slcio";
-    static String lcioFilePath = "/nfs/slac/g/hps3/data/testrun/runs/recon_new/hps_001351.evio.0_recon.slcio";
-    static String detectorName = "HPS-TestRun-v8-5";
-    
-    // ET ring with streaming EVIO file must be running for this to work.
-    /*
-    public void testEtSource() {
-        EventProcessingChain processing = new EventProcessingChain();
-        processing.setRecordSource(new EtEventSource());
-        processing.setEventBuilder(new LCSimTestRunEventBuilder());
-        processing.setDetectorName(detectorName);
-        processing.add(new DummyEvioProcessor());
-        processing.add(new DummyDriver());
-        processing.setStopOnEndRun();
-        processing.configure();
-        processing.loop();
-    }
-    */
-    
-    public void testEvioFile() {
-        
-        ProcessingConfiguration config = new ProcessingConfiguration();
-        config.setDataSourceType(DataSourceType.EVIO_FILE);
-        config.setFilePath(evioFilePath);
-        config.setLCSimEventBuild(new LCSimTestRunEventBuilder());
-        config.setDetectorName(detectorName);
-        config.add(new DummyEvioProcessor());
-        config.add(new DummyDriver());     
-        ProcessingChain processing = new ProcessingChain(config);
-        processing.run();
-    }
-    
-    /*
-    public void testLcioFile() {
-        EventProcessingChain processing = new EventProcessingChain();
-        try {
-            processing.setRecordSource(new LCIOEventSource(new File(lcioFilePath)));
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-        processing.setEventBuilder(new LCSimTestRunEventBuilder());
-        processing.setDetectorName(detectorName);
-        processing.add(new DummyDriver());
-        processing.configure();
-        processing.loop();
-    }
-    */
-    
-    static class DummyDriver extends Driver {
-        public void process(EventHeader event) {
-            System.out.println(this.getClass().getSimpleName() + " got LCIO event #" + event.getEventNumber());
-            for (LCMetaData metaData : event.getMetaData()) {
-                String collectionName = metaData.getName();
-                Class type = metaData.getType();
-                System.out.println (collectionName + " " + event.get(type, collectionName).size());
-            }
-        }
-    }
-    
-    static class DummyEvioProcessor extends EvioProcessor {
-        public void process(EvioEvent event) {
-            System.out.println(this.getClass().getSimpleName() + " got EVIO event #" + event.getEventNumber());
-        }
-    }
-}
SVNspam 0.1