/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2005 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with any library licensed under the Apache Software License,
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
- * (or with modified versions of the above that use the same license as the above),
- * and distribute linked combinations including the two. You must obey the
- * GNU General Public License in all respects for all of the code used other than
- * the above mentioned libraries. If you modify this file, you may extend this
+ * the code of this program with any library licensed under the Apache Software License.
+ * You must obey the GNU General Public License in all respects for all of the code used
+ * other than the above mentioned libraries. If you modify this file, you may extend this
* exception to your version of the file, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your version.
*/
package mir.media;
-import java.io.InputStream;
-import java.io.File;
-import java.util.List;
-
import mir.entity.Entity;
import mir.session.UploadedFile;
+import java.io.InputStream;
+
/**
* Interface for Media handling in Mir. All media handlers
* must implement this interface. Each specific media type,
* content-type map for this....).
* <p>
* The "mime_type" field is the most important as it does maps the type to Java
- * classes (the storage and media_handler name). We call those classes using
+ * classes (the database and media_handler name). We call those classes using
* reflection. This way, once a Handler for a specific media type is implemented
* and entered into the media_type table, no other Mir code needs to be modified.
* <p>
* The "classname" field is the name of the media handler (e.g MediaHandlerAudio)
* we use it to call the MediaHandler methods via reflection.
* <p>
- * The "tablename" is the name of the database storage classes (e.g DatabaseImages
- * and EntityImages). We use this to fetch/storage the media (meta)data in the db.
+ * The "tablename" is the name of the database database classes (e.g DatabaseImages
+ * and EntityImages). We use this to fetch/database the media (meta)data in the db.
* <p?
* The "dcname" field is as of yet unused. Do search for "Dublin Core" on google
* to learn more.
* ) and just override the things that need to be specific. see MediaHandlerAudio
*
* @author <mh@nadir.org>, the Mir-coders group
+ * @version $Id: MediaHandler.java,v 1.3 2007/04/08 21:46:43 idfx Exp $
*/
public interface MediaHandler {
public void store(InputStream anInputStream, Entity aMedia, Entity aMediaType) throws MediaExc, MediaFailure;
/**
- * Store the media content from a file.
- */
- public void store(File aFile, Entity aMedia, Entity aMediaType) throws MediaExc, MediaFailure;
-
- /**
* Perform production related tasks for this media.
*/
public void produce(Entity aMedia, Entity aMediaType ) throws MediaExc, MediaFailure;
/**
- * Get's the media data from storage and returns it as an InputStream
- * Not very useful for most media types as they are stored in a file,
- * but very usefull for ones stored in the DB as it is necessary to get
- * it first before making a file out of it (in Producer*).
+ * Returns the associated media as an input stream
*/
public InputStream getMedia (Entity aMedia, Entity aMediaType) throws MediaExc, MediaFailure;
/**
- * Pretty much like get() above. But get's the specific Icon
- * representation. useful for media stored in the DB.
+ * Returns a thumbnail of the associated media as an input stream
*/
public InputStream getThumbnail(Entity aMedia) throws MediaExc, MediaFailure;
-
/**
* Returns the mime-type of the media's thumbnail
*/
public String getThumbnailMimeType(Entity aMediaEntity, Entity aMediaType) throws MediaExc, MediaFailure;
/**
- * gets the final content representation for the media
- * in the form of a URL (String) that allows someone to
- * download, look at or listen to the media. (HREF, img src
- * streaming link, etc..)
- * It should use the helper functions in the StringUtil class to
- * build URL's safely, eliminating any *illegal* user input.
- */
- public List getURL (Entity aMedia, Entity aMediaType) throws MediaExc, MediaFailure;
-
- /**
* Returns the absolute filesystem path to where the media
* content should be stored. This path is usually defined
* in the configuration wich is accessible through the MirConfig
* class.
*/
- public String getStoragePath () throws MediaExc, MediaFailure;
+ public String getBaseStoragePath () throws MediaExc, MediaFailure;
- /**
+ /**
* Returns the *relative* filesystem path to where the media
* icon content should be stored. It is relative to the path
- * returned by getStoragePath()
+ * returned by getBaseStoragePath()
* This path is usually defined
* in the configuration wich is accessible through the MirConfig
* class.
*/
- public String getIconStoragePath () throws MediaExc, MediaFailure;
+ public String getBaseIconStoragePath () throws MediaExc, MediaFailure;
- /**
+ /**
* Returns the base URL to that the media is accessible from
* to the end user. This could be a URL to another host.
* This is used in the Metadata stored in the DB and later on
*/
public String getPublishHost () throws MediaExc, MediaFailure;
- /**
+ /**
* Returns the file name of the Icon representing the media type.
* It is used in the summary view.
* It is usually defined
*/
public String getBigIconName ();
- /**
+ /**
* Returns the file name of the small Icon representing
* the media type.
* It is used in the right hand newswire list of the startpage.