net.simplace.simulation.io.output.FWSimOutputAdapter

Abstract implementation for the IO-Adapter for only writing output data This abstract implementation is net.simplace.simulation.io.FWSimIOAdapter. It additionally implements a blocking queue java.util.concurrent.ArrayBlockingQueue that makes it possible to divide the model output from writing the output to the different interfaces. Cache size is the number of elements that can be cached in the queue before the queue will also stop to take elements from the model output. !!IMPORTANT!! Before finalizing the application it has to be checked, if all output is written to the net.simplace.simulation.io.interfaces.FWSimInterfaces resp. the blocking queue is empty. reads general information from the xml-structure given as



public abstract class FWSimOutputAdapter extends
net.simplace.simulation.io.FWSimIOAdapter {
// Public Constructors
public FWSimOutputAdapter(String aName, Element aOutputElement,
FWSimInterface aInterface, FWSimIOAdapter.FREQUENCE aFrequence, int
aOrderNumber, String aCacheSize);
// Protected Constructors
protected FWSimOutputAdapter(Element aOutputElement, int aOrderNumber,
FWSimVarMap aVarMap);
protected FWSimOutputAdapter(FWSimOutputAdapter aOutputAdapter,
FWSimInterface aInterface);

// Protected Instance Variables
protected ArrayBlockingQueue iQueue;
protected int iCacheSize;

// Class Methods
public static FWSimOutputAdapter createAdapter(Element aOutputElement, int
aOrderNumber, FWSimVarMap aVarMap) throws MissingSimResourceException;


returns the output Adapter to be created
public static FWSimOutputAdapter updateAdapter(FWSimOutputAdapter aAdapter,
FWSimInterface aInterface) throws MissingSimResourceException;


returns updated FWSimOutputAdapter
public static FWSimOutputAdapter createOutputFromObservable(FWObservable
aObservable, int aOrderNumber) throws MissingSimResourceException;


returns the output Adapter to be created

// Public Instance Methods
public void initialize(FWSimVarMap aVarMap);

public void receiveData(FWSimQueueObjectMap aVarMap);

Outputter should write the data to this method - writing is done automatically in another thread.
public void writeData();

method called by different thread actually writing the data to the given media in SimInterface
public Collection getOutputVariables();

always returns empty list. No Output expected from this adapter
public Collection getInputVariables();

returns list of the input variables given as header information
public FWSimVariable.CONTENT_TYPE getContentType();

public int getQueueLenth();


returns length of the current queue
public boolean isActive();


returns if the Queue is actively running
public FWSimInterface getInterface(); // Defines
net.simplace.simulation.io.FWSimIOAdapter



returns the connected interface
public boolean hasStatistics();


returns if the adapter has statistics
public LinkedHashMap getStatisticsHeaderVariables();


returns the statistics header variable
public LinkedList getStatistics();


returns the statistics
public FWSimResultCache getStatisticsResultCache(String aSimulationID);


returns the statisticsResultCache
public FWSimOutputAdapter getStatisticsAdapter();


returns the statisticsAdapter
public Element toXML();

public String toHTMLTablestring();

creates HTML Documentation form of the Output Adaptor
returns the generated HTMLString
public boolean isWriting();

for synchronization purposes checks, if the writing method is still active, even if the queue is empty
returns true if the writing process is still active

// Protected Instance Methods
protected abstract void init(FWSimVarMap aVarMap);

protected abstract void writeData(FWSimQueueObjectMap aObjectToWrite);

writes data to the interface - has to be implemented for each adapter individually


}



Hierarchy: java.lang.Object - net.simplace.simulation.io.FWSimIOAdapter (net.simplace.simulation.util.FWSimFieldContainer) - FWSimOutputAdapter



Extended by: net.simplace.simulation.io.output.adapter.CacheOutputAdapter, net.simplace.simulation.io.output.adapter.CSVOutputAdapter, net.simplace.simulation.io.output.adapter.DatabaseOutputAdapter



Passed to: net.simplace.simulation.io.output.adapter.CacheOutputAdapter(), FWSimStatisticVariable.createStatistic(), net.simplace.simulation.io.output.adapter.CSVOutputAdapter(), net.simplace.simulation.io.output.adapter.DatabaseOutputAdapter(), net.simplace.simulation.io.output.statistic.DefaultSimStatistic(), FWSimOutputAdapter(), FWSimStatisticVariable.FWSimStatisticVariable(), updateAdapter()



Returned by: createAdapter(), createOutputFromObservable(), FWSimOutput.getAdapter(), getStatisticsAdapter(), updateAdapter()



Type of: FWSimOutput.iAdapter