|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.tivoli.twg.libs.ServiceNode
ServiceNode is the base class for defining Director transport interfaces. This class actually abstracts the creation of a environment-specific version of the ServiceNode class, which contains the actual functional components of the class.
Field Summary | |
---|---|
static int |
SVCNODE_DISABLE_TRACING_CMD
|
static int |
SVCNODE_ENABLE_TRACING_CMD
|
static int |
SVCNODE_GET_STATUS_CMD
|
static int |
SVCNODE_KILL_SERVICE_CMD
|
Constructor Summary | |
---|---|
ServiceNode()
Constructor for ServiceNode. |
|
ServiceNode(com.tivoli.twg.libs.ServiceNodeImpl imp)
Deprecated. |
|
ServiceNode(com.tivoli.twg.libs.ServiceNodeImpl imp,
boolean is_raw,
boolean make_thrd)
Deprecated. |
|
ServiceNode(java.lang.String sn_name)
Constructor for ServiceNode. |
|
ServiceNode(java.lang.String sn_name,
boolean make_thrd)
Constructor for ServiceNode. |
|
ServiceNode(java.lang.String sn_name,
boolean make_thrd,
boolean is_raw)
Constructor for ServiceNode. |
Method Summary | |
---|---|
boolean |
Close()
Close and detach the ServiceNode. |
boolean |
CommandReceived(Command cmd)
Callback for processing any Commands received by the ServiceNode (if in cooked mode (default)). |
static boolean |
ConnectionActive(java.lang.String name)
Test to see if a ServiceNode with the given name is currently active. |
boolean |
Create()
Test to see if ServiceNode was created successfully. |
void |
DeregisterCommandListener(long cmd_code)
Deregister a command-received listener for a given command code. |
void |
DeregisterDefaultCommandListener()
Deregister the default command-received listener. |
void |
EnqueueCommandFail(long cmd_id,
long rc)
Enqueue command failure reply : used by ServiceNodeImpl to deliver generic command failures with no parameters |
void |
EnqueueReceiveBuffer(byte[] data,
int start,
int length)
Enqueue receive buffer : used by ServiceNodeImpl to deliver data |
static java.lang.String |
formatCommandCode(Command c)
|
static java.lang.String |
formatReturnCode(Command c)
|
static int |
GetFeatureFlags()
Get global feature flags for local (or server) system. |
static ServiceNodeImplFactory |
GetServiceNodeFactory()
Get default factory object to use for creating our ServiceNodeImpl |
static java.lang.String |
getTS()
|
boolean |
IsActive()
Get active state of ServiceNode. |
boolean |
IsRawMode()
Test ServiceNode for Raw mode. |
static byte[] |
LocalMACAddress()
Return local (or server, if proxy) MAC address, as byte[6] |
static byte[][] |
LocalMacAddressList()
|
static java.lang.String |
LocalSystemName()
Return local system's name (or server name, for proxy). |
static byte[] |
LocalUniqueID()
Return local (or server, if proxy) unique ID, as byte[8]. |
java.lang.String |
Name()
Return name of service node |
boolean |
PeriodicCallback()
Callback method for periodic callback (set using SetPeriodicCallback()) Default does nothing. |
void |
ProcessCommands()
Method called to handle processing for the ServiceNode (if a processing thread was not created). |
void |
ReceiveData(byte[] data,
int start,
int length)
Callback for raw-mode data receive. |
static void |
RegisterAsServiceBase()
Register this process as a "service base" process, which should not be terminated if the user logs off the system (i.e. |
void |
RegisterCommandListener(long cmd_code,
CommandReceivedListener listener)
Register a command-received listener for a given command code. |
void |
RegisterDefaultCommandListener(CommandReceivedListener listener)
Register the default command-received listener. |
void |
run()
|
boolean |
SendAsynchCommand(Command cmd)
Send command without waiting for command reply. |
boolean |
SendBuffer(byte[] data,
int start,
int length)
Send method for raw-mode ServiceNode. |
boolean |
SendCommand(Command cmd)
Send command and wait for reply before returning. |
boolean |
SendLocalAsyncCommand(Command cmd)
Send a command to destination ServiceNode that is within the same JVM as the source ServiceNode without waiting for a reply. |
boolean |
SendLocalCommand(Command cmd)
Send a command to destination ServiceNode that is within the same JVM as the source ServiceNode and waits for a reply. |
boolean |
SendPostponedReply(Command cmd)
Send a postponed Command which is ready to be sent. |
void |
SetActive(boolean active)
Set active state of ServiceNode. |
void |
setCommandDebugString(long cc,
java.lang.String debug_str)
Set command debug string for given command code |
static void |
SetFeatureFlags(int flags)
Set global feature flags for local (or server) system. |
static void |
SetGlobalNetworkTimeout(int timeout)
Set global default timeout for Commands. |
static void |
SetLocalSystemName(java.lang.String name)
Set local system's name (or server name, for proxy). |
void |
SetPeriodicCallback(int period_msec)
Sets interval for periodic callback, in msec. |
static void |
SetServiceNodeFactory(ServiceNodeImplFactory factory)
Set default factory object to use for creating our ServiceNodeImpl |
void |
ThreadInit()
Callback method called when processing thread has begun processing Default method does nothing, but ServiceNode subclasses can provide their own version. |
void |
ThreadTerm()
Callback method called when processing thread has finished processing Default method does nothing, but ServiceNode subclasses can provide their own version. |
java.lang.String |
toString()
Returns a string representation of the object. |
void |
traceCommandCompleteCall(Command c,
int cn,
java.lang.String identifier)
|
void |
traceCommandReceived(Command c,
java.lang.String identifier)
|
void |
traceCommandReceivedReturn(Command c,
java.lang.String identifier)
|
void |
traceCommandSend(Command c,
java.lang.String identifier)
|
void |
traceError(Command c,
java.lang.String message)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int SVCNODE_ENABLE_TRACING_CMD
public static final int SVCNODE_DISABLE_TRACING_CMD
public static final int SVCNODE_GET_STATUS_CMD
public static final int SVCNODE_KILL_SERVICE_CMD
Constructor Detail |
public ServiceNode(java.lang.String sn_name, boolean make_thrd, boolean is_raw) throws BadServiceNodeImplException, ServiceNodeClosedException, ServiceNodeException
sn_name
- - name stringmake_thrd
- - true means that ServiceNode will create its own
processing thread, false means that the user will call ProcessCommands()is_raw
- - ServiceNode is raw if true, else its cooked modeBadServiceNodeImplException
- - if no ServiceNodeImplFactory definedServiceNodeClosedException
- - if ServiceNode failed to openServiceNodeException
- if other problem occurspublic ServiceNode(java.lang.String sn_name, boolean make_thrd) throws BadServiceNodeImplException, ServiceNodeClosedException, ServiceNodeException
sn_name
- - name stringmake_thrd
- - true means that ServiceNode will create its own
processing thread, false means that the user will call ProcessCommands()BadServiceNodeImplException
- - if no ServiceNodeImplFactory definedServiceNodeClosedException
- - if ServiceNode failed to openServiceNodeException
- if other problem occurspublic ServiceNode(java.lang.String sn_name) throws BadServiceNodeImplException, ServiceNodeClosedException, ServiceNodeException
sn_name
- - name stringBadServiceNodeImplException
- - if no ServiceNodeImplFactory definedServiceNodeClosedException
- - if ServiceNode failed to openServiceNodeException
- if other problem occurspublic ServiceNode() throws BadServiceNodeImplException, ServiceNodeClosedException, ServiceNodeException
BadServiceNodeImplException
- - if no ServiceNodeImplFactory definedServiceNodeClosedException
- - if ServiceNode failed to openServiceNodeException
- if other problem occurspublic ServiceNode(com.tivoli.twg.libs.ServiceNodeImpl imp, boolean is_raw, boolean make_thrd) throws ServiceNodeClosedException
imp
- - user-provided ServiceNodeImplis_raw
- - Set to raw (true) or cooked (false) modemake_thrd
- - true means that ServiceNode will create its own
processing thread, false means that the user will call ProcessCommands()ServiceNodeClosedException
- - if ServiceNode failed to openpublic ServiceNode(com.tivoli.twg.libs.ServiceNodeImpl imp) throws ServiceNodeClosedException
imp
- - user-provided ServiceNodeImplServiceNodeClosedException
- - if ServiceNode failed to openMethod Detail |
public boolean Close() throws ServiceNodeException
ServiceNodeException
- if other problem occurspublic java.lang.String Name() throws ServiceNodeClosedException
ServiceNodeClosedException
- - if ServiceNode is closedpublic java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public boolean Create()
public boolean IsRawMode() throws ServiceNodeClosedException
ServiceNodeClosedException
- - if ServiceNode is closedpublic boolean CommandReceived(Command cmd)
public void ProcessCommands() throws ServiceNodeClosedException, ServiceNodeException, java.lang.InterruptedException
ServiceNodeClosedException
- - if ServiceNode is closedServiceNodeException
- for processing errorsjava.lang.InterruptedException
- if thread is interruptedpublic void EnqueueReceiveBuffer(byte[] data, int start, int length) throws ServiceNodeClosedException
data
- - byte[] containing packetstart
- - index in data of start of packetlength
- - length of packetServiceNodeClosedException
- if ServiceNode is closedpublic void EnqueueCommandFail(long cmd_id, long rc) throws ServiceNodeClosedException
cmd_id
- - command ID of failed commandrc
- - return code for failed commandServiceNodeClosedException
- if ServiceNode is closedpublic static boolean ConnectionActive(java.lang.String name) throws BadServiceNodeImplException, ServiceNodeException
name
- - Name of ServiceNode to checkBadServiceNodeImplException
- if no ServiceNodeImplFactory
defined.ServiceNodeException
- if other problem occurspublic boolean SendAsynchCommand(Command cmd) throws ServiceNodeClosedException, ServiceNodeException, java.lang.InterruptedException
cmd
- - Command to be sent through ServiceNodeServiceNodeClosedException
- if ServiceNode is closedServiceNodeException
- for other problemsjava.lang.InterruptedException
- if thread interrupted while waitingpublic boolean SendCommand(Command cmd) throws ServiceNodeClosedException, ServiceNodeException, java.lang.InterruptedException
cmd
- - Command to be sent through ServiceNodeServiceNodeClosedException
- if ServiceNode is closedServiceNodeException
- for other problemsjava.lang.InterruptedException
- if thread interrupted while waitingpublic boolean SendLocalAsyncCommand(Command cmd) throws ServiceNodeClosedException, ServiceNodeException, java.lang.InterruptedException
SendAsynchCommand()
.
SendLocalAsyncCommand
is faster than SendAsychCommand
when sending commands within the same JVM. However, since the actual Command
object is enqueued to the destination, the Command should not be modified or
resent until after CommandComplete()
has finished. If a Command
is resent before it has completed, the method returns false.cmd
- - Command to be sent through ServiceNodeServiceNodeClosedException
- if ServiceNode is closedServiceNodeException
- for other problemsjava.lang.InterruptedException
- if thread interrupted while waitingpublic boolean SendLocalCommand(Command cmd) throws ServiceNodeClosedException, ServiceNodeException, java.lang.InterruptedException
SendCommand()
.
SendLocalCommand
is faster than SendCommand
when sending commands within the same JVM. However, since the actual Command
object is enqueued to the destination, the Command should not be modified or
resent until after CommandComplete()
has finished. If a Command
is resent before it has completed, the method returns false.cmd
- - Command to be sent through ServiceNodeServiceNodeClosedException
- if ServiceNode is closedServiceNodeException
- for other problemsjava.lang.InterruptedException
- if thread interrupted while waitingpublic void ThreadInit()
public void ThreadTerm()
public boolean SendPostponedReply(Command cmd) throws ServiceNodeClosedException, ServiceNodeException
cmd
- - Postponed Command to be sentServiceNodeClosedException
- if ServiceNode is closedServiceNodeException
- for other problemspublic void ReceiveData(byte[] data, int start, int length)
data
- - byte[] containing data receivedstart
- - index in 'data' of start of data packet receivedlength
- - number of bytes in data packet receivedpublic boolean SendBuffer(byte[] data, int start, int length) throws ServiceNodeClosedException, ServiceNodeException
data
- - byte[] containing data to be sentstart
- - index in data of start of data packet to sendlength
- - number of bytes in data packet to sendServiceNodeClosedException
- if ServiceNode is closedServiceNodeException
- for other problemspublic static void SetGlobalNetworkTimeout(int timeout) throws BadServiceNodeImplException, ServiceNodeException
timeout
- - default time-out, in millisecondsBadServiceNodeImplException
- if no ServiceNodeImplFactoryServiceNodeException
- for other problemspublic static java.lang.String LocalSystemName() throws BadServiceNodeImplException, ServiceNodeException
BadServiceNodeImplException
- if no ServiceNodeImplFactoryServiceNodeException
- for other problemspublic static void SetLocalSystemName(java.lang.String name) throws BadServiceNodeImplException, ServiceNodeException
name
- - string for system's nameBadServiceNodeImplException
- if no ServiceNodeImplFactoryServiceNodeException
- for other problemspublic static byte[] LocalMACAddress() throws BadServiceNodeImplException, ServiceNodeException
BadServiceNodeImplException
- if no ServiceNodeImplFactoryServiceNodeException
- for other problemspublic static byte[][] LocalMacAddressList() throws BadServiceNodeImplException, ServiceNodeException
public static byte[] LocalUniqueID() throws BadServiceNodeImplException, ServiceNodeException
BadServiceNodeImplException
- if no ServiceNodeImplFactoryServiceNodeException
- for other problemspublic boolean PeriodicCallback()
public void SetPeriodicCallback(int period_msec) throws ServiceNodeClosedException
period_msec
- - period, in msec (0 = disabled)ServiceNodeClosedException
- if ServiceNode is closedpublic static void RegisterAsServiceBase() throws BadServiceNodeImplException, ServiceNodeException
BadServiceNodeImplException
- if no ServiceNodeImplFactoryServiceNodeException
- for other problemspublic static int GetFeatureFlags() throws BadServiceNodeImplException, ServiceNodeException
BadServiceNodeImplException
- if no ServiceNodeImplFactoryServiceNodeException
- for other problemspublic static void SetFeatureFlags(int flags) throws BadServiceNodeImplException, ServiceNodeException
flags
- - feature flags, as intBadServiceNodeImplException
- if no ServiceNodeImplFactoryServiceNodeException
- for other problemspublic void SetActive(boolean active) throws ServiceNodeClosedException, ServiceNodeException
active
- - if true, set to active, else set to inactiveServiceNodeClosedException
- if service node is closedServiceNodeException
- for other problemspublic boolean IsActive() throws ServiceNodeClosedException
ServiceNodeClosedException
- if service node is closedpublic static void SetServiceNodeFactory(ServiceNodeImplFactory factory)
factory
- - ServiceNodeImplFactory to use as defaultpublic void RegisterCommandListener(long cmd_code, CommandReceivedListener listener)
cmd_code
- - command code to be listened forlistener
- - CommandReceivedListener to be registeredpublic void DeregisterCommandListener(long cmd_code)
cmd_code
- - command code to have listener deregisteredpublic void RegisterDefaultCommandListener(CommandReceivedListener listener)
listener
- - CommandReceivedListener to be registeredpublic void DeregisterDefaultCommandListener()
public static ServiceNodeImplFactory GetServiceNodeFactory()
public void run()
run
in interface java.lang.Runnable
public void setCommandDebugString(long cc, java.lang.String debug_str)
cc
- - command codedebug_str
- - debug stringpublic static java.lang.String getTS()
public static java.lang.String formatCommandCode(Command c)
public static java.lang.String formatReturnCode(Command c)
public void traceCommandReceived(Command c, java.lang.String identifier)
public void traceCommandReceivedReturn(Command c, java.lang.String identifier)
public void traceCommandSend(Command c, java.lang.String identifier)
public void traceCommandCompleteCall(Command c, int cn, java.lang.String identifier)
public void traceError(Command c, java.lang.String message)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |