public class CreateWorkspaceTask
extends org.apache.tools.ant.Task
ANT
task to create a series of workspace schema pools to be used
by the content management runtime. Workspace creation consists of pointing
to a database and schema instance and creating a set of schemas to store and view
content managed data. For each workspace, two schemas will be created. One will
contain only the changed data (the write schema). The other represents how the changed data will appear
when merged into the base schema (the read schema). The tables that are content managed and operational are
defined in the XML
configuration of the resource containers defined. For any table
that is in the current schema and is not considered operational or content managed,
a pointer to the base table is created. For operational tables, a copy of the table
will be created in the write schema. The read schema will contain a pointer to
this table. For content managed tables, a copy of the table will be created in the
write schema. The read schema will contain a view that merges the content of the
table found in the write schema with the base schema.
The create workspace ANT
task takes the following parameters:
jdbcURL
(required): The JDBC URL connection string.jdbcDriver
(required): The JDBC driver class name.userId
(required): The database user identity.password
(required): The database user password.numberOfWorkspaces
(optional): The number of workspaces to create. If not specified then
one is assumed.baseSchema
(optional): The base schema that needs to be replicated. If not specified
then the base schema used is the database user's schema.instanceName
(optional): The instance namereadSchemaPrefix
(optional): The read schema prefix when creating the read schema. If
not specified then the default is used.writeSchemaPrefix
(optional): The write schema prefix when creating the write schema.
If not specified then the default is used.generateSQLStatementsOnly
(optional): A flag to indicate that the ANT
task should not
actually create the new workspaces. Rather it should just report the SQL
used to create the
workspace pool. The default value is false, which indicates that the workspace pool will be created.generateSQLStatementsOutputFile
(optional): The output file to print the SQL
statements to if generateSQLStatementsOnly is set to true. If not specified then the
SQL is output to standard output stream.
The following is an example of calling the create workspace ANT
task:
<createWorkspace jdbcDriver="${jdbcDriver}" jdbcURL="${jdbcURL}" userId="${dbaName}" password="${dbaPassword}" baseSchema="${dbaName}" instanceName="${instanceName}" numberOfWorkspaces="${cmNumWorkspaces}" readSchemaPrefix="${cmReadPrefix}" writeSchemaPrefix="${cmWritePrefix}" generateSQLStatementsOnly="false" generateSQLStatementsOutputFile="" />
To debug this ANT
task, enable the CONTENT
tracing component
by calling the log configuration ANT
task just before this task.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
Constructor and Description |
---|
CreateWorkspaceTask()
This is the default constructor for this class.
|
Modifier and Type | Method and Description |
---|---|
void |
execute()
This method creates the workspace schema pool or generates the
SQL statements depending on the
parameters passed to the ANT task. |
java.lang.String |
getBaseSchema()
This method returns the base schema that contains the tables that will be managed.
|
java.lang.String |
getGenerateSQLStatementsOnly()
This method returns whether the
SQL statements should be generated or executed to
actually create the workspace schema pool. |
java.lang.String |
getGenerateSQLStatementsOutputFile()
This method returns the output file for the generated
SQL statements. |
static java.lang.String |
getInstanceName()
This method returns the name of the instance.
|
java.lang.String |
getJdbcDriver()
This method returns the class name of the JDBC driver.
|
java.lang.String |
getJdbcURL()
This method returns the JDBC
URL connection string to connect to the database. |
java.lang.String |
getNumberOfWorkspaces()
This method returns the number of workspaces to create in the workspace pool.
|
java.lang.String |
getPassword()
This method returns the password to access the database.
|
java.lang.String |
getReadSchemaPrefix()
This method returns the read schema prefix when creating the name to define the read schema.
|
static java.lang.String |
getResourceXMLLocation()
This method returns the resourceXMLLocation.
|
java.lang.String |
getUserId()
This method returns the user identity to connect to the database.
|
java.lang.String |
getWriteSchemaPrefix()
This method returns the write schema prefix when creating the name to define the write schema.
|
static void |
main(java.lang.String[] args)
This main method was added to get around the long classpath problem with the
ConfigManager . |
void |
setBaseSchema(java.lang.String baseSchema)
This method sets the base schema where the tables reside.
|
void |
setGenerateSQLStatementsOnly(java.lang.String booleanValue)
This method sets whether to only generate the
SQL statements or not. |
void |
setGenerateSQLStatementsOutputFile(java.lang.String fileName)
This method sets the output file name for the
SQL statements. |
void |
setInstanceName(java.lang.String instanceName)
This method sets the instance name.
|
void |
setJdbcDriver(java.lang.String jdbcDriver)
This method sets the JDBC driver class name.
|
void |
setJdbcURL(java.lang.String jdbcURL)
This method sets the JDBC
URL to connect to the database. |
void |
setNumberOfWorkspaces(java.lang.String numberOfWorkspaces)
This method sets the number of workspaces to create.
|
void |
setPassword(java.lang.String password)
This method sets the database password.
|
void |
setReadSchemaPrefix(java.lang.String prefix)
This method sets the prefix for the read schema name.
|
void |
setResourceXMLLocation(java.lang.String resourceXMLLocation)
This method sets the resource XML Location.
|
void |
setUserId(java.lang.String userId)
This method sets the user identity to connect to the database.
|
void |
setWriteSchemaPrefix(java.lang.String prefix)
This method sets the write schema prefix.
|
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, init, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
public static final java.lang.String COPYRIGHT
public CreateWorkspaceTask()
public static void main(java.lang.String[] args)
ConfigManager
. With this change, this
ANT
task can be executed in a separate JVM to have its own classpath. Therefore, it does not depend on the
parent's (ConfigManager
) classpath.args
- Command line arguments; none are expected.public void execute() throws org.apache.tools.ant.BuildException
SQL
statements depending on the
parameters passed to the ANT
task.execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
- Thrown for any exception that occurs during the execution of the
ANT
task. This is most like an SQLException
when either trying to read the database
metadata
or creating new database objects.Task.execute()
public java.lang.String getBaseSchema()
public java.lang.String getGenerateSQLStatementsOnly()
SQL
statements should be generated or executed to
actually create the workspace schema pool. A value of true means that
the SQL
statements will only be generated and not executed.SQL
statements.public java.lang.String getGenerateSQLStatementsOutputFile()
SQL
statements. If none
is specified then the output will go to System.out
.SQL
statements.public java.lang.String getJdbcDriver()
public java.lang.String getJdbcURL()
URL
connection string to connect to the database.URL
.public java.lang.String getNumberOfWorkspaces()
public java.lang.String getPassword()
public java.lang.String getReadSchemaPrefix()
public java.lang.String getUserId()
public java.lang.String getWriteSchemaPrefix()
public void setBaseSchema(java.lang.String baseSchema)
baseSchema
- The base schema.public void setGenerateSQLStatementsOnly(java.lang.String booleanValue)
SQL
statements or not.booleanValue
- true if the SQL
statements should only be generated (and not executed).public void setGenerateSQLStatementsOutputFile(java.lang.String fileName)
SQL
statements.fileName
- The name of the file.public void setJdbcDriver(java.lang.String jdbcDriver)
jdbcDriver
- The JDBC driver class name.public void setJdbcURL(java.lang.String jdbcURL)
URL
to connect to the database.jdbcURL
- The JDBC URL
.public void setNumberOfWorkspaces(java.lang.String numberOfWorkspaces)
numberOfWorkspaces
- The number of workspaces to create.public void setPassword(java.lang.String password)
password
- The database password.public void setReadSchemaPrefix(java.lang.String prefix)
prefix
- The read schema prefix.public void setUserId(java.lang.String userId)
userId
- The user identity.public void setWriteSchemaPrefix(java.lang.String prefix)
prefix
- The write schema prefix.public void setResourceXMLLocation(java.lang.String resourceXMLLocation)
resourceXMLLocation
- The resource XML Location.public static java.lang.String getResourceXMLLocation()
public void setInstanceName(java.lang.String instanceName)
instanceName
- The instance name.public static java.lang.String getInstanceName()