|
||||||||||
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 String |
DOT
|
static String |
GZ
|
static String |
JCR_ROOT
|
static String |
PROPERTIES
|
static String |
SLASH
|
static String |
UTF8
|
static String |
XML
|
static String |
ZIP
|
Constructor Summary | |
---|---|
DataTransporter()
|
Method Summary | |
---|---|
static String |
decodePath(String path,
String enc)
decode a path (ex. |
static String |
encodePath(String path,
String separator,
String enc)
|
static void |
executeBootstrapImport(File xmlFile,
String repositoryName)
|
static void |
executeExport(OutputStream baseOutputStream,
boolean keepVersionHistory,
boolean format,
javax.jcr.Session session,
String basepath,
String repository,
String ext)
|
protected static InputStream |
getXslStreamForXmlFile(File file)
|
static void |
importDocument(Document xmlDocument,
String repositoryName,
String basepath,
boolean keepVersionHistory,
int importMode,
boolean saveAfterImport,
boolean createBasepathIfNotExist)
Converts a xml document into a file. |
static void |
importFile(File xmlFile,
String repositoryName,
String basepath,
boolean keepVersionHistory,
int importMode,
boolean saveAfterImport,
boolean createBasepathIfNotExist)
Creates an InputStream backed by the specified xml file. |
static void |
importProperties(Properties properties,
String repositoryName)
Deprecated. since 4.0 - use the PropertiesImportExport class instead. |
static void |
importXmlStream(InputStream xmlStream,
String repositoryName,
String basepath,
String name,
boolean keepVersionHistory,
int importMode,
boolean saveAfterImport,
boolean createBasepathIfNotExist)
Imports XML stream into repository. |
static void |
parseAndFormat(OutputStream stream,
XMLReader reader,
String repository,
String basepath,
javax.jcr.Session session,
boolean noRecurse)
Exports the content of the repository, and format it if necessary. |
protected static void |
readFormatted(XMLReader reader,
File inputFile,
OutputStream outputStream)
|
protected static void |
readFormatted(XMLReader reader,
InputStream inputStream,
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 String ZIP
public static final String GZ
public static final String XML
public static final String PROPERTIES
public static final String DOT
public static final String SLASH
public static final String UTF8
public static final String JCR_ROOT
Constructor Detail |
---|
public DataTransporter()
Method Detail |
---|
public static void importDocument(Document xmlDocument, String repositoryName, String basepath, boolean keepVersionHistory, int importMode, boolean saveAfterImport, boolean createBasepathIfNotExist) throws 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
-
IOException
ImportUUIDBehavior
public static void importFile(File xmlFile, String repositoryName, String basepath, boolean keepVersionHistory, int importMode, boolean saveAfterImport, boolean createBasepathIfNotExist) throws 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
-
IOException
ImportUUIDBehavior
public static void executeBootstrapImport(File xmlFile, String repositoryName) throws IOException
xmlFile
- repositoryName
-
IOException
public static void importProperties(Properties properties, String repositoryName)
properties
- repositoryName
- public static void importXmlStream(InputStream xmlStream, String repositoryName, String basepath, String name, boolean keepVersionHistory, int importMode, boolean saveAfterImport, boolean createBasepathIfNotExist) throws 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
-
IOException
ImportUUIDBehavior
,
ImportXmlRootFilter
,
VersionFilter
,
MagnoliaV2Filter
protected static InputStream getXslStreamForXmlFile(File file)
file
-
null
public static void executeExport(OutputStream baseOutputStream, boolean keepVersionHistory, boolean format, javax.jcr.Session session, String basepath, String repository, String ext) throws IOException
IOException
public static void parseAndFormat(OutputStream stream, XMLReader reader, String repository, String basepath, javax.jcr.Session session, boolean noRecurse) throws IOException, 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
-
IOException
SAXException
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
protected static void readFormatted(XMLReader reader, File inputFile, OutputStream outputStream) throws FileNotFoundException, IOException, SAXException
reader
- inputFile
- outputStream
-
FileNotFoundException
IOException
SAXException
protected static void readFormatted(XMLReader reader, InputStream inputStream, OutputStream outputStream) throws FileNotFoundException, IOException, SAXException
reader
- inputStream
- outputStream
-
FileNotFoundException
IOException
SAXException
public static String encodePath(String path, String separator, String enc)
path
- path to encodeseparator
- "." (dot) or "/", it will be not encoded if foundenc
- charset
public static String decodePath(String path, String enc)
path
- path to decodeenc
- charset
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |