1.1 restoration
[mir.git] / source / mir / media / MediaHandler.java
index 33a45f4..a77ab2e 100755 (executable)
 package  mir.media;
 
 import java.io.InputStream;
+import java.io.File;
 import java.util.List;
 
 import mir.entity.Entity;
+import mir.session.UploadedFile;
 
 /**
  * Interface for Media handling in Mir. All media handlers
@@ -79,90 +81,65 @@ import mir.entity.Entity;
  * ) 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.1.2.2 2003/12/21 13:32:03 zapata Exp $
+ * @version $Id: MediaHandler.java,v 1.1.2.3 2004/11/21 22:07:13 zapata Exp $
  */
 
 public interface MediaHandler {
   /**
-   * Takes the uploaded media data itself, along with the media Entity
-   * which contains the Media metadata plus the MediaType entity containing
-   * all the info for the specific media type itself. It's job is store the
-   * Media data (content) itself, this could be on the local filesystem, in the
-   * DB or even on a remote host. It then inserts the MetaData in the DB.
-   * @param InputStream, a stream of the uploaded data.
-   * @param ent, an Entity holding the media MetaData
-   * @param mediaType, an Entity holding the media_table entry
-   * @return boolean, success/fail
-   * @see mir.entity.Entity
+   * Store the media content from an {@link UploadedFile}
    */
-  public void store(InputStream in, Entity ent, Entity mediaTypeEnt ) throws MediaExc, MediaFailure;
+  public void store(UploadedFile anUploadedFile, Entity aMedia, Entity aMediaType) throws MediaExc, MediaFailure;
+
+  /**
+   * Store the media content from an input stream.
+   */
+  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;
 
-  public void produce(Entity ent, Entity mediaTypeEnt ) 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*).
-   * @param ent, an Entity holding the media MetaData
-   * @param mediaType, an Entity holding the media_table entry
-   * @return java.io.InputStream
-   * @see mir.entity.Entity
    */
-  public InputStream getMedia (Entity ent, Entity mediaTypeEnt) throws MediaExc, MediaFailure;
+  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.
-   * @param ent, an Entity holding the media MetaData
-   * @return java.io.InputStream
-   * @see mir.entity.Entity
    */
-  public InputStream getThumbnail(Entity ent) throws MediaExc, MediaFailure;
+  public InputStream getThumbnail(Entity aMedia) throws MediaExc, MediaFailure;
 
 
   /**
-   *
-   * @param ent
-   * @return
-   * @throws MediaExc
-   * @throws 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.
-   * @param ent, an Entity holding the media MetaData
-   * @param mediaTypeEnt, an Entity holding the media_table entry
-   * @return String, the url.
-   * @see mir.entity.Entity
-   * @see mir.misc.StringUtil
-   */
-  public List getURL (Entity ent, Entity mediaTypeEnt) 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.
-   * @return String, the path.
-   * @see mir.misc.MirConfig
    */
   public String getStoragePath () 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()
    * This path is usually defined
    * in the configuration wich is accessible through the MirConfig
    * class.
-   * @return String, the path.
-   * @see mir.misc.MirConfig
    */
   public String getIconStoragePath () throws MediaExc, MediaFailure;
 
@@ -174,8 +151,6 @@ public interface MediaHandler {
    * It is usually defined
    * in the configuration witch is accessible through the MirConfig
    * class.
-   * @return String, the base URL to the host.
-   * @see mir.misc.MirConfig
    */
   public String getPublishHost () throws MediaExc, MediaFailure;
 
@@ -185,8 +160,6 @@ public interface MediaHandler {
    * It is usually defined
    * in the configuration wich is accessible through the MirConfig
    * class.
-   * @return String, the icon filename.
-   * @see mir.misc.MirConfig
    */
   public String getBigIconName ();
 
@@ -197,8 +170,6 @@ public interface MediaHandler {
    * It is usually defined
    * in the configuration wich is accessible through the MirConfig
    * class.
-   * @return String, the icon filename.
-   * @see mir.misc.MirConfig
    */
   public String getTinyIconName ();
 
@@ -214,7 +185,7 @@ public interface MediaHandler {
    * media type is.
    * @return String
    */
-  public String getDescr (Entity mediaTypeEnt);
+  public String getDescr (Entity aMediaType);
 
 }