HOME

com.ireasoning.protocol.tl1
Class TL1Line

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

public class TL1Line
extends Object
implements Serializable

This class represents each line in payload.

 Payload contains one or multiple lines. 
 Each Line (Represented by TL1Line) has the following format:
 "section [: section]*"     (section is represented by TL1Section)
 In each section:
 "field [, field]*"    (field is represented by TL1Field)
 In each field
 "name [ = value]"
 
For instance, for a TL1 response message :
   NODE 2000-05-09 17:32:36
M  1 COMPLD
   "SLOT-3:E1000,EQUIP,,ACT:CARDNAME=E1000"
   "SLOT-4:OC3,EQUIP,,NA:CARDNAME=OC3-IR:IS"

  "SLOT-3:E1000,EQUIP,,ACT:CARDNAME=E1000" and
  "SLOT-4:OC3,EQUIP,,NA:CARDNAME=OC3-IR:IS" are lines in the payload.
 
Usage Example:
      ...
      TL1ResponseMsg [] responses = session.send(command);
      ...
      TL1ResponseMsg response =  response[0];
      
      TL1Line[] lines =  response.getPayloadData();
      for (int j = 0; j < lines.length ; j++) 
      {
          TL1Section [] sections = lines[j].getSections();
          // System.out.println( "line: " + j);
          for (int k = 0; k < sections.length ; k++) 
          {
              // System.out.println( "section: " + k);
              TL1Field [] fields = sections[k].getFields();
              for ( int m = 0; m < fields.length; m++)
              {
                  TL1Field f = fields[m];
                  // System.out.println("<" + f.getName() + "> = <" + f.getValue()
                          + ">");
              }
          }
      }
 

See Also:
Serialized Form

Constructor Summary
TL1Line(String line)
          Constructs a new TL1Line with the specified line string
 
Method Summary
 TL1Section getSection(int index)
          Returns the section at the specified position in this line.
 int getSectionCount()
          Returns the number of sections contained in this line
 TL1Section[] getSections()
          Returns the sections contained in this line.
 String lookupValue(String key)
          Returns the value corresponding to the passed key.
 String toString()
          Returns the string representation of this class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TL1Line

public TL1Line(String line)
Constructs a new TL1Line with the specified line string

Parameters:
line - the raw line string. e.g. "SLOT-3:E1000,EQUIP,,ACT:CARDNAME=E1000"
Method Detail

getSections

public TL1Section[] getSections()
Returns the sections contained in this line. Empty section still counts, e.g. for "a::b,c", getSections will return "a", "", "b,c" sections.


getSection

public TL1Section getSection(int index)
Returns the section at the specified position in this line.

Throws:
IndexOutOfBoundsException - if index is out of range (index < 0 || index >= getSectionCount()).

getSectionCount

public int getSectionCount()
Returns the number of sections contained in this line


lookupValue

public String lookupValue(String key)
Returns the value corresponding to the passed key. For instance, for a line "DS3-3::PEC=ABCDE,REL=AA1,CLEI=3339,RCV", lookupValue("PEC") will return "ABCDE"; lookupValue("RCV") will return null.

Returns:
the value corresponding to the passed key, or null if key does not exist.

toString

public String toString()
Returns the string representation of this class


HOME

Copyright © 2002 iReasoning Inc. All Rights Reserved.