⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jahiafilemanagerservice.java

📁 java 写的一个新闻发布系统
💻 JAVA
字号:
////                                   ____.//                       __/\ ______|    |__/\.     _______//            __   .____|    |       \   |    +----+       \//    _______|  /--|    |    |    -   \  _    |    :    -   \_________//   \\______: :---|    :    :           |    :    |         \________>//           |__\---\_____________:______:    :____|____:_____\//                                      /_____|////                 . . . i n   j a h i a   w e   t r u s t . . .////////  JahiaFilemanagerService////  NK      02.02.2001////package org.jahia.services.filemanager;import java.io.*;import java.util.*;import javax.servlet.*;import javax.servlet.http.*;import org.jahia.tools.files.*;import org.jahia.utils.*;           // JahiaConsoleimport org.jahia.params.*;       import org.jahia.exceptions.*;      // JahiaInitializationExceptionimport org.jahia.settings.*;        // JahiaPrivateSettingsimport org.jahia.services.sites.*;import org.jahia.services.usermanager.*;import org.jahia.services.*;import org.jahia.data.files.*;import org.jahia.data.JahiaDOMObject;/** * Abstract class JahiaFilemanagerService * Handle files stored on disk. * * @author Khue ng * @version 1.0 */public abstract class JahiaFilemanagerService extends JahiaService {   /***    * init	 * NK    31.10.2000	 * NK    18.11.2000  setting passed through parameters    * @param JahiaPrivateSettings jSettings    */    public abstract void init( JahiaPrivateSettings jSettings )    throws JahiaInitializationException;   	//--------------------------------------------------------------------------   	//   	// Jahia Context Section   	//   	//--------------------------------------------------------------------------   /**    * @param siteID    * @param pageID    * @param bothPublic    * @return Vector of available files    */    public abstract Vector getFilesByPage ( int siteID, int pageID , boolean publicFile);       /**    * @param int fieldID    * @return the file object associated with this field    */     public abstract JahiaFileField getFileField( int fieldID ) throws JahiaException;   	/**     * @param the Jahia File Field     * @return true if no error     */    public abstract boolean insertJahiaFileField(JahiaFileField fField) throws JahiaException;    /**     * @param the Jahia File Field     * @return true if no error     */	public abstract boolean updateJahiaFileField(JahiaFileField fField) throws JahiaException;      /**    * Change the field value with new file ID    * @param int fieldID    * @param int fileID    */    public abstract void changeFile( int fieldID, int fileID )    throws JahiaException;   	/**     * @param JahiaFileField     * @return true if success     */     public abstract boolean saveJahiaFileField( JahiaFileField fField ) throws JahiaException;    /**     * Delete a file field definition from database     *     * @param the Jahia File Field     * @return true if no error     */    public abstract boolean deleteJahiaFileField(JahiaFileField fField) throws JahiaException;        /**     * Copy a file for a cloned page     *     * @param the Jahia File Field ID     * @param the cloned page ID     * @return true if no error     */    public abstract boolean copyFileField(int oldJahiaFileFieldID, int newFieldID, int pageID) throws JahiaException;	//--------------------------------------------------------------------------   	//   	// Disk Storage Section   	//   	//--------------------------------------------------------------------------   /**    * Get the File Repository Root Path    *    */   public abstract String getFileRepositoryRootPath();   /**    * Set the FileRepositoryRootPath    *    * @param path the FileRepositoryRootPath    */   protected abstract void setFileRepositoryRootPath(String path);   /**    * Get the Dir Prefix Name    *    */   public abstract String getDirPrefixName();   /**    * Set the Dir Prefix Name    *    * @param path the prefixName    */   public abstract void setDirPrefixName(String prefixName);	/**	 * Handle file download     *	 * @exception ServletException	 * @exception IOException     *	 */	public abstract boolean handleFileDownload( 								  	HttpServletRequest req,								  	HttpServletResponse res,								  	int fileID								  )	;	/**	 * Delete a file from disk	 *	 * @param JahiaFile the abstract file 	 */	public abstract boolean deleteFile( JahiaFile fileItem );   /**    * Get the File Upload Max Size    *    */   public abstract int getFileUploadMaxSize();      /**    * Set the FileUploadMaxSize    *    * @param maxSize the file Upload Max Size    */   public abstract void setFileUploadMaxSize(int maxSize);	/**	 * Create a new directory in the File Repository Root Directory<br>	 * The Directory name is randomly generated    *    * @author Khue ng	 * @return the abstract File for the created directory else null on error	 */		public abstract File createDirectory();	/**	 * Create a new directory in the File Repository Root Directory for a gived site<br>	 * The Directory name is randomly generated    *    * @author Khue ng	 * @return the abstract File for the created directory else null on error	 */		public abstract File createDirectory(JahiaSite site);		/**	 * Create a new directory in the File Repository Root Directory<br>	 * 	 * @param dirName The name of the directory to create	 * @param overwrite if true overwrite existing directory with same name	 * @return the abstract File for the created directory else null on error	 */		public abstract File createDirectory(String dirName, boolean overwrite);	/**	 * return a FileUpload Handler object	 *	Files uploaded are stored in a temporary directory with a random generated name    *    * @param context ServletContext      	 * @param req HttpServletRequest	 * @return a FileUpload object or null	 * @exception ServletException	 * @exception IOException    *	 */	public abstract FileUpload getFileUploadHandler(                                             	ServletContext context, 	                                          HttpServletRequest req	                                          ) throws ServletException, IOException;	/**	 * Handle file upload of new files, save them in the filemanager assotiated with	 * the current JahiaID     *	 * @exception ServletException	 * @exception IOException     *	 */	public abstract int handleFileUpload( 										  ParamBean jParams,										  FileUpload fupload,										  int folderID,											  String fileTitle,										  String uploadUser,										  int isPublic											 ) throws ServletException, IOException, JahiaException;   //--------------------------------------------------------------------------   //   //   // Jahia Filemanager  DB Handling Section   //   //   //--------------------------------------------------------------------------	/**     * create a filemanager for a gived owner     */   	public abstract boolean createFilemanager(int ownerID);    /**     * Delete a filemanager and all its contents     */    public abstract boolean deleteFilemanager(JahiaUser user ,int ownerID)    throws JahiaException;	/**	 * Method getFilemanager<br>	 * Return a filemanager	 * 	 * @param filemanagerID the filemanager id	 * @return filemanager or null	 *	 */	 public abstract Filemanager getFilemanager(int filemanagerID);	/**	 * Method getFilemanagerByOwner<br>	 * Return a filemanager	 * 	 * @param filemanagerID the filemanager id	 * @return filemanager or null	 *	 */	 public abstract Filemanager getFilemanagerByOwner(int ownerID);	    //--------------------------------------------------------------------------   //   //   // File DB Handling Section   //   //   //--------------------------------------------------------------------------   /**    * @param the file object to create    * @return the fileID or -1 on errors    */   public abstract int insertFileDB(JahiaFileField aFile) throws JahiaException;   /**    * Insert new row in jahia_filemgr_files table    *    * @param the file object to create    * @return the fileID of the new file or -1 on error    */   public abstract int insertFileDB(JahiaFile aFile) throws JahiaException;   /**    * Update a row in jahia_filemgr_files table    *    * @param a file object	* @return true if no exception occurs    */   public abstract boolean updateFileDB(JahiaFile aFile);	/**    * Delete a row in jahia_filemgr_files table    *    * @param fileID    * @return false on any error else true    */   public abstract boolean deleteFileDB(int fileID);	/**     * Method getFile     * Return a file object looking at it's id     *	     * @param file id	 * @return a file object else null     */   	public abstract JahiaFile getFileDB(int fileID);	/**     * Method getFiles     * Return a Vectors of Files objects depending of a sql where condition     *	     * @param sqlWhere	 * @return a Vector of Files object else null	 */   	public abstract Vector getFilesDB(String sqlWhere);	/**     * Method getFilesByFolder     * Return a Vector of files for a gived folderID     *	     * @param folder id     * @param orderSql an optional sql order command	 * @return a Vector of link objects else null     */   	public abstract Vector getFilesByFolderDB(int folderID, String orderSql);   	/**     * delete all files in a gived folder     * @param folderID      * @return the false on error     */   	public abstract boolean deleteFilesDB(int folderID) throws JahiaException;   //--------------------------------------------------------------------------   //   //   // Folder DB Section   //   //   //--------------------------------------------------------------------------	/**	 * Method getFilemanager<br>	 * Return a filemanager	 * 	 * @param filemanagerID the filemanager id	 * @return filemanager or null	 *	 */	 public abstract Folder getFolderByFile(int fileID);	/**	 * Method getFolder<br>	 * Return a folder 	 * 	 * @param folderID the folder id	 * @return folder or null	 *	 */	 public abstract Folder getFolder(int folderID) ;   //--------------------------------------------------------------------------   //   //   // DOM Representation Section   //   //   //--------------------------------------------------------------------------    //--------------------------------------------------------------------------    /**     * returns a DOM representation of the filemanager of a site     *     * @param int siteID     * @auhtor NK     */    public abstract JahiaDOMObject getFileMgrAsDOM( int siteID )    throws JahiaException;    //--------------------------------------------------------------------------    /**     * returns a DOM representation of the filemanager folders of a site     *     * @param int siteID     * @auhtor NK     */    public abstract JahiaDOMObject getFileMgrFoldersAsDOM( int siteID )    throws JahiaException;    //--------------------------------------------------------------------------    /**     * returns a DOM representation of the filemanager files of a site     *     * @param int siteID     * @auhtor NK     */    public abstract JahiaDOMObject getFileMgrFilesAsDOM( int siteID )    throws JahiaException;    //--------------------------------------------------------------------------	/**	 * return a DOM document of the Filemanager file fields of a site	 *	 * @param int the site id	 *	 * @return JahiaDOMObject a DOM representation of this object	 *	 * @author NK	 */	public abstract JahiaDOMObject getFileMgrFileFieldsAsDOM( int siteID )	throws JahiaException;    /**     * Method getJahiaFileFiel     * Return a Jahia File Field object looking at the field id     *     * @param the field id     * @return a (JahiaFileField) or null     */    public abstract JahiaFileField getJahiaFileField(int fieldID);} // end Class JahiaFileRepositoryService

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -