public abstract class AMonitor extends java.lang.Object implements IMonitor
This is the abstract monitor which allows to set and get the subject design pattern of the observable. Moreover some methods are declared in this class, most of these are for fetching the device names and links or reporting the error (if one occurred).
Modifier and Type | Field and Description |
---|---|
protected IEDeviceGroup |
_devices
Is the enumeration of devices.
|
protected static java.util.Map<EAccess,java.lang.Short> |
_htAccess
Creates a map with the the TINE access as a key element and the
corresponding index in the link array as a value element.
|
protected java.util.Map<java.lang.Integer,de.desy.tine.client.TLink> |
_htLinks
The hash table which holds the link index and the link in key-value pair.
|
protected ILinkData |
_linkData
Link data instance.
|
protected java.util.Map<java.lang.Integer,IEDeviceGroup> |
_mapDeviceGroup
The hash table which holds the link index and the corresponding device
group of device context and server.
|
protected static IDeviceSubject |
_subjects
Is the subject interface which controls all observers of the observer
design pattern.
|
Modifier | Constructor and Description |
---|---|
protected |
AMonitor(IEDeviceGroup devices_)
Deprecated.
|
protected |
AMonitor(IEDeviceGroup devices_,
ILinkData linkData_)
This is the abstract constructor of the class AMonitor.
|
protected |
AMonitor(IEDeviceGroup devices_,
ILinkData linkData_,
java.lang.String name_)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
calculate()
Will calculate the result from its current value list.
|
void |
calculate(IEData component_)
This method will calculate the delivered data component and set
internally their values.
|
boolean |
equals(java.lang.Object object_) |
IEDeviceGroup |
fetchDeviceName(int nLinkIndex_)
Returns the current device name enumeration of the give link index.
|
de.desy.tine.client.TLink |
fetchLink(int nLinkIndex_)
Will fetch the current link index that correspond to the link.
|
IEDeviceGroup |
getDeviceGroup()
Returns the current device group enumeration which is used to created
the monitor.
|
protected static java.lang.String |
getLinkInfo(boolean html_,
de.desy.tine.client.TLink... links_)
Returns link information of the delivered TINE links.
|
protected static java.lang.String |
getLinkInfo(de.desy.tine.client.TLink... links_)
Returns link information of the delivered TINE links.
|
protected static IDeviceSubject |
getSubject()
Returns the current subject of this monitor class.
|
protected void |
logLinkStatus(IEDeviceGroup devices_)
Logs all TINE links to the console output and logging file.
|
protected void |
logLinkStatus(java.lang.String CLAZZ_,
IEDeviceGroup devices_)
Logs all TINE links to the console output and logging file.
|
protected void |
logLinkStatus(java.lang.String CLAZZ_,
de.desy.tine.client.TLink... links_)
Logs all TINE links to the console output.
|
protected void |
logLinkStatus(de.desy.tine.client.TLink... links_)
Logs all TINE links to the console output.
|
protected void |
putDeviceName(int nLinkIndex_,
IEDeviceGroup deviceName_)
This method allows to put the combination of a link index and the
corresponding device name into a hash table.
|
protected void |
putLink(int nLinkIndex_,
de.desy.tine.client.TLink lnk_)
This private method is used for putting the link index and the link in
a hash table.
|
static void |
reportError(IEDeviceGroup devices_,
IMonitor monitor_,
int status_,
IEData data_)
Reports the error message and prints it on the Java console.
|
static void |
reportError(IEDeviceGroup devices_,
IMonitor monitor_,
int status_,
IEData data_,
boolean isPermanent_)
Reports the error message and prints it on the Java console.
|
static void |
reportError(ILinkData linkData_,
IEDeviceGroup devices_,
IMonitor monitor_,
int status_,
IEData data_)
Reports the error message and prints it on the Java console.
|
static void |
reportError(ILinkData linkData_,
IEDeviceGroup devices_,
IMonitor monitor_,
int status_,
IEData data_,
boolean isPermanent_)
Reports the error message and prints it on the Java console.
|
java.lang.String |
toString() |
protected static IDeviceSubject _subjects
protected final java.util.Map<java.lang.Integer,de.desy.tine.client.TLink> _htLinks
protected final java.util.Map<java.lang.Integer,IEDeviceGroup> _mapDeviceGroup
protected static final java.util.Map<EAccess,java.lang.Short> _htAccess
protected final IEDeviceGroup _devices
protected final ILinkData _linkData
@Deprecated protected AMonitor(IEDeviceGroup devices_)
This is the abstract constructor of the class AMonitor. It will initialized the hash table of the links, and the device name.
DEPREACTED: You should call AMonitor(IEDeviceGroup, ILinkData)
!
devices_
- Device group.@Deprecated protected AMonitor(IEDeviceGroup devices_, ILinkData linkData_, java.lang.String name_)
This is the abstract constructor of the class AMonitor. It will initialized the hash table of the links, and the device name. More over it will also provide the TINE type and create a TINE link with the type information in it. The sorting of the device group is data elements is dismissed.
devices_
- Device group.linkData_
- Link data.name_
- Name of the sub class.protected AMonitor(IEDeviceGroup devices_, ILinkData linkData_)
This is the abstract constructor of the class AMonitor. It will initialized the hash table of the links, and the device name.
devices_
- Device group.linkData_
- Link data instance.public static final void reportError(IEDeviceGroup devices_, IMonitor monitor_, int status_, IEData data_)
devices_
- The device group.monitor_
- The monitor instance.status_
- TINE error status.data_
- The current data enumeration element; can also be null.public static final void reportError(IEDeviceGroup devices_, IMonitor monitor_, int status_, IEData data_, boolean isPermanent_)
devices_
- The device group.monitor_
- The monitor instance.status_
- TINE error status.data_
- The current data enumeration element; can also be null.isPermanent_
- Switches the output logging information. If this field
is set to false
then the output is controlled as a
debug information and only appears as a transient information on the
output. Otherwise by setting this field to true
it is controlled
as an error output and therefore it also appears in the permanent
logging file.public static final void reportError(ILinkData linkData_, IEDeviceGroup devices_, IMonitor monitor_, int status_, IEData data_)
linkData_
- Link data instance to get more information about the back
ground TINE link, i.e. its full TINE address, access, etc.devices_
- The device group.monitor_
- The monitor instance.status_
- TINE error status.data_
- The current data enumeration element; can also be null.public static final void reportError(ILinkData linkData_, IEDeviceGroup devices_, IMonitor monitor_, int status_, IEData data_, boolean isPermanent_)
linkData_
- Link data instance to get more information about the back
ground TINE link, i.e. its full TINE address, access, etc.devices_
- The device group.monitor_
- The monitor instance.status_
- TINE error status.data_
- The current data enumeration element; can also be null.isPermanent_
- Switches the output logging information. If this field
is set to false
then the output is controlled as a
debug information and only appears as a transient information on the
output. Otherwise by setting this field to true
it is controlled
as an error output and therefore it also appears in the permanent
logging file.protected static IDeviceSubject getSubject()
Returns the current subject of this monitor class. It can also return a
null
value as the subject is not set by the class.
protected static java.lang.String getLinkInfo(de.desy.tine.client.TLink... links_)
links_
- Array of all relevant TINE links.protected static java.lang.String getLinkInfo(boolean html_, de.desy.tine.client.TLink... links_)
html_
- The returned String value is an HTML fragment.links_
- Array of all relevant TINE links.protected void putLink(int nLinkIndex_, de.desy.tine.client.TLink lnk_)
This private method is used for putting the link index and the link in a hash table. The link can not be null otherwise a runtime exception is thrown.
It first controls if there exists a connection between the link index and the link, and if not it will create a new one.
nLinkIndex_
- Is the link index which is return by the attach
method of the class de.desy.mst.tine.client.TLink
.lnk_
- Is the link from which the attach
method was called.protected void putDeviceName(int nLinkIndex_, IEDeviceGroup deviceName_)
This method allows to put the combination of a link index and the corresponding device name into a hash table. So it is easy to look in the hash table from the corresponding device name which link index it is. There can be in the hash table only one link index but multiple device names.
nLinkIndex_
- The link index which is returned by the method
attach
from the class de.desy.tine.client.TLink
.deviceName_
- Device name which belongs to the linked index.
It is the device name of a context and its server from
TINE. This is created from the common interface
IEDeviceGroup
which inherits by a concrete enumeration of
EDeviceName
public IEDeviceGroup getDeviceGroup()
IMonitor
getDeviceGroup
in interface IMonitor
public de.desy.tine.client.TLink fetchLink(int nLinkIndex_) throws TineException
IMonitor
null
value is returned. Will look
in the internal hash table. In this associated table it will fetch the
link and link index and return the stored value of the key-value pair.fetchLink
in interface IMonitor
nLinkIndex_
- Is the link index value from the attach
method
of the class de.desy.tine.client.TLink
.TLink
instance.TineException
- A TINE exception is thrown if the current link
does not exist.public IEDeviceGroup fetchDeviceName(int nLinkIndex_)
IMonitor
fetchDeviceName
in interface IMonitor
nLinkIndex_
- Is the link index value from the attach
method
of the class de.desy.tine.client.TLink
.IllegalArgumentException
is thrown.protected void logLinkStatus(IEDeviceGroup devices_)
devices_
- Device group.protected void logLinkStatus(java.lang.String CLAZZ_, IEDeviceGroup devices_)
CLAZZ_
- Calling class name.devices_
- Device group.protected void logLinkStatus(de.desy.tine.client.TLink... links_)
links_
- TINE links.protected void logLinkStatus(java.lang.String CLAZZ_, de.desy.tine.client.TLink... links_)
CLAZZ_
- Calling class name.links_
- TINE links.public void calculate() throws TineException
IMonitor
Will calculate the result from its current value list. This is only responsible for a valid result if all links are opened first.
Moreover it will throw a runtime exception if the argument of the subject
is not set. The subject is part of the observer design pattern. It uses
this to inform all observers which are stored in the subject.
There exist two class method in the class AMonitor
which will set
and get the subject. See at link AMonitor.setSubject(IDeviceSubject)
and AMonitor.getSubject()
calculate
in interface IMonitor
TineException
- A TINE exception is thrown if an error occurred
during getting information or developing of information from TINE.public void calculate(IEData component_) throws TineException
IMonitor
This method will calculate the delivered data component and set
internally their values. These values can therefore be read by the
IMonitor.fetchResult(IEDeviceGroup)
or direct from the TINE
data type parameter via IMonitor.fetchData(IEDeviceGroup)
.
calculate
in interface IMonitor
component_
- Is the enumeration interface of the data component.TineException
- Returns a TineException if an error
occurred.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object object_)
equals
in class java.lang.Object
14-September-2016 18:23 Deutsches Elektronen-Synchrotron DESY in der Helmholtz-Gemeinschaft