net.i2p.router.client
Class ClientManagerFacadeImpl

java.lang.Object
  extended by net.i2p.router.ClientManagerFacade
      extended by net.i2p.router.client.ClientManagerFacadeImpl
All Implemented Interfaces:
Service

public class ClientManagerFacadeImpl
extends ClientManagerFacade

Base impl of the client facade

Author:
jrandom

Field Summary
static java.lang.String DEFAULT_HOST
           
static int DEFAULT_PORT
           
static java.lang.String PROP_CLIENT_HOST
           
static java.lang.String PROP_CLIENT_PORT
           
 
Fields inherited from class net.i2p.router.ClientManagerFacade
PROP_CLIENT_ONLY
 
Constructor Summary
ClientManagerFacadeImpl(RouterContext context)
           
 
Method Summary
 SessionConfig getClientSessionConfig(Destination dest)
          Return the client's current config, or null if not connected
 SessionKeyManager getClientSessionKeyManager(Hash dest)
          Return the client's current manager or null if not connected
 boolean isAlive()
           
 boolean isLocal(Destination dest)
          Determine if the destination specified is managed locally.
 boolean isLocal(Hash destHash)
          Determine if the destination specified is managed locally.
 java.util.Set<Destination> listClients()
          Return the list of locally connected clients
 void messageDeliveryStatusUpdate(Destination fromDest, MessageId id, boolean delivered)
           
 void messageReceived(ClientMessage msg)
           
 void renderStatusHTML(java.io.Writer out)
           
 void reportAbuse(Destination dest, java.lang.String reason, int severity)
          Instruct the client (or all clients) that they are under attack.
 void requestLeaseSet(Destination dest, LeaseSet set, long timeout, Job onCreateJob, Job onFailedJob)
          Request that a particular client authorize the Leases contained in the LeaseSet, after which the onCreateJob is queued up.
 void requestLeaseSet(Hash dest, LeaseSet set)
           
 void restart()
          Perform a soft restart.
 boolean shouldPublishLeaseSet(Hash destinationHash)
          Does the client specified want their leaseSet published?
 void shutdown()
          Instruct the service that the router is shutting down and that it should do whatever is necessary to go down gracefully.
 void startup()
          Instruct the service that it should start normal operation.
 boolean verifyClientLiveliness()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_CLIENT_PORT

public static final java.lang.String PROP_CLIENT_PORT
See Also:
Constant Field Values

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

PROP_CLIENT_HOST

public static final java.lang.String PROP_CLIENT_HOST
See Also:
Constant Field Values

DEFAULT_HOST

public static final java.lang.String DEFAULT_HOST
See Also:
Constant Field Values
Constructor Detail

ClientManagerFacadeImpl

public ClientManagerFacadeImpl(RouterContext context)
Method Detail

startup

public void startup()
Description copied from interface: Service
Instruct the service that it should start normal operation. This call DOES block until the service is ready.


shutdown

public void shutdown()
Description copied from interface: Service
Instruct the service that the router is shutting down and that it should do whatever is necessary to go down gracefully. It should not depend on other components at this point. This call DOES block.


restart

public void restart()
Description copied from interface: Service
Perform a soft restart.


isAlive

public boolean isAlive()
Overrides:
isAlive in class ClientManagerFacade

verifyClientLiveliness

public boolean verifyClientLiveliness()
Overrides:
verifyClientLiveliness in class ClientManagerFacade

requestLeaseSet

public void requestLeaseSet(Destination dest,
                            LeaseSet set,
                            long timeout,
                            Job onCreateJob,
                            Job onFailedJob)
Request that a particular client authorize the Leases contained in the LeaseSet, after which the onCreateJob is queued up. If that doesn't occur within the timeout specified, queue up the onFailedJob. This call does not block.

Specified by:
requestLeaseSet in class ClientManagerFacade
Parameters:
dest - Destination from which the LeaseSet's authorization should be requested
set - LeaseSet with requested leases - this object must be updated to contain the signed version (as well as any changed/added/removed Leases)
timeout - ms to wait before failing
onCreateJob - Job to run after the LeaseSet is authorized
onFailedJob - Job to run after the timeout passes without receiving authorization

requestLeaseSet

public void requestLeaseSet(Hash dest,
                            LeaseSet set)
Specified by:
requestLeaseSet in class ClientManagerFacade

reportAbuse

public void reportAbuse(Destination dest,
                        java.lang.String reason,
                        int severity)
Instruct the client (or all clients) that they are under attack. This call does not block.

Specified by:
reportAbuse in class ClientManagerFacade
Parameters:
dest - Destination under attack, or null if all destinations are affected
reason - Why the router thinks that there is abusive behavior
severity - How severe the abuse is, with 0 being not severe and 255 is the max

isLocal

public boolean isLocal(Destination dest)
Determine if the destination specified is managed locally. This call DOES block.

Specified by:
isLocal in class ClientManagerFacade
Parameters:
dest - Destination to be checked

isLocal

public boolean isLocal(Hash destHash)
Determine if the destination specified is managed locally. This call DOES block.

Specified by:
isLocal in class ClientManagerFacade
Parameters:
destHash - Hash of Destination to be checked

shouldPublishLeaseSet

public boolean shouldPublishLeaseSet(Hash destinationHash)
Description copied from class: ClientManagerFacade
Does the client specified want their leaseSet published?

Overrides:
shouldPublishLeaseSet in class ClientManagerFacade

messageDeliveryStatusUpdate

public void messageDeliveryStatusUpdate(Destination fromDest,
                                        MessageId id,
                                        boolean delivered)
Specified by:
messageDeliveryStatusUpdate in class ClientManagerFacade

messageReceived

public void messageReceived(ClientMessage msg)
Specified by:
messageReceived in class ClientManagerFacade

getClientSessionConfig

public SessionConfig getClientSessionConfig(Destination dest)
Return the client's current config, or null if not connected

Specified by:
getClientSessionConfig in class ClientManagerFacade

getClientSessionKeyManager

public SessionKeyManager getClientSessionKeyManager(Hash dest)
Return the client's current manager or null if not connected

Specified by:
getClientSessionKeyManager in class ClientManagerFacade

renderStatusHTML

public void renderStatusHTML(java.io.Writer out)
                      throws java.io.IOException
Specified by:
renderStatusHTML in interface Service
Overrides:
renderStatusHTML in class ClientManagerFacade
Throws:
java.io.IOException

listClients

public java.util.Set<Destination> listClients()
Return the list of locally connected clients

Overrides:
listClients in class ClientManagerFacade
Returns:
set of Destination objects