Class semper.transfer.Container
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class semper.transfer.Container

java.lang.Object
   |
   +----semper.transfer.Operation
           |
           +----semper.transfer.Container

public class Container
extends Operation
implements Streamable
This class provides the functionality to build containers and to get and set some internal data. Also the container can be written to a stream and read from a stream. As a special feature the whole container can be converted into a string, which is then the data of the node content of the root. With this feature it is possible to hide the structure of the container.

Constructor Index

 o Container()
Constructor without arguments makes just the root of the container.
 o Container(String, int, Security)
Constructor with container ID, send descriptor and Security attributes as arguments.

Method Index

 o Abort()
Aborts a transfer operation if possible.
 o addChild(Node)
Adds a node as a child into the container tree.
 o concatenate(Container, Container, String, Security)
Concatenates two containers.
 o getContainerID()
Gets the Container ID.
 o getLeaves()
Gets all the leaves of the container
 o getLeaves(Node, Vector)
Adds all the leaves of the specified subtree to the passed Vector
 o getRoot()
Gets the root the container.
 o getRootID()
Gets the node ID of the root.
 o getSendDescr()
Returns the send descriptor of the container.
 o GetStatus()
Returns the status of a transfer operation.
 o makeContainerPrimitive(String)
Converts a string into a primitive Container (i.e.
 o makeFromStringToContainer()
Converts a streamed Container into a "expanded" container.
 o makeFromStringToContainer(Node)
The method that makes the work of getting a container from a string.
 o makeStringPrimitive(Node)
Converts a primitive Container (only root and leaves) into a String.
 o makeToString(Node, Vector)
Converts a subtree into a String.
 o makeToString(Vector)
Converts a Container into a String.
 o myStreamSize()
Gives the stream size of the container.
 o myStreamSize(Node)
Gives the size of a subtree of the container.
 o print()
Prints information about each node within the Container
 o readObject(StreamInputInterface)
Reads a container from a data stream.
 o Resume()
Resumes the status of an interrupted transfer operation.
 o sanity_check(Node)
checks the structure of the container.
 o setContainerID(String)
Sets the ContainerID of all nodes to the same value.
 o setContentDescr(String)
Inserts the content description into the root.
 o setNodeAttributes(Security)
Sets the root's Node security attributes.
 o setNodeContent(TransferData)
Inserts the content into the root.
 o setNodeType(String)
Inserts the node type to the root.
 o setRoot(Node)
This method is used internally to change a containers content.
 o setSendDescr(int)
Sets the send descriptor of the container.
 o setSubConAttributes(Security)
Sets the root's subcontainer security attributes.
 o writeObject(StreamOutputInterface)
Writes the container into a stream.

Constructors

 o Container
  public Container(String ContainerID,
                   int SendDescr,
                   Security SubConAttributes)
Constructor with container ID, send descriptor and Security attributes as arguments.
Parameters:
ContainerId - Container Identification
SendDescr - describes the content (used by commlayer)
SubConAttributes - attributes of the node and subtree
 o Container
  public Container()
Constructor without arguments makes just the root of the container. All attributes are false, the container ID is null.

Methods

 o Resume
  public void Resume()
Resumes the status of an interrupted transfer operation.
Overrides:
Resume in class Operation
 o Abort
  public void Abort()
Aborts a transfer operation if possible.
Overrides:
Abort in class Operation
 o GetStatus
  public void GetStatus()
Returns the status of a transfer operation.
Overrides:
GetStatus in class Operation
 o setContainerID
  public void setContainerID(String ContainerID)
Sets the ContainerID of all nodes to the same value.
Parameters:
ContainerId - Container Identification
 o getContainerID
  public String getContainerID()
Gets the Container ID.
Returns:
the ContainerId
 o getRootID
  public String getRootID()
Gets the node ID of the root.
Returns:
the node ID of the root.
 o addChild
  public void addChild(Node Child)
Adds a node as a child into the container tree. This method can be used to build containers. You can add as much children as you like.
Parameters:
Child - the Node to be added
 o concatenate
  public void concatenate(Container Cont1,
                          Container Cont2,
                          String ContainerID,
                          Security SubConAttributes)
Concatenates two containers. The tree structures are assembled into a new container by inserting a new node as root that has the two former root nodes as sons. This function also inserts security attributes valid for the new container. The security attributes of the former containers are mantained.
Parameters:
Cont1 - Container to be concatenated
Cont2 - Container to be concatenated
ContainerID - Container Identification
SubConAttributes - the security attributes valid for the new container.
 o sanity_check
  public boolean sanity_check(Node root)
checks the structure of the container.
Parameters:
root - Root node.
Returns:
true if the structur of the container is alright.
 o getRoot
  public Node getRoot()
Gets the root the container.
Returns:
a reference to the root
 o getSendDescr
  public int getSendDescr()
Returns the send descriptor of the container.
Returns:
a description of the content of the container.
 o setSendDescr
  public void setSendDescr(int SendDescr)
Sets the send descriptor of the container.
Parameters:
SendDescr - a description of the content of the container.
 o setNodeType
  public void setNodeType(String NodeType)
Inserts the node type to the root.
Parameters:
NodeType - specifies the node type (i.e statement)
 o setNodeContent
  public void setNodeContent(TransferData NodeContent)
Inserts the content into the root.
Parameters:
NodeContent - Content data to be provided for a node.
 o setContentDescr
  public void setContentDescr(String ContentDescr)
Inserts the content description into the root.
Parameters:
ContentDescr - Content Description.
 o setNodeAttributes
  public void setNodeAttributes(Security Attribute_list)
Sets the root's Node security attributes.
Parameters:
Attribute_list - Security attributes.
 o setSubConAttributes
  public void setSubConAttributes(Security Attribute_list)
Sets the root's subcontainer security attributes.
Parameters:
Attribute_list - Security Attributes.
 o writeObject
  public void writeObject(StreamOutputInterface s) throws StreamIOException
Writes the container into a stream.
Parameters:
stream - the stream of data the object state is recorded in
Throws: StreamIOException
If a subobject does not implement the Streamable interface.
 o readObject
  public void readObject(StreamInputInterface s) throws StreamIOException
Reads a container from a data stream.
Parameters:
stream - the stream of data the object state is retrieved from
Throws: StreamIOException
If a class is not present or the input data is corrupt
 o myStreamSize
  public int myStreamSize() throws StreamIOException
Gives the stream size of the container.
Returns:
the size of the stream
Throws: StreamIOException
if method can't get the streamsize of container
 o myStreamSize
  public int myStreamSize(Node node) throws StreamIOException
Gives the size of a subtree of the container.
Parameters:
node - the root of the subtree
Returns:
the size of the stream of the subtree
 o makeStringPrimitive
  protected String makeStringPrimitive(Node node) throws StreamIOException
Converts a primitive Container (only root and leaves) into a String.
Returns:
the size of the stream
 o makeToString
  public boolean makeToString(Vector options) throws StreamIOException
Converts a Container into a String. This function is based on the protected function -makeStringPrimitive-, which converts a conatainer that exist only of root and leaves into a string. The return value is boolean. It is true if the container was converted and false if not. A container can only be converted one time. A second try to convert it returns false.
 o makeToString
  protected void makeToString(Node node,
                              Vector options) throws StreamIOException
Converts a subtree into a String. This function is based on the protected function -makeStringPrimitive-, which converts a conatainer that exist only of root and leaves into a string. The return value is boolean. It is true if the subtree was converted and false if not. A subtree can only be converted one time. A second try to convert it returns false.
Parameters:
node - the root of the subtree
 o makeContainerPrimitive
  protected Node makeContainerPrimitive(String string) throws StreamIOException
Converts a string into a primitive Container (i.e. only root and leaves).
Parameters:
string - the String which representate the Container
Returns:
the root of the tree
 o makeFromStringToContainer
  public boolean makeFromStringToContainer() throws StreamIOException
Converts a streamed Container into a "expanded" container.
Returns:
false if this container was not made to a string before
 o makeFromStringToContainer
  protected Node makeFromStringToContainer(Node node) throws StreamIOException
The method that makes the work of getting a container from a string.
Returns:
the root of the tree
 o setRoot
  protected void setRoot(Node new_root)
This method is used internally to change a containers content.
Parameters:
new_root - the node which becomes the new root
 o getLeaves
  public Vector getLeaves()
Gets all the leaves of the container
Returns:
the leaves as a Vector
 o getLeaves
  protected void getLeaves(Node node,
                           Vector leaves)
Adds all the leaves of the specified subtree to the passed Vector
Parameters:
node - the root of the subtree
leaves - the Vector to which the found leaves are added
 o print
  public void print()
Prints information about each node within the Container

All Packages  Class Hierarchy  This Package  Previous  Next  Index