nl.toolforge.karma.core.boot
Class WorkingContextConfiguration

java.lang.Object
  extended bynl.toolforge.karma.core.boot.WorkingContextConfiguration

public final class WorkingContextConfiguration
extends java.lang.Object

Configuration class for a WorkingContext. A WorkingContextConfiguration consists of the following configuration:

The configuration is not loaded automatically. By calling the load()-method the configuration will be loaded.

Version:
$Id: WorkingContextConfiguration.java,v 1.6 2004/11/03 20:54:14 asmedes Exp $
Author:
D.A. Smedes

Field Summary
static ErrorCode CONFIGURATION_LOAD_ERROR
           
 
Constructor Summary
WorkingContextConfiguration(WorkingContext workingContext)
          Creates a configuration object using configFile as the configuration file.
 
Method Summary
 ErrorCode check()
          Thorough checks of this configuration is valid, and if it is not, returns the ErrorCode to indicate what went wrong or null if nothing went wrong, and this configuration is ready to use.
 LocationStore getLocationStore()
          Returns the LocationStore for this configuration.
 ManifestStore getManifestStore()
          Returns the ManifestStore for this configuration.
 java.lang.String getProperty(java.lang.String key)
           
 boolean load()
          Loads the configuration from working-context.xml.
 void setLocationStore(LocationStore locationStore)
          Sets the location store for this configuration.
 void setManifestStore(ManifestStore manifestStore)
          Sets the manifest store for this configuration.
 void setProperty(java.lang.String name, java.lang.String value)
          Adds or changes a property in the current configuration.
 void store()
          Stores the all configuration items in configuration in the working-context.xml file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIGURATION_LOAD_ERROR

public static final ErrorCode CONFIGURATION_LOAD_ERROR
Constructor Detail

WorkingContextConfiguration

public WorkingContextConfiguration(WorkingContext workingContext)
Creates a configuration object using configFile as the configuration file. The configuration is loaded by calling load().

Parameters:
workingContext - The WorkingContext for this configuration.
Method Detail

getLocationStore

public LocationStore getLocationStore()
Returns the LocationStore for this configuration. Can be null if not configured properly.

Returns:
The LocationStore for this configuration. Can be null if not configured properly.

getManifestStore

public ManifestStore getManifestStore()
Returns the ManifestStore for this configuration. Can be null if not configured properly.

Returns:
The ManifestStore for this configuration. Can be null if not configured properly.

setManifestStore

public void setManifestStore(ManifestStore manifestStore)
Sets the manifest store for this configuration. nulls are allowed.

Parameters:
manifestStore - The manifest store for this configuration.

setLocationStore

public void setLocationStore(LocationStore locationStore)
Sets the location store for this configuration. nulls are allowed.

Parameters:
locationStore - The location store for this configuration.

getProperty

public java.lang.String getProperty(java.lang.String key)
Parameters:
key -
Returns:
null if the property is not found.

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Adds or changes a property in the current configuration. When a property with key name exists, its value is overwritten with value.


check

public ErrorCode check()
Thorough checks of this configuration is valid, and if it is not, returns the ErrorCode to indicate what went wrong or null if nothing went wrong, and this configuration is ready to use.

Returns:
An ErrorCode indicating the exact failure or null of nothing it wrong.

load

public boolean load()
             throws WorkingContextException

Loads the configuration from working-context.xml. When the file did not exists, false will be returned. Otherwise, this method returns true and the configuration succeeded. Note that this method performs no validation on the configuration itself. This is left to the user.

When the configuration could be loaded, this method returns true. This is not to say that the configuration is correct. The configuration should still be checked for correctness by the client.

Calling this method overwrites any properties already set for this configuration.

Returns:
true when the configuration could be loaded, false if it couldn't.
Throws:
WorkingContextException - When an IOException or SAXException occurs, indicating an error when reading a configuration file, which could result by the client in specific actions (thus the exception and not the true or false.

store

public void store()
           throws WorkingContextException
Stores the all configuration items in configuration in the working-context.xml file.

Throws:
WorkingContextException - When storing failed.


Copyright © 2002-2004 Toolforge. All Rights Reserved.