X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmir%2Fmedia%2FMediaHandlerImages.java;fp=source%2Fmir%2Fmedia%2FMediaHandlerImages.java;h=0000000000000000000000000000000000000000;hb=eed379d582e04f6a9642358fbb5b7c4b427f969b;hp=cd8c7c57665e7c23090209a7345fdc451ee344d3;hpb=3b9eb37b9becbcb00a23790fc0074c956c7a992f;p=mir.git diff --git a/source/mir/media/MediaHandlerImages.java b/source/mir/media/MediaHandlerImages.java deleted file mode 100755 index cd8c7c57..00000000 --- a/source/mir/media/MediaHandlerImages.java +++ /dev/null @@ -1,169 +0,0 @@ - -package mir.media; - -import java.lang.*; -import java.io.*; -import java.util.*; -import java.lang.reflect.*; - -import mir.misc.*; -import mir.entity.*; - -/** - * This class handles saving, fetching creating representations - * for all images. The image content is stored in the DB. The content is - * written out to a file at the ProducerImages level. - * Remember that Handlers for specific image types, Gif, Jpeg, etc.. - * should override it. - * It implements the MirMedia interface. - *

- * ok. this is a big hack, it's cause putting the image in the DB - * and fetching it from the DB needs low level db connections for - * some reason. Does anyone know how to get around this? - * -mh 25.09.2001 - * - * @see mir.media.MirMedia - * @author mh - * @version 24.09.2001 - */ - - -public class MediaHandlerImages implements MirMedia -{ - protected final String WEBDB_JPG="0"; - protected final String WEBDB_GIF="1"; - - protected String imageType="0"; - private Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home")+"log/media.log"); - - public byte[] get(Entity ent, Entity mediaTypeEnt) throws MirMediaException - { - byte[] image_data = null; - - try { - Method method = ent.getClass().getMethod("getImage",null); - image_data = (byte[])method.invoke(ent, null); - } catch ( NoSuchMethodException e) { - theLog.printDebugInfo("method lookup unsuccesful: "+e.toString()); - throw new MirMediaException(e.toString()); - } catch ( IllegalAccessException e) { - theLog.printDebugInfo("method illegal: "+e.toString()); - throw new MirMediaException(e.toString()); - } catch ( InvocationTargetException e) { - theLog.printDebugInfo("get: invocation target illegal: "+e.toString()); - throw new MirMediaException(e.toString()); - } - - - return image_data; - } - - public boolean set(byte[] uploadData, Entity ent, Entity mediaTypeEnt) - throws MirMediaException { - - try { - Class[] params = {byte[].class, String.class}; - theLog.printDebugInfo("NAME: "+ent.getClass().getName()+" "+ - mediaTypeEnt.getClass().getName()+" "+uploadData.length+" "+ - imageType); - Method method = ent.getClass().getMethod("setImage",params); - method.invoke(ent, new Object[] {uploadData, imageType}); - } catch ( NoSuchMethodException e) { - theLog.printDebugInfo("method lookup unsuccesful: "+e.toString()); - throw new MirMediaException(e.toString()); - } catch ( IllegalAccessException e) { - theLog.printDebugInfo("method illegal: "+e.toString()); - throw new MirMediaException(e.toString()); - } catch ( InvocationTargetException e) { - theLog.printDebugInfo("set: invocation target illegal: "+e.toString()); - throw new MirMediaException(e.toString()); - } - //deref. -mh - uploadData=null; - - return true; - } - - public byte[] getIcon(Entity ent) throws MirMediaException - { - byte[] icon_data = null; - - try { - Method method = ent.getClass().getMethod("getIcon",null); - icon_data = (byte[])method.invoke(ent, null); - } catch ( NoSuchMethodException e) { - theLog.printDebugInfo("method lookup unsuccesful: "+e.toString()); - throw new MirMediaException(e.toString()); - } catch ( IllegalAccessException e) { - theLog.printDebugInfo("method illegal: "+e.toString()); - throw new MirMediaException(e.toString()); - } catch ( InvocationTargetException e) { - theLog.printDebugInfo("getIcon: invocation target illegal: "+e.toString()); - throw new MirMediaException(e.toString()); - } - - return icon_data; - } - - public String getURL(Entity ent, Entity mediaTypeEnt) - { - String title = ent.getValue("title"); - return StringUtil.createIMGLinks(ent.getValue("publish_server")+ - ent.getValue("publish_path"), title, ent.getValue("img_height"), - ent.getValue("img_width")); - } - - public String getListView(Entity ent, Entity mediaTypeEnt) - { - //String title = ent.getValue("title"); - return StringUtil.createIMGLinks( MirConfig.getProp("Producer.ProductionHost")+ - ent.getValue("icon_path"), null, ent.getValue("icon_height"), - ent.getValue("icon_width")); - } - - public String getStoragePath() - { - return MirConfig.getProp("Producer.Image.Path"); - } - - public String getIconStoragePath() - { - return MirConfig.getProp("Producer.Image.IconPath"); - } - - public String getPublishHost() - { - return MirConfig.getProp("Producer.Image.Host"); - } - - public String getTinyIcon () - { - return MirConfig.getProp("Producer.Icon.TinyImage"); - } - - public String getBigIcon () - { - return MirConfig.getProp("Producer.Icon.BigImage"); - } - - public String getIconAlt () - { - return "Image"; - } - - public boolean isVideo () - { - return false; - } - - public boolean isAudio () - { - return false; - } - - public boolean isImage () - { - return true; - } - -}