net.i2p.router.startup
Class RouterAppManager

java.lang.Object
  extended by net.i2p.router.startup.RouterAppManager
All Implemented Interfaces:
ClientAppManager

public class RouterAppManager
extends Object
implements ClientAppManager

Notify the router of events, and provide methods for client apps to find each other.

Since:
0.9.4

Constructor Summary
RouterAppManager(RouterContext ctx)
           
 
Method Summary
 void addAndStart(ClientApp app)
           
 ClientApp getRegisteredApp(String name)
          Get a registered app.
 void notify(ClientApp app, ClientAppState state, String message, Exception e)
          Must be called on all state transitions except from UNINITIALIZED to INITIALIZED.
 boolean register(ClientApp app)
          Register with the manager under the given name, so that other clients may find it.
 void unregister(ClientApp app)
          Unregister with the manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RouterAppManager

public RouterAppManager(RouterContext ctx)
Method Detail

addAndStart

public void addAndStart(ClientApp app)

notify

public void notify(ClientApp app,
                   ClientAppState state,
                   String message,
                   Exception e)
Must be called on all state transitions except from UNINITIALIZED to INITIALIZED.

Specified by:
notify in interface ClientAppManager
Parameters:
app - non-null
state - non-null
message - may be null
e - may be null

register

public boolean register(ClientApp app)
Register with the manager under the given name, so that other clients may find it. Only required for apps used by other apps.

Specified by:
register in interface ClientAppManager
Parameters:
app - non-null
Returns:
true if successful, false if duplicate name

unregister

public void unregister(ClientApp app)
Unregister with the manager. Name must be the same as that from register(). Only required for apps used by other apps.

Specified by:
unregister in interface ClientAppManager
Parameters:
app - non-null

getRegisteredApp

public ClientApp getRegisteredApp(String name)
Get a registered app. Only used for apps finding other apps. Do not hold a static reference. If you only need to find a port, use the PortMapper instead.

Specified by:
getRegisteredApp in interface ClientAppManager
Parameters:
name - non-null
Returns:
client app or null