org.jconfig.handler
Class URLHandler

java.lang.Object
  extended byorg.jconfig.handler.URLHandler
All Implemented Interfaces:
ConfigurationHandler, java.util.EventListener, FileListener
Direct Known Subclasses:
ConfigServerHandler

public class URLHandler
extends java.lang.Object
implements ConfigurationHandler, FileListener

This class will read the content from an URL and generate the properties. If you have the need to use a proxy server, create jconfig.properties file and place it inside your system path.
jconfig.properties example:
# jconfig.properties file
http.proxyHost=proxy.server.url
http.proxyPort=3128

Author:
Andreas Mecky andreas.mecky@xcom.de, Terry Dye terry.dye@xcom.de

Constructor Summary
URLHandler()
           
 
Method Summary
 void addFileListener(FileListener fileListener)
           
 void fileChanged(FileListenerEvent event)
          This method, once implemented, will be called when the File object itself changes.
 java.lang.String getURL()
           
 Configuration load()
           
 Configuration load(java.lang.String configName)
          This method loads a configuration and returns it
 Configuration load(java.lang.String configName, ConfigurationParser parser)
          This method loads a configuration using a specific parser and returns it
protected  Configuration load(java.lang.String theURL, java.lang.String configName)
           
protected  Configuration load(java.lang.String theURL, java.lang.String configName, ConfigurationParser parser)
           
 void setURL(java.lang.String url)
           
 void setValidation(boolean validate)
          This defines if the file will be vaidated using a DTD.
 void store(Configuration configuration)
          This method should store all categories and properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLHandler

public URLHandler()
Method Detail

setURL

public void setURL(java.lang.String url)

setValidation

public void setValidation(boolean validate)
This defines if the file will be vaidated using a DTD. The default is false.

Parameters:
validate - defines the validation

load

public Configuration load()
                   throws ConfigurationManagerException
Throws:
ConfigurationManagerException

fileChanged

public void fileChanged(FileListenerEvent event)
Description copied from interface: FileListener
This method, once implemented, will be called when the File object itself changes.

Specified by:
fileChanged in interface FileListener

load

public Configuration load(java.lang.String configName)
                   throws ConfigurationManagerException
Description copied from interface: ConfigurationHandler
This method loads a configuration and returns it

Specified by:
load in interface ConfigurationHandler
Parameters:
configName - the name of the configuration
Returns:
the Configuration
Throws:
ConfigurationManagerException - if the file cannot be processed

load

public Configuration load(java.lang.String configName,
                          ConfigurationParser parser)
                   throws ConfigurationManagerException
Description copied from interface: ConfigurationHandler
This method loads a configuration using a specific parser and returns it

Specified by:
load in interface ConfigurationHandler
Parameters:
configName - the name of the configuration
parser - the parser that should be used
Returns:
the Configuration
Throws:
ConfigurationManagerException

load

protected Configuration load(java.lang.String theURL,
                             java.lang.String configName)
                      throws ConfigurationManagerException
Throws:
ConfigurationManagerException

load

protected Configuration load(java.lang.String theURL,
                             java.lang.String configName,
                             ConfigurationParser parser)
                      throws ConfigurationManagerException
Throws:
ConfigurationManagerException

store

public void store(Configuration configuration)
           throws ConfigurationManagerException
This method should store all categories and properties.

Specified by:
store in interface ConfigurationHandler
Parameters:
configuration - the Configuration that should be saved
Throws:
ConfigurationManagerException

addFileListener

public void addFileListener(FileListener fileListener)

getURL

public java.lang.String getURL()


Copyright © 2001-2005 Andreas Mecky, Terry Dye. All Rights Reserved.