Package gov.aps.jca.cas
Class ServerChannel
- java.lang.Object
-
- gov.aps.jca.cas.ServerChannel
-
public class ServerChannel extends Object
Server channel (client connection to process variable). This (default) implementation grants all access rights.- Version:
- $Id: ServerChannel.java,v 1.8 2006-08-28 12:28:32 msekoranja Exp $
- Author:
- Matej Sekoranja
-
-
Field Summary
Fields Modifier and Type Field Description protected intcidChannel CID.protected booleandestroyedDestroy state.protected MapmonitorsMonitors.protected ProcessVariableprocessVariableProcess variable.protected intsidChannel SID.
-
Constructor Summary
Constructors Constructor Description ServerChannel(ProcessVariable processVariable, int cid, int sid, String userName, String hostName)Create server channel for given process variable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Destory server channel.protected voiddestroyAllMonitors()Destroy all registered monitors.intgetCID()Get channel CID.ServerMonitorgetMonitor(int ioid)Get monitor by its IOID.ProcessVariablegetProcessVariable()Get process variable.intgetSID()Get channel SID.voidprintInfo()Prints detailed information about the process variable to the standard output stream.voidprintInfo(PrintStream out)Prints detailed information about the process variable to the specified output stream.CAStatusread(DBR value, ProcessVariableReadCallback asyncReadCallback)Read process variable value.booleanreadAccess()Check if read access is granted.voidregisterMonitor(ServerMonitor monitor)Register monitor.voidunregisterMonitor(ServerMonitor monitor)Unregister monitor.CAStatuswrite(DBR value, ProcessVariableWriteCallback asyncWriteCallback)Write process variable value.booleanwriteAccess()Check if write access is granted.
-
-
-
Field Detail
-
processVariable
protected ProcessVariable processVariable
Process variable.
-
sid
protected int sid
Channel SID.
-
cid
protected int cid
Channel CID.
-
monitors
protected Map monitors
Monitors.
-
destroyed
protected boolean destroyed
Destroy state.
-
-
Constructor Detail
-
ServerChannel
public ServerChannel(ProcessVariable processVariable, int cid, int sid, String userName, String hostName)
Create server channel for given process variable.- Parameters:
processVariable- process variable.cid- channel CID.sid- channel SID.userName- client user name.hostName- client host name.
-
-
Method Detail
-
getProcessVariable
public ProcessVariable getProcessVariable()
Get process variable.- Returns:
- process variable.
-
getCID
public int getCID()
Get channel CID.- Returns:
- channel CID.
-
getSID
public int getSID()
Get channel SID.- Returns:
- channel SID.
-
read
public CAStatus read(DBR value, ProcessVariableReadCallback asyncReadCallback) throws CAException
Read process variable value. Default implementation callsProcessVariable.read()method.- Throws:
CAException- See Also:
ProcessVariable
-
write
public CAStatus write(DBR value, ProcessVariableWriteCallback asyncWriteCallback) throws CAException
Write process variable value. Default implementation callsProcessVariable.write()method.- Throws:
CAException- See Also:
ProcessVariable
-
readAccess
public boolean readAccess()
Check if read access is granted.- Returns:
true(default) if read access is granted,falseotherwise.
-
writeAccess
public boolean writeAccess()
Check if write access is granted.- Returns:
true(default) if write access is granted,falseotherwise.
-
registerMonitor
public void registerMonitor(ServerMonitor monitor)
Register monitor.- Parameters:
monitor- monitor to be registered.
-
unregisterMonitor
public void unregisterMonitor(ServerMonitor monitor)
Unregister monitor.- Parameters:
monitor- monitor to be unregistered.
-
getMonitor
public ServerMonitor getMonitor(int ioid)
Get monitor by its IOID.- Parameters:
ioid- monitor IOID- Returns:
- monitor with given IOID,
nullif there is no monitor with such IOID.
-
destroyAllMonitors
protected void destroyAllMonitors()
Destroy all registered monitors.
-
destroy
public void destroy()
Destory server channel. This method MUST BE called if this it is overriden.
-
printInfo
public void printInfo() throws IllegalStateExceptionPrints detailed information about the process variable to the standard output stream.- Throws:
IllegalStateException- if the context has been destroyed.
-
printInfo
public void printInfo(PrintStream out) throws IllegalStateException
Prints detailed information about the process variable to the specified output stream.- Parameters:
out- the output stream.- Throws:
IllegalStateException- if the context has been destroyed.
-
-