J-Sim v1.2.1-p7 API

drcl.inet.application
Class SApplication

java.lang.Object
  extended bydrcl.DrclObj
      extended bydrcl.comp.Component
          extended bydrcl.net.Module
              extended bydrcl.inet.application.SApplication
All Implemented Interfaces:
java.lang.Cloneable, ObjectDuplicable, java.io.Serializable
Direct Known Subclasses:
ftp, ftpd

public class SApplication
extends Module

Single-session (or simplified) application base class. No open or close is needed. Assume that the connection is already established at the transport layer. This class provides a set of send() and receive() methods to send/receive byte streams to/from the peer application process. One can also use getInputStream() and getOutputStream() to send/receive byte stream using the stream classes in java.io.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class drcl.comp.Component
Component.Locks
 
Field Summary
 
Fields inherited from class drcl.net.Module
address, downPort, PortGroup_DOWN, PortGroup_UP, timerPort, upPort
 
Fields inherited from class drcl.comp.Component
FLAG_COMPONENT_NOTIFICATION, FLAG_DEBUG_ENABLED, FLAG_DIRECT_OUTPUT_ENABLED, FLAG_ENABLED, FLAG_ERROR_ENABLED, FLAG_EVENT_ENABLED, FLAG_EXPOSED, FLAG_GARBAGE_DISPLAY_ENABLED, FLAG_GARBAGE_ENABLED, FLAG_HAS_EXPOSED_CHILD, FLAG_PORT_NOTIFICATION, FLAG_STARTED, FLAG_STOPPED, FLAG_TRACE_ENABLED, FLAG_UNDEFINED_START, id, infoPort, locks, name, parent, PortGroup_DEFAULT_GROUP, PortGroup_EVENT, PortGroup_SERVICE, Root, Trace_DATA, Trace_SEND
 
Constructor Summary
SApplication()
           
SApplication(java.lang.String id_)
           
 
Method Summary
 java.io.InputStream getInputStream()
           
 java.io.OutputStream getOutputStream()
           
protected  void process(java.lang.Object data_, Port inPort_)
          This method classifies inPort_ and delegates process of data to the appropriate handler.
protected  int receive()
          Receives whatever is currently available through the down port.
protected  int receive(byte[] buffer_)
          Receives a buffer of data through the down port.
protected  int receive(byte[] buffer_, int size_)
          Receives a maximun of size_ data through the down port.
protected  int receive(int size_)
          Receives size_ bytes of data through the down port.
protected  void send(byte[] buffer_, int len_)
          Sends len_ bytes of data from buffer_ through the down port.
protected  void send(int len_)
          Sends len_ bytes of pseudo-data through the down port.
 
Methods inherited from class drcl.net.Module
cancelTimeout, dataArriveAtDownPort, dataArriveAtUpPort, deliver, duplicate, getAddress, processOther, removeDefaultDownPort, removeDefaultUpPort, removeTimerPort, setAddress, setTimeout, setTimeoutAt, timeout
 
Methods inherited from class drcl.comp.Component
_resume, _start, _stop, addComponent, addComponent, addEventPort, addEventPort, addForkPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addServerPort, addServerPort, cancelFork, componentAdded, componentRemoved, connect, containsComponent, containsComponent, containsPort, debug, disconnectAll, disconnectAllPeers, disconnectAllPorts, drop, drop, error, error, expose, exposeEventPorts, exposePort, exposePort, exposePort, exposePort, exposePort, findAvailable, findAvailable, findAvailable, finishing, fork, forkAt, getAllComponents, getAllPorts, getAllPorts, getAllWiresInside, getAllWiresInsideOut, getAllWiresOut, getComponent, getComponentFlag, getComponentFlag, getContract, getContractHT, getContractHT, getDebugFlagsInBinary, getDebugLevelNames, getForkManager, getID, getName, getParent, getPort, getPort, getRoot, getRuntime, getTime, iduplicate, info, isAncestorOf, isComponentNotificationEnabled, isContainer, isDebugEnabled, isDebugEnabledAt, isDirectlyRelatedTo, isDirectOutputEnabled, isEnabled, isErrorNoticeEnabled, isEventExportEnabled, isGarbageDisplayEnabled, isGarbageEnabled, isPortNotificationEnabled, isPortRemovable, isStarted, isStopped, isTraceEnabled, lock, notify, notifyAll, operate, portAdded, portRemoved, reboot, removeAll, removeAllComponents, removeAllPorts, removeAllPorts, removeComponent, removeComponent, removePort, removePort, removePort, reset, resume, run, sduplicate, send, sendAt, setComponentFlag, setComponentFlag, setComponentNotificationEnabled, setContract, setDebugEnabled, setDebugEnabled, setDebugEnabledAt, setDebugEnabledAt, setDebugEnabledAt, setDirectOutputEnabled, setDirectOutputEnabled, setEnabled, setErrorNoticeEnabled, setErrorNoticeEnabled, setEventExportEnabled, setEventExportEnabled, setExecutionBoundary, setGarbageDisplayEnabled, setGarbageDisplayEnabled, setGarbageEnabled, setGarbageEnabled, setID, setID, setName, setPort, setPort, setPortNotificationEnabled, setPortRemovable, setRuntime, setTraceEnabled, setTraceEnabled, sleepFor, sleepUntil, stop, toString, unexpose, unlock, useLocalForkManager, useLocalForkManager, wait, yield
 
Methods inherited from class drcl.DrclObj
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SApplication

public SApplication()

SApplication

public SApplication(java.lang.String id_)
Method Detail

getInputStream

public java.io.InputStream getInputStream()

getOutputStream

public java.io.OutputStream getOutputStream()

send

protected void send(int len_)
             throws java.io.IOException
Sends len_ bytes of pseudo-data through the down port.

Parameters:
len_ - size of the data to send.
Throws:
java.io.IOException

send

protected void send(byte[] buffer_,
                    int len_)
             throws java.io.IOException
Sends len_ bytes of data from buffer_ through the down port. Pseudo-data is sent if buffer_ is null.

Parameters:
buffer_ - where is put the data to be sent.
len_ - size of the data to send.
Throws:
java.io.IOException

receive

protected int receive()
               throws java.io.IOException
Receives whatever is currently available through the down port. No real data is received.

Returns:
the number of bytes received. 0 if EOF is encountered.
Throws:
java.io.IOException

receive

protected int receive(int size_)
               throws java.io.IOException
Receives size_ bytes of data through the down port. No real data is received. If size_ is greater than 0, this method will be blocked until exactly the amount of data is available. If size_ is less than 0, then the method will grab all the data available right now.

Returns:
the number of bytes received. 0 if EOF is encountered.
Throws:
java.io.IOException

receive

protected int receive(byte[] buffer_)
               throws java.io.IOException
Receives a buffer of data through the down port. This method will be blocked until the buffer is filled.

Parameters:
buffer_ - the buffer to store the incoming data.
Returns:
the number of bytes received. 0 if EOF is encountered.
Throws:
java.io.IOException

receive

protected int receive(byte[] buffer_,
                      int size_)
               throws java.io.IOException
Receives a maximun of size_ data through the down port. No real data is received if buffer_ is null. If size_ is greater than 0, this method will be blocked until exactly the amount of data is filled to the buffer. If size_ is less than 0, then the method will grab all the data available right now till the buffer is full.

Parameters:
buffer_ - the buffer to store the incoming data.
Returns:
the number of bytes received. 0 if EOF is encountered.
Throws:
java.io.IOException

process

protected void process(java.lang.Object data_,
                       Port inPort_)
Description copied from class: Module
This method classifies inPort_ and delegates process of data to the appropriate handler. If a subclass decides to override this method, then it should call super.process(data_, inPort_) to make those handlers effective.

Overrides:
process in class Module
See Also:
Module.dataArriveAtUpPort(Object, drcl.comp.Port), Module.dataArriveAtDownPort(Object, drcl.comp.Port), Module.processOther(Object, drcl.comp.Port)

J-Sim v1.2.1-p7 API

Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved.     ~ To J-Sim Home ~