View Javadoc
1 /* 2 * PROJECT : DAR Runtime and Tools 3 * COPYRIGHT : Copyright (C) 1999-2004 tim.stephenson@enableit.org 4 * LICENSE : GNU LESSER GENERAL PUBLIC LICENSE 5 * Version 2.1, February 1999 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 */ 21 package org.enableit.db.darrt; 22 23 import java.io.File; 24 import java.rmi.RemoteException; 25 26 import org.enableit.db.DBException; 27 import org.enableit.db.beans.Provider; 28 29 30 /*** 31 * <p>Defines a common file handler interface to decouple the file receiver 32 * from the application processing.</p> 33 * 34 * <p>For example a Struts Action 35 * {@link org.enableit.db.darrt.web.UploadAction.class} has been written 36 * to allow a user to upload files through a web interface. But a variety 37 * of possible functionality is required to process the file once received. 38 * This interface is implemented by the <em>processor</em>, which the 39 * <em>receiver</em> delegates to as appropriate. How the <em>receiver</em> 40 * obtains the <em>processor</em> is undefined, though in the example 41 * <code>Action</code> it is via a JNDI lookup.</p> 42 * 43 * @author Tim Stephenson 44 */ 45 public interface FileProcessor { 46 /* 47 * Properties 48 */ 49 /* 50 * Methods 51 */ 52 53 /*** 54 * Process the specified file. 55 * 56 * @param file The file to upload. 57 * @param fileType A file type that will be recognised by the 58 * implentation. Typically this should refer to the type of the 59 * data in the file not the file's format or mime type, which the 60 * implementation is expected to detect for itself (for example by 61 * file extension or using the Java Activation Framework). 62 * @throws ConfigurationException If the fileType parameter is 63 * unrecognised 64 * @throws DBException If the handling of the file goes wrong 65 * in some recoverable way. 66 * @throws RemoteException If some system exception occurs within an 67 * implementing class that is running in a distributed environment 68 * (i.e. an EJB) 69 */ 70 void process(File file, String fileType) 71 throws ConfigurationException, DBException, RemoteException; 72 73 /*** 74 * Specify database connection details. 75 * 76 * @param provider Provider to be used by the <code>FileProcessor</code>. 77 * @throws ConfigurationException If this <code>FileProcessor</code> does 78 * not expect a provider. 79 * @throws DBException If the handling of the file goes wrong 80 * in some recoverable way. 81 * @throws RemoteException If some system exception occurs within an 82 * implementing class that is running in a distributed environment 83 * (i.e. an EJB) 84 */ 85 void setProvider(Provider provider) 86 throws ConfigurationException, DBException, RemoteException; 87 }

This page was automatically generated by Maven