public class GenericPropertiesCreator
extends java.lang.Object
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). 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. UseDyanmic
property in the props file (values: true|false).CREATOR_FILE,
PROPERTY_FILE,
USE_DYNAMIC,
GenericObjectEditor,
ClassDiscovery| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
CREATOR_FILE
The name of the properties file to use as a template.
|
protected static java.lang.String |
EXCLUDE_CLASS
the prefix for an (exact) class exclusion
|
protected static java.lang.String |
EXCLUDE_FILE
The name of the properties file that lists classes/interfaces/superclasses
to exclude from being shown in the GUI.
|
protected static java.lang.String |
EXCLUDE_INTERFACE
the prefix for an interface exclusion
|
protected static java.lang.String |
EXCLUDE_SUPERCLASS
the prefix for a superclass exclusion
|
protected static GenericPropertiesCreator |
GLOBAL_CREATOR
Globally available properties
|
protected static java.util.Properties |
GLOBAL_INPUT_PROPERTIES |
protected static java.util.Properties |
GLOBAL_OUTPUT_PROPERTIES |
protected java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.util.Vector<java.lang.String>>> |
m_Excludes
the hashtable that stores the excludes: key -> Hashtable(prefix ->
Vector of classnames)
|
protected boolean |
m_ExplicitPropsFile
whether an explicit input file was given - if false, the Utils class is
used to locate the props-file
|
protected java.lang.String |
m_InputFilename
the input file with the packages
|
protected java.util.Properties |
m_InputProperties
the "template" properties file with the layout and the packages
|
protected java.lang.String |
m_OutputFilename
the output props file for the GenericObjectEditor
|
protected java.util.Properties |
m_OutputProperties
the output properties file with the filled in classes
|
protected static java.lang.String |
PROPERTY_FILE
The name of the properties file for the static GenericObjectEditor (
USE_DYNAMIC = false) |
static java.lang.String |
USE_DYNAMIC
name of property whether to use the dynamic approach or the old
GenericObjectEditor.props file
|
static boolean |
VERBOSE
whether to output some debug information
|
| Constructor and Description |
|---|
GenericPropertiesCreator()
initializes the creator, locates the props file with the Utils class.
|
GenericPropertiesCreator(java.lang.String filename)
initializes the creator, the given file overrides the props-file search of
the Utils class
|
| Modifier and Type | Method and Description |
|---|---|
void |
execute()
generates the props-file for the GenericObjectEditor and stores it
|
void |
execute(boolean store)
generates the props-file for the GenericObjectEditor
|
void |
execute(boolean store,
boolean loadInputProps)
generates the props-file for the GenericObjectEditor and stores it only if
the the param
store is TRUE. |
protected void |
generateOutputProperties()
fills in all the classes (based on the packages in the input properties
file) into the output properties file
|
boolean |
getExplicitPropsFile()
returns TRUE, if a file is loaded and not the Utils class used for locating
the props file.
|
static java.util.Properties |
getGlobalInputProperties()
Get the global input properties
|
static java.util.Properties |
getGlobalOutputProperties()
Get the global output properties
|
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)
|
protected boolean |
isValidClassname(java.lang.String classname)
checks whether the classname is a valid one, i.e., from a public class
|
protected boolean |
isValidClassname(java.lang.String key,
java.lang.String classname)
Checks whether the classname is a valid one for the given key.
|
protected void |
loadInputProperties()
loads the property file containing the layout and the packages of the
output-property-file.
|
static void |
main(java.lang.String[] args)
for generating props file:
no parameter: see default constructor
1 parameter (i.e., filename): see default constructor +
setOutputFilename(String)
2 parameters (i.e, filenames): see constructor with String argument +
setOutputFilename(String)
|
static void |
regenerateGlobalOutputProperties()
Regenerate the global output properties.
|
void |
setExplicitPropsFile(boolean value)
if FALSE, the locating of a props-file of the Utils-class is used,
otherwise it's tried to load the specified file
|
void |
setInputFilename(java.lang.String filename)
sets the file to get the information about the packages from. automatically
sets explicitPropsFile to TRUE.
|
void |
setOutputFilename(java.lang.String filename)
sets the file to output the properties for the GEO to
|
protected void |
storeOutputProperties()
stores the generated output properties file
|
boolean |
useDynamic()
gets whether the dynamic approach should be used or not
|
public static final boolean VERBOSE
public static final java.lang.String USE_DYNAMIC
protected static java.lang.String CREATOR_FILE
PROPERTY_FILEPROPERTY_FILEprotected static java.lang.String EXCLUDE_FILE
protected static java.lang.String EXCLUDE_INTERFACE
protected static java.lang.String EXCLUDE_CLASS
protected static java.lang.String EXCLUDE_SUPERCLASS
protected static java.lang.String PROPERTY_FILE
USE_DYNAMIC = false)GenericObjectEditor,
USE_DYNAMICprotected java.lang.String m_InputFilename
protected java.lang.String m_OutputFilename
protected java.util.Properties m_InputProperties
protected java.util.Properties m_OutputProperties
protected static GenericPropertiesCreator GLOBAL_CREATOR
protected static java.util.Properties GLOBAL_INPUT_PROPERTIES
protected static java.util.Properties GLOBAL_OUTPUT_PROPERTIES
protected boolean m_ExplicitPropsFile
protected java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.util.Vector<java.lang.String>>> m_Excludes
public GenericPropertiesCreator()
throws java.lang.Exception
java.lang.Exception - if loading of CREATOR_FILE failsCREATOR_FILE,
Utils.readProperties(String),
loadInputProperties()public GenericPropertiesCreator(java.lang.String filename)
throws java.lang.Exception
filename - the file containing the packages to create a props file
fromjava.lang.Exception - if loading of the file failsCREATOR_FILE,
Utils.readProperties(String),
loadInputProperties()public static java.util.Properties getGlobalOutputProperties()
public static java.util.Properties getGlobalInputProperties()
public static void regenerateGlobalOutputProperties()
public void setExplicitPropsFile(boolean value)
value - if true the specified file will be loaded not via the
Utils-classUtils.readProperties(String),
loadInputProperties()public boolean getExplicitPropsFile()
Utils.readProperties(String),
loadInputProperties()public java.lang.String getOutputFilename()
public void setOutputFilename(java.lang.String filename)
filename - the filename for the outputpublic java.lang.String getInputFilename()
public void setInputFilename(java.lang.String filename)
filename - the filename for the inputsetExplicitPropsFile(boolean)public java.util.Properties getInputProperties()
public java.util.Properties getOutputProperties()
protected void loadInputProperties()
m_InputProperties,
m_InputFilenamepublic boolean useDynamic()
protected boolean isValidClassname(java.lang.String classname)
classname - the classname to checkprotected boolean isValidClassname(java.lang.String key,
java.lang.String classname)
key - the property keyclassname - the classname to checkEXCLUDE_FILEprotected void generateOutputProperties()
throws java.lang.Exception
java.lang.Exception - if something goes wrongm_OutputPropertiesprotected void storeOutputProperties()
throws java.lang.Exception
java.lang.Exception - if the saving failsm_OutputProperties,
m_OutputFilenamepublic void execute()
throws java.lang.Exception
java.lang.Exception - if something goes wrongexecute(boolean)public void execute(boolean store)
throws java.lang.Exception
store - true if the generated props should be storedjava.lang.Exceptionpublic void execute(boolean store,
boolean loadInputProps)
throws java.lang.Exception
store is TRUE. If it is FALSE then the generated
properties file can be retrieved via the getOutputProperties
method.store - if TRUE then the properties file is stored to the stored
filenameloadInputProps - true if the input properties should be loadedjava.lang.Exception - if something goes wronggetOutputFilename(),
setOutputFilename(String),
getOutputProperties()public static void main(java.lang.String[] args)
throws java.lang.Exception
args - the commandline argumentsjava.lang.Exception - if something goes wrongGenericPropertiesCreator(),
GenericPropertiesCreator(String),
setOutputFilename(String)