Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.eireneh.config
Class Config  view Config download Config.java

java.lang.Object
  extended bycom.eireneh.config.Config
All Implemented Interfaces:
java.io.Serializable

public class Config
extends java.lang.Object
implements java.io.Serializable

Config is the core part of the configuration system; it is simply a Collection of Choices.

Config does the following things:

Config does not attempt to make permanent copies of the config data because different apps may wish to store the data in different ways. Possible storage mechanisms include:

The Config class stored the current Choices, and moves the data between the various places that it is stored. There are 4 storage areas: TODO: Questions that fail on load - ask TODO: I18N
Distribution Licence:
Project B is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, by writing to Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, Or locally at the Licence link below.
The copyright to this program is held by it's authors.


Field Summary
protected  com.eireneh.util.RobustList keys
          The array that stores the keys
protected  com.eireneh.util.EventListenerList listener_list
          The list of listeners
protected  java.util.Properties local
          The set of local values
protected static com.eireneh.util.Logger log
          The log stream
protected  com.eireneh.util.RobustList models
          The array that stores the models
protected  java.lang.String title
          The name for dialog boxes and properties files
 
Constructor Summary
Config(java.lang.String title)
          Ensure that we can not be instansiated
 
Method Summary
 void add(java.lang.String key, Choice model)
          Add a key/model pairing
 void addConfigListener(ConfigListener li)
          Add an Exception listener to the list of things wanting to know whenever we capture an Exception
 void applicationToLocal()
          Take the data in the application and copy it to the local storage area.
protected  void fireChoiceAdded(java.lang.String key, Choice model)
          A Choice got added
protected  void fireChoiceRemoved(java.lang.String key, Choice model)
          A Choice got added
 Choice getChoice(java.lang.String key)
          Step through the keys
static java.lang.String getLeaf(java.lang.String key)
          What is the Path of this key
 java.lang.String getLocal(java.lang.String name)
          Get a configuration Choice (by name).
 java.util.Enumeration getNames()
          The set of Choice Names that we are controlling
static java.lang.String getPath(java.lang.String key)
          What is the Path of this key
 java.util.Enumeration getPaths()
          The set of Choice Names that we are controlling
 java.util.Properties getProperties()
          Take the data in the local storage area and store it permanently, using the specified stream.
 java.lang.String getTitle()
           
 void localToApplication(boolean force)
          Take the data in the local storage area and copy it to the application.
 void localToPermanent(java.lang.String host, int port)
          Take the data in the local storage area and store it permanently, using the configured storage area.
 void localToPermanent(java.net.URL url)
          Take the data in the local storage area and store it permanently, using the configured storage area.
 void permanentToLocal(java.lang.String host, int port)
          Take the data stored permanently and copy it to the local storage area, using the configured storage area
 void permanentToLocal(java.net.URL url)
          Take the data stored permanently and copy it to the local storage area, using the configured storage area
 void remove(java.lang.String key)
          Remove a key/model pairing
 void removeConfigListener(ConfigListener li)
          Remove an Exception listener from the list of things wanting to know whenever we capture an Exception
 void setLocal(java.lang.String name, java.lang.String value)
          Set a configuration Choice (by name) to a new value.
 void setProperties(java.util.Properties prop)
          Take the data stored permanetly and copy it to the local storage area, using the specified stream
 int size()
          The number of Choices
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static com.eireneh.util.Logger log
The log stream


title

protected java.lang.String title
The name for dialog boxes and properties files


keys

protected com.eireneh.util.RobustList keys
The array that stores the keys


models

protected com.eireneh.util.RobustList models
The array that stores the models


local

protected java.util.Properties local
The set of local values


listener_list

protected com.eireneh.util.EventListenerList listener_list
The list of listeners

Constructor Detail

Config

public Config(java.lang.String title)
Ensure that we can not be instansiated

Method Detail

getTitle

public java.lang.String getTitle()

add

public void add(java.lang.String key,
                Choice model)
Add a key/model pairing


remove

public void remove(java.lang.String key)
Remove a key/model pairing


getPaths

public java.util.Enumeration getPaths()
The set of Choice Names that we are controlling


getNames

public java.util.Enumeration getNames()
The set of Choice Names that we are controlling


getChoice

public Choice getChoice(java.lang.String key)
Step through the keys


size

public int size()
The number of Choices


setLocal

public void setLocal(java.lang.String name,
                     java.lang.String value)
Set a configuration Choice (by name) to a new value. This method is only of use to classes displaying config information


getLocal

public java.lang.String getLocal(java.lang.String name)
Get a configuration Choice (by name). This method is only of use to classes displaying config information


applicationToLocal

public void applicationToLocal()
Take the data in the application and copy it to the local storage area.


localToApplication

public void localToApplication(boolean force)
Take the data in the local storage area and copy it to the application.


setProperties

public void setProperties(java.util.Properties prop)
Take the data stored permanetly and copy it to the local storage area, using the specified stream


getProperties

public java.util.Properties getProperties()
Take the data in the local storage area and store it permanently, using the specified stream.


permanentToLocal

public void permanentToLocal(java.net.URL url)
                      throws java.io.IOException
Take the data stored permanently and copy it to the local storage area, using the configured storage area


localToPermanent

public void localToPermanent(java.net.URL url)
                      throws java.io.IOException
Take the data in the local storage area and store it permanently, using the configured storage area.


permanentToLocal

public void permanentToLocal(java.lang.String host,
                             int port)
                      throws java.io.IOException
Take the data stored permanently and copy it to the local storage area, using the configured storage area


localToPermanent

public void localToPermanent(java.lang.String host,
                             int port)
                      throws java.io.IOException
Take the data in the local storage area and store it permanently, using the configured storage area.


getPath

public static java.lang.String getPath(java.lang.String key)
What is the Path of this key


getLeaf

public static java.lang.String getLeaf(java.lang.String key)
What is the Path of this key


addConfigListener

public void addConfigListener(ConfigListener li)
Add an Exception listener to the list of things wanting to know whenever we capture an Exception


removeConfigListener

public void removeConfigListener(ConfigListener li)
Remove an Exception listener from the list of things wanting to know whenever we capture an Exception


fireChoiceAdded

protected void fireChoiceAdded(java.lang.String key,
                               Choice model)
A Choice got added


fireChoiceRemoved

protected void fireChoiceRemoved(java.lang.String key,
                                 Choice model)
A Choice got added