001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.db;
029
030import java.util.Set;
031
032/**
033 * Provides methods to write export points to the "real" file system.<p>
034 */
035public interface I_CmsExportPointDriver {
036
037    /**
038     * If required, creates the folder with the given root path in the real file system.<p>
039     *
040     * @param resourceName the root path of the folder to create
041     * @param exportpoint the export point to create the folder in
042     */
043    void createFolder(String resourceName, String exportpoint);
044
045    /**
046     * Deletes a file or a folder in the real file sytem.<p>
047     *
048     * If the given resource name points to a folder, then this folder is only deleted if it is empty.
049     * This is required since the same export point RFS target folder may be used by multiple export points.
050     * For example, this is usually the case with the <code>/WEB-INF/classes/</code> and
051     * <code>/WEB-INF/lib/</code> folders which are export point for multiple modules.
052     * If all resources in the RFS target folder where deleted, uninstalling one module would delete the
053     * export <code>classes</code> and <code>lib</code> resources of all other modules.<p>
054     *
055     * @param resourceName the root path of the resource to be deleted
056     * @param exportpoint the name of the export point
057     */
058    void deleteResource(String resourceName, String exportpoint);
059
060    /**
061     * Returns the export point path for the given resource root path,
062     * or <code>null</code> if the resource is not contained in
063     * any export point.<p>
064     *
065     * @param rootPath the root path of a resource in the OpenCms VFS
066     * @return the export point path for the given resource, or <code>null</code> if the resource is not contained in
067     *      any export point
068     */
069    String getExportPoint(String rootPath);
070
071    /**
072     * Returns the set of all VFS paths that are exported as an export point.<p>
073     *
074     * @return the set of all VFS paths that are exported as an export point
075     */
076    Set<String> getExportPointPaths();
077
078    /**
079     * Writes the file with the given root path to the real file system.<p>
080     *
081     * If required, missing parent folders in the real file system are automatically created.<p>
082     *
083     * @param resourceName the root path of the file to write
084     * @param exportpoint the export point to write file to
085     * @param content the contents of the file to write
086     */
087    void writeFile(String resourceName, String exportpoint, byte[] content);
088
089}