KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > importexport > I_CmsImportExportHandler


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/importexport/I_CmsImportExportHandler.java,v $
3  * Date : $Date: 2005/06/23 11:11:23 $
4  * Version: $Revision: 1.14 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.importexport;
33
34 import org.opencms.configuration.CmsConfigurationException;
35 import org.opencms.file.CmsObject;
36 import org.opencms.main.CmsException;
37 import org.opencms.report.I_CmsReport;
38 import org.opencms.security.CmsRoleViolationException;
39 import org.opencms.xml.CmsXmlException;
40
41 import org.dom4j.Document;
42
43 /**
44  * An import/export handler is an abstract layer to hide the logic how to import/export a specific
45  * type of Cms data.<p>
46  *
47  * To export data, you would create an instance of a class implementing this interface, and call the
48  * implementation's setter methods to arrange which data should be exported. To write the export,
49  * call {@link org.opencms.importexport.CmsImportExportManager#exportData(CmsObject, I_CmsImportExportHandler, I_CmsReport)}.<p>
50  *
51  * To import data, call {@link org.opencms.importexport.CmsImportExportManager#importData(CmsObject, String, String, I_CmsReport)}.
52  * You don't have to worry about the contents of an imported a ZIP archive -
53  * the import/export manager finds the right import/export handler implementation
54  * to import the data. You can assign null to the importPath argument in case of a Cms module import.<p>
55  *
56  * Use {@link org.opencms.main.OpenCms#getImportExportManager()} to get the Cms import/export manager.<p>
57  *
58  * @author Thomas Weckert
59  *
60  * @version $Revision: 1.14 $
61  *
62  * @since 6.0.0
63  */

64 public interface I_CmsImportExportHandler {
65
66     /**
67      * Exports the data from the Cms.<p>
68      *
69      * @param cms the current OpenCms context object
70      * @param report a Cms report to print log messages
71      * @throws CmsImportExportException if operation was not successful
72      * @throws CmsRoleViolationException if the current user has not the required role
73      * @throws CmsConfigurationException if a specified module to be exproted does not exist
74      */

75     void exportData(CmsObject cms, I_CmsReport report)
76     throws CmsConfigurationException, CmsImportExportException, CmsRoleViolationException;
77
78     /**
79      * Returns the description of this import/export handler.<p>
80      * The description is useful to print some info about the purpose of this handler.<p>
81      *
82      * @return the description of this import/export handler
83      */

84     String JavaDoc getDescription();
85
86     /**
87      * Imports the data into the Cms.<p>
88      *
89      * @param cms the current OpenCms context object
90      * @param importFile the name (absolute path) of the resource (zipfile or folder) to be imported
91      * @param importPath the name (absolute path) of the destination folder in the Cms (if required)
92      * @param report a Cms report to print log messages
93      *
94      * @throws CmsImportExportException if operation was not successful
95      * @throws CmsRoleViolationException if the current user has not the required role
96      * @throws CmsXmlException if the manifest of the import could not be unmarshalled
97      * @throws CmsException in case of errors accessing the VFS
98      */

99     void importData(CmsObject cms, String JavaDoc importFile, String JavaDoc importPath, I_CmsReport report)
100     throws CmsXmlException, CmsImportExportException, CmsRoleViolationException, CmsException;
101
102     /**
103      * Checks, if this import/export handler matches with a specified manifest document of an import,
104      * so that it is able to import the data listed in the manifest document.<p>
105      *
106      * @param manifest the manifest.xml of the import as a dom4j XML document
107      * @return true, this handler is able to import the data listed in the manifest document
108      */

109     boolean matches(Document manifest);
110
111     /**
112      * Sets the description of this import/export handler.<p>
113      * The description is useful to print some info about the purpose of this handler.<p>
114      *
115      * @param description the description of this import/export handler
116      */

117     void setDescription(String JavaDoc description);
118
119 }
120
Popular Tags