JACK 5.4 Application Interface

aos.jack.jak.core
Class Dci

java.lang.Object
  extended byaos.jack.jak.core.Dci

public class Dci
extends java.lang.Object

The DCI command line functionality can be achieved in JACK code using this class.


Field Summary
static int DEBUG_CONNECT
          Bitmap debug flag to be used in call to setDebug(...).
static int DEBUG_MISC
          Bitmap debug flag to be used in call to setDebug(...).
static int DEBUG_RAWDATA
          Bitmap debug flag to be used in call to setDebug(...).
static int DEBUG_TRANSFER
          Bitmap debug flag to be used in call to setDebug(...).
static int PING_NO_RESPONSE
          Ping return status indicating that there was no response to the ping request and it timed out.
static int PING_NOT_READY
          Ping return status indicating that there is no local portal present in the current process yet.
static int PING_OK
          Ping return status indicating that the given agent responded correctly.
static int PING_TIMEOUT
          The number of milliseconds before timeout for a standard ping.
static int PING_UNKNOWN_NAME
          Ping return status indicating that the given agent is not known at the given portal (or the local portal if no portal was specified in the name).
static int PING_UNKNOWN_PORTAL
          Ping return status indicating that the given portal is not known at the current (local) portal.
 
Constructor Summary
Dci()
           
 
Method Summary
static void connect(java.lang.String local_name, java.lang.String remote_name, java.lang.String rdesc)
          This method can be called at any time to establish a connection.
static void create(java.lang.String name, java.lang.String desc)
          Creates a new portal for this process.
static aos.dci.Addressable findAddressable(java.lang.String name)
           
static java.lang.String getHost()
          Return the hostname of the first Portal in this process.
static java.lang.String getName()
          Return the name of the first Portal in this process.
static int getPort()
          Return the port number of the first Portal in this process.
static void initCommsObject(java.lang.String portal_type, CommsObject obj)
          Provide an object implementing the CommsObject interface to the low level portal initialization code.
static int multiPing(java.lang.String addressable, int timeout, int period)
          One ping is attempted and if it was unsuccessful, more are attempted 'period' milliseconds apart until 'timeout' occurs.
static boolean multiPingOk(java.lang.String addressable)
          One ping is attempted and if it was unsuccessful, more are attempted '1000' milliseconds apart until 'timeout' occurs.
static boolean multiPingOk(java.lang.String addressable, int timeout, int period)
          One ping is attempted and if it was unsuccessful, more are attempted 'period' milliseconds apart until 'timeout' occurs.
static void nameserver(java.lang.String ns)
          This method can be called at any time to establish a new, additional nameserver.
static int ping(java.lang.String addressable)
          One ping.
static boolean pingOk(java.lang.String addressable)
          Convenience form of ping method that returns a simple true/false success status.
static java.lang.String pingStatusString(int status)
          Returns a descriptive (english) error string when given an integer ping return status.
static java.lang.String query(java.lang.String portal)
          Query a portal for a colon separated list of all known agents.
static void setDaemon(boolean val)
          Set whether or not the Portal receiving thread becomes a deamon thread.
static void setDebug(int value)
          Enable tracing on the local Portal.
static void setPriority(int val)
          Set the increase (or decrease) in thread priority for the portal receiving thread.
static void setTimeout(int value)
          This method can be called at any time to change the timeout period for the next connection request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PING_NO_RESPONSE

public static final int PING_NO_RESPONSE
Ping return status indicating that there was no response to the ping request and it timed out.

See Also:
Constant Field Values

PING_NOT_READY

public static final int PING_NOT_READY
Ping return status indicating that there is no local portal present in the current process yet.

See Also:
Constant Field Values

PING_UNKNOWN_PORTAL

public static final int PING_UNKNOWN_PORTAL
Ping return status indicating that the given portal is not known at the current (local) portal.

See Also:
Constant Field Values

PING_UNKNOWN_NAME

public static final int PING_UNKNOWN_NAME
Ping return status indicating that the given agent is not known at the given portal (or the local portal if no portal was specified in the name).

See Also:
Constant Field Values

PING_OK

public static final int PING_OK
Ping return status indicating that the given agent responded correctly.

See Also:
Constant Field Values

PING_TIMEOUT

public static final int PING_TIMEOUT
The number of milliseconds before timeout for a standard ping.

See Also:
Constant Field Values

DEBUG_CONNECT

public static final int DEBUG_CONNECT
Bitmap debug flag to be used in call to setDebug(...). Causes debugging output tracing connection attempts.

See Also:
Constant Field Values

DEBUG_TRANSFER

public static final int DEBUG_TRANSFER
Bitmap debug flag to be used in call to setDebug(...). Causes debugging output tracing data transfer.

See Also:
Constant Field Values

DEBUG_MISC

public static final int DEBUG_MISC
Bitmap debug flag to be used in call to setDebug(...). Causes various extra debugging output.

See Also:
Constant Field Values

DEBUG_RAWDATA

public static final int DEBUG_RAWDATA
Bitmap debug flag to be used in call to setDebug(...). Causes debugging output tracing raw data transfer.

See Also:
Constant Field Values
Constructor Detail

Dci

public Dci()
Method Detail

setDebug

public static void setDebug(int value)
Enable tracing on the local Portal. The debug flags given above should be or'ed together.


setDaemon

public static void setDaemon(boolean val)
Set whether or not the Portal receiving thread becomes a deamon thread. If 'false' then the main program will not exit when 'main()' exits. This must be called before a portal is created.


setPriority

public static void setPriority(int val)
Set the increase (or decrease) in thread priority for the portal receiving thread. A positive value increases the priority. The default value is 2. This must be called before a portal is created.


setTimeout

public static void setTimeout(int value)
This method can be called at any time to change the timeout period for the next connection request.

Parameters:
value - The new timeout period.

create

public static void create(java.lang.String name,
                          java.lang.String desc)
Creates a new portal for this process.

Parameters:
name - The name of the portal.
desc - The description String containing host:port. This method needs to be called before the first agent is created.

connect

public static void connect(java.lang.String local_name,
                           java.lang.String remote_name,
                           java.lang.String rdesc)
This method can be called at any time to establish a connection.

Parameters:
local_name - The local portal requesting the connection.
remote_name - The portal to connect to.

nameserver

public static void nameserver(java.lang.String ns)
This method can be called at any time to establish a new, additional nameserver.


findAddressable

public static aos.dci.Addressable findAddressable(java.lang.String name)

pingStatusString

public static java.lang.String pingStatusString(int status)
Returns a descriptive (english) error string when given an integer ping return status.


pingOk

public static boolean pingOk(java.lang.String addressable)
Convenience form of ping method that returns a simple true/false success status. One ping only. Will not attempt any connection.

Parameters:
addressable - The address of the agent to ping.
Returns:
true if the ping was successful, false otherwise.

ping

public static int ping(java.lang.String addressable)
One ping. Will not attempt any connection.

Parameters:
addressable - The address of the agent to ping.
Returns:
An integer representing the result of the ping as described above.

multiPingOk

public static boolean multiPingOk(java.lang.String addressable)
One ping is attempted and if it was unsuccessful, more are attempted '1000' milliseconds apart until 'timeout' occurs.

Parameters:
addressable - The agent to ping.
Returns:
a simple true/false success status.

multiPingOk

public static boolean multiPingOk(java.lang.String addressable,
                                  int timeout,
                                  int period)
One ping is attempted and if it was unsuccessful, more are attempted 'period' milliseconds apart until 'timeout' occurs.

Parameters:
addressable - The agent to ping
timeout - The number of milliseconds to wait until timing out.
period - The time between pings.
Returns:
a simple true/false success status

multiPing

public static int multiPing(java.lang.String addressable,
                            int timeout,
                            int period)
One ping is attempted and if it was unsuccessful, more are attempted 'period' milliseconds apart until 'timeout' occurs.

Parameters:
addressable - The agent to ping
timeout - The number of milliseconds to wait until timing out.
period - The time between pings.
Returns:
integer status value as described above.

query

public static java.lang.String query(java.lang.String portal)
Query a portal for a colon separated list of all known agents. Returns null if there is no portal in this process or if there was no response.


getHost

public static java.lang.String getHost()
Return the hostname of the first Portal in this process. (Only one Portal per process is currently supported.)


getPort

public static int getPort()
Return the port number of the first Portal in this process. (Only one Portal per process is currently supported.)


getName

public static java.lang.String getName()
Return the name of the first Portal in this process. (Only one Portal per process is currently supported.)


initCommsObject

public static void initCommsObject(java.lang.String portal_type,
                                   CommsObject obj)
Provide an object implementing the CommsObject interface to the low level portal initialization code.

Currently this is only implemented for "UDP" which requires a CommsObject whose createCommsObject(Object o) method must accept an Integer object containing the port number and return a DatagramSocket object bound to the given port number. This is most useful when the method returns an object derived from DatagramSocket enabling the user to log or modify the communications behaviour.

Parameters:
portal_type - The type of portal, currently only "UDP".
obj - The CommsObject.

JACK 5.4 Application Interface

Copyright (C) 1999-2008, Agent Oriented Software Pty. Ltd.

US Government Restricted Rights
The JACK Modules and relevant Software Material have been developed entirely at private expense and are accordingly provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of DFARS 252.227-7013 or subparagraph (c)(1) and (2) of the Commercial Computer Software Restricted Rights and 48 CFR 52.2270-19, as applicable.


Agent Oriented Software Pty. Ltd.     http://www.aosgrp.com
PO Box 639, Carlton South, Victoria 3053, Australia
Phone: +61 3 9349 5055, Fax: +61 3 9349 5088