DRCL J-Sim API

drcl.inet.socket
Class Launcher

java.lang.Object
  extended bydrcl.DrclObj
      extended bydrcl.comp.Component
          extended bydrcl.inet.socket.Launcher
All Implemented Interfaces:
java.lang.Cloneable, ObjectCloneable, 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 JSim/INET. The process involves two steps:

  1. Configuring the "map" from the real Internet addresses to JSim/INET addresses. This map is used to retrieve the remote address in JSim 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 JSim without modification.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class drcl.comp.Component
Component.Locks
 
Field Summary
 
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, locks, 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_)
          Configures the launcher with a "map".
 java.net.SocketImpl createSocketImpl()
           
 java.net.InetAddress getInetAddress(long javasimAddr_)
          Returns the real InetAddress given the JSim/INET address (long).
 long getJSimAddr(java.net.InetAddress addr_)
          Returns the corresponding JSim/INET address (long) given the real InetAddress.
 Node getNode()
          Returns the node component in which the current thread is working for the JSimSocketImpl.
 java.lang.String info()
          Returns information regarding this component.
 void removeSocket(JSimSocketImpl 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
addComponent, addComponent, addEventPort, addEventPort, addForkPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addServerPort, addServerPort, cancelFork, connect, containsComponent, containsComponent, containsPort, debug, disconnectAll, disconnectAllPeers, disconnectAllPorts, drop, drop, duplicate, error, error, expose, exposeEventPorts, exposePort, exposePort, exposePort, exposePort, exposePort, findAvailable, findAvailable, findAvailable, fork, forkAt, getAllComponents, getAllPorts, getAllPorts, getAllWiresInside, getAllWiresInsideOut, getAllWiresOut, getComponent, getComponentFlag, getComponentFlag, getContract, getContractHT, getContractHT, getDebugFlagsInBinary, getDebugLevelNames, getID, getName, getParent, getPort, getPort, getRoot, getTime, iduplicate, isAncestorOf, isContainer, isDebugEnabled, isDebugEnabledAt, isDirectlyRelatedTo, isDirectOutputEnabled, isEnabled, isErrorNoticeEnabled, isEventExportEnabled, isGarbageDisplayEnabled, isGarbageEnabled, isPortRemovable, isStarted, isStopped, isTraceEnabled, lock, notify, notifyAll, operate, reboot, removeAll, removeAllComponents, removeAllPorts, removeAllPorts, removeComponent, removeComponent, removePort, removePort, removePort, resume, run, sduplicate, send, sendAt, setComponentFlag, setComponentFlag, setDebugEnabled, setDebugEnabled, setDebugEnabledAt, setDebugEnabledAt, setDebugEnabledAt, setDirectOutputEnabled, setDirectOutputEnabled, setEnabled, setErrorNoticeEnabled, setErrorNoticeEnabled, setEventExportEnabled, setEventExportEnabled, setExecutionBoundary, setGarbageDisplayEnabled, setGarbageDisplayEnabled, setGarbageEnabled, setGarbageEnabled, setID, setID, setName, setPort, setPort, 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, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Launcher

public Launcher()
Method Detail

getJSimAddr

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


getInetAddress

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


getNode

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


takeover

public void takeover()

restore

public void restore()

configure

public void configure(java.lang.String map_)
Configures the launcher with a "map". Each line of the map is in the following format:
<domain name> or <ip>	<JSim 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(JSimSocketImpl s_)

DRCL J-Sim API

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