Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.io.impl
Class IOManagerImpl

java.lang.Object
  extended by org.nuxeo.ecm.platform.io.impl.IOManagerImpl
All Implemented Interfaces:
Serializable, IOManager

public class IOManagerImpl
extends Object
implements IOManager

IOManager implementation

Author:
Anahide Tchertchian
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.nuxeo.ecm.platform.io.api.IOManager
DOCUMENTS_ADAPTER_NAME
 
Constructor Summary
IOManagerImpl()
           
 
Method Summary
 void addAdapter(String name, IOResourceAdapter adapter)
          Adds an adapter with given name and definition.
 Collection<DocumentRef> copyDocumentsAndResources(String repo, Collection<DocumentRef> sources, DocumentLocation targetLocation, Collection<String> ioAdapters)
          Copy documents and resources to another location (on a same machine).
 void copyDocumentsAndResources(String repo, Collection<DocumentRef> sources, IOManager remoteIOManager, DocumentLocation targetLocation, Collection<String> ioAdapters)
          Remote copy.
 void copyDocumentsAndResources(String repo, Collection<DocumentRef> sources, IOManager remoteIOManager, DocumentLocation targetLocation, String docReaderFactoryName, Map<String,Object> readerFactoryParams, String docWriterFactoryName, Map<String,Object> writerFactoryParams, Collection<String> ioAdapters)
           
 void copyDocumentsAndResources(String repo, Collection<DocumentRef> sources, String serverAddress, int jndiPort, DocumentLocation targetLocation, Collection<String> ioAdapters)
          Remote copy.
 void copyDocumentsAndResources(String repo, Collection<DocumentRef> sources, String serverAddress, int jndiPort, DocumentLocation targetLocation, String docReaderFactoryName, Map<String,Object> readerFactoryParams, String docWriterFactoryName, Map<String,Object> writerFactoryParams, Collection<String> ioAdapters)
          Copies documents and resources associated with the given sources from the local repository to a remote repository instance (available on a machine with the given serverAddress).
 void disposeExport(String uri)
          Should be called by client code after using the export created by calling the IOManager.externalizeExport(java.lang.String, java.util.Collection, java.util.Collection).
 void exportDocumentsAndResources(OutputStream out, String repo, Collection<DocumentRef> sources, boolean recurse, String format, Collection<String> ioAdapters)
          Export documents and resources.
 void exportDocumentsAndResources(OutputStream out, String repo, String format, Collection<String> ioAdapters, DocumentReader customDocReader)
           
 String externalizeExport(String repo, Collection<DocumentRef> sources, Collection<String> ioAdapters)
          Exports the documents and resources specified by sources and creates an external reachable URI (through stream service) from where a client could download the export.
 String externalizeExport(String repo, Collection<DocumentRef> sources, String docReaderFactoryName, Map<String,Object> readerFactoryParams, Collection<String> ioAdapters)
          Exports documents as an streamable archive - using all options
 String externalizeExport(String repo, String docReaderFactoryName, Map<String,Object> readerFactoryParams, Collection<String> ioAdapters)
          Exports the documents and resources using custom DocumentReader that will be created by specified readerFactoryName.
 IOResourceAdapter getAdapter(String name)
          Returns the adapter with given name.
 void importDocumentsAndResources(InputStream in, String repo, DocumentRef root)
          Import document and resources described by given input stream at given document location.
 void importDocumentsAndResources(InputStream in, String repo, DocumentRef root, DocumentWriter customDocWriter)
           
 void importExportedFile(String uri, DocumentLocation targetLocation)
          Will be called after a successful export to import data from the file.
 void importExportedFile(String uri, DocumentLocation targetLocation, String docWriterFactoryName, Map<String,Object> factoryParams)
          Will be called after a successful export to import data from the file.
 void importFromStream(InputStream in, DocumentLocation targetLocation, String docReaderFactoryClassName, Map<String,Object> rFactoryParams, String docWriterFactoryClassName, Map<String,Object> wFactoryParams)
           
 void importFromStreamSource(String uri, DocumentLocation targetLocation, String docReaderFactoryClassName, Map<String,Object> rFactoryParams, String docWriterFactoryClassName, Map<String,Object> wFactoryParams)
           
 void removeAdapter(String name)
          Removes adapter with given name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOManagerImpl

public IOManagerImpl()
Method Detail

getAdapter

public IOResourceAdapter getAdapter(String name)
                             throws ClientException
Description copied from interface: IOManager
Returns the adapter with given name.

Specified by:
getAdapter in interface IOManager
Throws:
ClientException

addAdapter

public void addAdapter(String name,
                       IOResourceAdapter adapter)
                throws ClientException
Description copied from interface: IOManager
Adds an adapter with given name and definition.

Specified by:
addAdapter in interface IOManager
Throws:
ClientException

removeAdapter

public void removeAdapter(String name)
                   throws ClientException
Description copied from interface: IOManager
Removes adapter with given name.

Specified by:
removeAdapter in interface IOManager
Throws:
ClientException

exportDocumentsAndResources

public void exportDocumentsAndResources(OutputStream out,
                                        String repo,
                                        String format,
                                        Collection<String> ioAdapters,
                                        DocumentReader customDocReader)
                                 throws ExportDocumentException,
                                        IOException,
                                        ClientException
Throws:
ExportDocumentException
IOException
ClientException

exportDocumentsAndResources

public void exportDocumentsAndResources(OutputStream out,
                                        String repo,
                                        Collection<DocumentRef> sources,
                                        boolean recurse,
                                        String format,
                                        Collection<String> ioAdapters)
                                 throws IOException,
                                        ClientException,
                                        ExportDocumentException
Description copied from interface: IOManager
Export documents and resources.

Specified by:
exportDocumentsAndResources in interface IOManager
Parameters:
out - stream that can be turned into a zip holding a group of file for each additional resources types.
repo - TODO
sources - locations of documents to export.
recurse - recurse into sources children
format - export format. XXX see what format is actually accepted.
ioAdapters - list of adapters to use for additional resources.
Throws:
IOException
ClientException
ExportDocumentException

importDocumentsAndResources

public void importDocumentsAndResources(InputStream in,
                                        String repo,
                                        DocumentRef root)
                                 throws IOException,
                                        ClientException,
                                        ImportDocumentException
Description copied from interface: IOManager
Import document and resources described by given input stream at given document location.

Specified by:
importDocumentsAndResources in interface IOManager
Parameters:
in - stream representing the documents and resources to import. Can be a zip file of a group of export files. The service is responsible for unzipping and redirecting import to specific import services.
repo - the repository name.
root - Optional location of document that must be taken as root of the import (can be null).
Throws:
IOException
ClientException
ImportDocumentException

importDocumentsAndResources

public void importDocumentsAndResources(InputStream in,
                                        String repo,
                                        DocumentRef root,
                                        DocumentWriter customDocWriter)
                                 throws IOException,
                                        ClientException,
                                        ImportDocumentException
Throws:
IOException
ClientException
ImportDocumentException

copyDocumentsAndResources

public Collection<DocumentRef> copyDocumentsAndResources(String repo,
                                                         Collection<DocumentRef> sources,
                                                         DocumentLocation targetLocation,
                                                         Collection<String> ioAdapters)
                                                  throws ClientException
Description copied from interface: IOManager
Copy documents and resources to another location (on a same machine).

Specified by:
copyDocumentsAndResources in interface IOManager
Parameters:
repo - the initial repository name.
sources - locations of documents to export.
targetLocation - location of the document where copies must be placed.
ioAdapters - list of adapters to use for additional resources.
Returns:
the list of copied documents references.
Throws:
ClientException

copyDocumentsAndResources

public void copyDocumentsAndResources(String repo,
                                      Collection<DocumentRef> sources,
                                      String serverAddress,
                                      int jndiPort,
                                      DocumentLocation targetLocation,
                                      Collection<String> ioAdapters)
                               throws ClientException
Description copied from interface: IOManager
Remote copy. Copy documents and resources to another location.

Specified by:
copyDocumentsAndResources in interface IOManager
Throws:
ClientException

copyDocumentsAndResources

public void copyDocumentsAndResources(String repo,
                                      Collection<DocumentRef> sources,
                                      IOManager remoteIOManager,
                                      DocumentLocation targetLocation,
                                      Collection<String> ioAdapters)
                               throws ClientException
Description copied from interface: IOManager
Remote copy. Copy documents and resources to another location.

Specified by:
copyDocumentsAndResources in interface IOManager
Throws:
ClientException

importExportedFile

public void importExportedFile(String uri,
                               DocumentLocation targetLocation)
                        throws ClientException
Description copied from interface: IOManager
Will be called after a successful export to import data from the file.

Specified by:
importExportedFile in interface IOManager
Throws:
ClientException

copyDocumentsAndResources

public void copyDocumentsAndResources(String repo,
                                      Collection<DocumentRef> sources,
                                      String serverAddress,
                                      int jndiPort,
                                      DocumentLocation targetLocation,
                                      String docReaderFactoryName,
                                      Map<String,Object> readerFactoryParams,
                                      String docWriterFactoryName,
                                      Map<String,Object> writerFactoryParams,
                                      Collection<String> ioAdapters)
                               throws ClientException
Description copied from interface: IOManager
Copies documents and resources associated with the given sources from the local repository to a remote repository instance (available on a machine with the given serverAddress).

Also if there are custom DocumentReader and DocumentWriter classes that should be used when externalizing documents and/or when re-creating them at the remote location, they could be created through specific factory classes (specified as class names). These factory classes are instantiated and provided with the given factoryParams in order to build custom DocumentReader or DocumentWriter objects.

Specified by:
copyDocumentsAndResources in interface IOManager
docReaderFactoryName - classname for a DocumentReaderFactory custom implementation
readerFactoryParams - params to be given to custom DocumentReaderFactory to create DocumentReader
docWriterFactoryName - classname for a DocumentWriterFactory custom implementation
writerFactoryParams - params to be given to custom DocumentWriterFactory to create DocumentWriter
Throws:
ClientException

copyDocumentsAndResources

public void copyDocumentsAndResources(String repo,
                                      Collection<DocumentRef> sources,
                                      IOManager remoteIOManager,
                                      DocumentLocation targetLocation,
                                      String docReaderFactoryName,
                                      Map<String,Object> readerFactoryParams,
                                      String docWriterFactoryName,
                                      Map<String,Object> writerFactoryParams,
                                      Collection<String> ioAdapters)
                               throws ClientException
Throws:
ClientException

externalizeExport

public String externalizeExport(String repo,
                                Collection<DocumentRef> sources,
                                Collection<String> ioAdapters)
                         throws ClientException
Description copied from interface: IOManager
Exports the documents and resources specified by sources and creates an external reachable URI (through stream service) from where a client could download the export.

Specified by:
externalizeExport in interface IOManager
Throws:
ClientException

externalizeExport

public String externalizeExport(String repo,
                                String docReaderFactoryName,
                                Map<String,Object> readerFactoryParams,
                                Collection<String> ioAdapters)
                         throws ClientException
Description copied from interface: IOManager
Exports the documents and resources using custom DocumentReader that will be created by specified readerFactoryName. Creates an external reachable URI (through stream service) from where a client could download the export.

Specified by:
externalizeExport in interface IOManager
Throws:
ClientException

externalizeExport

public String externalizeExport(String repo,
                                Collection<DocumentRef> sources,
                                String docReaderFactoryName,
                                Map<String,Object> readerFactoryParams,
                                Collection<String> ioAdapters)
                         throws ClientException
Description copied from interface: IOManager
Exports documents as an streamable archive - using all options

Specified by:
externalizeExport in interface IOManager
Throws:
ClientException

disposeExport

public void disposeExport(String uri)
                   throws ClientException
Description copied from interface: IOManager
Should be called by client code after using the export created by calling the IOManager.externalizeExport(java.lang.String, java.util.Collection, java.util.Collection).

Specified by:
disposeExport in interface IOManager
Throws:
ClientException

importExportedFile

public void importExportedFile(String uri,
                               DocumentLocation targetLocation,
                               String docWriterFactoryName,
                               Map<String,Object> factoryParams)
                        throws ClientException
Description copied from interface: IOManager
Will be called after a successful export to import data from the file.

Specified by:
importExportedFile in interface IOManager
Throws:
ClientException

importFromStream

public void importFromStream(InputStream in,
                             DocumentLocation targetLocation,
                             String docReaderFactoryClassName,
                             Map<String,Object> rFactoryParams,
                             String docWriterFactoryClassName,
                             Map<String,Object> wFactoryParams)
                      throws ClientException
Specified by:
importFromStream in interface IOManager
Throws:
ClientException

importFromStreamSource

public void importFromStreamSource(String uri,
                                   DocumentLocation targetLocation,
                                   String docReaderFactoryClassName,
                                   Map<String,Object> rFactoryParams,
                                   String docWriterFactoryClassName,
                                   Map<String,Object> wFactoryParams)
                            throws ClientException
Specified by:
importFromStreamSource in interface IOManager
Throws:
ClientException

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.