com.centrasite.importexport
Class ExportOperation

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

public class ExportOperation
extends java.lang.Object

Exporting registry objects and their related objects into a zip-archive. The objects to be added are specified with the addExportXxx methods. The export can handle single objects as well as more complex like asset types with assets, taxonomies with its instances or organizations with all their related objects.
For example exporting a taxonomy will additionally export all the corresponding categories. Together with the objects, their audit trail meaning the history of their modifications, will be exported. All the exported registry objects are represented as xml files within the zip-archive.

Repository objects will be copied into a sub-directory named 'webDAV' within the zip-archive. The entire pathname of the repository object will be kept in the archive.

Using the IEventCallback interface messages like errors, warnings and informational messages are communicated.

 Example:
    OutputStream os = new FileOutputStream("myfile.zip");
    ExportOperation eo =
        new ExportOperation("http://localhost:53305/CentraSite/CentraSite", "usr", "pwd", os);
    eo.addExportObject(regObj);
    eo.execute();
 

The export set may also be determined by a prepared query. This query can be prepared as a 'saved search' in webdav, see addSavedSearchObjects(String, String), or directly be specified as query file, see addSearchFromFile(java.lang.String).
Also the objects to be exported can be filtered with the modifiedSince time stamp. So only objects which were created or modified after the given time stamp are selected for export, see setModifiedSince(String).

 Example: export with saved search, modified since 2 hours:
    OutputStream os = new FileOutputStream("myfile.zip");
    ExportOperation eo =
        new ExportOperation("http://localhost:53305/CentraSite/CentraSite", "usr", "pwd", os);
    eo.addSavedSearchObjects("MySavedSearch");
    eo.setModifiedSince("PT2H");
    eo.execute();
 


Nested Class Summary
static class ExportOperation.CollectorResults
           
static class ExportOperation.ExportOrganizationMode
          Organization export mode.
 
Field Summary
static ExportOperation.ExportOrganizationMode exportOrganizationModeDefault
           
 
Constructor Summary
ExportOperation(com.centrasite.jaxr.CentraSiteConnection connection, java.io.OutputStream outputStream)
           
ExportOperation(java.lang.String centraSiteUrl, java.lang.String user, java.lang.String password, java.io.OutputStream outputStream)
          Constructs a CentraSite export instance.
 
Method Summary
 void addExportKey(javax.xml.registry.infomodel.Key key)
          Add a key of an object to the collection of keys to be exported.
 void addExportKeys(java.util.Collection<javax.xml.registry.infomodel.Key> keyCollection)
          Add a collection of object keys to the collection of keys to be exported.
 void addExportObject(javax.xml.registry.infomodel.RegistryObject registryObject)
          Add a registry object to the collection of objects to be exported.
 void addExportObjects(java.util.Collection<javax.xml.registry.infomodel.RegistryObject> registryObjectsCollection)
          Add a collection of registry objects to the collection of objects to be exported.
 void addSavedSearchObjects(java.lang.String savedSearchName)
          Add the objects from a saved search, given by its name to the objects for export.
 void addSavedSearchObjects(java.lang.String savedSearchName, java.lang.String userName)
          Add the objects from a saved search, given by its name to the objects for export.
 void addSearchFromFile(java.lang.String queryFileName)
          Add the objects executed by the search, given by its file name to the objects for export.
 void close()
          Close connections and resources of an open ExportOperation.
 void execute()
          Export execution.
 java.util.List<ExportOperation.CollectorResults> getCollectorResult()
           
 javax.xml.registry.infomodel.Concept getConcept(java.lang.String conceptValue)
          Get concept using the name of the concept.
 int getExportObjectCount()
          Return the object count to be exported.
 javax.xml.registry.infomodel.Key getKey(java.lang.String keyValue)
          Create key of a registryObject using the key given as a String
 java.util.Collection<javax.xml.registry.infomodel.RegistryObject> getMainObjectsToExport()
          Get all main objects to be exported.
 java.util.Map<javax.xml.registry.infomodel.RegistryObject,java.util.Collection<javax.xml.registry.infomodel.RegistryObject>> getMainObjectsToExportMap()
          Get all selected objects to be exported as a map.
static void main(java.lang.String[] args)
          main entry point.
 void removeExportObject(javax.xml.registry.infomodel.RegistryObject registryObject)
          Remove the object from the set of objects to be exported.
 void removeExportObject(java.lang.String key)
          Remove the object from the set of objects to be exported.
 void removeExportObjects(java.util.Collection<java.lang.String> keys)
          Remove the objects from the set of objects to be exported.
 void setCheckUnreferencedAssociations(boolean checkUnreferencedAssociations)
          Set whether to check for unreferenced objects during export.
 void setDeleteAfterExport(boolean isObjectsDeletedAfterExport)
          Set whether to delete registry objects after export.
 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 setExportOrganizationMode(ExportOperation.ExportOrganizationMode mode)
          Set the export mode for exporting organizations.
 void setHeterogeneousObjectsExport(boolean isHeterogeneousObjectsExport)
           
 void setIncludeChildOrganizations(boolean includeChildOrganizations)
          Indicates if child organization should be exported with its parent organization.
 void setIncludeChildren(boolean isChildrenIncluded)
          Deprecated.  
 void setIncludeExternalLinks(boolean isExternalLinksIncluded)
          Deprecated.  
 void setIncludeImports(boolean isImportsIncluded)
          Deprecated.  
 void setIncludeInstances(boolean isInstancesIncluded)
          Set whether to include instances of asset types or the classified objects of taxonomies.
 void setIncludeInstancesOfLCM(boolean isInstancesIncludedForLCM)
           
 void setIncludeInstancesOfTaxonomy(boolean isInstancesIncludedForTaxonomy)
           
 void setIncludeInstancesOfType(boolean isInstancesIncludedForType)
           
 void setIncludeReferencedAssets(boolean includeReferencedAssets)
          Indicates if referenced assets should also be exported.
 void setIncludeReferencedAssetsOfAsset(boolean includeReferencedAssetsOfAsset)
           
 void setIncludeReferencedAssetsOfLCM(boolean includeReferencedAssetsOfLCM)
           
 void setIncludeReferencedAssetsOfTaxonomy(boolean includeReferencedAssetsOfTaxonomy)
           
 void setIncludeReferencedAssetsOfType(boolean includeReferencedAssetsOfType)
           
 void setIncludeTypeInfo(boolean isTypeInfoIncluded)
          Deprecated.  
 void setMinimizeAuditableEvents(boolean minimizeAuditableEvents)
          Controls the amount of audit trail for the objects.
 void setModifiedSince(java.lang.String timeSpec)
          Sets the time stamp for filtering the objects to export which were created/modified after this time stamp.
 void setOrgWithAssets(boolean orgWithAssets)
          Indicates if assets of organization should be exported with the organization.
 void setOutputStream(java.io.OutputStream outputStream)
           
 void setRepositoryRoot(java.lang.String repositoryRoot)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

exportOrganizationModeDefault

public static final ExportOperation.ExportOrganizationMode exportOrganizationModeDefault
Constructor Detail

ExportOperation

public ExportOperation(com.centrasite.jaxr.CentraSiteConnection connection,
                       java.io.OutputStream outputStream)
                throws java.lang.Exception
Throws:
java.lang.Exception

ExportOperation

public ExportOperation(java.lang.String centraSiteUrl,
                       java.lang.String user,
                       java.lang.String password,
                       java.io.OutputStream outputStream)
                throws java.lang.Exception
Constructs a CentraSite export instance. Opens a CentraSite connection.

Parameters:
centraSiteUrl - the URL of the CentraSite database
user - the user name
password - the password of the user
outputStream - the stream the export archive goes to
Throws:
java.lang.Exception - error connecting to CentraSite
Method Detail

setExportOrganizationMode

public void setExportOrganizationMode(ExportOperation.ExportOrganizationMode mode)
Set the export mode for exporting organizations. ExportOrganizationMode.PLAIN_WITH_LCM works as ExportOrganizationMode.OBJECTS_WITH_LCM. The default is ExportOrganizationMode.OBJECTS.

Parameters:
mode - the ExportOrganizationMode

setIncludeChildOrganizations

public void setIncludeChildOrganizations(boolean includeChildOrganizations)
Indicates if child organization should be exported with its parent organization.

Parameters:
includeChildOrganizations - true: include child organizations (default); false: no child organizations

setIncludeReferencedAssets

public void setIncludeReferencedAssets(boolean includeReferencedAssets)
Indicates if referenced assets should also be exported. If set to false and an exported asset references another one, then a warning message gets logged.

Parameters:
includeReferencedAssets - true: include referenced assets; false: do not include referenced assets (default)

setHeterogeneousObjectsExport

public void setHeterogeneousObjectsExport(boolean isHeterogeneousObjectsExport)

setOrgWithAssets

public void setOrgWithAssets(boolean orgWithAssets)
Indicates if assets of organization should be exported with the organization.

Parameters:
orgWithAssets - true: include assets of organizations; false: no assets with organizations (default)

setMinimizeAuditableEvents

public void setMinimizeAuditableEvents(boolean minimizeAuditableEvents)
Controls the amount of audit trail for the objects.

Parameters:
minimizeAuditableEvents - true: minimum auditable events for the objects; false: full amount of auditable events (default)

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)


setIncludeExternalLinks

public void setIncludeExternalLinks(boolean isExternalLinksIncluded)
Deprecated. 


setIncludeChildren

public void setIncludeChildren(boolean isChildrenIncluded)
Deprecated. 


setIncludeImports

public void setIncludeImports(boolean isImportsIncluded)
Deprecated. 


setIncludeTypeInfo

public void setIncludeTypeInfo(boolean isTypeInfoIncluded)
Deprecated. 


setIncludeInstances

public void setIncludeInstances(boolean isInstancesIncluded)
Set whether to include instances of asset types or the classified objects of taxonomies.

Parameters:
isInstancesIncluded - true: include the instances (default); false: no instances

setIncludeInstancesOfTaxonomy

public void setIncludeInstancesOfTaxonomy(boolean isInstancesIncludedForTaxonomy)

setIncludeReferencedAssetsOfTaxonomy

public void setIncludeReferencedAssetsOfTaxonomy(boolean includeReferencedAssetsOfTaxonomy)

setIncludeInstancesOfLCM

public void setIncludeInstancesOfLCM(boolean isInstancesIncludedForLCM)

setIncludeReferencedAssetsOfLCM

public void setIncludeReferencedAssetsOfLCM(boolean includeReferencedAssetsOfLCM)

setIncludeInstancesOfType

public void setIncludeInstancesOfType(boolean isInstancesIncludedForType)

setIncludeReferencedAssetsOfType

public void setIncludeReferencedAssetsOfType(boolean includeReferencedAssetsOfType)

setIncludeReferencedAssetsOfAsset

public void setIncludeReferencedAssetsOfAsset(boolean includeReferencedAssetsOfAsset)

setDeleteAfterExport

public void setDeleteAfterExport(boolean isObjectsDeletedAfterExport)
Set whether to delete registry objects after export.

Parameters:
isObjectsDeletedAfterExport - true: delete objects after export; false: do not delete objects (default)

setCheckUnreferencedAssociations

public final void setCheckUnreferencedAssociations(boolean checkUnreferencedAssociations)
Set whether to check for unreferenced objects during export. For each unreferenced objects a warning message will be displayed via the IEventCallback callback.

Parameters:
checkUnreferencedAssociations - true: check for unreferenced objects (default); false: no checks

setRepositoryRoot

public void setRepositoryRoot(java.lang.String repositoryRoot)

setOutputStream

public void setOutputStream(java.io.OutputStream outputStream)

addExportKey

public void addExportKey(javax.xml.registry.infomodel.Key key)
                  throws javax.xml.registry.JAXRException
Add a key of an object to the collection of keys to be exported.

Parameters:
key - the key of the object to be exported
Throws:
javax.xml.registry.JAXRException

addExportKeys

public void addExportKeys(java.util.Collection<javax.xml.registry.infomodel.Key> keyCollection)
                   throws javax.xml.registry.JAXRException
Add a collection of object keys to the collection of keys to be exported.

Parameters:
keyCollection - the collection of keys to be exported
Throws:
javax.xml.registry.JAXRException

addExportObject

public void addExportObject(javax.xml.registry.infomodel.RegistryObject registryObject)
                     throws javax.xml.registry.JAXRException
Add a registry object to the collection of objects to be exported.

Parameters:
registryObject - the registry object
Throws:
javax.xml.registry.JAXRException

addExportObjects

public void addExportObjects(java.util.Collection<javax.xml.registry.infomodel.RegistryObject> registryObjectsCollection)
Add a collection of registry objects to the collection of objects to be exported.

Parameters:
registryObjectsCollection - collection of registry objects

removeExportObject

public void removeExportObject(javax.xml.registry.infomodel.RegistryObject registryObject)
Remove the object from the set of objects to be exported. This method can only be used if getMainObjectsToExportMap() has already been executed.

Parameters:
registryObject - the object to be removed from the set.

removeExportObject

public void removeExportObject(java.lang.String key)
Remove the object from the set of objects to be exported.

Parameters:
key - key of a top object to be ignored at export

removeExportObjects

public void removeExportObjects(java.util.Collection<java.lang.String> keys)
Remove the objects from the set of objects to be exported.

Parameters:
key - keys of a top object to be ignored at export

getExportObjectCount

public int getExportObjectCount()
Return the object count to be exported. Note: it is only valid after getMainObjectsToExport() or (getMainObjectsToExport().

Returns:
number of objects being collected (-1: getMainObjectsXXX() not executed before)

addSavedSearchObjects

public void addSavedSearchObjects(java.lang.String savedSearchName)
                           throws com.centrasite.jaxr.importexport.ExportException
Add the objects from a saved search, given by its name to the objects for export. The saved search is expected below the jaxr user. Note: a saved search can be created with centraSite Control and is stored in webdav. Refer to QueryExecutor for more information.

Parameters:
savedSearchName - the name of the saved search
Throws:
com.centrasite.jaxr.importexport.ExportException - query failure

addSavedSearchObjects

public void addSavedSearchObjects(java.lang.String savedSearchName,
                                  java.lang.String userName)
                           throws com.centrasite.jaxr.importexport.ExportException
Add the objects from a saved search, given by its name to the objects for export. Note: a saved search can be created with centraSite Control and is stored in webdav. Refer to QueryExecutor for more information.

Parameters:
savedSearchName - the name of the saved search
userName - the user name where the saved search is stored (null: take current jaxr user)
Throws:
com.centrasite.jaxr.importexport.ExportException - query failure

addSearchFromFile

public void addSearchFromFile(java.lang.String queryFileName)
                       throws com.centrasite.jaxr.importexport.ExportException
Add the objects executed by the search, given by its file name to the objects for export. The query file contains a xml specification containing the query. The starting elements are "predicated", "keywords" or "xquery".

Parameters:
queryFileName - path name (or URL) of a query file
Throws:
com.centrasite.jaxr.importexport.ExportException - query failure

setModifiedSince

public void setModifiedSince(java.lang.String timeSpec)
                      throws com.centrasite.jaxr.importexport.ExportException
Sets the time stamp for filtering the objects to export which were created/modified after this time stamp. Older objects will not be exported.
The time stamp may be specified as absolute time stamp (xs:dateTime) or as a time interval (xs:duration)

The time stamp will be checked at:

  • only explicitly specified objects
  • objects determined by saved searched
  • objects of organization (groups, policies, lcm ...) - the entire organization will be exported
  • assets of organization - only the objects but not the organization will be exported

    Parameters:
    timeSpec - the time specification in xs:dateTime or xs:duration syntax (null: no time limit)
    Throws:
    com.centrasite.jaxr.importexport.ExportException - invalid dateTime/duration syntax

  • execute

    public void execute()
                 throws java.lang.Exception
    Export execution. Execute the export with the following processing:
    1. Convert all registry keys into objects
    2. Open zip-file
    3. For all object collect their dependent objects
    4. Read objects from registry and convert them to XML format
    5. Read repository objects, if any and add to zip-archive
    6. Write to zip-archive
    7. Delete exported objects, if selected
    8. Close zip-archive
    9. After processing each object, a message will be sent using the IEventCallback interface
    10. Close CentraSite connection
    The execute() method can only be used once within a ExportOperation instance.

    Throws:
    java.lang.Exception

    close

    public void close()
    Close connections and resources of an open ExportOperation. Note that calling close() is done at the end of a successful execute().


    getMainObjectsToExport

    public java.util.Collection<javax.xml.registry.infomodel.RegistryObject> getMainObjectsToExport()
                                                                                             throws java.lang.Exception
    Get all main objects to be exported. They are assets, types, taxonomies to fulfil the export set. Related objects like external links are not returned.

    Returns:
    collection of top objects to be exported
    Throws:
    java.lang.Exception

    getMainObjectsToExportMap

    public java.util.Map<javax.xml.registry.infomodel.RegistryObject,java.util.Collection<javax.xml.registry.infomodel.RegistryObject>> getMainObjectsToExportMap()
                                                                                                                                                           throws java.lang.Exception
    Get all selected objects to be exported as a map. The values of the map are the dependent objects of them (e.g a asset has its asset type as dependent object).

    Returns:
    map of top objects to be exported
    Throws:
    java.lang.Exception

    getCollectorResult

    public java.util.List<ExportOperation.CollectorResults> getCollectorResult()
                                                                        throws java.lang.Exception
    Throws:
    java.lang.Exception

    getConcept

    public javax.xml.registry.infomodel.Concept getConcept(java.lang.String conceptValue)
                                                    throws java.lang.Exception
    Get concept using the name of the concept.

    Parameters:
    conceptValue - the name of the concept
    Returns:
    the instance of the concept with this name
    Throws:
    java.lang.Exception

    getKey

    public javax.xml.registry.infomodel.Key getKey(java.lang.String keyValue)
                                            throws java.lang.Exception
    Create key of a registryObject using the key given as a String

    Parameters:
    keyValue - the key as a uddi string
    Returns:
    the instance of the key with this value
    Throws:
    java.lang.Exception

    setErrorMessageLocale

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

    Parameters:
    locale - the locale as string

    main

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

    usage:
    ExportOperation [options] < CentraSite URL > < export filename > < user > < password > [< registry-key > ...]

    Options:

    OptionExplanation
    -noinstances Do not export the instances of a Type and/or Taxonomy
    -deleteafterexport Delete the objects to be exported after export (not for types and organizations)
    -minimizeauditableevents Export only the minimal set of audit trail
    -withreferencedassets Export also the directly referenced(associated) assets
    -orgnousers Do not export the users of exported organizations
    -orgwithpolicyandlifecycle Export the policies and LCMs of exported organizations
    -orgnochildorganization Do not export the child organizations of exported organizations
    -orgwithassets Export all the assets of the exported organizations
    -ignore id Ignore the top object at export. This option may be specified more than once
    -savedsearch searchname Add the result of the saved search to the objects to export. This option may be specified more than once
    -savedsearchuser user Use the given user for the -savedsearch option instead of session user
    -searchfile file Add the result of the search, specified in the xml file, to the objects to export. This option may be specified more than once
    -modifiedsince timespec Export only objects created/modified after timespec (syntax: xs:dateTime or xs:duration)
    -displaymainobjects Display the main objects to be exported and do NOT export
    -displaycollectorresult Display the collector result and do NOT export
    -full Full output option of a display

    deprecated option: [-orgnorelated] : use -orgnousers

    Parameters:
    args - program arguments