|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.knowgate.hipergate.datamodel.ModelManager
public class ModelManager
hipergate Data Model Manager
This class is used for programatically creating the full underlying data model for hipergate Java packages.
It may be used as an alternative method to database dumps for initial data loading, or, also, as a tool for porting the data model to a new DBMS in a structured way.
| Constructor Summary | |
|---|---|
ModelManager()
|
|
| Method Summary | |
|---|---|
void |
bulkLoad(java.lang.String sTableName,
java.lang.String sFilePath,
java.lang.String sEncoding)
Load a delimited text file into a database table |
void |
clear()
Clear internal operation log |
void |
cloneContacts(java.lang.String sContactsFilter,
java.lang.String sTargetWorkArea,
java.lang.String sNewOwnerId)
Clone a set of Contacts Contacts are cloned by following instructions contained in contact_clon.xml file. |
java.lang.String |
cloneWorkArea(java.lang.String sOriginWorkArea,
java.lang.String sTargetWorkArea)
Create a clone of a WorkArea WorkAreas are cloned by following instructions contained in com/knowgate/hipergate/datamodel/scripts/dbms/workarea_clon.xml file. |
void |
connect(java.lang.String sDriver,
java.lang.String sUrl,
java.lang.String sSch,
java.lang.String sUsr,
java.lang.String sPwd)
Connect to database Connection autocommit is set to ON. |
boolean |
create(java.lang.String sModuleName)
Create a functional module |
boolean |
createAll()
Create all modules The created modules will be (in order): kernel, lookups, security, jobs, categories, thesauri, products, addrbook, forums, crm, projtrack, lists, webbuilder, shops, billing, hipermail, training |
java.lang.String |
createCategoriesForUser(java.lang.String sUserId)
Create default categories for a user Internally executes scripts/user_categories_create.js Java BeanShell Script contained inside JAR file under com/knowgate/hipergate/datamodel. |
boolean |
createDefaultDatabase()
Create a default database ready for use All modules for the full suite will be created at the new database. |
int |
createDomain(java.lang.String sDomainNm)
Create New Domain Internally executes scripts/domain_create.js Java BeanShell Script contained inside JAR file under com/knowgate/hipergate/datamodel. |
void |
disconnect()
Disconnect from database |
boolean |
drop(java.lang.String sModuleName)
Drop a functional module |
boolean |
dropAll()
Drop all modules The created modules will be (in order): example, marketing, training, hipermail, billing, shops, webbuilder, lists, projtrack, crm, forums, addrbook, products, thesauri, categories, jobs, security, lookups, kernel |
int |
dropDomain(java.lang.String sDomainNm)
Drop Domain Drop a Domain, all its WorkAreas and associated data. |
java.lang.String |
dropWorkArea(java.lang.String sDomainDotWorkAreaNm,
java.util.Properties oProps)
Drop WorkArea THIS METHOD DROPS ALL WORKAREA DATA. |
void |
executeSQLScript(java.lang.String sScriptSource,
java.lang.String sDelimiter)
|
int |
fixTranslationColumns()
|
java.sql.Connection |
getConnection()
Get reference to opened database connection |
java.lang.String |
getEncoding()
|
java.lang.String |
getResourceAsString(java.lang.String sResourcePath,
java.lang.String sEncoding)
Get an embedded resource file as a String |
static void |
main(java.lang.String[] argv)
Method for calling ModelManager from the command line Usage: java com.knowgate.hipergate.datamodel.ModelManager /etc/hipergate.cnf command module [domain_name|domain_name.workarea_name] [verbose] Path "/etc/hipergate.cnf" must point to where hipergate.cnf file is located. |
void |
recompileOrcl()
Re-compile invalid objects for an Oracle database |
java.lang.String |
report()
Print internal operation log to a String |
void |
scriptData(java.lang.String sTableName,
java.lang.String sWhere,
java.lang.String sFilePath)
Create INSERT SQL statements for the data of a table |
void |
setConnection(java.sql.Connection oJDBCConn)
Assign an external conenction to ModelManager Use this method when ModelManager must not connect itself to database but reuse an already existing connection. |
void |
setEncoding(java.lang.String sCharset)
|
boolean |
stopOnError()
Get whether or not create() and drop() methods will stop on error |
void |
stopOnError(boolean bStop)
Set whether or not create() and drop() methods should stop on error |
void |
truncate(java.lang.String sTableName)
Truncate table |
void |
upgrade(java.lang.String sOldVersion,
java.lang.String sNewVersion,
java.util.Properties oProps)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ModelManager()
| Method Detail |
|---|
public java.lang.String getEncoding()
public void setEncoding(java.lang.String sCharset)
public void stopOnError(boolean bStop)
Set whether or not create() and drop() methods should stop on error
bStop - true=stop on error, false=don not stoppublic boolean stopOnError()
Get whether or not create() and drop() methods will stop on error
public void connect(java.lang.String sDriver,
java.lang.String sUrl,
java.lang.String sSch,
java.lang.String sUsr,
java.lang.String sPwd)
throws java.sql.SQLException,
java.lang.ClassNotFoundException,
java.lang.IllegalStateException,
java.lang.UnsupportedOperationException
Connect to database
Connection autocommit is set to ON.
sDriver - JDBC driver class namesUrl - Database URLsUsr - Database UsersPwd - Database Password
java.sql.SQLException
java.lang.ClassNotFoundException - If class for JDBC driver is not found
java.lang.IllegalStateException - If already connected to database
java.lang.UnsupportedOperationException - If DBMS is not recognized,
currently only Oracle, Microsoft SQL Server and PostgreSQL are recognized.
public void disconnect()
throws java.sql.SQLException
Disconnect from database
java.sql.SQLException
public void setConnection(java.sql.Connection oJDBCConn)
throws java.sql.SQLException,
java.lang.UnsupportedOperationException,
java.lang.NullPointerException
Assign an external conenction to ModelManager
Use this method when ModelManager must not connect itself to database but reuse an already existing connection.
oJDBCConn - Database Connection
java.sql.SQLException
java.lang.UnsupportedOperationException - If DBMS is not recognized
java.lang.NullPointerException - if oJDBCConn is nullpublic void clear()
public java.sql.Connection getConnection()
public java.lang.String report()
public void bulkLoad(java.lang.String sTableName,
java.lang.String sFilePath,
java.lang.String sEncoding)
throws java.sql.SQLException,
java.io.IOException,
java.io.FileNotFoundException,
java.io.UnsupportedEncodingException,
java.lang.NumberFormatException,
java.lang.ArrayIndexOutOfBoundsException,
java.text.ParseException
sTableName - String Fully qualified table namesFilePath - String File PathsEncoding - String File Character encoding
java.sql.SQLException
java.text.ParseException
java.lang.NumberFormatException
java.io.IOException
java.io.FileNotFoundException
java.io.UnsupportedEncodingException
java.lang.ArrayIndexOutOfBoundsException
public void truncate(java.lang.String sTableName)
throws java.sql.SQLException
sTableName - String Table name
java.sql.SQLException
public void executeSQLScript(java.lang.String sScriptSource,
java.lang.String sDelimiter)
throws java.sql.SQLException,
java.lang.InterruptedException,
java.lang.IllegalArgumentException
java.sql.SQLException
java.lang.InterruptedException
java.lang.IllegalArgumentException
public boolean create(java.lang.String sModuleName)
throws java.lang.IllegalStateException,
java.sql.SQLException,
java.io.FileNotFoundException,
java.io.IOException
Create a functional module
sModuleName - Name of module to create { kernel | lookups | security |
jobs | thesauri | categories | products | addrbook | webbuilder | crm |
lists | shops | projtrack | billing | hipermail | marketing }
java.lang.IllegalStateException - If not connected to database
java.io.FileNotFoundException - If any of the internal files for module is not found
java.sql.SQLException
java.io.IOException
public boolean drop(java.lang.String sModuleName)
throws java.lang.IllegalStateException,
java.sql.SQLException,
java.io.FileNotFoundException,
java.io.IOException
Drop a functional module
sModuleName - Name of module to drop { kernel | lookups | security |
jobs | thesauri | categories | products | addrbook | webbuilder | crm |
lists | shops | projtrack | billing | hipermail }
java.lang.IllegalStateException
java.sql.SQLException
java.io.FileNotFoundException
java.io.IOException
public boolean createAll()
throws java.lang.IllegalStateException,
java.sql.SQLException,
java.io.FileNotFoundException,
java.io.IOException
Create all modules
The created modules will be (in order): kernel, lookups, security, jobs, categories, thesauri, products, addrbook, forums, crm, projtrack, lists, webbuilder, shops, billing, hipermail, training
java.io.FileNotFoundException - If any of the internal files for modules are not found
java.lang.IllegalStateException
java.sql.SQLException
java.io.IOException
public boolean dropAll()
throws java.lang.IllegalStateException,
java.sql.SQLException,
java.io.FileNotFoundException,
java.io.IOException
Drop all modules
The created modules will be (in order): example, marketing, training, hipermail, billing, shops, webbuilder, lists, projtrack, crm, forums, addrbook, products, thesauri, categories, jobs, security, lookups, kernel
java.lang.IllegalStateException
java.sql.SQLException
java.io.FileNotFoundException
java.io.IOException
public boolean createDefaultDatabase()
throws java.io.FileNotFoundException,
java.io.IOException,
java.sql.SQLException,
EvalError,
java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.ClassNotFoundException,
org.xml.sax.SAXException
Create a default database ready for use
All modules for the full suite will be created at the new database.
java.io.FileNotFoundException - If any of the internal files for modules are not found
EvalError - Java BeanShell script domain_create.js as a syntax error
org.xml.sax.SAXException - Parsing error at file workarea_clon.xml
java.lang.InstantiationException - SAX parser is not properly installed
java.lang.IllegalAccessException - SAX parser is not properly installed
java.lang.ClassNotFoundException - SAX parser is not properly installed
java.io.IOException
java.sql.SQLException
public void scriptData(java.lang.String sTableName,
java.lang.String sWhere,
java.lang.String sFilePath)
throws java.sql.SQLException,
java.io.IOException
sTableName - Table NamesWhere - SQL filter clausesFilePath - Path for file where INSERT statements are to be written
java.sql.SQLException
java.io.IOException
public java.lang.String getResourceAsString(java.lang.String sResourcePath,
java.lang.String sEncoding)
throws java.io.FileNotFoundException,
java.io.IOException
Get an embedded resource file as a String
sResourcePath - Relative path at JAR file from com/knowgate/hipergate/datamodel/ModelManagersEncoding - Character encoding for resource if it is a text file.java.io.FileNotFoundException
java.io.IOException
public void recompileOrcl()
throws java.sql.SQLException
Re-compile invalid objects for an Oracle database
java.sql.SQLException
java.io.FileNotFoundException
java.io.IOException
public void cloneContacts(java.lang.String sContactsFilter,
java.lang.String sTargetWorkArea,
java.lang.String sNewOwnerId)
throws java.sql.SQLException,
java.io.IOException,
java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.io.IOException,
java.lang.ClassNotFoundException,
org.xml.sax.SAXException
Clone a set of Contacts
Contacts are cloned by following instructions contained in contact_clon.xml file.
sContactsFilter - WHERE clause of contacts to be cloned, for cloning just one contact use "gu_contact='GUID_OF_CONTACT'"sTargetWorkArea - GUID of WorkArea where new contact is to be writtensNewOwner - GUID of user (from k_users table) that will be the new owner of the contact or null
java.sql.SQLException
java.io.IOException - XML definition file for cloning not found
java.lang.InstantiationException - SAX parser is not properly installed
java.lang.IllegalAccessException - SAX parser is not properly installed
java.lang.ClassNotFoundException - SAX parser is not properly installed
org.xml.sax.SAXException - Parsing error at file workarea_clon.xml
java.io.IOException
public java.lang.String cloneWorkArea(java.lang.String sOriginWorkArea,
java.lang.String sTargetWorkArea)
throws java.sql.SQLException,
java.io.IOException,
java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.ClassNotFoundException,
org.xml.sax.SAXException
Create a clone of a WorkArea
WorkAreas are cloned by following instructions contained in com/knowgate/hipergate/datamodel/scripts/dbms/workarea_clon.xml file.
sOriginWorkArea - String of the form domain_name.workarea_name,
for example "MODEL.default_workarea"sTargetWorkArea - String of the form domain_name.workarea_name,
for example "TEST1.devel_workarea"
java.sql.SQLException - Most probably raised because data at model_default workarea is corrupted
java.lang.InstantiationException - SAX parser is not properly installed
java.lang.IllegalAccessException - SAX parser is not properly installed
java.lang.ClassNotFoundException - SAX parser is not properly installed
org.xml.sax.SAXException - Parsing error at file workarea_clon.xml
java.io.IOExceptionWorkArea.delete(JDCConnection,String)
public java.lang.String dropWorkArea(java.lang.String sDomainDotWorkAreaNm,
java.util.Properties oProps)
throws java.sql.SQLException,
java.io.IOException,
java.lang.Exception
Drop WorkArea
THIS METHOD DROPS ALL WORKAREA DATA. USE IT WITH CARE.
sDomainDotWorkAreaNm - Domain Name and WorkArea Name with a middle dot. Domain_Name.WorkArea_NameoProps - Environment properties (as readed from hipergate.cnf)
java.sql.SQLException
java.io.IOException
java.lang.Exception(JDCConnection,String,java.util.Properties)
public int dropDomain(java.lang.String sDomainNm)
throws EvalError,
java.sql.SQLException,
java.io.IOException
Drop Domain
Drop a Domain, all its WorkAreas and associated data.
sDomainNm - Name of domain to be droped.
EvalError
java.sql.SQLException
java.io.IOExceptionACLDomain.delete(JDCConnection,int);
public int createDomain(java.lang.String sDomainNm)
throws EvalError,
java.io.IOException,
java.io.FileNotFoundException,
java.sql.SQLException
Create New Domain
Internally executes scripts/domain_create.js Java BeanShell Script contained inside JAR file under com/knowgate/hipergate/datamodel.
sDomainNm - New Domain Name
EvalError - Java BeanShell script domain_create.js as a syntax error
java.io.IOException
java.io.FileNotFoundException
java.sql.SQLException
public java.lang.String createCategoriesForUser(java.lang.String sUserId)
throws java.io.IOException,
java.io.FileNotFoundException,
java.sql.SQLException
Create default categories for a user
Internally executes scripts/user_categories_create.js Java BeanShell Script contained inside JAR file under com/knowgate/hipergate/datamodel.
sUserId - User GUID
EvalError - Java BeanShell script user_categories_create.js as a syntax error
java.io.IOException
java.io.FileNotFoundException
java.sql.SQLException
public void upgrade(java.lang.String sOldVersion,
java.lang.String sNewVersion,
java.util.Properties oProps)
throws java.lang.IllegalStateException,
java.sql.SQLException,
java.io.FileNotFoundException,
java.io.IOException
java.lang.IllegalStateException
java.sql.SQLException
java.io.FileNotFoundException
java.io.IOException
public int fixTranslationColumns()
throws java.sql.SQLException
java.sql.SQLExceptionpublic static void main(java.lang.String[] argv)
Method for calling ModelManager from the command line
Usage:
argv - Array of Strings with 3 to 6 elements
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||