1.1 restoration
[mir.git] / source / mircoders / media / URLMediaHandler.java
1 package mircoders.media;
2
3 import mir.entity.Entity;
4 import mir.media.MediaExc;
5 import mir.media.MediaFailure;
6 import mir.media.MediaHandler;
7 import mir.session.UploadedFile;
8
9 import java.io.File;
10 import java.io.InputStream;
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    * Since this media handler assumes the media is stored on a wholly different
56    * server, this operation is not applicable
57    */
58   public void store(File aFile, Entity aMedia, Entity aMediaType) throws MediaExc, MediaFailure {
59     throw new UnsupportedOperationException();
60   }
61
62   /**
63    * {@inheritDoc}
64    */
65   public void produce(Entity anEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
66     // nothing to do here
67   }
68
69   public InputStream getMedia(Entity anEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
70     return null;
71   }
72
73   public InputStream getThumbnail(Entity anEntity) throws MediaExc, MediaFailure {
74     return null;
75   }
76
77   public String getThumbnailMimeType(Entity aMediaEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
78     return "application/octetstream";
79   }
80
81   public String getStoragePath () throws MediaExc, MediaFailure {
82     throw new UnsupportedOperationException();
83   }
84
85   public String getIconStoragePath () throws MediaExc, MediaFailure {
86     throw new UnsupportedOperationException();
87   }
88
89   public String getPublishHost () throws MediaExc, MediaFailure {
90     throw new UnsupportedOperationException();
91   }
92
93   public String getBigIconName () {
94     return bigIcon;
95   }
96
97   public String getTinyIconName () {
98     return tinyIcon;
99   }
100
101   public String getIconAltName () {
102     return iconAlternative;
103   }
104
105   public String getDescr(Entity mediaTypeEnt) {
106     return "Url";
107   }
108 }