HOME

com.ireasoning.protocol.tl1
Class TL1Command

java.lang.Object
  extended bycom.ireasoning.protocol.tl1.TL1Command
All Implemented Interfaces:
Serializable

public class TL1Command
extends Object
implements Serializable

This class is used to create a TL1 Command. TL1 command's format: "ACTION:TID:AIDs:CTAG:[General Block]:[Data Block]*;".
For example, for TL1 command "ACT-USER::username:123::password;", action is "ACT-USER", tid is empty, aid is "username", ctag is "123", general block is empty, data block is "password"

See Also:
TL1Session, Serialized Form

Constructor Summary
TL1Command()
          Default constructor
TL1Command(String command)
          Constructs a TL1 command
TL1Command(String action, String tid, String aid, String ctag)
          Constructs a TL1 command.
TL1Command(String action, String tid, String aid, String ctag, String dataBlock)
          Constructs a TL1 command.
TL1Command(String action, String tid, String aid, String ctag, String generalBlock, String dataBlock)
          Constructs a TL1 command.
TL1Command(String action, String tid, String aid, String ctag, String generalBlock, String[] dataBlocks)
          Constructs a TL1 command.
 
Method Summary
static TL1Command act_user(String user, String password)
          Creates ACT-USER command, with empty tid and ctag .
static TL1Command act_user(String user, String password, String tid, String ctag)
          Creates ACT-USER command.
static TL1Command canc_user(String user)
          Creates CANC-USER command, with empty tid and ctag
static TL1Command canc_user(String user, String tid, String ctag)
          Creates CANC-USER command
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 boolean equalsIgnoreCase(TL1Command cmd)
          Compares this TL1Command to another TL1Command, ignoring case considerations.
 String getAction()
          Returns the action part of TL1 command
 String getAID()
          Returns access identifier
 String getAID2()
          Returns the second access identifier (some commands have two access identifiers)
 String getCTAG()
          Returns correlation tag
 String getDataBlock()
          Returns the first data block
 String[] getDataBlocks()
          Returns all data blocks
 String getGeneralBlock()
          Returns the general block of TL1 command
 String getTID()
          Returns target identifier
 int hashCode()
          Returns the hash code value for this TL1Command object
 void setAction(String s)
          Sets action part of TL1 command
 void setAID(String s)
          Sets access identifier.
 void setAID2(String s)
          Sets the second access identifier
 void setCommand(String s)
          Sets a new TL1 command
 void setCTAG(String s)
          Sets correlation tag
 void setDataBlock(String s)
          Sets "Data Block" value
 void setDataBlocks(String[] dataBlocks)
          If there are multiple data blocks, set values to all of them
 void setGeneralBlock(String s)
          Sets the general block part of TL1 command.
 void setTID(String s)
          Sets target identifier
 String toString()
          Returns a String representation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TL1Command

public TL1Command()
Default constructor


TL1Command

public TL1Command(String command)
           throws TL1ParsingException
Constructs a TL1 command

Parameters:
command - the raw TL1 command string, e.g. "ACT-USER::username:123::password;"

TL1Command

public TL1Command(String action,
                  String tid,
                  String aid,
                  String ctag)
Constructs a TL1 command. TL1 command has the following format "ACTION:TID:AIDs:CTAG:[General Block]:[Data Block]*;"

Parameters:
action - action part of TL1 command
tid - target ID
aid - access identifier
ctag - correlation tag

TL1Command

public TL1Command(String action,
                  String tid,
                  String aid,
                  String ctag,
                  String dataBlock)
Constructs a TL1 command. TL1 command has the following format "ACTION:TID:AIDs:CTAG:[General Block]:[Data Block]*;"

Parameters:
action - action part of TL1 command
tid - target ID
aid - access identifier
ctag - correlation tag
dataBlock - data block part of TL1 command

TL1Command

public TL1Command(String action,
                  String tid,
                  String aid,
                  String ctag,
                  String generalBlock,
                  String dataBlock)
Constructs a TL1 command. TL1 command has the following format "ACTION:TID:AIDs:CTAG:[General Block]:[Data Block]*;"

Parameters:
action - action part of TL1 command
tid - target ID
aid - access identifier
ctag - correlation tag
dataBlock - data block part of TL1 command
generalBlock - general block part of TL1 command

TL1Command

public TL1Command(String action,
                  String tid,
                  String aid,
                  String ctag,
                  String generalBlock,
                  String[] dataBlocks)
Constructs a TL1 command. TL1 command has the following format "ACTION:TID:AIDs:CTAG:[General Block]:[Data Block]*;"

Parameters:
action - action part of TL1 command
tid - target ID
aid - access identifier
ctag - correlation tag
dataBlocks - one or more data blocks
generalBlock - general block part of TL1 command
Method Detail

act_user

public static TL1Command act_user(String user,
                                  String password,
                                  String tid,
                                  String ctag)
Creates ACT-USER command.

Parameters:
user - user name
password - password
tid - target ID
ctag - correlation tag

act_user

public static TL1Command act_user(String user,
                                  String password)
Creates ACT-USER command, with empty tid and ctag .

Parameters:
user - user name
password - password

canc_user

public static TL1Command canc_user(String user)
Creates CANC-USER command, with empty tid and ctag


canc_user

public static TL1Command canc_user(String user,
                                   String tid,
                                   String ctag)
Creates CANC-USER command

Parameters:
user - user name
tid - target ID
ctag - correlation tag

getAID

public String getAID()
Returns access identifier


getAID2

public String getAID2()
Returns the second access identifier (some commands have two access identifiers)


getDataBlock

public String getDataBlock()
Returns the first data block


getDataBlocks

public String[] getDataBlocks()
Returns all data blocks


getCTAG

public String getCTAG()
Returns correlation tag


getTID

public String getTID()
Returns target identifier


getAction

public String getAction()
Returns the action part of TL1 command


setAID

public void setAID(String s)
Sets access identifier.

Parameters:
s - Acess identifier. Use "null" if no AID data.

setAID2

public void setAID2(String s)
Sets the second access identifier

Parameters:
s - Acess identifier. Use "null" if no AID data.

setGeneralBlock

public void setGeneralBlock(String s)
Sets the general block part of TL1 command.

Parameters:
s - general block

getGeneralBlock

public String getGeneralBlock()
Returns the general block of TL1 command


setDataBlock

public void setDataBlock(String s)
Sets "Data Block" value

Parameters:
s - the value of "Data Block"

setDataBlocks

public void setDataBlocks(String[] dataBlocks)
If there are multiple data blocks, set values to all of them

Parameters:
dataBlocks - array of data blocks.

setCTAG

public void setCTAG(String s)
Sets correlation tag

Parameters:
s - correlation tag

setTID

public void setTID(String s)
Sets target identifier

Parameters:
s - target identifier

setAction

public void setAction(String s)
Sets action part of TL1 command

Parameters:
s - action string

setCommand

public void setCommand(String s)
                throws TL1ParsingException
Sets a new TL1 command

Parameters:
s - new raw TL1 command, e.g. "ACT-USER::username:123::password;"
Throws:
TL1ParsingException

toString

public String toString()
Returns a String representation

Returns:
a String representation, null if TL1FormattingException is thrown.

equalsIgnoreCase

public boolean equalsIgnoreCase(TL1Command cmd)
Compares this TL1Command to another TL1Command, ignoring case considerations. Two TL1Command are considered equal ignoring case if each parts of TL1 command is the same ignoring case.

Parameters:
cmd - the TL1Command instance to compare this one against
Returns:
true if the argument is not null and the TL1Commands are equal, ignoring case; false otherwise.

equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one. Two TL1Command are considered equal if each parts of TL1 command is the same.

Parameters:
obj - the TL1Command to compare this one against
Returns:
true if the argument is not null and the TL1Commands are equal; false otherwise.

hashCode

public int hashCode()
Returns the hash code value for this TL1Command object


HOME

Copyright © 2002 iReasoning Inc. All Rights Reserved.