|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pt.ist.fenixframework.Config
public abstract class Config
An instance of the Config
class bundles together the initialization parameters
used by the Fenix Framework.
Therefore, before initializing the framework (via the call to the
FenixFramework.initialize(Config)
method), the programmer should create an instance of
Config
with the correct values for each of the parameters.
No constructor is provided for this class (other than the default constructor), because the
Config
class has several parameters, some of which are optional. But, whereas
optional parameters do not need to be specified, the parameters that are required must be
specified by the programmer before calling the FenixFramework.initialize(Config)
method.
Additional configuration parameters may be added by subclassing this class. Subclasses of
config can override the init()
method. Typically, their own init()
should also
call super#init()
if an hierarchy of configs is used.
To create an instance of this class with the proper values for its parameters, programmers should generally use code like this (assuming one specific backend as an example):
Note that theConfig config = new MemConfig() { // any subclass of Config should be ok { this.domainModelURLs = resourceToURLArray("path/to/domain.dml"); this.appName = "MyAppName"; } };
Config
takes an array of URLs for the domainModelURLs
.
Utility methods are provided in this class to convert from other typical representations to their
corresponding URL. All of the utility method return the required URL[]
. Here are
some guidelines:
resourceToURLArray(String)
: looks up the given resource using
Thread.currentThread().getContextClassLoader().getResource(String)
;filenameToURLArray(String)
: looks up the given file on the local filesystem;
resourcesToURLArray(String [])
) are equivalent,
except that they take multiple DML file locations.{ {} }to delimit an instance initializer block for the anonymous inner class being created. Each of the parameters of the
Config
class is represented as a
protected class field. Look at the documentation of each field to see what is
it for, whether it is optional or required, and in the former case, what is
its default value.
FenixFramework
,
MemConfig
Field Summary | |
---|---|
protected String |
appName
This optional parameter specifies a name for the application. |
protected URL[] |
domainModelURLs
This required parameter specifies the URL[] to each file
containing the DML code that corresponds to the domain model of the application. |
protected static String |
PROPERTY_CONFIG_CLASS
|
protected static String |
SETTER_FROM_STRING
|
Constructor Summary | |
---|---|
Config()
|
Method Summary | |
---|---|
protected void |
appNameFromString(String value)
Note: Either appNameFromString or domainModelURLsFromString should be used, but not both! |
protected void |
checkConfig()
Subclasses of this class can overwrite this method, but they should specifically call super.checkConfig() to check the superclass's configuration. |
protected void |
checkForDomainModelURLs()
Check if the value of domainModelURLs is already set. |
protected void |
checkRequired(Object obj,
String fieldName)
|
protected void |
domainModelURLsFromString(String value)
Note: Either appNameFromString or domainModelURLsFromString should be used, but not both! |
static URL[] |
filenamesToURLArray(String... filenames)
|
static URL[] |
filenameToURLArray(String filename)
|
String |
getAppName()
|
abstract BackEnd |
getBackEnd()
Get the current BackEnd in use. |
URL[] |
getDomainModelURLs()
|
protected abstract void |
init()
|
protected void |
initialize()
This method is invoked by the FenixFramework.initialize(Config) . |
protected static void |
missingRequired(String fieldName)
|
protected void |
populate(Properties props)
|
static URL[] |
resourcesToURLArray(String... resources)
|
static URL[] |
resourceToURLArray(String resource)
|
protected void |
setProperty(String propName,
String value)
|
protected void |
shutdown()
Subclasses of this class can overwrite this method, but they should specifically call super.shutdown() to orderly shutdown the framework. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String PROPERTY_CONFIG_CLASS
protected static final String SETTER_FROM_STRING
protected URL[] domainModelURLs
URL[]
to each file
containing the DML code that corresponds to the domain model of the application. A non-empty
array must be specified for this parameter.
protected String appName
<appName>/project.properties
file. Additionally, this name will be used
by the framework in the statistical logs performed during the application execution. The
default value for this parameter is null
.
Constructor Detail |
---|
public Config()
Method Detail |
---|
protected void checkRequired(Object obj, String fieldName)
protected void checkForDomainModelURLs()
domainModelURLs
is already set.
protected void checkConfig()
super.checkConfig()
to check the superclass's configuration.
protected static void missingRequired(String fieldName)
protected final void initialize()
FenixFramework.initialize(Config)
.
protected final void populate(Properties props)
protected final void setProperty(String propName, String value)
protected void appNameFromString(String value)
protected void domainModelURLsFromString(String value)
protected abstract void init()
public abstract BackEnd getBackEnd()
BackEnd
in use.
public URL[] getDomainModelURLs()
public String getAppName()
protected void shutdown()
super.shutdown()
to orderly shutdown the framework.
public static URL[] resourceToURLArray(String resource)
public static URL[] resourcesToURLArray(String... resources)
public static URL[] filenameToURLArray(String filename)
public static URL[] filenamesToURLArray(String... filenames)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |