001: /*
002: * File : $Source: /usr/local/cvs/opencms/src/org/opencms/importexport/I_CmsImportExportHandler.java,v $
003: * Date : $Date: 2008-02-27 12:05:48 $
004: * Version: $Revision: 1.17 $
005: *
006: * This library is part of OpenCms -
007: * the Open Source Content Management System
008: *
009: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010: *
011: * This library is free software; you can redistribute it and/or
012: * modify it under the terms of the GNU Lesser General Public
013: * License as published by the Free Software Foundation; either
014: * version 2.1 of the License, or (at your option) any later version.
015: *
016: * This library is distributed in the hope that it will be useful,
017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: * Lesser General Public License for more details.
020: *
021: * For further information about Alkacon Software GmbH, please see the
022: * company website: http://www.alkacon.com
023: *
024: * For further information about OpenCms, please see the
025: * project website: http://www.opencms.org
026: *
027: * You should have received a copy of the GNU Lesser General Public
028: * License along with this library; if not, write to the Free Software
029: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
030: */
031:
032: package org.opencms.importexport;
033:
034: import org.opencms.configuration.CmsConfigurationException;
035: import org.opencms.file.CmsObject;
036: import org.opencms.main.CmsException;
037: import org.opencms.report.I_CmsReport;
038: import org.opencms.security.CmsRoleViolationException;
039: import org.opencms.xml.CmsXmlException;
040:
041: import org.dom4j.Document;
042:
043: /**
044: * An import/export handler is an abstract layer to hide the logic how to import/export a specific
045: * type of Cms data.<p>
046: *
047: * To export data, you would create an instance of a class implementing this interface, and call the
048: * implementation's setter methods to arrange which data should be exported. To write the export,
049: * call {@link org.opencms.importexport.CmsImportExportManager#exportData(CmsObject, I_CmsImportExportHandler, I_CmsReport)}.<p>
050: *
051: * To import data, call {@link org.opencms.importexport.CmsImportExportManager#importData(CmsObject, I_CmsReport, CmsImportParameters)}.
052: * You don't have to worry about the contents of an imported a ZIP archive -
053: * the import/export manager finds the right import/export handler implementation
054: * to import the data. You can assign null to the importPath argument in case of a Cms module import.<p>
055: *
056: * Use {@link org.opencms.main.OpenCms#getImportExportManager()} to get the Cms import/export manager.<p>
057: *
058: * @author Thomas Weckert
059: *
060: * @version $Revision: 1.17 $
061: *
062: * @since 6.0.0
063: */
064: public interface I_CmsImportExportHandler {
065:
066: /**
067: * Exports the data from the Cms.<p>
068: *
069: * @param cms the current OpenCms context object
070: * @param report a Cms report to print log messages
071: *
072: * @throws CmsImportExportException if operation was not successful
073: * @throws CmsRoleViolationException if the current user has not the required role
074: * @throws CmsConfigurationException if a specified module to be exported does not exist
075: */
076: void exportData(CmsObject cms, I_CmsReport report)
077: throws CmsConfigurationException, CmsImportExportException,
078: CmsRoleViolationException;
079:
080: /**
081: * Returns the description of this import/export handler.<p>
082: * The description is useful to print some info about the purpose of this handler.<p>
083: *
084: * @return the description of this import/export handler
085: */
086: String getDescription();
087:
088: /**
089: * Returns the import parameters.<p>
090: *
091: * @return the import parameters
092: */
093: CmsImportParameters getImportParameters();
094:
095: /**
096: * Imports the data into the Cms.<p>
097: *
098: * @param cms the current OpenCms context object
099: * @param report a Cms report to print log messages
100: *
101: * @throws CmsImportExportException if operation was not successful
102: * @throws CmsRoleViolationException if the current user has not the required role
103: * @throws CmsXmlException if the manifest of the import could not be unmarshalled
104: * @throws CmsException in case of errors accessing the VFS
105: */
106: void importData(CmsObject cms, I_CmsReport report)
107: throws CmsXmlException, CmsImportExportException,
108: CmsRoleViolationException, CmsException;
109:
110: /**
111: * Imports the data into the Cms.<p>
112: *
113: * @param cms the current OpenCms context object
114: * @param importFile the name (absolute path) of the resource (zip file or folder) to be imported
115: * @param importPath the name (absolute path) of the destination folder in the Cms (if required)
116: * @param report a Cms report to print log messages
117: *
118: * @throws CmsImportExportException if operation was not successful
119: * @throws CmsRoleViolationException if the current user has not the required role
120: * @throws CmsXmlException if the manifest of the import could not be unmarshalled
121: * @throws CmsException in case of errors accessing the VFS
122: *
123: * @deprecated use {@link #importData(CmsObject, I_CmsReport)} instead
124: */
125: void importData(CmsObject cms, String importFile,
126: String importPath, I_CmsReport report)
127: throws CmsXmlException, CmsImportExportException,
128: CmsRoleViolationException, CmsException;
129:
130: /**
131: * Checks, if this import/export handler matches with a specified manifest document of an import,
132: * so that it is able to import the data listed in the manifest document.<p>
133: *
134: * @param manifest the manifest.xml of the import as a dom4j XML document
135: * @return true, this handler is able to import the data listed in the manifest document
136: */
137: boolean matches(Document manifest);
138:
139: /**
140: * Sets the description of this import/export handler.<p>
141: * The description is useful to print some info about the purpose of this handler.<p>
142: *
143: * @param description the description of this import/export handler
144: */
145: void setDescription(String description);
146:
147: /**
148: * Sets the import parameters.<p>
149: *
150: * @param parameters the import parameters to set
151: */
152: void setImportParameters(CmsImportParameters parameters);
153: }
|