com.ibm.commerce.context.content.ant.tasks
Class CreateWorkspaceTask
- java.lang.Object
-
- org.apache.tools.ant.ProjectComponent
-
- org.apache.tools.ant.Task
-
- com.ibm.commerce.context.content.ant.tasks.CreateWorkspaceTask
-
public class CreateWorkspaceTask extends org.apache.tools.ant.Task
This class defines anANT
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 theXML
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 theANT
task should not actually create the new workspaces. Rather it should just report theSQL
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 theSQL
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 theCONTENT
tracing component by calling the log configurationANT
task just before this task.
-
-
Field Summary
Fields
Modifier and Type
Field and Description
static java.lang.String
COPYRIGHT
IBM copyright notice field.
-
Constructor Summary
Constructors
Constructor and Description
CreateWorkspaceTask()
This is the default constructor for this class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods
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.
-
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, init, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
-
-
Field Detail
-
COPYRIGHT
public static final java.lang.String COPYRIGHT
IBM copyright notice field.
- See Also:
- Constant Field Values
-
Constructor Detail
-
CreateWorkspaceTask
public CreateWorkspaceTask()
This is the default constructor for this class. It calls the constructor from the superclass.
-
Method Detail
-
main
public static void main(java.lang.String[] args)
This main method was added to get around the long classpath problem with the 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.
- Parameters:
args
- Command line arguments; none are expected.
-
execute
public void execute()
throws org.apache.tools.ant.BuildException
This method creates the workspace schema pool or generates the SQL
statements depending on the
parameters passed to the ANT
task.
- Overrides:
execute
in class org.apache.tools.ant.Task
- Throws:
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.
- See Also:
Task.execute()
-
getBaseSchema
public java.lang.String getBaseSchema()
This method returns the base schema that contains the tables that will be managed.
- Returns:
- The base schema.
-
getGenerateSQLStatementsOnly
public java.lang.String getGenerateSQLStatementsOnly()
This method returns whether the 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.
- Returns:
- This method returns whether to only generate the
SQL
statements.
-
getGenerateSQLStatementsOutputFile
public java.lang.String getGenerateSQLStatementsOutputFile()
This method returns the output file for the generated SQL
statements. If none
is specified then the output will go to System.out
.
- Returns:
- The output file for the generated
SQL
statements.
-
getJdbcDriver
public java.lang.String getJdbcDriver()
This method returns the class name of the JDBC driver.
- Returns:
- The JDBC driver class name.
-
getJdbcURL
public java.lang.String getJdbcURL()
This method returns the JDBC URL
connection string to connect to the database.
- Returns:
- The JDBC
URL
.
-
getNumberOfWorkspaces
public java.lang.String getNumberOfWorkspaces()
This method returns the number of workspaces to create in the workspace pool.
- Returns:
- The number of workspaces to create in the workspace pool.
-
getPassword
public java.lang.String getPassword()
This method returns the password to access the database.
- Returns:
- The database password.
-
getReadSchemaPrefix
public java.lang.String getReadSchemaPrefix()
This method returns the read schema prefix when creating the name to define the read schema.
- Returns:
- The read schema prefix.
-
getUserId
public java.lang.String getUserId()
This method returns the user identity to connect to the database.
- Returns:
- The database user.
-
getWriteSchemaPrefix
public java.lang.String getWriteSchemaPrefix()
This method returns the write schema prefix when creating the name to define the write schema.
- Returns:
- The write schema prefix.
-
setBaseSchema
public void setBaseSchema(java.lang.String baseSchema)
This method sets the base schema where the tables reside.
- Parameters:
baseSchema
- The base schema.
-
setGenerateSQLStatementsOnly
public void setGenerateSQLStatementsOnly(java.lang.String booleanValue)
This method sets whether to only generate the SQL
statements or not.
- Parameters:
booleanValue
- true if the SQL
statements should only be generated (and not executed).
-
setGenerateSQLStatementsOutputFile
public void setGenerateSQLStatementsOutputFile(java.lang.String fileName)
This method sets the output file name for the SQL
statements.
- Parameters:
fileName
- The name of the file.
-
setJdbcDriver
public void setJdbcDriver(java.lang.String jdbcDriver)
This method sets the JDBC driver class name.
- Parameters:
jdbcDriver
- The JDBC driver class name.
-
setJdbcURL
public void setJdbcURL(java.lang.String jdbcURL)
This method sets the JDBC URL
to connect to the database.
- Parameters:
jdbcURL
- The JDBC URL
.
-
setNumberOfWorkspaces
public void setNumberOfWorkspaces(java.lang.String numberOfWorkspaces)
This method sets the number of workspaces to create. This value will be the
maximum number of content management workspaces.
- Parameters:
numberOfWorkspaces
- The number of workspaces to create.
-
setPassword
public void setPassword(java.lang.String password)
This method sets the database password.
- Parameters:
password
- The database password.
-
setReadSchemaPrefix
public void setReadSchemaPrefix(java.lang.String prefix)
This method sets the prefix for the read schema name.
- Parameters:
prefix
- The read schema prefix.
-
setUserId
public void setUserId(java.lang.String userId)
This method sets the user identity to connect to the database.
- Parameters:
userId
- The user identity.
-
setWriteSchemaPrefix
public void setWriteSchemaPrefix(java.lang.String prefix)
This method sets the write schema prefix.
- Parameters:
prefix
- The write schema prefix.
-
setResourceXMLLocation
public void setResourceXMLLocation(java.lang.String resourceXMLLocation)
This method sets the resource XML Location.
- Parameters:
resourceXMLLocation
- The resource XML Location.
-
getResourceXMLLocation
public static java.lang.String getResourceXMLLocation()
This method returns the resourceXMLLocation.
- Returns:
- The resource XML Location.
-
setInstanceName
public void setInstanceName(java.lang.String instanceName)
This method sets the instance name.
- Parameters:
instanceName
- The instance name.
-
getInstanceName
public static java.lang.String getInstanceName()
This method returns the name of the instance.
- Returns:
- The instance name