|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.importexport.DataTransporter
public class DataTransporter
Utility class for manipulation of XML files (mainly JCR XML).
Field Summary | |
---|---|
static java.lang.String |
DOT
|
static java.lang.String |
GZ
|
static java.lang.String |
JCR_ROOT
|
static java.lang.String |
PROPERTIES
|
static java.lang.String |
SLASH
|
static java.lang.String |
UTF8
|
static java.lang.String |
XML
|
static java.lang.String |
ZIP
|
Constructor Summary | |
---|---|
DataTransporter()
|
Method Summary | |
---|---|
static java.lang.String |
decodePath(java.lang.String path,
java.lang.String enc)
decode a path (ex. |
static java.lang.String |
encodePath(java.lang.String path,
java.lang.String separator,
java.lang.String enc)
|
static void |
executeBootstrapImport(java.io.File xmlFile,
java.lang.String repositoryName)
|
static void |
executeExport(java.io.OutputStream baseOutputStream,
boolean keepVersionHistory,
boolean format,
javax.jcr.Session session,
java.lang.String basepath,
java.lang.String repository,
java.lang.String ext)
|
protected static java.io.InputStream |
getXslStreamForXmlFile(java.io.File file)
|
static void |
importDocument(Document xmlDocument,
java.lang.String repositoryName,
java.lang.String basepath,
boolean keepVersionHistory,
int importMode,
boolean saveAfterImport,
boolean createBasepathIfNotExist)
Converts a xml document into a file. |
static void |
importFile(java.io.File xmlFile,
java.lang.String repositoryName,
java.lang.String basepath,
boolean keepVersionHistory,
int importMode,
boolean saveAfterImport,
boolean createBasepathIfNotExist)
Creates an InputStream backed by the specified xml file. |
static void |
importProperties(java.util.Properties properties,
java.lang.String repositoryName)
Deprecated. since 4.0 - use the PropertiesImportExport class instead. |
static void |
importXmlStream(java.io.InputStream xmlStream,
java.lang.String repositoryName,
java.lang.String basepath,
java.lang.String name,
boolean keepVersionHistory,
int importMode,
boolean saveAfterImport,
boolean createBasepathIfNotExist)
Imports XML stream into repository. |
static void |
parseAndFormat(java.io.OutputStream stream,
org.xml.sax.XMLReader reader,
java.lang.String repository,
java.lang.String basepath,
javax.jcr.Session session,
boolean noRecurse)
Exports the content of the repository, and format it if necessary. |
protected static void |
readFormatted(org.xml.sax.XMLReader reader,
java.io.File inputFile,
java.io.OutputStream outputStream)
|
protected static void |
readFormatted(org.xml.sax.XMLReader reader,
java.io.InputStream inputStream,
java.io.OutputStream outputStream)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ZIP
public static final java.lang.String GZ
public static final java.lang.String XML
public static final java.lang.String PROPERTIES
public static final java.lang.String DOT
public static final java.lang.String SLASH
public static final java.lang.String UTF8
public static final java.lang.String JCR_ROOT
Constructor Detail |
---|
public DataTransporter()
Method Detail |
---|
public static void importDocument(Document xmlDocument, java.lang.String repositoryName, java.lang.String basepath, boolean keepVersionHistory, int importMode, boolean saveAfterImport, boolean createBasepathIfNotExist) throws java.io.IOException
xmlDocument
- uploaded filerepositoryName
- selected repositorybasepath
- base path in repositorykeepVersionHistory
- if false
version info will be stripped before importing the documentimportMode
- a valid value for ImportUUIDBehaviorsaveAfterImport
- createBasepathIfNotExist
-
java.io.IOException
ImportUUIDBehavior
public static void importFile(java.io.File xmlFile, java.lang.String repositoryName, java.lang.String basepath, boolean keepVersionHistory, int importMode, boolean saveAfterImport, boolean createBasepathIfNotExist) throws java.io.IOException
InputStream
backed by the specified xml file.
xmlFile
- (zipped/gzipped) XML file to importrepositoryName
- selected repositorybasepath
- base path in repositorykeepVersionHistory
- if false
version info will be stripped before importing the documentimportMode
- a valid value for ImportUUIDBehaviorsaveAfterImport
- createBasepathIfNotExist
-
java.io.IOException
ImportUUIDBehavior
public static void executeBootstrapImport(java.io.File xmlFile, java.lang.String repositoryName) throws java.io.IOException
xmlFile
- repositoryName
-
java.io.IOException
public static void importProperties(java.util.Properties properties, java.lang.String repositoryName)
properties
- repositoryName
- public static void importXmlStream(java.io.InputStream xmlStream, java.lang.String repositoryName, java.lang.String basepath, java.lang.String name, boolean keepVersionHistory, int importMode, boolean saveAfterImport, boolean createBasepathIfNotExist) throws java.io.IOException
MagnoliaV2Filter
, VersionFilter
and ImportXmlRootFilter
if keepVersionHistory
is set to false
xmlStream
- XML stream to importrepositoryName
- selected repositorybasepath
- base path in repositoryname
- (absolute path of File
)keepVersionHistory
- if false
version info will be stripped before importing the documentimportMode
- a valid value for ImportUUIDBehaviorsaveAfterImport
- createBasepathIfNotExist
-
java.io.IOException
ImportUUIDBehavior
,
ImportXmlRootFilter
,
VersionFilter
,
MagnoliaV2Filter
protected static java.io.InputStream getXslStreamForXmlFile(java.io.File file)
file
-
null
public static void executeExport(java.io.OutputStream baseOutputStream, boolean keepVersionHistory, boolean format, javax.jcr.Session session, java.lang.String basepath, java.lang.String repository, java.lang.String ext) throws java.io.IOException
java.io.IOException
public static void parseAndFormat(java.io.OutputStream stream, org.xml.sax.XMLReader reader, java.lang.String repository, java.lang.String basepath, javax.jcr.Session session, boolean noRecurse) throws java.io.IOException, org.xml.sax.SAXException, javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
stream
- the stream to write the content toreader
- the reader to use to parse the xml content (so that we can perform filtering), if null instanciate
a default onerepository
- the repository to exportbasepath
- the basepath in the repositorysession
- the session to use to export the data from the repositorynoRecurse
-
java.io.IOException
org.xml.sax.SAXException
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
protected static void readFormatted(org.xml.sax.XMLReader reader, java.io.File inputFile, java.io.OutputStream outputStream) throws java.io.FileNotFoundException, java.io.IOException, org.xml.sax.SAXException
reader
- inputFile
- outputStream
-
java.io.FileNotFoundException
java.io.IOException
org.xml.sax.SAXException
protected static void readFormatted(org.xml.sax.XMLReader reader, java.io.InputStream inputStream, java.io.OutputStream outputStream) throws java.io.FileNotFoundException, java.io.IOException, org.xml.sax.SAXException
reader
- inputStream
- outputStream
-
java.io.FileNotFoundException
java.io.IOException
org.xml.sax.SAXException
public static java.lang.String encodePath(java.lang.String path, java.lang.String separator, java.lang.String enc)
path
- path to encodeseparator
- "." (dot) or "/", it will be not encoded if foundenc
- charset
public static java.lang.String decodePath(java.lang.String path, java.lang.String enc)
path
- path to decodeenc
- charset
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |