net.i2p.i2ptunnel
Class TunnelControllerGroup

java.lang.Object
  extended by net.i2p.i2ptunnel.TunnelControllerGroup

public class TunnelControllerGroup
extends java.lang.Object

Coordinate a set of tunnels within the JVM, loading and storing their config to disk, and building new ones as requested. Warning - this is a singleton. Todo: fix


Field Summary
(package private) static java.lang.String DEFAULT_CONFIG_FILE
           
 
Method Summary
(package private)  void acquire(TunnelController controller, I2PSession session)
          Note the fact that the controller is using the session so that it isn't destroyed prematurely.
 void addController(TunnelController controller)
          Add the given tunnel to the set of known controllers (but dont add it to a config file or start it or anything)
 java.util.List<java.lang.String> clearAllMessages()
          Fetch all outstanding messages from any of the known tunnels
 java.util.List<TunnelController> getControllers()
          Retrieve a list of tunnels known
static TunnelControllerGroup getInstance()
           
 void loadControllers(java.lang.String configFile)
          Load up all of the tunnels configured in the given file (but do not start them)
static void main(java.lang.String[] args)
           
(package private)  void release(TunnelController controller, I2PSession session)
          Note the fact that the controller is no longer using the session, and if no other controllers are using it, destroy the session.
 void reloadControllers()
           
 java.util.List<java.lang.String> removeController(TunnelController controller)
          Stop and remove the given tunnel
 java.util.List<java.lang.String> restartAllControllers()
          Restart all tunnels
 void saveConfig()
          Save the configuration of all known tunnels to the default config file
 void saveConfig(java.lang.String configFile)
          Save the configuration of all known tunnels to the given file
 java.util.List<java.lang.String> startAllControllers()
          Start all tunnels
 java.util.List<java.lang.String> stopAllControllers()
          Stop all tunnels
 void unloadControllers()
          Stop and remove reference to all known tunnels (but dont delete any config file or do other silly things)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONFIG_FILE

static final java.lang.String DEFAULT_CONFIG_FILE
See Also:
Constant Field Values
Method Detail

getInstance

public static TunnelControllerGroup getInstance()

main

public static void main(java.lang.String[] args)

loadControllers

public void loadControllers(java.lang.String configFile)
Load up all of the tunnels configured in the given file (but do not start them)


reloadControllers

public void reloadControllers()

unloadControllers

public void unloadControllers()
Stop and remove reference to all known tunnels (but dont delete any config file or do other silly things)


addController

public void addController(TunnelController controller)
Add the given tunnel to the set of known controllers (but dont add it to a config file or start it or anything)


removeController

public java.util.List<java.lang.String> removeController(TunnelController controller)
Stop and remove the given tunnel

Returns:
list of messages from the controller as it is stopped

stopAllControllers

public java.util.List<java.lang.String> stopAllControllers()
Stop all tunnels

Returns:
list of messages the tunnels generate when stopped

startAllControllers

public java.util.List<java.lang.String> startAllControllers()
Start all tunnels

Returns:
list of messages the tunnels generate when started

restartAllControllers

public java.util.List<java.lang.String> restartAllControllers()
Restart all tunnels

Returns:
list of messages the tunnels generate when restarted

clearAllMessages

public java.util.List<java.lang.String> clearAllMessages()
Fetch all outstanding messages from any of the known tunnels

Returns:
list of messages the tunnels have generated

saveConfig

public void saveConfig()
Save the configuration of all known tunnels to the default config file


saveConfig

public void saveConfig(java.lang.String configFile)
Save the configuration of all known tunnels to the given file


getControllers

public java.util.List<TunnelController> getControllers()
Retrieve a list of tunnels known

Returns:
list of TunnelController objects

acquire

void acquire(TunnelController controller,
             I2PSession session)
Note the fact that the controller is using the session so that it isn't destroyed prematurely.


release

void release(TunnelController controller,
             I2PSession session)
Note the fact that the controller is no longer using the session, and if no other controllers are using it, destroy the session.