cleanup / abuse system fix / prepping for a release
[mir.git] / source / mircoders / media / URLMediaHandler.java
1 package mircoders.media;
2
3 import java.io.File;
4 import java.io.InputStream;
5
6 import mir.entity.Entity;
7 import mir.media.MediaExc;
8 import mir.media.MediaFailure;
9 import mir.media.MediaHandler;
10 import mir.session.UploadedFile;
11
12 /**
13  * <p>URLMediaHandler</p>
14  * <p>Description:
15  *     This is a media handler for externally stored media.
16  *     The media is presented by its url.
17  * </p>
18  * @author Zapata
19  */
20
21 public class URLMediaHandler implements MediaHandler {
22   private String bigIcon;
23   private String tinyIcon;
24   private String iconAlternative;
25
26   public URLMediaHandler(String aBigIcon, String aTinyIcon, String anIconAlternative) {
27     bigIcon = aBigIcon;
28     tinyIcon = aTinyIcon;
29     iconAlternative = anIconAlternative;
30   }
31
32   /**
33    * {@inheritDoc}
34    *
35    * Since this media handler assumes the media is stored on a wholly different
36    * server, this operation is not applicable
37    */
38   public void store(UploadedFile anUploadedFile, Entity aMedia, Entity aMediaType) throws MediaExc, MediaFailure {
39     throw new UnsupportedOperationException();
40   }
41
42   /**
43    * {@inheritDoc}
44    *
45    * Since this media handler assumes the media is stored on a wholly different
46    * server, this operation is not applicable
47    */
48   public void store(InputStream anInputStream, Entity anEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
49     throw new UnsupportedOperationException();
50   }
51
52   /**
53    * {@inheritDoc}
54    */
55   public void produce(Entity anEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
56     // nothing to do here
57   }
58
59   public InputStream getMedia(Entity anEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
60     return null;
61   }
62
63   public InputStream getThumbnail(Entity anEntity) throws MediaExc, MediaFailure {
64     return null;
65   }
66
67   public String getThumbnailMimeType(Entity aMediaEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
68     return "application/octetstream";
69   }
70
71   public String getBaseStoragePath () throws MediaExc, MediaFailure {
72     throw new UnsupportedOperationException();
73   }
74
75   public String getBaseIconStoragePath () throws MediaExc, MediaFailure {
76     throw new UnsupportedOperationException();
77   }
78
79   public String getPublishHost () throws MediaExc, MediaFailure {
80     throw new UnsupportedOperationException();
81   }
82
83   public String getBigIconName () {
84     return bigIcon;
85   }
86
87   public String getTinyIconName () {
88     return tinyIcon;
89   }
90
91   public String getIconAltName () {
92     return iconAlternative;
93   }
94
95   public String getDescr(Entity mediaTypeEnt) {
96     return "Url";
97   }
98 }