DRCL JavaSim API

drcl.inet.socket
Class Launcher

java.lang.Object
  |
  +--drcl.DrclObj
        |
        +--drcl.comp.Component
              |
              +--drcl.inet.socket.Launcher
All Implemented Interfaces:
java.lang.Cloneable, ObjectDuplicable, java.io.Serializable, java.net.SocketImplFactory

public class Launcher
extends Component
implements java.net.SocketImplFactory

This class is the front end of running real applications on JavaSim/INET. The process involves two steps:

  1. Configuring the "map" from the real Internet addresses to JavaSim/INET addresses. This map is used to retrieve the remote address in JavaSim when an application opens a connection with a real Internet address.
  2. Launching the application on a node using start(String, String[], Node).
In this framework, we assume:
  1. The application class is a standalone Java program (containing the static main() method to start with).
  2. The application does not create its own ThreadGroup, or if it does, it does not open a socket in its own ThreadGroup. Note that a GUI application may open socket in the GUI thread group, in which case, the application cannot run on JavaSim without modification.

See Also:
Serialized Form

Inner classes inherited from class drcl.comp.Component
Component.LockPack
 
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_GARBAGE_DISPLAY_ENABLED, FLAG_GARBAGE_ENABLED, FLAG_PORT_NOTIFICATION, FLAG_STARTED, FLAG_STOPPED, FLAG_TRACE_ENABLED, FLAG_UNDEFINED_START, id, infoPort, lockHead, name, parent, PortGroup_DEFAULT_GROUP, PortGroup_EVENT, PortGroup_SERVICE, Root, Trace_DATA, Trace_SEND
 
Constructor Summary
Launcher()
           
 
Method Summary
 void configure(java.lang.String map_)
          Each line of the map is in the following format:
 java.net.SocketImpl createSocketImpl()
           
 java.net.InetAddress getInetAddress(long javasimAddr_)
          Returns the real InetAddress given the JavaSim/INET address (long).
 long getJavaSimAddr(java.net.InetAddress addr_)
          Returns the corresponding JavaSim/INET address (long) given the real InetAddress.
 Node getNode()
          Returns the node component in which the current thread is working for the JavaSimSocket.
 java.lang.String info()
          Returns information regarding this component.
 void removeSocket(JavaSimSocket s_)
           
 void reset()
          Resets the component for being used anew.
 void restore()
           
 void start(java.lang.String appClassName_, java.lang.String[] args_, Node node_)
          Starts an application.
 void takeover()
           
 
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, duplicate, 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, isAncestorOf, isComponentNotificationEnabled, isContainer, isDebugEnabled, isDebugEnabledAt, isDirectOutputEnabled, isEnabled, isErrorNoticeEnabled, isEventExportEnabled, isGarbageDisplayEnabled, isGarbageEnabled, isPortNotificationEnabled, isPortRemovable, isStarted, isStopped, isTraceEnabled, lock, notify, notifyAll, operate, portAdded, portRemoved, process, reboot, removeAll, removeAllComponents, removeAllPorts, removeAllPorts, removeComponent, removeComponent, removePort, removePort, removePort, 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
 
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

Launcher

public Launcher()
Method Detail

getJavaSimAddr

public long getJavaSimAddr(java.net.InetAddress addr_)
Returns the corresponding JavaSim/INET address (long) given the real InetAddress.

getInetAddress

public java.net.InetAddress getInetAddress(long javasimAddr_)
Returns the real InetAddress given the JavaSim/INET address (long).

getNode

public Node getNode()
Returns the node component in which the current thread is working for the JavaSimSocket.

takeover

public void takeover()

restore

public void restore()

configure

public void configure(java.lang.String map_)
Each line of the map is in the following format:
<domain name> or <ip>	<JavaSim address>

start

public void start(java.lang.String appClassName_,
                  java.lang.String[] args_,
                  Node node_)
Starts an application.

info

public java.lang.String info()
Description copied from class: Component
Returns information regarding this component. Subclasses should override this method to provide useful information at run-time.
Overrides:
info in class Component

reset

public void reset()
Description copied from class: Component
Resets the component for being used anew. All the internal variables must be set to the initial state. All the ports and child components are reset as well.
Overrides:
reset in class Component

createSocketImpl

public java.net.SocketImpl createSocketImpl()
Specified by:
createSocketImpl in interface java.net.SocketImplFactory

removeSocket

public void removeSocket(JavaSimSocket s_)

DRCL JavaSim API

Copyright © 2001 - DRCL, OSU     ~ Back to JavaSim Home ~