|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.importexport.CmsImport
Holds the functionaility to import resources from the filesystem or a zip file into the OpenCms VFS.
Field Summary | |
protected CmsObject |
m_cms
The cms context to do the operations with. |
protected org.dom4j.Document |
m_docXml
The xml manifest-file. |
protected java.lang.String |
m_importFile
The import-file to load resources from. |
protected java.util.List |
m_importImplementations
Stores all import interface implementations . |
protected java.lang.String |
m_importPath
The import-path to write resources into the cms. |
protected java.io.File |
m_importResource
The import-resource (folder) to load resources from. |
protected int |
m_importVersion
The version of this import, noted in the info tag of the manifest.xml. |
protected java.util.zip.ZipFile |
m_importZip
The import-resource (zip) to load resources from. |
protected I_CmsReport |
m_report
The object to report the log messages. |
Constructor Summary | |
CmsImport()
Constructs a new uninitialized import, required for special subclass data import. |
|
CmsImport(CmsObject cms,
java.lang.String importFile,
java.lang.String importPath,
I_CmsReport report)
Constructs a new import object which imports the resources from an OpenCms export zip file or a folder in the "real" file system. |
Method Summary | |
protected void |
closeImportFile()
Closes the import file. |
static java.lang.String |
getChildElementTextValue(org.dom4j.Element parentElement,
java.lang.String elementName)
Returns the value of a child element with a specified name for a given parent element. |
java.util.List |
getConflictingFilenames()
Returns a list of files which are both in the import and in the virtual file system. |
protected byte[] |
getFileBytes(java.lang.String filename)
Returns a byte array containing the content of the file. |
protected void |
getImportResource()
Gets the import resource and stores it in object-member. |
java.util.List |
getResourcesForProject()
Returns a list of resource names that are needed to create a project for this import. |
void |
importResources()
Imports the resources and writes them to the cms VFS, even if there already exist files with the same name. |
protected void |
openImportFile()
Initalizes the import. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected CmsObject m_cms
protected org.dom4j.Document m_docXml
protected java.lang.String m_importFile
protected java.util.List m_importImplementations
protected java.lang.String m_importPath
protected java.io.File m_importResource
protected int m_importVersion
0 indicates an export file without a version number, that is before version 4.3.23 of OpenCms.
1 indicates an export file of OpenCms with a version before 5.0.0
2 indicates an export file of OpenCms with a version before 5.1.2
3 indicates an export file of OpenCms with a version before 5.1.6
4 indicates an export file of OpenCms with a version after 5.1.6
protected java.util.zip.ZipFile m_importZip
protected I_CmsReport m_report
Constructor Detail |
public CmsImport()
public CmsImport(CmsObject cms, java.lang.String importFile, java.lang.String importPath, I_CmsReport report) throws CmsRoleViolationException
cms
- the current cms objectimportFile
- the file or folder to import fromimportPath
- the path in the cms VFS to import intoreport
- a report object to output the progress information to
CmsRoleViolationException
- if the current user dies not have role permissions to import the databaseMethod Detail |
public static java.lang.String getChildElementTextValue(org.dom4j.Element parentElement, java.lang.String elementName)
parentElement
- the parent elementelementName
- the child element name
public java.util.List getConflictingFilenames() throws CmsXmlException, CmsImportExportException
CmsImportExportException
- if the import file could not be opened
CmsXmlException
- if the manifest of the import could not be unmarshalledpublic java.util.List getResourcesForProject() throws CmsImportExportException
It calls the method getConflictingFileNames if needed, to calculate these resources.
CmsImportExportException
- if ZIP archive could not be closedpublic void importResources() throws CmsImportExportException, CmsXmlException
CmsImportExportException
- if something goes wrong
CmsXmlException
- if the manifest of the import file could not be unmarshalledprotected void closeImportFile() throws CmsImportExportException
CmsImportExportException
- if the ZIP archive could not be closedprotected byte[] getFileBytes(java.lang.String filename)
filename
- the name of the file to read
protected void getImportResource() throws CmsImportExportException
CmsImportExportException
- if the import file could not be openedprotected void openImportFile() throws CmsXmlException, CmsImportExportException
CmsImportExportException
- if the import file could not be opened
CmsXmlException
- if the manifest of the import could not be unmarshalled
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |