uk.ac.soton.itinnovation.grid.service.utils.webadmin
Class AbstractWebConfigBase

java.lang.Object
  extended by uk.ac.soton.itinnovation.grid.service.utils.webadmin.AbstractWebConfigBase
All Implemented Interfaces:
WebAdmin
Direct Known Subclasses:
WebConfigBase

public abstract class AbstractWebConfigBase
extends Object
implements WebAdmin

This class provides a web interface for configuring a set of services. It handles testing for missing jars, setting up a keystore and TLS, and configuring hibernate. Once the base is configured correctly, it will display aggregated feeds from other services. When creating a .WAR distribution, this class should be subclassed to list the individual services required.


Field Summary
protected static org.apache.log4j.Logger log
           
protected  Writer out
           
protected  String parentWebAppContext
           
protected  HttpServletRequest request
           
protected  File webappClasses
           
protected  File webinf
           
 
Constructor Summary
AbstractWebConfigBase(HttpServletRequest request, Writer out)
          Constructor.
 
Method Summary
 void checkConfig()
          Ensure that the services are configured correctly.
 void ensurePoliciesDeployed()
          Ensure that any required PBAC policies are deployed.
 Document getAtomFeed()
          Get an Atom feed for this webapp.
 Document getAtomFeed(String atomFeed, String serviceBase)
          Get at Atom feed for this container.
protected  File getDefaultConfigDir()
          The default directory to suggest for configuration.
protected  String getUpgradeMessage(String serviceName, String progress)
           
protected  String getVersionProperty()
          The old name of the property in warversion.properties used for the version number.
protected abstract  void mergeServiceAtomFeeds(Document feed, String atomFeed, String base)
          Let each service add any events it wants to the master Atom feed.
protected abstract  void serviceSpecificSetup()
          Called while displaying the admin page if the base configuration is OK.
protected  int showFeed(WebAdmin service, String feedURL, String serviceBase)
          Show the first few items of feed in a compact format.
abstract  boolean showPublicServices()
          List all the services, with links to their WSDL.
protected abstract  void showServices(boolean available)
          Write out HTML listing all the services.
protected  void testInvocation(String service, String operation)
          Try invoking a simple SOAP operation.
protected  UpgradeReport upgradeService(String serviceName, String upgraderFactoryClass, String oldVersion)
           
protected abstract  void upgradeServices(String oldVersion)
          Called when upgrading from an older version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

protected Writer out

request

protected HttpServletRequest request

webappClasses

protected File webappClasses

parentWebAppContext

protected String parentWebAppContext

log

protected static org.apache.log4j.Logger log

webinf

protected File webinf
Constructor Detail

AbstractWebConfigBase

public AbstractWebConfigBase(HttpServletRequest request,
                             Writer out)
Constructor.

Parameters:
request - the request object from the JSP context
out - the response's output writer
Method Detail

getVersionProperty

protected String getVersionProperty()
The old name of the property in warversion.properties used for the version number. This is needed to support upgrading from versions which used a different property name in their version.properties files.


getDefaultConfigDir

protected File getDefaultConfigDir()
The default directory to suggest for configuration. E.g. "/etc/myprog"

Returns:
the value of baseconfig.default.config.dir.posix in baseconfig.properties (except on Windows systems, where it returns baseconfig.default.config.dir.windows)

checkConfig

public void checkConfig()
                 throws Exception
Ensure that the services are configured correctly. If not, lead the user through the configuration process. This method gets the user to set the configuration directory, checks for missing jars, displays a message during upgrades (and warns about downgrades), gets the user to configure a keystore, database and endpoint base address, and then invokes testBaseConfiguration(). It displays a list of links to the various configuration pages and services, and displays any notifications from the services' Atom streams.

Throws:
Exception

upgradeServices

protected abstract void upgradeServices(String oldVersion)
                                 throws Stop
Called when upgrading from an older version.

Throws:
Stop

serviceSpecificSetup

protected abstract void serviceSpecificSetup()
                                      throws Exception
Called while displaying the admin page if the base configuration is OK. This should perform any service-specific tests or setup, including any test invocation.

Throws:
Exception

getUpgradeMessage

protected String getUpgradeMessage(String serviceName,
                                   String progress)

testInvocation

protected void testInvocation(String service,
                              String operation)
                       throws Exception
Try invoking a simple SOAP operation. We featch the WSDL from .../services/[service]?wsdl and try to invoke the operation (which takes no arguments). Call this from testBaseConfiguration().

Parameters:
service - name of service, e.g. "MyService"
operation - the operation to invoke
Throws:
Stop - with useful diagnostic information and hints on failure
Exception

upgradeService

protected UpgradeReport upgradeService(String serviceName,
                                       String upgraderFactoryClass,
                                       String oldVersion)
                                throws Stop
Throws:
Stop

showFeed

protected int showFeed(WebAdmin service,
                       String feedURL,
                       String serviceBase)
                throws IOException
Show the first few items of feed in a compact format.

Returns:
the number of items displayed
Throws:
IOException

showServices

protected abstract void showServices(boolean available)
                              throws IOException
Write out HTML listing all the services.

Parameters:
available - whether the links should be clickable (i.e. whether the base configuration has been compeleted yet)
Throws:
IOException

showPublicServices

public abstract boolean showPublicServices()
                                    throws IOException
List all the services, with links to their WSDL.

Returns:
true if the list was displayed, or false if the services aren't configured yet
Throws:
IOException

getAtomFeed

public Document getAtomFeed()
                     throws Exception
Get an Atom feed for this webapp. This aggregates the feeds of all the services inside this webapp, and also a feed for the container itself (for example, including warnings about the keystore expiring soon).

Returns:
an Atom feed
Throws:
Exception

mergeServiceAtomFeeds

protected abstract void mergeServiceAtomFeeds(Document feed,
                                              String atomFeed,
                                              String base)
                                       throws Exception
Let each service add any events it wants to the master Atom feed.

Parameters:
feed - the feed so far
atomFeed - the URL of the atom feed being generated
base - the base URL for this web-app
Throws:
Exception

getAtomFeed

public Document getAtomFeed(String atomFeed,
                            String serviceBase)
                     throws GridFailureException
Get at Atom feed for this container. This feed contains only events relating to the container as a whole; it does not include events from individual services.

Specified by:
getAtomFeed in interface WebAdmin
Parameters:
atomFeed - the URL of the feed
serviceBase - the service administration URL (for creating hyperlinks)
Throws:
GridFailureException
See Also:
AtomUtils

ensurePoliciesDeployed

public void ensurePoliciesDeployed()
Description copied from interface: WebAdmin
Ensure that any required PBAC policies are deployed.

Specified by:
ensurePoliciesDeployed in interface WebAdmin


Copyright © 2001-2007 University of Southampton IT Innovation Centre. All Rights Reserved.