org.glite.authz.common.http
Class JettyAdminService

java.lang.Object
  extended by org.glite.authz.common.http.JettyAdminService

public class JettyAdminService
extends java.lang.Object

A Jetty instance that listens on a give port for command requests. This command starts a separate Jetty instance that binds to 127.0.0.1 on a port given during service construction. Incoming requests are delegated to registered command objects based on their path. This service also registers a special shutdown command for itself. When the shutdown command, registered at /shutdown is run a set of registered shutdown tasks are executed after which this service is also shutdown.


Constructor Summary
JettyAdminService(java.lang.String hostname, int port, java.lang.String password)
          Constructor.
 
Method Summary
protected  org.mortbay.jetty.Server buildAdminService()
          Builds the Jetty server that will receive admin requests.
protected  AbstractAdminCommand buildShutdownCommand()
          Builds an AbstractAdminCommand which shutdowns this admin service.
 void registerAdminCommand(AbstractAdminCommand command)
          Registers a new administration command.
 void registerShutdownTask(java.lang.Runnable task)
          Registers a task to be run at shutdown time.
 void start()
          Creates and starts the shutdown service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JettyAdminService

public JettyAdminService(java.lang.String hostname,
                         int port,
                         java.lang.String password)
Constructor.

Parameters:
hostname - hostname upon which the admin service listens
port - port upon which the admin service listens
password - password required to execute admin commands, may be null if no password is required
Method Detail

registerAdminCommand

public void registerAdminCommand(AbstractAdminCommand command)
Registers a new administration command. New commands may not be registered after the service has been started.

Parameters:
command - command to register

registerShutdownTask

public void registerShutdownTask(java.lang.Runnable task)
Registers a task to be run at shutdown time. Tasks will be run in the order they are registered. New tasks may not be registered once the service has been started.

Parameters:
task - shutdown task to run at service shutdown time

start

public void start()
Creates and starts the shutdown service.


buildAdminService

protected org.mortbay.jetty.Server buildAdminService()
Builds the Jetty server that will receive admin requests.

Returns:
Jetty server that will receive admin requests

buildShutdownCommand

protected AbstractAdminCommand buildShutdownCommand()
Builds an AbstractAdminCommand which shutdowns this admin service.

Returns:
the shutdown command


Copyright © 2008-2012 EMI - European Middleware Initiative. All Rights Reserved.