6603d1c9cd344f49303f7f12d4e7ad99f7e4ef6e
[mir.git] / source / mircoders / media / URLMediaHandler.java
1 package mircoders.media;
2
3 import mir.media.*;
4 import java.io.InputStream;
5 import mir.entity.*;
6 import java.util.List;
7 import java.util.ArrayList;
8
9 /**
10  * <p>URLMediaHandler</p>
11  * <p>Description:
12  *     This is a media handler for media that are only known by url.
13  * </p>
14  * @author Zapata
15  */
16
17 public class URLMediaHandler implements MediaHandler {
18   private String bigIcon;
19   private String tinyIcon;
20   private String iconAlternative;
21
22   public URLMediaHandler(String aBigIcon, String aTinyIcon, String anIconAlternative) {
23     bigIcon = aBigIcon;
24     tinyIcon = aTinyIcon;
25     iconAlternative = anIconAlternative;
26   }
27
28   public void store(InputStream anInputStream, Entity anEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
29     throw new UnsupportedOperationException();
30   };
31
32   public void produce(Entity anEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
33   }
34
35   public InputStream getMedia(Entity anEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
36     return null;
37   }
38
39   public InputStream getThumbnail(Entity anEntity) throws MediaExc, MediaFailure {
40     return null;
41   }
42
43   public String getThumbnailMimeType(Entity aMediaEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
44     return "application/octetstream";
45   }
46
47   public List getURL(Entity aMediaEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
48     List result = new ArrayList();
49     result.add(aMediaTypeEntity.getFieldValue("publish_server")+aMediaTypeEntity.getFieldValue("publish_path"));
50
51     return result;
52   }
53
54   public Object getURLs(Entity ent, Entity mediaTypeEnt) throws MediaExc, MediaFailure {
55     return null;
56   }
57
58   public String getStoragePath () throws MediaExc, MediaFailure {
59     throw new UnsupportedOperationException();
60   }
61
62   public String getIconStoragePath () throws MediaExc, MediaFailure {
63     throw new UnsupportedOperationException();
64   }
65
66   public String getPublishHost () throws MediaExc, MediaFailure {
67     throw new UnsupportedOperationException();
68   }
69
70   public String getBigIconName () {
71     return bigIcon;
72   }
73
74   public String getTinyIconName () {
75     return tinyIcon;
76   }
77
78   public String getIconAltName () {
79     return iconAlternative;
80   }
81
82   public String getDescr (Entity mediaTypeEnt) {
83     return "Url";
84   }
85 }