📄 i_cmsvfsdriver.java
字号:
/*
* File : $Source: /usr/local/cvs/opencms/src/org/opencms/db/I_CmsVfsDriver.java,v $
* Date : $Date: 2006/03/27 14:52:26 $
* Version: $Revision: 1.114 $
*
* This library is part of OpenCms -
* the Open Source Content Mananagement System
*
* Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* For further information about Alkacon Software GmbH, please see the
* company website: http://www.alkacon.com
*
* For further information about OpenCms, please see the
* project website: http://www.opencms.org
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.opencms.db;
import org.opencms.db.generic.CmsSqlManager;
import org.opencms.file.CmsDataAccessException;
import org.opencms.file.CmsFile;
import org.opencms.file.CmsFolder;
import org.opencms.file.CmsProject;
import org.opencms.file.CmsProperty;
import org.opencms.file.CmsPropertyDefinition;
import org.opencms.file.CmsResource;
import org.opencms.util.CmsUUID;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
/**
* Definitions of all required VFS driver methods.<p>
*
* @author Thomas Weckert
* @author Michael Emmerich
*
* @version $Revision: 1.114 $
*
* @since 6.0.0
*/
public interface I_CmsVfsDriver {
/** The type ID to identify user driver implementations. */
int DRIVER_TYPE_ID = 3;
/**
* Creates a resource content with the specified id.<p>
*
* @param dbc the current database context
* @param project the current project
* @param resourceId the resource id to create the content for
* @param content the content to write
* @param versionId for the content of a backup file you need to insert the versionId of the backup
*
* @throws CmsDataAccessException if something goes wrong
*/
void createContent(CmsDbContext dbc, CmsProject project, CmsUUID resourceId, byte[] content, int versionId)
throws CmsDataAccessException;
/**
* Creates a CmsFile instance from a JDBC ResultSet.<p>
*
* @param res the JDBC ResultSet
* @param projectId the project id
*
* @return the created file
* @throws SQLException in case the result set does not include a requested table attribute
*/
CmsFile createFile(ResultSet res, int projectId) throws SQLException;
/**
* Creates a CmsFile instance from a JDBC ResultSet.<p>
*
* @param res the JDBC ResultSet
* @param projectId the project id
* @param hasFileContentInResultSet flag to include the file content
*
* @return the created file
* @throws SQLException in case the result set does not include a requested table attribute
*/
CmsFile createFile(ResultSet res, int projectId, boolean hasFileContentInResultSet) throws SQLException;
/**
* Creates a CmsFolder instance from a JDBC ResultSet.<p>
*
* @param res the JDBC ResultSet
* @param projectId the ID of the current project
* @param hasProjectIdInResultSet true if the SQL select query includes the PROJECT_ID table attribute
*
* @return the created folder
* @throws SQLException in case the result set does not include a requested table attribute
*/
CmsFolder createFolder(ResultSet res, int projectId, boolean hasProjectIdInResultSet) throws SQLException;
/**
* Creates a new property defintion in the database.<p>
*
* @param dbc the current database context
* @param projectId the project in which the propertydefinition is created
* @param name the name of the propertydefinitions to overwrite
*
* @return the new propertydefinition
*
* @throws CmsDataAccessException if something goes wrong
*/
CmsPropertyDefinition createPropertyDefinition(CmsDbContext dbc, int projectId, String name)
throws CmsDataAccessException;
/**
* Creates a new resource from a given CmsResource object.<p>
*
* This method works for both files and folders. Existing resources get overwritten.<p>
*
* @param dbc the current database context
* @param project the current project
* @param resource the resource to be created
* @param content the file content, or null in case of a folder
* @return the created Cms resource
*
* @throws CmsDataAccessException if somethong goes wrong
*
* @see org.opencms.file.types.I_CmsResourceType#createResource(org.opencms.file.CmsObject, CmsSecurityManager, String, byte[], List)
* @see org.opencms.file.types.I_CmsResourceType#importResource(org.opencms.file.CmsObject, CmsSecurityManager, String, CmsResource, byte[], List)
* @see org.opencms.file.CmsObject#createResource(String, int, byte[], List)
* @see org.opencms.file.CmsObject#importResource(String, CmsResource, byte[], List)
*/
CmsResource createResource(CmsDbContext dbc, CmsProject project, CmsResource resource, byte[] content)
throws CmsDataAccessException;
/**
* Creates a CmsResource instance from a JDBC ResultSet.<p>
*
* @param res the JDBC ResultSet
* @param projectId the ID of the current project to adjust the modification date in case the resource is a VFS link
*
* @return the created resource
* @throws SQLException in case the result set does not include a requested table attribute
*/
CmsResource createResource(ResultSet res, int projectId) throws SQLException;
/**
* Creates a new sibling for a specified resource.<p>
* @param dbc the current database context
* @param project the project where to create the link
* @param resource the link prototype
*
* @throws CmsDataAccessException if something goes wrong
*/
void createSibling(CmsDbContext dbc, CmsProject project, CmsResource resource) throws CmsDataAccessException;
/**
* Deletes a property defintion.<p>
*
* @param dbc the current database context
* @param name the property definitions to be deleted
*
* @throws CmsDataAccessException if something goes wrong
*/
void deletePropertyDefinition(CmsDbContext dbc, CmsPropertyDefinition name) throws CmsDataAccessException;
/**
* Deletes all property values of a file or folder.<p>
*
* You may specify which whether just structure or resource property values should
* be deleted, or both of them.<p>
*
* @param dbc the current database context
* @param projectId the id of the project
* @param resource the resource
* @param deleteOption determines which property values should be deleted
*
* @throws CmsDataAccessException if something goes wrong
* @see org.opencms.file.CmsProperty#DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES
* @see org.opencms.file.CmsProperty#DELETE_OPTION_DELETE_STRUCTURE_VALUES
* @see org.opencms.file.CmsProperty#DELETE_OPTION_DELETE_RESOURCE_VALUES
*/
void deletePropertyObjects(CmsDbContext dbc, int projectId, CmsResource resource, int deleteOption)
throws CmsDataAccessException;
/**
* Destroys this driver.<p>
*
* @throws Throwable if something goes wrong
*/
void destroy() throws Throwable;
/**
* Returns the SqlManager of this driver.<p>
*
* @return the SqlManager of this driver
*/
CmsSqlManager getSqlManager();
/**
* Initializes the SQL manager for this driver.<p>
*
* To obtain JDBC connections from different pools, further
* {online|offline|backup} pool Urls have to be specified.<p>
*
* @param classname the classname of the SQL manager
*
* @return the SQL manager for this driver
*/
org.opencms.db.generic.CmsSqlManager initSqlManager(String classname);
/**
* Publishes the structure and resource records of an
* offline resource into it's online counterpart.<p>
*
* @param dbc the current database context
* @param onlineProject the online project
* @param onlineResource the online resource
* @param offlineResource the offline resource
* @param writeFileContent true, if also the content record of the specified offline resource should be written to the online table; false otherwise
*
* @throws CmsDataAccessException if somethong goes wrong
*/
void publishResource(
CmsDbContext dbc,
CmsProject onlineProject,
CmsResource onlineResource,
CmsResource offlineResource,
boolean writeFileContent) throws CmsDataAccessException;
/**
* Reads all child-files and/or child-folders of a specified parent resource.<p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -