com.centrasite.importexport
Class ImportOperation

java.lang.Object
  extended by com.centrasite.importexport.ImportOperation

public class ImportOperation
extends java.lang.Object

The import processes an export archive, produced by ExportOperation and adds the content into CentraSite. The repository items will be copied into the CentraSite repository and the other items will be loaded into the CentraSite registry. Internally the items of the zip-archive will be distributed in 4 separate lists:

  1. webdav - list containing all repository items
  2. taxonomy - list containing all taxonomies and categories
  3. types - list containing the categories of user-defined asset types containing all classifications and associations
  4. instances - list containing all others (instances)
The creation of the separate lists is necessary, because the objects must be loaded in a special order because of dependencies.

Moreover it is possible to import only particular object(s) out from an archive (@see addImportKey(String) for more information).


Nested Class Summary
static class ImportOperation.Timing
           
 
Constructor Summary
ImportOperation(com.centrasite.jaxr.CentraSiteConnection connection, java.lang.String zipFileName)
          Constructs a CentraSite import instance out from given connection.
ImportOperation(java.lang.String centraSiteUrl, java.lang.String user, java.lang.String password, java.lang.String zipFileName)
          Constructs a CentraSite import instance.
ImportOperation(java.lang.String centraSiteUrl, java.lang.String user, java.lang.String password, java.lang.String zipFileName, java.util.Properties sslProperties)
          Constructs a CentraSite import instance.
 
Method Summary
 void addImportKey(java.lang.String uddiKey)
          Add a key to import.
 void addImportKeys(java.util.Collection<java.lang.String> uddiKeys)
          Add keys to import.
 void execute()
          Import execution.
 java.util.Locale getErrorMessageLocale()
          Return the error message locale.
 java.lang.String getZipFileName()
           
 boolean isClustered()
           
static boolean isObjectToLog(javax.xml.registry.infomodel.RegistryObject registryObject)
          Check if given registry object is supposed to log via event-logging.
static void main(java.lang.String[] args)
          main entry point.
 void setErrorMessageLocale(java.util.Locale locale)
          Set the error message locale.
 void setEventCallback(com.centrasite.jaxr.importexport.IEventCallback eventCallback)
          Sets a callback class which is called for messages (errors, warnings, informational).
 void setEventCallback(com.centrasite.importexport.IEventCallback eventCallback)
          Deprecated. please use setEventCallback(com.centrasite.jaxr.importexport.IEventCallback)
 void setImportGroup(boolean importGroup)
          Indicate whether to replace objects if the objects in the zip-archive are older than the ones in the registry.
 void setImportOrganizationKey(java.lang.String importOrganizationKey)
          Set the organization the objects should be imported into.
 void setImportOrganizationName(java.lang.String importOrganizationName)
          Set the organization the objects should be imported into.
 void setKeepLCMState(boolean keepLCMState)
          Indicate if after import the lifecycle state should be kept.
 void setKeepOrganization(boolean keepOrganization)
          Indicate whether to keep the original organization of all the importing objects.
 void setKeepOwner(boolean keepOwner)
          Indicate whether to keep the original owner of all the importing objects.
 void setNewOwner(javax.xml.registry.infomodel.User newOwner)
          Set the given as owner of all the importing objects
 void setNewOwnerName(java.lang.String newOwnerName)
          Set the given user as owner of all the importing objects.
 void setRemoveAllMissingReferences(boolean removeAllMissingReferences)
          Indicate if during import all missing associations are to removed from the object.
 void setReplace(boolean replaceOption)
          Indicate whether to replace objects if the objects in the zip-archive are older than the ones in the registry.
 void setRepositoryRoot(java.lang.String repositoryRoot)
          Deprecated.  
 void setSimulate(boolean simulate)
          Indicate if the import should simulate; this means no records will be updated to the registry but the log and also the error messages get written.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImportOperation

public ImportOperation(com.centrasite.jaxr.CentraSiteConnection connection,
                       java.lang.String zipFileName)
                throws java.lang.Exception
Constructs a CentraSite import instance out from given connection. A own connection will be created.

Parameters:
connection - active registry connection (null: working without connection)
zipFileName - the name of the zip-archive to import
Throws:
java.lang.Exception - error connecting to CentraSite

ImportOperation

public ImportOperation(java.lang.String centraSiteUrl,
                       java.lang.String user,
                       java.lang.String password,
                       java.lang.String zipFileName,
                       java.util.Properties sslProperties)
                throws java.lang.Exception
Constructs a CentraSite import instance. Opens a CentraSite connection with https if the ssl properties given.

Parameters:
centraSiteUrl - the URL of the CentraSite database
user - the user name
password - the password of the user
zipFileName - the name of the zip-archive to import
sslProperties - thw ssl properties for https communication (null: no https)
Throws:
java.lang.Exception - error connecting to CentraSite

ImportOperation

public ImportOperation(java.lang.String centraSiteUrl,
                       java.lang.String user,
                       java.lang.String password,
                       java.lang.String zipFileName)
                throws java.lang.Exception
Constructs a CentraSite import instance. Opens a CentraSite connection.

Parameters:
centraSiteUrl - the URL of the CentraSite database
user - the user name
password - the password of the user
zipFileName - the name of the zip-archive to import
Throws:
java.lang.Exception - error connecting to CentraSite
Method Detail

setReplace

public void setReplace(boolean replaceOption)
Indicate whether to replace objects if the objects in the zip-archive are older than the ones in the registry.

Parameters:
replaceOption - true: replace objects, no matter of their timestamp; false: reject older objects (default)

setImportGroup

public void setImportGroup(boolean importGroup)
Indicate whether to replace objects if the objects in the zip-archive are older than the ones in the registry.

Parameters:
replaceOption - true: replace objects, no matter of their timestamp; false: reject older objects (default)

setKeepOwner

public void setKeepOwner(boolean keepOwner)
Indicate whether to keep the original owner of all the importing objects. By default the objects get the executing user as owner.

Parameters:
keepOwner - true: keep the original owner; false: set owner to importing user (default)

setNewOwner

public void setNewOwner(javax.xml.registry.infomodel.User newOwner)
Set the given as owner of all the importing objects

Parameters:
newOwner - CentraSite login user

setNewOwnerName

public void setNewOwnerName(java.lang.String newOwnerName)
                     throws javax.xml.registry.JAXRException,
                            com.centrasite.jaxr.importexport.ExportException
Set the given user as owner of all the importing objects. Its expected that the user with this name is present in the registry.

Parameters:
newOwnerName - the name of the new owner (syntax: "domain\name", default domain: "INTERNAL")
Throws:
javax.xml.registry.JAXRException - internal jaxr error
com.centrasite.jaxr.importexport.ExportException - user not found

setKeepOrganization

public void setKeepOrganization(boolean keepOrganization)
                         throws com.centrasite.jaxr.importexport.ExportException
Indicate whether to keep the original organization of all the importing objects. By default the objects get the organization of the executing user.
Note: if organizations with other objects are imported then this options gets automatically activated.

Parameters:
keepOrganization - true: keep the original organization; false: set organization of importing user (default)
Throws:
com.centrasite.jaxr.importexport.ExportException

setKeepLCMState

public final void setKeepLCMState(boolean keepLCMState)
Indicate if after import the lifecycle state should be kept. Otherwise if an asset has a lifecycle it will be reset to the initial state.

Parameters:
keepLCMState - true: keep lifecycle state at import
false: reset lifecycle state to initial (default)

setRemoveAllMissingReferences

public final void setRemoveAllMissingReferences(boolean removeAllMissingReferences)
Indicate if during import all missing associations are to removed from the object. Otherwise the objects may be rejected to import due to dangling references.

Parameters:
removeAllMissingReferences - true: remove all missing associations
false: reject objects due to missing associations (default)

setSimulate

public final void setSimulate(boolean simulate)
Indicate if the import should simulate; this means no records will be updated to the registry but the log and also the error messages get written.

Parameters:
simulate - true: simulate the import

addImportKey

public final void addImportKey(java.lang.String uddiKey)
Add a key to import. If this is done only the object(s) with those key(s) are imported in contrast to importing everything. If the key is not present in the archive, then it will be ignored. If the given object references another object in the archive which is not explicitly specified, then it will be imported implicitly.

Parameters:
uddiKey - "uddi:..."

addImportKeys

public final void addImportKeys(java.util.Collection<java.lang.String> uddiKeys)
Add keys to import. If this is done only the object(s) with those key(s) are imported in contrast to importing everything. If a key is not present in the archive, then it will be ignored. If a given object references another object in the archive which is not explicitly specified, then it will be imported implicitly.

Parameters:
uddiKey - list of "uddi:..."

setRepositoryRoot

public void setRepositoryRoot(java.lang.String repositoryRoot)
Deprecated. 


setEventCallback

public final void setEventCallback(com.centrasite.jaxr.importexport.IEventCallback eventCallback)
Sets a callback class which is called for messages (errors, warnings, informational).

Parameters:
eventCallback - the instance of the message callback class; null: no message callback (default)

setEventCallback

public final void setEventCallback(com.centrasite.importexport.IEventCallback eventCallback)
Deprecated. please use setEventCallback(com.centrasite.jaxr.importexport.IEventCallback)


setImportOrganizationKey

public void setImportOrganizationKey(java.lang.String importOrganizationKey)
                              throws com.centrasite.jaxr.importexport.ExportException
Set the organization the objects should be imported into. If the organization is omitted, then the import user's organization will receive the imported objects.

Parameters:
importOrganizationKey - the key of a organization; null: take the user's organization
Throws:
com.centrasite.jaxr.importexport.ExportException

setImportOrganizationName

public void setImportOrganizationName(java.lang.String importOrganizationName)
                               throws com.centrasite.jaxr.importexport.ExportException,
                                      javax.xml.registry.JAXRException
Set the organization the objects should be imported into. If the organization is omitted, then the import user's organization will receive the imported objects.

Parameters:
importOrganizationName - name of the organization
Throws:
com.centrasite.jaxr.importexport.ExportException
javax.xml.registry.JAXRException

getZipFileName

public java.lang.String getZipFileName()
Returns:
absolute filename of export zip file

isClustered

public boolean isClustered()
                    throws java.lang.IllegalArgumentException,
                           java.io.IOException
Throws:
java.lang.IllegalArgumentException
java.io.IOException

execute

public void execute()
             throws com.centrasite.jaxr.importexport.ExportException
Import execution. Import the content of the specified zip-archive into the CentraSite registry.

Throws:
com.centrasite.jaxr.importexport.ExportException

isObjectToLog

public static boolean isObjectToLog(javax.xml.registry.infomodel.RegistryObject registryObject)
Check if given registry object is supposed to log via event-logging.

Parameters:
registryObject -
Returns:
true: if to log

getErrorMessageLocale

public final java.util.Locale getErrorMessageLocale()
Return the error message locale.

Returns:
the error message locale.

setErrorMessageLocale

public void setErrorMessageLocale(java.util.Locale locale)
Set the error message locale.

Parameters:
locale - the locale

main

public static void main(java.lang.String[] args)
main entry point.

usage:
ImportOperation [options] < CentraSite URL > < export filename > < user > < password >

Options:

-setreplace replace objects if already present in the registry
-keepowner keep the object owner instead of assiging the importing user
-setowner < username > all imported object will be set to specified user
-keeporganization keep the organization instead of assigning the active one
-keeplcmstate keep the lcm state of the object which is set at export
-importorg < org-key > import the objects into the given organization by key
-importorgname < orgname > import the objects into the given organization by name
-simulate simulate the import, no updates to the registry but message logging
-removemissingreferences remove all missing associations causing dangling references
-importkeys uddi[,uddi...] import only those object(s) given by key(s)

Parameters:
args - program arguments