de.fzj.unicore.wsrflite.utils.deployment
Class ServiceConfigReader

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by de.fzj.unicore.wsrflite.utils.deployment.ServiceConfigReader
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler
Direct Known Subclasses:
ServiceConfigReader

public class ServiceConfigReader
extends DefaultHandler

Very basic config utility configures services based on a file having the following format:
<services>
<!-- you can add properties here -->
<property name="...." value="...."/>
...
<!-- you can add global handlers that will be put on all services -->
<globalHandler type="in|out" class="...."/>
...
<service name="..." wsrf="true|false" persistent="true|false" [wsdlLocation=" ... "]>
<interface class="" /> <!-- the interface defining your service -->
<implementation class=""/> <!-- the implementation of the service -->
<handler type="in|out" class="..."/> <!-- an in/out handler to add -->
<initTask class="..."/> <!-- a Java Runnable to run after deployment-->
<shutdownTask class="..."/> <!-- a Java Runnable to run before un-deployment -->
</service>
...
</services>

Author:
schuller

Field Summary
protected  String initTask
           
protected  String jarFilePath
           
protected  String monitorName
           
protected  String propertyName
           
protected  String propertyValue
           
protected  String shutdownTask
           
static String WATCH_CONFIG
           
static String WATCH_CONFIG_INTERVAL
           
 
Constructor Summary
ServiceConfigReader()
           
ServiceConfigReader(File configFile, long period)
          Configure from the given file.
 
Method Summary
protected  void addInHandlers(org.codehaus.xfire.service.Service s, List<String> handlers)
           
protected  void addOutHandlers(org.codehaus.xfire.service.Service s, List<String> handlers)
           
 void configureServices()
           
 void configureServices(InputStream is)
          configure the services
protected  org.codehaus.xfire.service.Service deployService()
           
protected  void discoverHostName()
           
 void endElement(String uri, String localName, String qName)
           
 List<Runnable> getInitTasks()
          return the list of Runnable that were defined in the configuration as service init tasks
protected  String makeBaseUrl()
           
protected  void reInit()
           
protected  void setDefaultPort()
           
 void startElement(String uri, String localName, String qName, Attributes attributes)
           
protected  void validate()
          sanity check on properties
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propertyName

protected String propertyName

propertyValue

protected String propertyValue

monitorName

protected String monitorName

jarFilePath

protected String jarFilePath

initTask

protected String initTask

shutdownTask

protected String shutdownTask

WATCH_CONFIG

public static final String WATCH_CONFIG
See Also:
Constant Field Values

WATCH_CONFIG_INTERVAL

public static final String WATCH_CONFIG_INTERVAL
See Also:
Constant Field Values
Constructor Detail

ServiceConfigReader

public ServiceConfigReader()

ServiceConfigReader

public ServiceConfigReader(File configFile,
                           long period)
                    throws FileNotFoundException
Configure from the given file. This file will be watched for changes using the given period (use -1 to disable the watch)

Parameters:
configFile - - the config file
period - - the file checking period in milliseconds
Throws:
FileNotFoundException
Method Detail

configureServices

public void configureServices()
                       throws Exception
Throws:
Exception

configureServices

public void configureServices(InputStream is)
                       throws SAXException,
                              ParserConfigurationException,
                              IOException
configure the services

Throws:
SAXException - - on parsing / XML syntax errors
IOException - - if the config stream cannot be read
ParserConfigurationException - - if no SAX parser can be set up

discoverHostName

protected void discoverHostName()

setDefaultPort

protected void setDefaultPort()

validate

protected void validate()
sanity check on properties


makeBaseUrl

protected String makeBaseUrl()

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attributes)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Throws:
SAXException

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException,
                       ServiceDeploymentException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Throws:
SAXException
ServiceDeploymentException

reInit

protected void reInit()

deployService

protected org.codehaus.xfire.service.Service deployService()
                                                    throws Exception
Throws:
Exception

addInHandlers

protected void addInHandlers(org.codehaus.xfire.service.Service s,
                             List<String> handlers)

addOutHandlers

protected void addOutHandlers(org.codehaus.xfire.service.Service s,
                              List<String> handlers)

getInitTasks

public List<Runnable> getInitTasks()
return the list of Runnable that were defined in the configuration as service init tasks



Copyright © 2010. All Rights Reserved.