| com.jcorporate.expresso.kernel.ContainerComponentBase com.jcorporate.expresso.core.dbobj.Schema
All known Subclasses: com.jcorporate.expresso.core.dbobj.tests.RowSecuredDBObjectTestSchema, com.jcorporate.expresso.core.ExpressoSchema, com.jcorporate.expresso.core.dbobj.tests.TestSchema, com.jcorporate.expresso.services.dbobj.tests.TestSchema, com.jcorporate.expresso.ext.tests.StressTestSchema,
Schema | abstract public class Schema extends ContainerComponentBase implements ComponentLifecycle,RegistrationFactory(Code) | |
A Schema contains a collection of DBObjects, Controllers, Jobs, and MessageBundles
allowing them to be created all at once,
dropped at once, and reported on as a group
A schema also contains (optional) a list of ReportPage objects
that make up the standard reports for a package
You create your own schema as the hub of your Expresso-based component.
To do this, derive your own class from Schema, override the abstract members
to give your component a name, component code, etc. And then in the constructor
of the schema, you add the various components such as DBOBjects to your schema.
author: Michael Nash |
Constructor Summary | |
public | Schema() |
Method Summary | |
public synchronized void | add(Job oneJob) | public synchronized void | add(String schemaClass, String setupCode, String descrip, String defaultValue) | protected synchronized void | addController(String controllerName) | protected synchronized void | addController(Class c) New method of adding a controller to the default category. | protected synchronized void | addController(String controllerName, String categoryName) New method to add controller objects to the list of controllers
in this Schema object. | protected synchronized void | addController(Class c, String categoryName) New method of adding a controller to the default category. | protected synchronized void | addDBObject(String dbobjectClass) | protected synchronized void | addDBObject(Class c, String categoryName) New method of adding a dbobject to the specified category. | protected synchronized void | addDBObject(Class c) New method of adding a dbobject to the default category. | protected synchronized void | addDBObject(String dbobjectClass, String otherDBName) Method to add a dbobject to the list of dbobjects in this schema
for a named dbother location in the default category. | protected synchronized void | addDBObject(String dbobjectClass, String otherDBName, String categoryName) Method to add a dbobject to the list of dbobjects in this schema
for a named dbother location and named category. | protected synchronized void | addJob(Class c) method of adding a job to the specified category. | public synchronized void | addReportPage(Class reportClass) Add a new report page to the schema.
Parameters: reportClass - the class of the report. | public synchronized void | addReportPage(String reportClassName) | protected synchronized void | addServlet(Class c) New method of adding a servlet to the specified category. | public synchronized void | addSetup(String schemaClass, String setupCode, String descrip, String defaultValue) | public synchronized void | addSetup(String setupCode, String descrip, String defaultValue) | public void | configure(Configuration newConfig) | public boolean | contains(DBObject dbObject) Checks if a particular dbobject resides in a given schema.
Parameters: dbObject - the object to check against. | public void | destroy() | public synchronized Vector | getConfig() | public java.util.List | getControllerList() Return a list of the Controller objects that are members of this
schema. | public synchronized String | getDBName() Return the name of the context/database connection that this schema is being
applied to. | public Hashtable | getDBObjMap() Retrieves the DBObject Map for table creation. | public synchronized String | getDataContext() Return the name of the context/database connection
that this schema is being
applied to. | public String | getDefaultComponentCode() Returns the default component code for this schema. | public String | getDefaultDescription() Returns the default description for this schema. | public static Schema | getInstance() | public Enumeration | getJobs() | public Controller | getLoginController() Retrieve the login controller for your schema. | public Enumeration | getMembers() | public String | getMessageBundlePath() Return the path, relative to the classpath, of the MessageBundle file for
this schema. | public URL | getMetadataLocation() Base metadata location. | public Controller | getRegistrationController() Retrieve the registration controller. | public synchronized Vector | getReports() Return the list of ExpressoReport objects that are required by this schema. | public int | getRequestingUser() Retrieve the UID of requesting user.
UID of requesting user, if known. | public Enumeration | getServlets() | protected String | getSetupDefault(String paramName, String defaultValue) Return the value if this property is defined in the properties file for
this config key. | public String | getSetupValue(String key) Retrieve one of the Setup values for the schema.
Parameters: key - The setup value key java.lang.String the value of the setup value. | public Controller | getStartController() Return a single transaction as the "starting point" for this application. | protected String | getString(String stringCode) Get the i18N'ized string for this schema
Parameters: stringCode - The string code to find in the messages bundle. | public Enumeration | getTests() | public String | getVersion() Method to return the current version number of an application Schema.
Individual Schema objects may override this method if they define a version,
then other dependant applications can use that information to make sure
that the current version dependancies are met.
How to define your own version string:
The format is: MajorVersion.MinorVersion.Release-EA Release Number
MajorVerseion,MinorVersion, and Release represent the typical: 1.0.1
type of version formatting. | public void | initialize() Initialize Lifecycle event. | public static Schema | instantiate(String className) | public synchronized void | otherSetup(InstallLog installLog, String dataContext) preferable way of performaing other setup. | public synchronized void | otherSetup(String dbName) Perform any additional setup/intialize functions required
by this schema. | public synchronized void | populateSchemaData(String dbName) Allow populations of sample data where all tables must be set up first. | public void | reconfigure(Configuration newConfig) Reconfigure Lifecycle Event. | protected void | requiresVersion(String versionString, String schemaClassName) Method for a schema to define a dependance on another schema
with a particular version - e.g. | public synchronized void | setDBName(String newOther) Set the database name/context for this schema. | public synchronized void | setDataContext(String newOther) Set the database name/context for this schema. | public void | setRequestingUser(int uid) Set the user ID of requester. | public void | setSetupValue(String key, String value) | public synchronized void | setupDefaultValues(String dbName) | public synchronized void | setupDefaultValuesWithException(String dbName) |
Schema | public Schema()(Code) | | Constructor
|
add | public synchronized void add(Job oneJob) throws DBException(Code) | | Add a new Job object to this schema
Parameters: oneJob - New job object to add as a member to thisschema throws: DBException - If the object cannot be added |
add | public synchronized void add(String schemaClass, String setupCode, String descrip, String defaultValue) throws DBException(Code) | | Add a new setup value to this schema
Parameters: schemaClass - Class name of this schema Parameters: setupCode - Code of the new setup value Parameters: descrip - A description of the new setup value Parameters: defaultValue - A default value for the new setup value throws: DBException - If the value cannot be added to the setup table See Also: Schema.addSetup |
addController | protected synchronized void addController(String controllerName)(Code) | | Add a controller to the default category
Parameters: controllerName - the String name of the controller to add to theschema |
addController | protected synchronized void addController(Class c)(Code) | | New method of adding a controller to the default category. Call by
writing:
addController("your.class.here.class");
Parameters: c - the class of the controller that you want to add. If you mis-typeyour controller name, the compiler will catch it at compile time. |
addController | protected synchronized void addController(String controllerName, String categoryName)(Code) | | New method to add controller objects to the list of controllers
in this Schema object. We no longer add the object itself (as this
is not very efficient, to say the least) we only store the *name*
of the controller.
Parameters: controllerName - The class name of the controller object Parameters: categoryName - The category to which this controller belongs |
addController | protected synchronized void addController(Class c, String categoryName)(Code) | | New method of adding a controller to the default category. Call by
writing:
addController("your.class.here.class");
Parameters: c - the class of the controller that you want to add. If you mis-typeyour controller name, the compiler will catch it at compile time. Parameters: categoryName - the category to which this controller belongs. |
addDBObject | protected synchronized void addDBObject(String dbobjectClass)(Code) | | Method to add a dbobject to the list of dbobjects in this schema
Parameters: dbobjectClass - the class name of the DBObject that you want to add. |
addDBObject | protected synchronized void addDBObject(Class c, String categoryName)(Code) | | New method of adding a dbobject to the specified category. Call by
writing:
Parameters: c - the class name of the DBObject that you want to add. Parameters: categoryName - the category to which this controller belongs. |
addDBObject | protected synchronized void addDBObject(Class c)(Code) | | New method of adding a dbobject to the default category. Call by
writing:
addController("your.class.here.class");
Parameters: c - the class of the controller that you want to add. If you mis-typeyour controller name, the compiler will catch it at compile time. |
addDBObject | protected synchronized void addDBObject(String dbobjectClass, String otherDBName)(Code) | | Method to add a dbobject to the list of dbobjects in this schema
for a named dbother location in the default category. Please note that
otherdb tables are not created on a DBCreate run.
Parameters: dbobjectClass - the name of the database object class to use Parameters: otherDBName - The dbcontext to use for this dataobject. |
addDBObject | protected synchronized void addDBObject(String dbobjectClass, String otherDBName, String categoryName)(Code) | | Method to add a dbobject to the list of dbobjects in this schema
for a named dbother location and named category.
Parameters: dbobjectClass - The name of the dbobject to add to the schema. Parameters: otherDBName - The dbcontext to use for this dataobject. Parameters: categoryName - the navigation category to use for this database object |
addJob | protected synchronized void addJob(Class c)(Code) | | method of adding a job to the specified category. Call by
writing:
addController("your.class.here.class");
Parameters: c - the class of the controller that you want to add. If you mis-typeyour controller name, the compiler will catch it at compile time. |
addReportPage | public synchronized void addReportPage(Class reportClass)(Code) | | Add a new report page to the schema.
Parameters: reportClass - the class of the report. Usually obtained by typingout the class name and adding ".class" at the end. Example:com.jcorporate.ext.report.DownloadUsers.class |
addReportPage | public synchronized void addReportPage(String reportClassName)(Code) | | Add a new ReportPage to the default category
Parameters: reportClassName - The class name of a "ReportPage" object that ispart of this schema |
addServlet | protected synchronized void addServlet(Class c)(Code) | | New method of adding a servlet to the specified category. Call by
writing:
addController("your.class.here.class");
Parameters: c - the class of the controller that you want to add. If you mis-typeyour controller name, the compiler will catch it at compile time. |
addSetup | public synchronized void addSetup(String schemaClass, String setupCode, String descrip, String defaultValue) throws DBException(Code) | | Add a new setup value to the named schema; will not change value if one already exists in Setup table
Parameters: schemaClass - Class name of this schema Parameters: setupCode - Code of the new setup value Parameters: descrip - A description of the new setup value Parameters: defaultValue - A default value for the new setup value throws: DBException - If the value cannot be added to the setup table |
addSetup | public synchronized void addSetup(String setupCode, String descrip, String defaultValue) throws DBException(Code) | | Add a new setup value to this schema for THIS schema; will not change value if one already exists in Setup table
Parameters: setupCode - Code of the new setup value Parameters: descrip - A description of the new setup value Parameters: defaultValue - A default value for the new setup value throws: DBException - If the value cannot be added to the setup table |
contains | public boolean contains(DBObject dbObject)(Code) | | Checks if a particular dbobject resides in a given schema.
Parameters: dbObject - the object to check against. true if this schema contains this object |
destroy | public void destroy()(Code) | | |
getConfig | public synchronized Vector getConfig()(Code) | | Return the list of configuration values required by this schema
Vector A vector of setup/configuration values for this schema |
getControllerList | public java.util.List getControllerList()(Code) | | Return a list of the Controller objects that are members of this
schema. Controllers are instantiated if not already cached. However, since ControllerFactory caches
the instances, performance of calls after the initial call is faster
java.util.List of Controller objects that belong to this schema |
getDBName | public synchronized String getDBName()(Code) | | Return the name of the context/database connection that this schema is being
applied to. If none is set, then we are applying to the "default"
database/context.
the database context that this Schema object is associated with. |
getDBObjMap | public Hashtable getDBObjMap()(Code) | | Retrieves the DBObject Map for table creation.
java.util.Hashtable |
getDataContext | public synchronized String getDataContext()(Code) | | Return the name of the context/database connection
that this schema is being
applied to. If none is set, then we are applying to the "default"
database/context.
the database context that this Schema objectis associated with. since: Expresso 5.6 |
getDefaultComponentCode | public String getDefaultComponentCode()(Code) | | Returns the default component code for this schema. Useful for automated
component testing/installation
the component code string as defined by the derived schema class |
getDefaultDescription | public String getDefaultDescription()(Code) | | Returns the default description for this schema. Useful for automated
component testing/installation
the component friendly name as defined by the derived schema class |
getInstance | public static Schema getInstance()(Code) | | an an instance of this schema instance. |
getJobs | public Enumeration getJobs()(Code) | | Return an enumeration of the jobs that are members of this schema
Enumeration List of Transaction objects that belong tothis schema |
getLoginController | public Controller getLoginController() throws ControllerException(Code) | | Retrieve the login controller for your schema. The default implementation
checks the ClassHandler section and returns it or the default (SimpleLogin)
if there is none defined in the ClassHandlers. Override for your own apps
to have custom and multiple logins and registration controllers.
Controller Instance throws: ControllerException - if there is an error instantiating the controller |
getMembers | public Enumeration getMembers()(Code) | | Return an enumeration of the database objects that belong to this schema
Enumeration List of DBObject objects that belong to this schema |
getMessageBundlePath | public String getMessageBundlePath()(Code) | | Return the path, relative to the classpath, of the MessageBundle file for
this schema. For example, the Expresso schema
(com.jcorporate.expresso.core.ExpressoSchema) returns
"com/jcorporate/expresso/core", as this is where it's message files are
stored.
A String describing the location of the MessageBundle Path |
getMetadataLocation | public URL getMetadataLocation()(Code) | | Base metadata location. All schemas have the same component metadata,
unless you want to specify your own. In which case, you'll want to
override based upon your own information.
java.net.URL |
getRegistrationController | public Controller getRegistrationController() throws ControllerException(Code) | | Retrieve the registration controller. The default version checks the
classhandlers section in the expresso-config.xml file and returns what's
appropriate there or SimpleRegistration if none is defined.
a controller instance for Registration throws: ControllerException - if there is an error instantiating the controller |
getReports | public synchronized Vector getReports()(Code) | | Return the list of ExpressoReport objects that are required by this schema.
Vector A list of ExpressoReport objects that are standard reportsin this schema. |
getRequestingUser | public int getRequestingUser()(Code) | | Retrieve the UID of requesting user.
UID of requesting user, if known. otherwise, returns 0 |
getServlets | public Enumeration getServlets()(Code) | | Return an enumeration of the servlets that are members of this schema
Enumeration List of StdServlet objects that belong tothis schema |
getSetupDefault | protected String getSetupDefault(String paramName, String defaultValue)(Code) | | Return the value if this property is defined in the properties file for
this config key.
Parameters: paramName - Property Name Parameters: defaultValue - value if property is not defined String Value of this property in the property file for this DBconfig. |
getSetupValue | public String getSetupValue(String key)(Code) | | Retrieve one of the Setup values for the schema.
Parameters: key - The setup value key java.lang.String the value of the setup value. May be null; |
getStartController | public Controller getStartController()(Code) | | Return a single transaction as the "starting point" for this application.
Each Schema object may define such a transaction, and the appropriate
application can then be invoked from that point
a Controller Instance of the starting controller point. |
getString | protected String getString(String stringCode)(Code) | | Get the i18N'ized string for this schema
Parameters: stringCode - The string code to find in the messages bundle. The Mapped String |
getTests | public Enumeration getTests()(Code) | | Return the list of Junit tests in this application
An Enumeration of all tests for this schema |
getVersion | public String getVersion()(Code) | | Method to return the current version number of an application Schema.
Individual Schema objects may override this method if they define a version,
then other dependant applications can use that information to make sure
that the current version dependancies are met.
How to define your own version string:
The format is: MajorVersion.MinorVersion.Release-EA Release Number
MajorVerseion,MinorVersion, and Release represent the typical: 1.0.1
type of version formatting. -EAReleaseNumber is also a number but is optional
if you do not wish to use a EA number if the version number.
Examples
- 1.0.1 : First Major Version with a bugfix release.
- 2.2.2-2: Second Major Version, Second Minor Version, Second Bugfix release
and it is currently considered ea-2
the Version you define for your system. |
initialize | public void initialize()(Code) | | Initialize Lifecycle event. Provide quick initialization
|
instantiate | public static Schema instantiate(String className) throws DBException(Code) | | Convenience method to create a Schema object from it's name
Parameters: className - The ClassName to instantiate A newly initialized Schema Object throws: DBException - if there's an instantiation problem |
otherSetup | public synchronized void otherSetup(InstallLog installLog, String dataContext) throws DBException(Code) | | preferable way of performaing other setup. Utilizes the context independant
logging system.
Parameters: installLog - the InstallLog implementation that the setup processwill log progress to. Parameters: dataContext - he database context to execute this process against. throws: DBException - If there's a database communication error |
otherSetup | public synchronized void otherSetup(String dbName) throws DBException(Code) | | Perform any additional setup/intialize functions required
by this schema. This is where applications can set up default
values for lookup tables, reference values, etc.
Subclass does not extend this method if it is not needed.
Parameters: dbName - The database context to execute this process against. throws: DBException - If there's a database communication error |
populateSchemaData | public synchronized void populateSchemaData(String dbName) throws DBException(Code) | | Allow populations of sample data where all tables must be set up first.
Parameters: dbName - The name to add the data tosee com.jcorporate.eforum.ForumSchema#populateSchemaData for example. throws: DBException - if an error occurs while populating the table. |
requiresVersion | protected void requiresVersion(String versionString, String schemaClassName) throws DBException(Code) | | Method for a schema to define a dependance on another schema
with a particular version - e.g. if eContent requires
expresso 3.11, it can call this method to ensure that's the version it's
being run with
Parameters: versionString - String the string version this requires. Parameters: schemaClassName - the class name to check against. throws: DBException - if an error occurs locating the appropriate schemaclass |
setDBName | public synchronized void setDBName(String newOther) throws DBException(Code) | | Set the database name/context for this schema. If setDBName is not called,
the "default" db name and context is used.
Parameters: newOther - The name of the context or database to use throws: DBException - If there's a problem switching to the database context. |
setDataContext | public synchronized void setDataContext(String newOther) throws DBException(Code) | | Set the database name/context for this schema. If setDBName is not called,
the "default" db name and context is used.
Parameters: newOther - The name of the context or database to use throws: DBException - If there's a problem switching to the database context. |
setRequestingUser | public void setRequestingUser(int uid)(Code) | | Set the user ID of requester.
Parameters: uid - ID of requesting user |
setSetupValue | public void setSetupValue(String key, String value)(Code) | | Sets the setup values for the given key
Parameters: key - The name of the setup value. Parameters: value - the Value of the setup value. |
setupDefaultValues | public synchronized void setupDefaultValues(String dbName)(Code) | | Go through each DBobject in the schema and call populateDefaultValues.
See: @see com.jcorporate.expresso.core.dbobj.DBObject.populateDefaultValues
Parameters: dbName - The name of the database to set this up on. |
setupDefaultValuesWithException | public synchronized void setupDefaultValuesWithException(String dbName) throws DBException(Code) | | Go through each DBobject and each Controller in the schema and call default-populate methods.
See: @see com.jcorporate.expresso.core.dbobj.DBObject.populateDefaultValues
See: @see com.jcorporate.expresso.core.controller.Controller.setupDefaultValues
Parameters: dbName - The name of the database to set this up on. throws: DBException - if a database exception occurs |
|
|