1 package mircoders.media;
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;
10 import java.io.InputStream;
13 * <p>URLMediaHandler</p>
15 * This is a media handler for externally stored media.
16 * The media is presented by its url.
21 public class URLMediaHandler implements MediaHandler {
22 private String bigIcon;
23 private String tinyIcon;
24 private String iconAlternative;
26 public URLMediaHandler(String aBigIcon, String aTinyIcon, String anIconAlternative) {
29 iconAlternative = anIconAlternative;
35 * Since this media handler assumes the media is stored on a wholly different
36 * server, this operation is not applicable
38 public void store(UploadedFile anUploadedFile, Entity aMedia, Entity aMediaType) throws MediaExc, MediaFailure {
39 throw new UnsupportedOperationException();
45 * Since this media handler assumes the media is stored on a wholly different
46 * server, this operation is not applicable
48 public void store(InputStream anInputStream, Entity anEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
49 throw new UnsupportedOperationException();
55 * Since this media handler assumes the media is stored on a wholly different
56 * server, this operation is not applicable
58 public void store(File aFile, Entity aMedia, Entity aMediaType) throws MediaExc, MediaFailure {
59 throw new UnsupportedOperationException();
65 public void produce(Entity anEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
69 public InputStream getMedia(Entity anEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
73 public InputStream getThumbnail(Entity anEntity) throws MediaExc, MediaFailure {
77 public String getThumbnailMimeType(Entity aMediaEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
78 return "application/octetstream";
81 public String getStoragePath () throws MediaExc, MediaFailure {
82 throw new UnsupportedOperationException();
85 public String getIconStoragePath () throws MediaExc, MediaFailure {
86 throw new UnsupportedOperationException();
89 public String getPublishHost () throws MediaExc, MediaFailure {
90 throw new UnsupportedOperationException();
93 public String getBigIconName () {
97 public String getTinyIconName () {
101 public String getIconAltName () {
102 return iconAlternative;
105 public String getDescr(Entity mediaTypeEnt) {