|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.adapter.gsa.DBCopier
public abstract class DBCopier
Service that copies a set of SQL tables from one RDBMS to another using the DB vendor's native bulk copy tools. Subclasses implement the copy() method for the various supported DB types.
Copy consists of:
It is important to note that this facility uses vendor specific bulk copy and SQL utilities for speed. This is accomplished by executing these commands in separate processes.
If the native bulk copy program operates on one table at a time, the
DBCopier imports table data in the order in which the tables are specified
and deletes table data in the reverse order. Thus if there are foreign key
constraints among the tables, the copy can still work if the tables are
specified in dependency order.
The various subclasses of DBCopier
implement copying for
different DB vendors and/or using different vendor tools.
To use DBCopier
the native SQL environment for the database
in question must be set up before starting the JVM (Dynamo). This
is required by the vendor tools themselves. For example, for Oracle 8 you
should set your environment up to look something like this:
ORACLE_HOME=/oracle-directory
PATH=$PATH:$ORACLE_HOME/bin
ORACLE_SID=ora8
For Sybase 11.9.2, you would set up something like this:
SYBASE=/sybase-directory
PATH=$PATH:$SYBASE/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/$SYBASE/lib
For Informix 9, you would set up something like this:
INFORMIXDIR=/informix-directory
PATH=$PATH:$INFORMIXDIR/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/$INFORMIXDIR/lib
INFORMIXSERVER=ifx_server_name
For Solid the set up is something like this:
SOLIDDIR=/solid-directory (containing solid.lic and solid.ini files)
PATH=$PATH:$SOLIDDIR/bin
These are only pseduo-code examples of typical envrionment settings. To
use DBCopier
you will need to set up the environement in
which the JVM runs as specified in the DB vendor documentation.
This facility uses a scratch directory for SQL and data files used during
the copy operation. This directory (defined by the directory
property) must exist before the copy is launched. Also, it is strongly
recommended that no other processes or facilites use this scratch
directory (especially other DBCopier
instances). After the
copy is performed, you can specify whether or not the files in the scratch
directory are deleted, via the cleanupDirectory
property,
which defaults to false.
Subclasses may have other specific configuration notes, so be sure to read
the documentation for the implementation you are using.
Field Summary
static java.lang.String
CLASS_VERSION
Class version string
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor Summary
DBCopier()
Construct an empty DBCopier.
Method Summary
void
cleanupDirectory()
Remove all files in directory
.
int
copy()
Copy from the source database to the destination database.
boolean
getCleanupDirectory()
Get property cleanupDirectory
java.lang.String
getCommandOutput()
Get property commandOutput
java.lang.String
getDataFileSuffix()
Get property dataFileSuffix
java.lang.String
getDeleteDataFileName()
Get property deleteDataFileName
atg.adapter.gsa.DBConnectionInfo
getDestination()
Get property destination
java.io.File
getDirectory()
Get property directory
java.lang.String
getExportCommand()
Get property exportCommand
java.lang.String
getImportCommand()
Get property importCommand
atg.adapter.gsa.DBConnectionInfo
getSource()
Get property source
java.lang.String
getSqlCommand()
Get property sqlCommand
java.lang.String[]
getTables()
Get property tables
boolean
isCleanupDirectory()
Test property cleanupDirectory
void
setCleanupDirectory(boolean pCleanupDirectory)
Set property cleanupDirectory
void
setDataFileSuffix(java.lang.String pDataFileSuffix)
Set property dataFileSuffix
void
setDeleteDataFileName(java.lang.String pDeleteDataFileName)
Set property deleteDataFileName
void
setDestination(atg.adapter.gsa.DBConnectionInfo pDestination)
Set property destination
void
setDirectory(java.io.File pDirectory)
Set property directory
void
setExportCommand(java.lang.String pExportCommand)
Set property exportCommand
void
setImportCommand(java.lang.String pImportCommand)
Set property importCommand
void
setSource(atg.adapter.gsa.DBConnectionInfo pSource)
Set property source
void
setSqlCommand(java.lang.String pSqlCommand)
Set property sqlCommand
void
setTables(java.lang.String[] pTables)
Set property tables
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail
CLASS_VERSION
public static java.lang.String CLASS_VERSION
- Class version string
Constructor Detail
DBCopier
public DBCopier()
- Construct an empty DBCopier.
Method Detail
copy
public int copy()
throws java.io.IOException
- Copy from the source database to the destination database.
This performs all steps needed for the copy.
- Returns:
- status of copy (0 means success)
- Throws:
java.io.IOException
- if there is trouble performing the copy
cleanupDirectory
public void cleanupDirectory()
- Remove all files in
directory
. Typically performed after a
copy to reclaim space. Note: directories are not removed.
setSource
public void setSource(atg.adapter.gsa.DBConnectionInfo pSource)
- Set property
source
- Parameters:
pSource
- new value to set
getSource
public atg.adapter.gsa.DBConnectionInfo getSource()
- Get property
source
- Returns:
source
setDestination
public void setDestination(atg.adapter.gsa.DBConnectionInfo pDestination)
- Set property
destination
- Parameters:
pDestination
- new value to set
getDestination
public atg.adapter.gsa.DBConnectionInfo getDestination()
- Get property
destination
- Returns:
destination
setDirectory
public void setDirectory(java.io.File pDirectory)
- Set property
directory
- Parameters:
pDirectory
- new value to set
getDirectory
public java.io.File getDirectory()
- Get property
directory
- Returns:
directory
setCleanupDirectory
public void setCleanupDirectory(boolean pCleanupDirectory)
- Set property
cleanupDirectory
- Parameters:
pCleanupDirectory
- new value to set
getCleanupDirectory
public boolean getCleanupDirectory()
- Get property
cleanupDirectory
- Returns:
cleanupDirectory
isCleanupDirectory
public boolean isCleanupDirectory()
- Test property
cleanupDirectory
- Returns:
cleanupDirectory
setDeleteDataFileName
public void setDeleteDataFileName(java.lang.String pDeleteDataFileName)
- Set property
deleteDataFileName
- Parameters:
pDeleteDataFileName
- new value to set
getDeleteDataFileName
public java.lang.String getDeleteDataFileName()
- Get property
deleteDataFileName
- Returns:
deleteDataFileName
setDataFileSuffix
public void setDataFileSuffix(java.lang.String pDataFileSuffix)
- Set property
dataFileSuffix
- Parameters:
pDataFileSuffix
- new value to set
getDataFileSuffix
public java.lang.String getDataFileSuffix()
- Get property
dataFileSuffix
- Returns:
dataFileSuffix
setSqlCommand
public void setSqlCommand(java.lang.String pSqlCommand)
- Set property
sqlCommand
- Parameters:
pSqlCommand
- new value to set
getSqlCommand
public java.lang.String getSqlCommand()
- Get property
sqlCommand
- Returns:
sqlCommand
setExportCommand
public void setExportCommand(java.lang.String pExportCommand)
- Set property
exportCommand
- Parameters:
pExportCommand
- new value to set
getExportCommand
public java.lang.String getExportCommand()
- Get property
exportCommand
- Returns:
exportCommand
setImportCommand
public void setImportCommand(java.lang.String pImportCommand)
- Set property
importCommand
- Parameters:
pImportCommand
- new value to set
getImportCommand
public java.lang.String getImportCommand()
- Get property
importCommand
- Returns:
importCommand
setTables
public void setTables(java.lang.String[] pTables)
- Set property
tables
- Parameters:
pTables
- new value to set
getTables
public java.lang.String[] getTables()
- Get property
tables
- Returns:
tables
getCommandOutput
public java.lang.String getCommandOutput()
- Get property
commandOutput
- Returns:
commandOutput
Overview
Package
Class
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD