public class Emu extends java.lang.Object implements CODAComponent
Modifier and Type | Class and Description |
---|---|
(package private) class |
Emu.StatusReportingThread
Class defining thread which reports the EMU status to Run Control.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.atomic.AtomicReference<java.lang.String> |
errorMsg
Error message.
|
Constructor and Description |
---|
Emu(java.lang.String name,
java.lang.String type,
boolean debugUI,
boolean debug)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
addOutputDestination(java.lang.String outputDestination)
Add a single output destination name, like a file or et system name, or
a string like "cMsg", to the array of destinations names.
|
void |
clearOutputDestinations()
Clear output destination names.
|
org.w3c.dom.Document |
configuration()
Get the configuration of this CODA component in the form of
a parsed XML document object that is loaded from a file when
the configure command is executed.
|
void |
execute(Command cmd)
This method takes a Command object and attempts to execute it.
|
int |
getBufferLevel()
Get the smallest number of evio-events/et-buffer that connected DC/PEB found.
|
CMSGPortal |
getCmsgPortal()
Get the cmsgPortal object of this emu.
|
java.lang.String |
getCmsgUDL()
Get the UDL used to connect to the cMsg server by this CODA component.
|
CODAClass |
getCodaClass()
Get the class of this CODA component (e.g.
|
CODAClass |
getCodaClassObject()
Get the CODAClass of this emu.
|
int |
getCodaid()
Get the id of this CODA component.
|
(package private) EmuDataPath |
getDataPath()
Get the data path object that directs how the run control
commands are distributed among the EMU parts.
|
int |
getDataStreamCount()
Get the total number of data streams in the configuration which contains this emu.
|
int |
getDataStreamId()
Get the id number of the data stream this emu is a part of.
|
long |
getEndingTimeLimit()
This method gets the amount of milliseconds to wait for an
END command to succeed before going to an ERROR state.
|
java.lang.String |
getError()
Get any available error information.
|
java.lang.String |
getExpid()
Get the experiment id (expid) of this CODA component.
|
int |
getFileOutputCount()
Get the number of file output channels in this emu.
|
DebugFrame |
getFramework()
Get the debug GUI object.
|
java.lang.String |
getHostName()
Get the name of the host this CODA component is running on.
|
java.util.List<DataChannel> |
getInChannels()
Get list of input channels.
|
int |
getInputChannelCount()
Get out the number of input channels to the first module.
|
Logger |
getLogger()
Get the Logger this emu uses.
|
java.util.List<DataChannel> |
getOutChannels()
Get list of output channels.
|
java.lang.String[] |
getPlatformIpAddresses()
Get the rc platform's IP addresses as dot-decimal strings.
|
int |
getPlatformTcpPort()
Get the platform's cMsg domain server's TCP port.
|
int |
getRunNumber()
Get the run number of this CODA component.
|
java.lang.String |
getRunType()
Get the runType of this CODA component.
|
int |
getRunTypeId()
Get the numeric code representing the run type of this CODA component.
|
java.lang.String |
getSession()
Get the session of this CODA component.
|
(package private) EmuModule |
getStatisticsModule()
Get the module from which we gather statistics.
|
java.lang.ThreadGroup |
getThreadGroup()
Get the ThreadGroup this emu's threads are part of.
|
long |
getTime()
Get the time from System.currentTimeMillis(), but it's updated
only every second or thereabouts.
|
boolean |
isFileWritingOn()
Set the flag to tell file output channel to actually write the file or not.
|
java.lang.String |
name()
Get the name of this CODA component.
|
org.w3c.dom.Document |
parameters()
Get the configuration of this CODA component in the form of
a parsed XML document object that is loaded when the configure
command is executed.
|
void |
postCommand(Command cmd)
This method puts a command object into a mailbox of a CODA
component that is periodically checked by that component.
|
CODAStateIF |
previousState()
This method returns the previous state of the modules in this Emu.
|
(package private) void |
quit()
Exit this Emu (there still may be other threads running in the JVM).
|
void |
reset()
This method executes a RESET command.
|
void |
sendRcErrorMessage(java.lang.String error)
Send run control an error message which gets displayed in its GUI.
|
void |
sendRcInfoMessage(java.lang.String msg)
Send run control a informational message which gets displayed in its GUI.
|
void |
sendRcSevereMessage(java.lang.String error)
Send run control a severe error message which gets displayed in its GUI.
|
void |
sendRcWarningMessage(java.lang.String msg)
Send run control a warning message which gets displayed in its GUI.
|
void |
sendStatusMessage()
Allow the "out-of-band" sending of a status message to run control.
|
void |
setBufferLevel(int bufferLevel)
Set the smallest number of evio-events/et-buffer that connected DC/PEB found.
|
void |
setCodaClass(CODAClass codaClass)
Method to set the CODAClass member.
|
void |
setCodaid(int codaid)
Set the id of this CODA component.
|
(package private) void |
setDataPath(EmuDataPath dataPath)
Set the data path object that directs how the run control
commands are distributed among the EMU parts.
|
void |
setErrorState(java.lang.String errorCause)
This method sets the state of this Emu to ERROR, but not if the
emu is currently resetting in which case it immediately returns.
|
void |
setOutputDestination(int index,
java.lang.String outputDestination)
Change an existing single output destination name in the array of names.
|
void |
setRunNumber(int runNumber)
Set the run number of this CODA component.
|
void |
setRunType(java.lang.String runType)
Set the runType of this CODA component.
|
void |
setRunTypeId(int runTypeId)
Set the numeric code representing the run type of this CODA component.
|
void |
setState(CODAStateIF state)
This method sets the state of this Emu, but not if emu is currently
resetting in which case it immediately returns.
|
CODAStateIF |
state()
Get the state of this object.
|
boolean |
theEndIsNigh()
Get whether END button has been pushed.
|
protected java.util.concurrent.atomic.AtomicReference<java.lang.String> errorMsg
public Emu(java.lang.String name, java.lang.String type, boolean debugUI, boolean debug) throws EmuException
This class is not executable. To create and run an Emu, use the EmuFactory
class.
name
- name of Emutype
- CODA component type of EmudebugUI
- start a debug GUIdebug
- turn on debug printoutEmuException
- if name is null, or cannot connect to rc serverpublic java.lang.String name()
name
in interface CODAComponent
public int getCodaid()
getCodaid
in interface CODAComponent
public void setCodaid(int codaid)
setCodaid
in interface CODAComponent
codaid
- the coda id of this CODA componentCODAComponent.setCodaid(int)
public java.lang.String getSession()
getSession
in interface CODAComponent
public java.lang.String getExpid()
getExpid
in interface CODAComponent
public java.lang.String getHostName()
getHostName
in interface CODAComponent
public CODAClass getCodaClass()
getCodaClass
in interface CODAComponent
public int getRunNumber()
getRunNumber
in interface CODAComponent
public int getRunTypeId()
getRunTypeId
in interface CODAComponent
public java.lang.String getRunType()
getRunType
in interface CODAComponent
public java.lang.String getCmsgUDL()
getCmsgUDL
in interface CODAComponent
public java.lang.String[] getPlatformIpAddresses()
public int getPlatformTcpPort()
public int getBufferLevel()
public void setBufferLevel(int bufferLevel)
bufferLevel
- smallest number of evio-events/et-buffer that connected DC/PEB found.public org.w3c.dom.Document configuration()
configuration
in interface CODAComponent
public org.w3c.dom.Document parameters()
parameters
in interface CODAComponent
public void setRunNumber(int runNumber)
setRunNumber
in interface CODAComponent
runNumber
- the run number of this CODA componentCODAComponent.setRunNumber(int)
public void setRunTypeId(int runTypeId)
setRunTypeId
in interface CODAComponent
runTypeId
- the numeric code representing the runType of this CODA componentCODAComponent.setRunTypeId(int)
public void setRunType(java.lang.String runType)
setRunType
in interface CODAComponent
runType
- the runType of this CODA componentCODAComponent.setRunType(String)
public CODAClass getCodaClassObject()
public void setCodaClass(CODAClass codaClass)
codaClass
- type of CODA component such as ROC, EMU, or ER.public boolean isFileWritingOn()
true
if file output channel will actually write the file, else false
.public DebugFrame getFramework()
public java.lang.ThreadGroup getThreadGroup()
public Logger getLogger()
public CMSGPortal getCmsgPortal()
public long getEndingTimeLimit()
EmuDataPath getDataPath()
void setDataPath(EmuDataPath dataPath)
dataPath
- the data path objectEmuModule getStatisticsModule()
public int getInputChannelCount()
public java.util.List<DataChannel> getInChannels()
public java.util.List<DataChannel> getOutChannels()
public int getDataStreamId()
public int getDataStreamCount()
public int getFileOutputCount()
public boolean theEndIsNigh()
Only to be used internally to the emu.
public CODAStateIF previousState()
public java.lang.String getError()
getError
in interface StatedObject
public void setState(CODAStateIF state)
state
- desired state of this Emu.public void setErrorState(java.lang.String errorCause)
errorCause
- description of error's cause.public CODAStateIF state()
state
in interface StatedObject
public void sendRcInfoMessage(java.lang.String msg)
msg
- info messagepublic void sendRcWarningMessage(java.lang.String msg)
msg
- warning messagepublic void sendRcErrorMessage(java.lang.String error)
error
- error messagepublic void sendRcSevereMessage(java.lang.String error)
error
- severe messagepublic int addOutputDestination(java.lang.String outputDestination)
outputDestination
- name of an output data destination of this emupublic void setOutputDestination(int index, java.lang.String outputDestination)
index
- index in array of name to be changed.outputDestination
- name of an output destination.public void clearOutputDestinations()
public void sendStatusMessage()
public long getTime()
public void postCommand(Command cmd) throws java.lang.InterruptedException
postCommand
in interface CommandAcceptor
cmd
- of type Command (eg. start transition, control run variables, control session)java.lang.InterruptedException
- if thread interrupted while in method.void quit()
public void reset()
reset
in interface CODAComponent
public void execute(Command cmd)
cmd
- of type Command