org.apache.jetspeed.serializer
Class JetspeedDDLApplication

java.lang.Object
  extended by org.apache.jetspeed.serializer.JetspeedDDLApplication

public class JetspeedDDLApplication
extends Object

Jetspeed Serializer DDL- Application invoke with mandatory either

-I directory or filename of schema files for input, if directory all xml files will be processed

and/or

-O schema file for output log of current database

and (if -I denotes a directory:)

-x if directory list provided for input schemas this pattern is excluded

-s name of the order file (if schema directory)

-m if directory list provided this is the merge file to use. If not set here or in the properties file, a hardcoded version is used

note that - if -I and -O are specified, the output file will contain the UPDATED database

invoke with (optional) parameters

-P propertyFileName, for settings

-R (flag) replace : overwrites default "UPDATE" and clears out the database before processing (ignored with -O option above)

-dn databaseName, for example MYSQL or ORACLE10

-dc driverClass, for example com.mysql.jdbc.Driver

-ds url, ruls according to the driver used, URL needs to point to the correct database

-du user, user with create/drop etc. rights on the database

-dp password

-l log4j-level, ERROR (default), WARN, INFO

Version:
$Id: $
Author:
Hajo Birthelmer

Nested Class Summary
(package private)  class JetspeedDDLApplication.LocalFilenameFilter
           
 
Field Summary
(package private)  String[] args
           
(package private)  org.apache.commons.configuration.PropertiesConfiguration configuration
           
(package private)  String databaseName
           
(package private)  boolean doExport
           
(package private)  boolean doImport
           
(package private)  String driverClass
           
(package private)  String exludeFileName
           
(package private)  String[] filesToProcess
           
static String JNDI_DS_NAME
           
(package private)  String logLevel
           
(package private)  String mergeFile
           
(package private)  String orderFileName
           
(package private)  String outputFile
           
(package private)  boolean overwrite
           
(package private)  String password
           
(package private)  String propertyFileName
           
(package private)  String schemaDirectory
           
(package private)  String url
           
(package private)  String user
           
 
Constructor Summary
JetspeedDDLApplication()
           
 
Method Summary
private  void checkDBSettings()
          ensure that we have valid database settings
private  File createTemp(String suffix)
          Helper routine to create a temporary file
private  File createXSLTFromFile(String fileName)
          Open the merge file from disk
private  File createXSLTFromMemory()
          If everything else fails, use a hardcoded XSLT here
 List getRows(JetspeedDDLUtil ddlUtil, String tableName)
           
 String getSelectQueryForAllString(JetspeedDDLUtil ddlUtil, org.apache.ddlutils.model.Table table)
           
static void main(String[] args)
           
private  String mergeFiles(String[] fileList)
          process of merging two or more schema files into one schema file.
private  void parseArguments()
          parse arguments for process instructions, order and exclude files as well as optional database arguments
private  String[] parseFiles()
          process provided filename or directory name
private  void processArguments(String[] arguments)
          setup environment by processing all arguments and call requested process routine
private  void processExport(JetspeedDDLUtil ddlUtil)
          read database schema to file
private  void processImport(JetspeedDDLUtil ddlUtil)
          create/alter database
private  void processPropertyFile()
          read the property file and read what has not yet been defined
private  ArrayList readOrderFile(String importFileName)
          read an xml file describing the basic order of the files to be processed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JNDI_DS_NAME

public static final String JNDI_DS_NAME
See Also:
Constant Field Values

propertyFileName

String propertyFileName

exludeFileName

String exludeFileName

orderFileName

String orderFileName

logLevel

String logLevel

configuration

org.apache.commons.configuration.PropertiesConfiguration configuration

doImport

boolean doImport

doExport

boolean doExport

schemaDirectory

String schemaDirectory

outputFile

String outputFile

overwrite

boolean overwrite

driverClass

String driverClass

url

String url

user

String user

password

String password

databaseName

String databaseName

filesToProcess

String[] filesToProcess

mergeFile

String mergeFile

args

String[] args
Constructor Detail

JetspeedDDLApplication

public JetspeedDDLApplication()
Method Detail

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

checkDBSettings

private void checkDBSettings()
ensure that we have valid database settings


parseArguments

private void parseArguments()
parse arguments for process instructions, order and exclude files as well as optional database arguments


parseFiles

private String[] parseFiles()
process provided filename or directory name

Returns:
one or more files to be processed

processArguments

private void processArguments(String[] arguments)
                       throws Exception
setup environment by processing all arguments and call requested process routine

Parameters:
arguments -
Throws:
Exception

processImport

private void processImport(JetspeedDDLUtil ddlUtil)
create/alter database

Parameters:
ddlUtil -

createTemp

private File createTemp(String suffix)
Helper routine to create a temporary file

Parameters:
suffix -
Returns:

createXSLTFromFile

private File createXSLTFromFile(String fileName)
Open the merge file from disk

Parameters:
fileName -
Returns:

createXSLTFromMemory

private File createXSLTFromMemory()
If everything else fails, use a hardcoded XSLT here

Returns:

mergeFiles

private String mergeFiles(String[] fileList)
process of merging two or more schema files into one schema file.

Parameters:
fileList - The filelist contains a (potentially) ordered list of schemas
Returns:
The name of the created temporary schema file

processExport

private void processExport(JetspeedDDLUtil ddlUtil)
read database schema to file


processPropertyFile

private void processPropertyFile()
read the property file and read what has not yet been defined


getRows

public List getRows(JetspeedDDLUtil ddlUtil,
                    String tableName)

getSelectQueryForAllString

public String getSelectQueryForAllString(JetspeedDDLUtil ddlUtil,
                                         org.apache.ddlutils.model.Table table)

readOrderFile

private ArrayList readOrderFile(String importFileName)
read an xml file describing the basic order of the files to be processed

Parameters:
importFileName -
Returns:
Throws:
SerializerException


Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.