Package net.i2p.router.startup
Class RouterAppManager
- java.lang.Object
-
- net.i2p.app.ClientAppManagerImpl
-
- net.i2p.router.startup.RouterAppManager
-
- All Implemented Interfaces:
ClientAppManager
public class RouterAppManager extends ClientAppManagerImpl
Notify the router of events, and provide methods for client apps to find each other.- Since:
- 0.9.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
RouterAppManager.Shutdown
-
Field Summary
-
Fields inherited from class net.i2p.app.ClientAppManagerImpl
_registered
-
-
Constructor Summary
Constructors Constructor Description RouterAppManager(RouterContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addAndStart(ClientApp app, String[] args)
void
addBubble(String svc, String text)
Increment the count and set the textint
getBubbleCount(String svc)
Bubble countString
getBubbleText(String svc)
Bubble message, translated, not HTML escapedClientApp
getClientApp(String className, String[] args)
Get the first known ClientApp with this class name and exact arguments.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
renderStatusHTML(Writer out)
debugvoid
setBubble(String svc, int count, String text)
Update notifications for servicevoid
shutdown()
void
unregister(ClientApp app)
Unregister with the manager.-
Methods inherited from class net.i2p.app.ClientAppManagerImpl
getRegisteredApp
-
-
-
-
Constructor Detail
-
RouterAppManager
public RouterAppManager(RouterContext ctx)
-
-
Method Detail
-
addAndStart
public boolean addAndStart(ClientApp app, String[] args)
- Parameters:
args
- the args that were used to instantiate the app, non-null, may be zero-length- Returns:
- success
- Throws:
IllegalArgumentException
- if already added
-
getClientApp
public ClientApp getClientApp(String className, String[] args)
Get the first known ClientApp with this class name and exact arguments. Caller may then retrieve or control the state of the returned client. A client will generally be found only if it is running or transitioning; after it is stopped it will not be tracked by the manager.- Parameters:
args
- non-null, may be zero-length- Returns:
- client app or null
- Since:
- 0.9.6
-
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 interfaceClientAppManager
- Overrides:
notify
in classClientAppManagerImpl
- Parameters:
app
- non-nullstate
- non-nullmessage
- may be nulle
- 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 interfaceClientAppManager
- Overrides:
register
in classClientAppManagerImpl
- 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 interfaceClientAppManager
- Overrides:
unregister
in classClientAppManagerImpl
- Parameters:
app
- non-null- Since:
- 0.9.41 overridden for logging only
-
getBubbleCount
public int getBubbleCount(String svc)
Bubble count- Specified by:
getBubbleCount
in interfaceClientAppManager
- Overrides:
getBubbleCount
in classClientAppManagerImpl
- Returns:
- 0 always, see RouterAppManager override
- Since:
- 0.9.66
-
getBubbleText
public String getBubbleText(String svc)
Bubble message, translated, not HTML escaped- Specified by:
getBubbleText
in interfaceClientAppManager
- Overrides:
getBubbleText
in classClientAppManagerImpl
- Returns:
- null if none
- Since:
- 0.9.66
-
setBubble
public void setBubble(String svc, int count, String text)
Update notifications for service- Specified by:
setBubble
in interfaceClientAppManager
- Overrides:
setBubble
in classClientAppManagerImpl
- Parameters:
count
- 0 to cleartext
- translated, not HTML escaped, null if none- Since:
- 0.9.66
-
addBubble
public void addBubble(String svc, String text)
Increment the count and set the text- Specified by:
addBubble
in interfaceClientAppManager
- Overrides:
addBubble
in classClientAppManagerImpl
- Parameters:
text
- translated, not HTML escaped, null if none- Since:
- 0.9.66
-
shutdown
public void shutdown()
- Since:
- 0.9.6
-
renderStatusHTML
public void renderStatusHTML(Writer out) throws IOException
debug- Throws:
IOException
- Since:
- 0.9.6
-
-