weka.gui
Class GenericPropertiesCreator

java.lang.Object
  extended byweka.gui.GenericPropertiesCreator

public class GenericPropertiesCreator
extends java.lang.Object

This class can generate the properties object that is normally loaded from the GenericObjectEditor.props file (= PROPERTY_FILE). It takes the GenericPropertiesCreator.props file as a template to determine all the derived classes by checking the classes in the given packages (a file with the same name in your home directory overrides the the one in the weka/gui directory/package).
E.g. if we want to have all the subclasses of the Classifier class then we specify the superclass ("weka.classifiers.Classifier") and the packages where to look for ("weka.classifiers.bayes" etc.):

 
   weka.classifiers.Classifier=\
     weka.classifiers.bayes,\
     weka.classifiers.functions,\
     weka.classifiers.lazy,\
     weka.classifiers.meta,\
     weka.classifiers.trees,\
     weka.classifiers.rules
  
 
This creates the same list as stored in the GenericObjectEditor.props file, but it will also add additional classes, that are not listed in the static list (e.g. a newly developed Classifier), but still in the classpath.

For discovering the subclasses the whole classpath is inspected, which means that you can have several parallel directories with the same package structure (e.g. a release directory and a developer directory with additional classes).

Code used and adapted from the following JavaWorld Tips:

Version:
$Revision: 1.1.2.2 $
Author:
FracPete (fracpete at waikato dot ac dot nz)
See Also:
#CREATOR_FILE, #PROPERTY_FILE, GenericObjectEditor, RTSI

Field Summary
static boolean VERBOSE
          whether to output some debug information
 
Constructor Summary
GenericPropertiesCreator()
          initializes the creator
GenericPropertiesCreator(java.lang.String filename)
          initializes the creator
 
Method Summary
 void execute()
          generates the props-file for the GenericObjectEditor and stores it
 void execute(boolean store)
          generates the props-file for the GenericObjectEditor and stores it only if the the param store is TRUE.
 java.lang.String getInputFilename()
          returns the name of the input file
 java.util.Properties getInputProperties()
          returns the input properties object (template containing the packages)
 java.lang.String getOutputFilename()
          returns the name of the output file
 java.util.Properties getOutputProperties()
          returns the output properties object (structure like the template, but filled with classes instead of packages)
static void main(java.lang.String[] args)
          for executing the
 void setInputFilename(java.lang.String filename)
          sets the file to get the information about the packages from
 void setOutputFilename(java.lang.String filename)
          sets the file to output the properties for the GEO to
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERBOSE

public static final boolean VERBOSE
whether to output some debug information

See Also:
Constant Field Values
Constructor Detail

GenericPropertiesCreator

public GenericPropertiesCreator()
                         throws java.lang.Exception
initializes the creator

Throws:
java.lang.Exception - if loading of CREATOR_FILE fails
See Also:
#CREATOR_FILE

GenericPropertiesCreator

public GenericPropertiesCreator(java.lang.String filename)
                         throws java.lang.Exception
initializes the creator

Parameters:
filename - the file containing the packages to create a props file from
Throws:
java.lang.Exception - if loading of the file fails
See Also:
#CREATOR_FILE
Method Detail

getOutputFilename

public java.lang.String getOutputFilename()
returns the name of the output file

Returns:
the name of the output file

setOutputFilename

public void setOutputFilename(java.lang.String filename)
sets the file to output the properties for the GEO to

Parameters:
filename - the filename for the output

getInputFilename

public java.lang.String getInputFilename()
returns the name of the input file

Returns:
the name of the input file

setInputFilename

public void setInputFilename(java.lang.String filename)
sets the file to get the information about the packages from

Parameters:
filename - the filename for the input

getInputProperties

public java.util.Properties getInputProperties()
returns the input properties object (template containing the packages)


getOutputProperties

public java.util.Properties getOutputProperties()
returns the output properties object (structure like the template, but filled with classes instead of packages)


execute

public void execute()
             throws java.lang.Exception
generates the props-file for the GenericObjectEditor and stores it

Throws:
java.lang.Exception
See Also:
execute(boolean)

execute

public void execute(boolean store)
             throws java.lang.Exception
generates the props-file for the GenericObjectEditor and stores it only if the the param store is TRUE. If it is FALSE then the generated properties file can be retrieved via the getOutputProperties method.

Parameters:
store - if TRUE then the properties file is stored to the stored filename
Throws:
java.lang.Exception
See Also:
getOutputFilename(), setOutputFilename(String), getOutputProperties()

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
for executing the

Throws:
java.lang.Exception