public abstract class DBCopier extends GenericService
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.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
SERVICE_INFO_KEYDEFAULT_LOG_TRACE_STATUSDEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS| Constructor and Description |
|---|
DBCopier()
Construct an empty DBCopier.
|
| Modifier and Type | Method and Description |
|---|---|
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 |
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopServicevlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarningpublic int copy()
throws java.io.IOException
java.io.IOException - if there is trouble performing the copypublic void cleanupDirectory()
directory. Typically performed after a
copy to reclaim space. Note: directories are not removed.public void setSource(atg.adapter.gsa.DBConnectionInfo pSource)
sourcepSource - new value to setpublic atg.adapter.gsa.DBConnectionInfo getSource()
sourcesourcepublic void setDestination(atg.adapter.gsa.DBConnectionInfo pDestination)
destinationpDestination - new value to setpublic atg.adapter.gsa.DBConnectionInfo getDestination()
destinationdestinationpublic void setDirectory(java.io.File pDirectory)
directorypDirectory - new value to setpublic java.io.File getDirectory()
directorydirectorypublic void setCleanupDirectory(boolean pCleanupDirectory)
cleanupDirectorypCleanupDirectory - new value to setpublic boolean getCleanupDirectory()
cleanupDirectorycleanupDirectorypublic boolean isCleanupDirectory()
cleanupDirectorycleanupDirectorypublic void setDeleteDataFileName(java.lang.String pDeleteDataFileName)
deleteDataFileNamepDeleteDataFileName - new value to setpublic java.lang.String getDeleteDataFileName()
deleteDataFileNamedeleteDataFileNamepublic void setDataFileSuffix(java.lang.String pDataFileSuffix)
dataFileSuffixpDataFileSuffix - new value to setpublic java.lang.String getDataFileSuffix()
dataFileSuffixdataFileSuffixpublic void setSqlCommand(java.lang.String pSqlCommand)
sqlCommandpSqlCommand - new value to setpublic java.lang.String getSqlCommand()
sqlCommandsqlCommandpublic void setExportCommand(java.lang.String pExportCommand)
exportCommandpExportCommand - new value to setpublic java.lang.String getExportCommand()
exportCommandexportCommandpublic void setImportCommand(java.lang.String pImportCommand)
importCommandpImportCommand - new value to setpublic java.lang.String getImportCommand()
importCommandimportCommandpublic void setTables(java.lang.String[] pTables)
tablespTables - new value to setpublic java.lang.String[] getTables()
tablestablespublic java.lang.String getCommandOutput()
commandOutputcommandOutput