|
|||||||||
| Home >> All >> rcs >> [ nml overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
rcs.nml
Class NMLConnection

java.lang.Objectrcs.nml.NMLConnection
- public class NMLConnection
- extends java.lang.Object
Class for connecting to NML buffers, ussually via network sockets.
Related Documentation: RCS Library, NML Programmers Guide (Java Version) Source Code: NMLConnection.java
| Constructor Summary | |
NMLConnection()
This constructs an NMLConnection which will not work until the host and port are set manually or by reading the NML configuration file with ReadNMLConfigurationFile(). |
|
NMLConnection(NMLMessageDictionary msg_dict,
java.lang.String BufferName,
java.lang.String ProcessName,
java.lang.String ConfigurationFile)
This constuctor creates a fully functional NML Connection using the application defined NMLMessageDictionary, read the NML configuration file, and connects immediately. |
|
| Method Summary | |
protected int |
cancelUDPSubscription()
|
static void |
ClearStaticData()
Clear any data saved from previously read configuration files. |
int |
connect()
This function connects this NMLConnection object to a server. |
void |
disconnect()
Disconnect this object from the NML server. |
protected void |
finalize()
Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed. |
NMLFormatConverter |
GetFormatConverter()
This functions gets the NMLFormatConverter for this connection. |
NMLMessageDictionary |
GetMessageDictionary()
This functions gets the NMLMessageDictionary for this connection. |
protected void |
LoadConfigurationFileData(java.lang.String configuration_file)
|
boolean |
login(java.lang.String name,
java.lang.String passwd)
This function allows the application to gain access to NML servers with security enabled. |
protected boolean |
loginTCP(java.lang.String name,
java.lang.String passwd)
|
protected void |
peek_raw_data()
|
NMLmsg |
peek()
Read an NMLmsg but do not change the was_read flag. |
java.lang.String |
peekDataString()
Reads an NMLmsg using peek() and converts it to a String. |
protected java.lang.String |
peekSTCPDataString()
|
protected void |
peekTCP_raw_data()
|
protected NMLmsg |
peekTCP()
|
protected void |
peekUDP_raw_data()
|
protected NMLmsg |
peekUDP()
|
protected void |
read_raw_data()
|
NMLmsg |
read()
Read a NMLmsg. |
java.lang.String |
readDataString()
Reads an NMLmsg and converts it to a String. |
void |
ReadNMLConfigurationFile()
Read preset configuration file. |
void |
ReadNMLConfigurationFile(java.lang.String BufferName,
java.lang.String ProcessName,
java.lang.String ConfigurationFile)
This function reads configuration information from the NML configuration file. |
void |
readRawDataFromTCPSocket()
|
protected java.lang.String |
readSTCPDataString()
|
protected void |
readTCP_raw_data()
|
protected NMLmsg |
readTCP()
|
protected void |
readUDP_raw_data()
|
protected NMLmsg |
readUDP()
|
int |
setDiagInfo()
|
void |
SetFormatConverter(NMLFormatConverter new_fc)
This functions sets the NMLFormatConverter for this connection. |
void |
SetMessageDictionary(NMLMessageDictionary new_dict)
This functions sets the NMLMessageDictionary for this connection. |
int |
setSubscriptionPeriod(double period)
|
protected int |
setTCPDiagInfo()
|
protected int |
setTCPSubscriptionPeriod(double period)
|
protected int |
setUDPSubscriptionPeriod(double period)
|
int |
write_raw_data()
|
int |
write(NMLmsg msg)
Writes an NMLmsg. |
int |
writeDataString(java.lang.String dataString)
Convert a String to an NMLmsg and then write it to the buffer. |
protected int |
writeSTCPDataString(java.lang.String dataString)
|
int |
writeTCP_raw_data()
|
protected int |
writeTCP(NMLmsg msg)
|
private int |
writeUDP_raw_data()
|
protected int |
writeUDP(NMLmsg msg)
|
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
previously_read_nml_configurations
protected static java.util.Hashtable previously_read_nml_configurations
interrupt_login
public static boolean interrupt_login
- This variable can be set to true by some other thread to
stop the login.
- See Also:
login(java.lang.String,java.lang.String)55
format_converter
protected NMLFormatConverterBase format_converter
message_dictionary
protected NMLMessageDictionary message_dictionary
BufferLine
public java.lang.String BufferLine
NML_STCP_PROTOCOL_TYPE
protected static final int NML_STCP_PROTOCOL_TYPE
- See Also:
- Constant Field Values
NML_TCP_PROTOCOL_TYPE
protected static final int NML_TCP_PROTOCOL_TYPE
- See Also:
- Constant Field Values
NML_UDP_PROTOCOL_TYPE
protected static final int NML_UDP_PROTOCOL_TYPE
- See Also:
- Constant Field Values
protocol_option
public int protocol_option
NML_ASCII_ENCODING_TYPE
protected static final int NML_ASCII_ENCODING_TYPE
- See Also:
- Constant Field Values
NML_DISP_ENCODING_TYPE
protected static final int NML_DISP_ENCODING_TYPE
- See Also:
- Constant Field Values
NML_XDR_ENCODING_TYPE
protected static final int NML_XDR_ENCODING_TYPE
- See Also:
- Constant Field Values
data_format_option
private int data_format_option
serial_number
private int serial_number
last_id_read
private int last_id_read
max_tries
private int max_tries
REMOTE_CMS_READ_REQUEST_TYPE
protected static final int REMOTE_CMS_READ_REQUEST_TYPE
- See Also:
- Constant Field Values
REMOTE_CMS_WRITE_REQUEST_TYPE
protected static final int REMOTE_CMS_WRITE_REQUEST_TYPE
- See Also:
- Constant Field Values
REMOTE_CMS_GET_KEYS_REQUEST_TYPE
protected static final int REMOTE_CMS_GET_KEYS_REQUEST_TYPE
- See Also:
- Constant Field Values
REMOTE_CMS_LOGIN_REQUEST_TYPE
protected static final int REMOTE_CMS_LOGIN_REQUEST_TYPE
- See Also:
- Constant Field Values
REMOTE_CMS_SET_SUBSCRIPTION_REQUEST_TYPE
protected static final int REMOTE_CMS_SET_SUBSCRIPTION_REQUEST_TYPE
- See Also:
- Constant Field Values
REMOTE_CMS_READ_COMBINED_REQUEST_TYPE
protected static final int REMOTE_CMS_READ_COMBINED_REQUEST_TYPE
- See Also:
- Constant Field Values
REMOTE_CMS_BLOCKING_READ_REQUEST_TYPE
protected static final int REMOTE_CMS_BLOCKING_READ_REQUEST_TYPE
- See Also:
- Constant Field Values
REMOTE_CMS_GET_BUF_NAME_REQUEST_TYPE
protected static final int REMOTE_CMS_GET_BUF_NAME_REQUEST_TYPE
- See Also:
- Constant Field Values
REMOTE_CMS_CANCEL_SUBSCRIPTION_REQUEST_TYPE
protected static final int REMOTE_CMS_CANCEL_SUBSCRIPTION_REQUEST_TYPE
- See Also:
- Constant Field Values
REMOTE_CMS_SET_DIAG_INFO_REQUEST_TYPE
protected static final int REMOTE_CMS_SET_DIAG_INFO_REQUEST_TYPE
- See Also:
- Constant Field Values
REMOTE_CMS_GET_DIAG_INFO_REQUEST_TYPE
protected static final int REMOTE_CMS_GET_DIAG_INFO_REQUEST_TYPE
- See Also:
- Constant Field Values
REMOTE_CMS_GET_MSG_COUNT_REQUEST_TYPE
protected static final int REMOTE_CMS_GET_MSG_COUNT_REQUEST_TYPE
- See Also:
- Constant Field Values
request_type
private int request_type
CMS_POLLED_SUBSCRIPTION
public static final int CMS_POLLED_SUBSCRIPTION
- See Also:
- Constant Field Values
CMS_NO_SUBSCRIPTION
public static final int CMS_NO_SUBSCRIPTION
- See Also:
- Constant Field Values
CMS_VARIABLE_SUBSCRIPTION
public static final int CMS_VARIABLE_SUBSCRIPTION
- See Also:
- Constant Field Values
CMS_READ_ACCESS
protected static final int CMS_READ_ACCESS
- See Also:
- Constant Field Values
CMS_CHECK_IF_READ_ACCESS
protected static final int CMS_CHECK_IF_READ_ACCESS
- See Also:
- Constant Field Values
CMS_PEEK_ACCESS
protected static final int CMS_PEEK_ACCESS
- See Also:
- Constant Field Values
CMS_WRITE_ACCESS
protected static final int CMS_WRITE_ACCESS
- See Also:
- Constant Field Values
CMS_WRITE_IF_READ_ACCESS
protected static final int CMS_WRITE_IF_READ_ACCESS
- See Also:
- Constant Field Values
access_type
private int access_type
remote_status
private int remote_status
message_size
private int message_size
was_read
private int was_read
input_bytes_read
private int input_bytes_read
reply_header_received
private boolean reply_header_received
write_reply_received
private boolean write_reply_received
input_buffer_ready
private boolean input_buffer_ready
output_data_size
protected int output_data_size
min_compatible_version
public double min_compatible_version
confirm_write
public boolean confirm_write
use_subscription
public boolean use_subscription
subscription_id
public int subscription_id
subscription_period
public double subscription_period
poll
public boolean poll
default_poll_state
public static boolean default_poll_state
diag_enabled
public boolean diag_enabled
connection_number
public int connection_number
last_msg_read
protected NMLmsg last_msg_read
config_debug_on
public static boolean config_debug_on
- Set config_debug_on to true to print out additional information
while reading the NML Congiguration file.
read_debug_on
public static boolean read_debug_on
- Set read_debug_on to true to print out additional information
while reading.
write_debug_on
public static boolean write_debug_on
- Set write_debug_on to true to print out additional information
while writing.
input_string
private java.lang.String input_string
buffer_name
public java.lang.String buffer_name
- Name of buffer to connect to. (used in configuration file)
process_name
public java.lang.String process_name
- Name of this process as used in configuration file.
configuration_file
public java.lang.String configuration_file
- Name/URL the configuration file to read.
input_buffer_offset
private int input_buffer_offset
input_bytes_ready
private int input_bytes_ready
input_buffer
private byte[] input_buffer
output_buffer
private byte[] output_buffer
NML_DEFAULT_BUFFER_SIZE
private static final int NML_DEFAULT_BUFFER_SIZE
- See Also:
- Constant Field Values
buffer_size
private int buffer_size
port
public int port
- TCP port of NML server.
buffer_number
public int buffer_number
- buffer_number from NML configuration file.
host
public java.lang.String host
- name of the computer the NML server runs on.
read_request_sent
protected boolean read_request_sent
null_error_reported
private boolean null_error_reported
m_InputStream
private java.io.DataInputStream m_InputStream
m_OutputStream
private java.io.DataOutputStream m_OutputStream
m_Socket
private java.net.Socket m_Socket
udpSocket
private NonBlockingDatagramSocket udpSocket
udpServerAddress
private java.net.InetAddress udpServerAddress
baOutputStream
private java.io.ByteArrayOutputStream baOutputStream
baInputStream
private java.io.ByteArrayInputStream baInputStream
udpInputPacket
private java.net.DatagramPacket udpInputPacket
udpRetryTimeoutMillis
private long udpRetryTimeoutMillis
lastUdpRequestTime
private long lastUdpRequestTime
broadcast_port
private int broadcast_port
connected
public boolean connected
- True when this object is connected to the NML server.
All reads and writes will fail when this is false.
serial_number_repeats
int serial_number_repeats
zero_messages
int zero_messages
id_repeats
int id_repeats
| Constructor Detail |
NMLConnection
public NMLConnection()
- This constructs an NMLConnection which will not work until
the host and port are set manually or
by reading the NML configuration file with ReadNMLConfigurationFile().
Most users should use the other constructor with several parameters.
NMLConnection
public NMLConnection(NMLMessageDictionary msg_dict, java.lang.String BufferName, java.lang.String ProcessName, java.lang.String ConfigurationFile) throws NMLException
- This constuctor creates a fully functional NML Connection
using the application defined NMLMessageDictionary, read
the NML configuration file, and connects immediately.
This is the constructor most users should use.
| Method Detail |
SetMessageDictionary
public void SetMessageDictionary(NMLMessageDictionary new_dict) throws NMLException
- This functions sets the NMLMessageDictionary for this connection.
The purpose of the NMLMessageDictionary is to provide a means
for the NMLConnection to determine the structure of messages being
sent or received using a message type. (An integer passed within
all NML messages.)
GetMessageDictionary
public NMLMessageDictionary GetMessageDictionary() throws NMLException
- This functions gets the NMLMessageDictionary for this connection.
SetFormatConverter
public void SetFormatConverter(NMLFormatConverter new_fc) throws NMLException
- This functions sets the NMLFormatConverter for this connection.
The NMLFormatConverter is resposible for converting each of
the basic data types to some neutral format that can be
used on many different platforms. Most users should either accept
the default (XDRFormatConverter) or allow the format to be specified
in the NML configuration file rather than calling this function
directly.
GetFormatConverter
public NMLFormatConverter GetFormatConverter() throws NMLException
- This functions gets the NMLFormatConverter for this connection.
ReadNMLConfigurationFile
public void ReadNMLConfigurationFile(java.lang.String BufferName, java.lang.String ProcessName, java.lang.String ConfigurationFile) throws NMLException
- This function reads configuration information from the NML configuration file.
ClearStaticData
public static void ClearStaticData()
- Clear any data saved from previously read configuration files.
LoadConfigurationFileData
protected void LoadConfigurationFileData(java.lang.String configuration_file) throws java.lang.Exception
ReadNMLConfigurationFile
public void ReadNMLConfigurationFile()
throws NMLException
- Read preset configuration file.
finalize
protected void finalize()
- Description copied from class:
java.lang.Object - Called on an object by the Virtual Machine at most once,
at some point after the Object is determined unreachable
but before it is destroyed. You would think that this
means it eventually is called on every Object, but this is
not necessarily the case. If execution terminates
abnormally, garbage collection does not always happen.
Thus you cannot rely on this method to always work.
For finer control over garbage collection, use references
from the
java.lang.refpackage.Virtual Machines are free to not call this method if they can determine that it does nothing important; for example, if your class extends Object and overrides finalize to do simply
super.finalize().finalize() will be called by a java.lang.Thread that has no locks on any Objects, and may be called concurrently. There are no guarantees on the order in which multiple objects are finalized. This means that finalize() is usually unsuited for performing actions that must be thread-safe, and that your implementation must be use defensive programming if it is to always work.
If an Exception is thrown from finalize() during garbage collection, it will be patently ignored and the Object will still be destroyed.
It is allowed, although not typical, for user code to call finalize() directly. User invocation does not affect whether automatic invocation will occur. It is also permitted, although not recommended, for a finalize() method to "revive" an object by making it reachable from normal code again.
Unlike constructors, finalize() does not get called for an object's superclass unless the implementation specifically calls
super.finalize().The default implementation does nothing.
connect
public int connect()
throws NMLException
- This function connects this NMLConnection object to a server.
All attempts to read or write will fail while the object is
disconnected.
Since the NMLConnection(NMLMessageDictionary, String, String,String)
disconnect
public void disconnect()
- Disconnect this object from the NML server. This
allows the NML server to shutdown and come back up
while preserving the configuration information in this
object.
All reads and writes will fail while the object is disconnected.
login
public boolean login(java.lang.String name, java.lang.String passwd) throws NMLException
- This function allows the application to gain access to
NML servers with security enabled.
read
public NMLmsg read() throws NMLException
- Read a NMLmsg.
setDiagInfo
public int setDiagInfo()
setTCPDiagInfo
protected int setTCPDiagInfo()
setSubscriptionPeriod
public int setSubscriptionPeriod(double period)
setUDPSubscriptionPeriod
protected int setUDPSubscriptionPeriod(double period)
cancelUDPSubscription
protected int cancelUDPSubscription()
setTCPSubscriptionPeriod
protected int setTCPSubscriptionPeriod(double period)
read_raw_data
protected void read_raw_data()
throws NMLException
readTCP_raw_data
protected void readTCP_raw_data()
throws NMLException
readTCP
protected NMLmsg readTCP() throws NMLException
readUDP
protected NMLmsg readUDP() throws NMLException
readUDP_raw_data
protected void readUDP_raw_data()
throws NMLException
readRawDataFromTCPSocket
public void readRawDataFromTCPSocket()
throws NMLException,
java.io.IOException
peek
public NMLmsg peek() throws NMLException
- Read an NMLmsg but do not change the was_read flag.
peek_raw_data
protected void peek_raw_data()
throws NMLException
peekTCP_raw_data
protected void peekTCP_raw_data()
throws NMLException
peekTCP
protected NMLmsg peekTCP() throws NMLException
peekUDP
protected NMLmsg peekUDP() throws NMLException
peekUDP_raw_data
protected void peekUDP_raw_data()
throws NMLException
readDataString
public java.lang.String readDataString() throws NMLException
- Reads an NMLmsg and converts it to a String.
readSTCPDataString
protected java.lang.String readSTCPDataString() throws NMLException
peekDataString
public java.lang.String peekDataString() throws NMLException
- Reads an NMLmsg using peek() and converts it to a String.
peekSTCPDataString
protected java.lang.String peekSTCPDataString() throws NMLException
loginTCP
protected boolean loginTCP(java.lang.String name, java.lang.String passwd) throws NMLException
writeTCP
protected int writeTCP(NMLmsg msg)
writeTCP_raw_data
public int writeTCP_raw_data()
writeUDP
protected int writeUDP(NMLmsg msg)
write
public int write(NMLmsg msg)
- Writes an NMLmsg.
write_raw_data
public int write_raw_data()
writeUDP_raw_data
private int writeUDP_raw_data()
writeDataString
public int writeDataString(java.lang.String dataString)
- Convert a String to an NMLmsg and then write it to the buffer.
writeSTCPDataString
protected int writeSTCPDataString(java.lang.String dataString)
|
|||||||||
| Home >> All >> rcs >> [ nml overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
rcs.nml.NMLConnection