organizing imports
authoridfx <idfx>
Sun, 9 Mar 2003 19:14:21 +0000 (19:14 +0000)
committeridfx <idfx>
Sun, 9 Mar 2003 19:14:21 +0000 (19:14 +0000)
18 files changed:
source/Mir.java
source/OpenMir.java
source/mir/misc/FileHandler.java
source/mir/module/AbstractModule.java
source/mir/storage/store/StoreContainer.java
source/mircoders/media/MediaHandlerGeneric.java
source/mircoders/media/MediaHandlerImages.java
source/mircoders/media/MediaHandlerMp3.java
source/mircoders/media/MediaHandlerRealAudio.java
source/mircoders/media/MediaHandlerRealVideo.java
source/mircoders/media/MediaRequest.java
source/mircoders/module/ModuleComment.java
source/mircoders/module/ModuleContent.java
source/mircoders/module/ModuleImages.java
source/mircoders/module/ModuleTopics.java
source/mircoders/servlet/ServletModuleContent.java
source/mircoders/servlet/ServletModuleOpenIndy.java
source/mircoders/servlet/ServletModuleUploadedMedia.java

index 62ae28f..95880d7 100755 (executable)
@@ -46,13 +46,6 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
-import org.apache.struts.util.MessageResources;
-
-import freemarker.template.SimpleHash;
-import freemarker.template.SimpleList;
-import freemarker.template.SimpleScalar;
-import freemarker.template.TemplateModel;
-
 import mir.config.MirPropertiesConfiguration;
 import mir.generator.FreemarkerGenerator;
 import mir.log.LoggerWrapper;
@@ -73,14 +66,21 @@ import mircoders.storage.DatabaseArticleType;
 import mircoders.storage.DatabaseMessages;
 import mircoders.storage.DatabaseUsers;
 
+import org.apache.struts.util.MessageResources;
+
+import freemarker.template.SimpleHash;
+import freemarker.template.SimpleList;
+import freemarker.template.SimpleScalar;
+import freemarker.template.TemplateModel;
+
 
 
 
 /**
  * Mir.java - main servlet, that dispatches to servletmodules
  *
- * @author $Author: zapata $
- * @version $Id: Mir.java,v 1.37 2003/03/09 05:52:12 zapata Exp $
+ * @author $Author: idfx $
+ * @version $Id: Mir.java,v 1.38 2003/03/09 19:14:21 idfx Exp $
  *
  */
 public class Mir extends AbstractServlet {
@@ -415,7 +415,7 @@ public class Mir extends AbstractServlet {
     }
     catch (Exception e) {
       logger.debug(e.getMessage());
-      e.printStackTrace(logger.asPrintWriter(logger.DEBUG_MESSAGE));
+      e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
 
       return null;
     }
index 3ba08b4..93460f0 100755 (executable)
@@ -39,11 +39,6 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
-import org.apache.struts.util.MessageResources;
-
-import freemarker.template.SimpleHash;
-import freemarker.template.SimpleScalar;
-
 import mir.config.MirPropertiesConfiguration;
 import mir.misc.HTMLTemplateProcessor;
 import mir.misc.StringUtil;
@@ -53,11 +48,16 @@ import mir.servlet.ServletModuleUserExc;
 import mir.util.ExceptionFunctions;
 import mircoders.servlet.ServletModuleOpenIndy;
 
+import org.apache.struts.util.MessageResources;
+
+import freemarker.template.SimpleHash;
+import freemarker.template.SimpleScalar;
+
 /**
  *  OpenMir.java - main servlet for open posting and comment feature to articles
  *
  *  @author RK 1999-2001, the mir-coders group
- *  @version $Id: OpenMir.java,v 1.26 2003/03/09 05:52:12 zapata Exp $
+ *  @version $Id: OpenMir.java,v 1.27 2003/03/09 19:14:21 idfx Exp $
  *
  */
 
index 7804e24..a7a6ec8 100755 (executable)
@@ -1,77 +1,78 @@
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package  mir.misc;\r
-\r
-import java.util.Map;\r
-import multex.Exc;\r
-import multex.Failure;\r
-\r
-import com.oreilly.servlet.multipart.FilePart;\r
-\r
-\r
-/**\r
- * Interface that classes wishing to be used as a callback on FileParts for the\r
- * WebdbMultipartRequest class should implement this interface.\r
- *\r
- * @author mh <mh@nadir.org>\r
- * @version $Id: FileHandler.java,v 1.5 2003/03/09 03:53:10 zapata Exp $\r
- * @see mir.misc.WebdbMultipartRequest\r
- *\r
- */\r
-\r
-public interface  FileHandler {\r
-\r
-  public void setFile (FilePart filePart, int fileNum, Map Params) throws FileHandlerExc, FileHandlerFailure;\r
-\r
-  public static class FileHandlerExc extends Exc {\r
-    public FileHandlerExc(String aMessage) {\r
-\r
-      super(aMessage);\r
-    }\r
-  }\r
-\r
-  public static class FileHandlerFailure extends Failure {\r
-\r
-    public FileHandlerFailure(String msg, Throwable cause) {\r
-      super(msg, cause);\r
-    }\r
-\r
-    public FileHandlerFailure(Throwable aCause) {\r
-      this(aCause.getMessage(), aCause);\r
-    }\r
-  }\r
-\r
-}\r
-\r
-\r
-\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package  mir.misc;
+
+import java.util.Map;
+
+import multex.Exc;
+import multex.Failure;
+
+import com.oreilly.servlet.multipart.FilePart;
+
+
+/**
+ * Interface that classes wishing to be used as a callback on FileParts for the
+ * WebdbMultipartRequest class should implement this interface.
+ *
+ * @author mh <mh@nadir.org>
+ * @version $Id: FileHandler.java,v 1.6 2003/03/09 19:14:21 idfx Exp $
+ * @see mir.misc.WebdbMultipartRequest
+ *
+ */
+
+public interface  FileHandler {
+
+  public void setFile (FilePart filePart, int fileNum, Map Params) throws FileHandlerExc, FileHandlerFailure;
+
+  public static class FileHandlerExc extends Exc {
+    public FileHandlerExc(String aMessage) {
+
+      super(aMessage);
+    }
+  }
+
+  public static class FileHandlerFailure extends Failure {
+
+    public FileHandlerFailure(String msg, Throwable cause) {
+      super(msg, cause);
+    }
+
+    public FileHandlerFailure(Throwable aCause) {
+      this(aCause.getMessage(), aCause);
+    }
+  }
+
+}
+
+
+
+
index 5f16a22..25a2282 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package  mir.module;\r
-\r
-import java.sql.SQLException;\r
-import java.util.Map;\r
-\r
-import mir.entity.Entity;\r
-import mir.entity.EntityList;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectExc;\r
-import mir.storage.StorageObjectFailure;\r
-import freemarker.template.SimpleHash;\r
-\r
-\r
-/**\r
- * This class provides the base functionality for the derived Module-Classes.\r
- * These classes should provide methods to make more or less complex actions\r
- * on Database and Entity classes. The modules are used by ServletModules.\r
- * Future possibility could be access via Applications.\r
- *\r
- * Abstrakte Klasse, von denen die Modules die Basisfunktionalit?t erben.\r
- * Die Moduleschicht dient dazu, Funktionalitaeten zur Verf?gung zu stellen,\r
- * die von mehreren ServletModulen verwendet werden.\r
- *\r
- */\r
-\r
-public class AbstractModule {\r
-  protected StorageObject theStorage;\r
-\r
-  public void setStorage(StorageObject storage) {\r
-    this.theStorage = storage;\r
-  }\r
-\r
-  /**\r
-   * Liefert das Standard-StorageObject zur?ck, mit dem das Module assoziiert ist.\r
-   * @return Standard-StorageObject\r
-   */\r
-  public StorageObject getStorageObject () {\r
-    return theStorage;\r
-  }\r
-\r
-  /**\r
-   *   Holt eine Entity anhand der Id via StorageObject\r
-   *   @param String der Entity\r
-   *   @return Entity\r
-   */\r
-  public Entity getById (String id) throws ModuleExc, ModuleFailure {\r
-    try {\r
-      if (theStorage == null)\r
-        throw  new ModuleExc("AbstractModule.getById: No StorageObject set!");\r
-      Entity entity = (Entity)theStorage.selectById(id);\r
-\r
-      if (entity == null)\r
-        throw new ModuleExc("AbstractModule.getById: No object for id = " + id);\r
-      else\r
-        return entity;\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  /**\r
-   *   Holt eine EntityListe anhand des WhereClause via StorageObject\r
-   *   @param String whereclause\r
-   *   @param offset - ab welchem Datensatz die gematchten Entities zurueckgeliefert werden\r
-   *   @return EntityList Liste der gematchten Datens?tze\r
-   */\r
-  public EntityList getByWhereClause (String whereClause, int offset) throws ModuleExc, ModuleFailure {\r
-    try {\r
-      if (theStorage == null)\r
-        throw  new ModuleExc("AbstractModule.getByWhereClause: No StorageObject set!");\r
-\r
-      return theStorage.selectByWhereClause(whereClause, offset);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  /**\r
-   *   Holt eine EntityListe anhand des WhereClause aus dem StorageObject\r
-   *   @param String where WhereClause\r
-   *   @param String order Sortierreihenfolge\r
-   *   @param offset - ab welchem Datensatz die gematchten Entities zurueckgeliefert werden\r
-   *   @return EntityList Liste der gematchten Datens?tze\r
-   */\r
-  public EntityList getByWhereClause (String where, String order, int offset) throws ModuleExc, ModuleFailure {\r
-    try {\r
-      if (theStorage==null)\r
-        throw new ModuleExc("AbstractModule.getByWhereClause: No StorageObject set!");\r
-\r
-      return theStorage.selectByWhereClause(where, order, offset);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ModuleFailure(e);\r
-    }\r
-  }\r
-  /**\r
-   *   Executes a where clause on the StorageObject with order criteria\r
-   *   fetching from offset the number of limit objects\r
-   *\r
-   *   @param String where\r
-   *   @param String order\r
-   *   @param int offset\r
-   *   @param int limit\r
-   *   @return EntityList\r
-   */\r
-\r
-  public EntityList getByWhereClause(String where, String order, int offset, int limit) throws ModuleExc, ModuleFailure   {\r
-    try {\r
-      if (theStorage==null)\r
-        throw new ModuleExc("AbstractModule.getByWhereClause: StorageObject not set!");\r
-\r
-      return theStorage.selectByWhereClause(where, order, offset, limit);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  /**\r
-   *   Holt eine EntityListe anhand des Wertes aValue von Feld aField aus dem StorageObject\r
-   *   @param String aField - Feldname im StorageObject\r
-   *   @param String aValue - Wert in Feld im StorageObject\r
-   *   @param offset - ab welchem Datensatz die gematchten Entities zurueckgeliefert werden\r
-   *   @return EntityList Liste der gematchten Datens?tze\r
-   */\r
-  public EntityList getByFieldValue (String aField, String aValue, int offset) throws ModuleExc, ModuleFailure {\r
-    String whereClause;\r
-    whereClause = aField + " like '%" + aValue + "%'";\r
-    return getByWhereClause(whereClause, offset);\r
-  }\r
-\r
-  /**\r
-   *    * Standardfunktion, um einen Datensatz via StorageObject einzuf?gen\r
-   * @param theValues Hash mit Spalte/Wert-Paaren\r
-   * @return Id des eingef?gten Objekts\r
-   * @exception ModuleExc\r
-   * @exception ModuleFailure\r
-   */\r
-  public String add (Map theValues) throws ModuleExc, ModuleFailure {\r
-    try {\r
-      Entity theEntity = (Entity)theStorage.getEntityClass().newInstance();\r
-      theEntity.setStorage(theStorage);\r
-      theEntity.setValues(theValues);\r
-      return theEntity.insert();\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  /**\r
-   * Standardfunktion, um einen Datensatz via StorageObject zu aktualisieren\r
-   * @param theValues Hash mit Spalte/Wert-Paaren\r
-   * @return Id des eingef?gten Objekts\r
-   * @exception ModuleExc\r
-   * @exception ModuleFailure\r
-   */\r
-  public String set (Map theValues) throws ModuleExc, ModuleFailure {\r
-    try {\r
-      Entity theEntity = theStorage.selectById((String)theValues.get("id"));\r
-      if (theEntity == null)\r
-        throw new ModuleExc("No object found with id " + theValues.get("id"));\r
-      theEntity.setValues(theValues);\r
-      theEntity.update();\r
-      return theEntity.getId();\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  /**\r
-   * Deletes a record using an id\r
-   * @param idParam\r
-   * @exception ModuleExc\r
-   * @exception ModuleFailure\r
-   */\r
-  public void deleteById (String idParam) throws ModuleExc, ModuleFailure {\r
-    try {\r
-      theStorage.delete(idParam);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  /**\r
-   * Liefert den Lookuptable aller Objekte des StorageObjects\r
-   * @return freemarker.template.SimpleHash\r
-   */\r
-  public SimpleHash getHashData() {\r
-    return theStorage.getHashData();\r
-  }\r
-\r
-  /**\r
-   * returns the number of rows\r
-   */\r
-  public int getSize(String where) throws ModuleExc, ModuleFailure {\r
-    try {\r
-      return theStorage.getSize(where);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new ModuleFailure(e);\r
-    }\r
-  }\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package  mir.module;
+
+import java.util.Map;
+
+import mir.entity.Entity;
+import mir.entity.EntityList;
+import mir.storage.StorageObject;
+import freemarker.template.SimpleHash;
+
+
+/**
+ * This class provides the base functionality for the derived Module-Classes.
+ * These classes should provide methods to make more or less complex actions
+ * on Database and Entity classes. The modules are used by ServletModules.
+ * Future possibility could be access via Applications.
+ *
+ * Abstrakte Klasse, von denen die Modules die Basisfunktionalit?t erben.
+ * Die Moduleschicht dient dazu, Funktionalitaeten zur Verf?gung zu stellen,
+ * die von mehreren ServletModulen verwendet werden.
+ *
+ */
+
+public class AbstractModule {
+  protected StorageObject theStorage;
+
+  public void setStorage(StorageObject storage) {
+    this.theStorage = storage;
+  }
+
+  /**
+   * Liefert das Standard-StorageObject zur?ck, mit dem das Module assoziiert ist.
+   * @return Standard-StorageObject
+   */
+  public StorageObject getStorageObject () {
+    return theStorage;
+  }
+
+  /**
+   *   Holt eine Entity anhand der Id via StorageObject
+   *   @param String der Entity
+   *   @return Entity
+   */
+  public Entity getById (String id) throws ModuleExc, ModuleFailure {
+    try {
+      if (theStorage == null)
+        throw  new ModuleExc("AbstractModule.getById: No StorageObject set!");
+      Entity entity = (Entity)theStorage.selectById(id);
+
+      if (entity == null)
+        throw new ModuleExc("AbstractModule.getById: No object for id = " + id);
+      else
+        return entity;
+    }
+    catch (Throwable e) {
+      throw new ModuleFailure(e);
+    }
+  }
+
+  /**
+   *   Holt eine EntityListe anhand des WhereClause via StorageObject
+   *   @param String whereclause
+   *   @param offset - ab welchem Datensatz die gematchten Entities zurueckgeliefert werden
+   *   @return EntityList Liste der gematchten Datens?tze
+   */
+  public EntityList getByWhereClause (String whereClause, int offset) throws ModuleExc, ModuleFailure {
+    try {
+      if (theStorage == null)
+        throw  new ModuleExc("AbstractModule.getByWhereClause: No StorageObject set!");
+
+      return theStorage.selectByWhereClause(whereClause, offset);
+    }
+    catch (Throwable e) {
+      throw new ModuleFailure(e);
+    }
+  }
+
+  /**
+   *   Holt eine EntityListe anhand des WhereClause aus dem StorageObject
+   *   @param String where WhereClause
+   *   @param String order Sortierreihenfolge
+   *   @param offset - ab welchem Datensatz die gematchten Entities zurueckgeliefert werden
+   *   @return EntityList Liste der gematchten Datens?tze
+   */
+  public EntityList getByWhereClause (String where, String order, int offset) throws ModuleExc, ModuleFailure {
+    try {
+      if (theStorage==null)
+        throw new ModuleExc("AbstractModule.getByWhereClause: No StorageObject set!");
+
+      return theStorage.selectByWhereClause(where, order, offset);
+    }
+    catch (Throwable e) {
+      throw new ModuleFailure(e);
+    }
+  }
+  /**
+   *   Executes a where clause on the StorageObject with order criteria
+   *   fetching from offset the number of limit objects
+   *
+   *   @param String where
+   *   @param String order
+   *   @param int offset
+   *   @param int limit
+   *   @return EntityList
+   */
+
+  public EntityList getByWhereClause(String where, String order, int offset, int limit) throws ModuleExc, ModuleFailure   {
+    try {
+      if (theStorage==null)
+        throw new ModuleExc("AbstractModule.getByWhereClause: StorageObject not set!");
+
+      return theStorage.selectByWhereClause(where, order, offset, limit);
+    }
+    catch (Throwable e) {
+      throw new ModuleFailure(e);
+    }
+  }
+
+  /**
+   *   Holt eine EntityListe anhand des Wertes aValue von Feld aField aus dem StorageObject
+   *   @param String aField - Feldname im StorageObject
+   *   @param String aValue - Wert in Feld im StorageObject
+   *   @param offset - ab welchem Datensatz die gematchten Entities zurueckgeliefert werden
+   *   @return EntityList Liste der gematchten Datens?tze
+   */
+  public EntityList getByFieldValue (String aField, String aValue, int offset) throws ModuleExc, ModuleFailure {
+    String whereClause;
+    whereClause = aField + " like '%" + aValue + "%'";
+    return getByWhereClause(whereClause, offset);
+  }
+
+  /**
+   *    * Standardfunktion, um einen Datensatz via StorageObject einzuf?gen
+   * @param theValues Hash mit Spalte/Wert-Paaren
+   * @return Id des eingef?gten Objekts
+   * @exception ModuleExc
+   * @exception ModuleFailure
+   */
+  public String add (Map theValues) throws ModuleExc, ModuleFailure {
+    try {
+      Entity theEntity = (Entity)theStorage.getEntityClass().newInstance();
+      theEntity.setStorage(theStorage);
+      theEntity.setValues(theValues);
+      return theEntity.insert();
+    }
+    catch (Throwable e) {
+      throw new ModuleFailure(e);
+    }
+  }
+
+  /**
+   * Standardfunktion, um einen Datensatz via StorageObject zu aktualisieren
+   * @param theValues Hash mit Spalte/Wert-Paaren
+   * @return Id des eingef?gten Objekts
+   * @exception ModuleExc
+   * @exception ModuleFailure
+   */
+  public String set (Map theValues) throws ModuleExc, ModuleFailure {
+    try {
+      Entity theEntity = theStorage.selectById((String)theValues.get("id"));
+      if (theEntity == null)
+        throw new ModuleExc("No object found with id " + theValues.get("id"));
+      theEntity.setValues(theValues);
+      theEntity.update();
+      return theEntity.getId();
+    }
+    catch (Throwable e) {
+      throw new ModuleFailure(e);
+    }
+  }
+
+  /**
+   * Deletes a record using an id
+   * @param idParam
+   * @exception ModuleExc
+   * @exception ModuleFailure
+   */
+  public void deleteById (String idParam) throws ModuleExc, ModuleFailure {
+    try {
+      theStorage.delete(idParam);
+    }
+    catch (Throwable e) {
+      throw new ModuleFailure(e);
+    }
+  }
+
+  /**
+   * Liefert den Lookuptable aller Objekte des StorageObjects
+   * @return freemarker.template.SimpleHash
+   */
+  public SimpleHash getHashData() {
+    return theStorage.getHashData();
+  }
+
+  /**
+   * returns the number of rows
+   */
+  public int getSize(String where) throws ModuleExc, ModuleFailure {
+    try {
+      return theStorage.getSize(where);
+    }
+    catch (Throwable e) {
+      throw new ModuleFailure(e);
+    }
+  }
+
+}
index fcff1f6..567d965 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.storage.store;\r
-\r
-/**\r
- * Title:         StoreContainer\r
- *\r
- * Description:   This is the bucket object for one type of StorableObjects,\r
- *                mainy a linked list of StoreIdenfiers. On use or creation\r
- *                an object stored in StoreIdentifier is put to head of the\r
- *                list. if maximum size of the list is reached, the\r
- *                StoreIdentifier at the end of the list is released.\r
- *\r
- * Copyright:     Copyright (c) 2002\r
- * Company:       indy\r
- * @author        //rk\r
- * @version 1.0\r
- */\r
-\r
-import java.util.LinkedList;\r
-import java.util.ListIterator;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-import mir.misc.StringUtil;\r
-import mir.log.LoggerWrapper;\r
-\r
-public class StoreContainer {\r
-  private final static int DEFAULT_SIZE = 10;\r
-  private static int uniqueCounter = 10000;\r
-\r
-  private LinkedList container;\r
-  private StoreContainerType stocType;\r
-  private int maxSize = DEFAULT_SIZE, uniqueId;\r
-  private int addCount = 0, removeCount = 0, storeOutCount;\r
-  private int hitCount = 0, missCount = 0;\r
-  private static ObjectStore o_store = ObjectStore.getInstance();\r
-\r
-  protected LoggerWrapper logger = new LoggerWrapper("Database.ObjectStore");\r
-\r
-  // avoid construction without parameters\r
-  private StoreContainer() {};\r
-\r
-\r
-  public StoreContainer(StoreContainerType stoc_type) {\r
-    this.uniqueId = ++uniqueCounter;\r
-    this.stocType = stoc_type;\r
-    this.container = new LinkedList();\r
-    int defaultSize = stoc_type.getDefaultSize();\r
-    String confProperty = stoc_type.getConfPrefix() + ".DefaultSize";\r
-    String confedSize = o_store.getConfProperty(confProperty);\r
-    if (confedSize != null) {\r
-      this.maxSize = StringUtil.parseInt(confedSize, defaultSize);\r
-    }\r
-  }\r
-\r
-  public StoreContainer(StoreContainerType stoc_type, int maxSize) {\r
-    this();\r
-    this.maxSize = maxSize;\r
-  }\r
-\r
-  public synchronized StorableObject use(StoreIdentifier sid) {\r
-    int hit = container.indexOf(sid);\r
-    if (hit >= 0) {\r
-      StoreIdentifier hitSid = (StoreIdentifier) container.get(hit);\r
-      if (hitSid != null) {\r
-        hitCount++;\r
-        return hitSid.use();\r
-      }\r
-    }\r
-    missCount++;\r
-    return null;\r
-  }\r
-\r
-  public boolean has(StoreIdentifier sid) {\r
-    return container.contains(sid);\r
-  }\r
-\r
-  public void add(StoreIdentifier sid) {\r
-    if (sid != null && sid.hasReference()) {\r
-      if (has(sid)) {\r
-        moveToHead(sid);\r
-        logger.error("OBJECTStore: tried to add sid " + sid.toString() + " that was already in store.");\r
-      }\r
-      else {\r
-        container.addFirst(sid);\r
-        shrinkIfNecessary();\r
-        addCount++;\r
-      }\r
-    }\r
-  }\r
-\r
-  /**\r
-   *  Method:       invalidate(StorableObject sto)\r
-   *  Description:  finds @see StorableObject, propagates invalidation to\r
-   *                @see StoreIdentifier and removes StoreIdentifier from\r
-   *                list.\r
-   */\r
-  public synchronized void invalidate(StoreIdentifier search_sid) {\r
-    if (search_sid != null) {\r
-      int hit = container.indexOf(search_sid);\r
-      if (hit >= 0) {\r
-        StoreIdentifier sid = (StoreIdentifier) container.get(hit);\r
-        container.remove(sid);\r
-        sid.invalidate();\r
-        removeCount++;\r
-      }\r
-    }\r
-  }\r
-\r
-  public synchronized void invalidate() {\r
-    StoreIdentifier sid;\r
-    while (container.size() > 0) {\r
-      sid = (StoreIdentifier) container.getLast();\r
-      container.removeLast();\r
-      sid.invalidate();\r
-    }\r
-  }\r
-\r
-  /**\r
-   *  Method:       setSize\r
-   *  Description:  readjusts StoreContainer size to value.\r
-   *\r
-   */\r
-  public void setSize(int size) {\r
-    if (size < 0)\r
-      return;\r
-    shrinkToSize(size);\r
-    this.maxSize = size;\r
-  }\r
-\r
-  private void shrinkIfNecessary() {\r
-    shrinkToSize(maxSize);\r
-  }\r
-\r
-  private void shrinkToSize(int size) {\r
-    if (size < container.size()) {\r
-      // shrink\r
-      while (size < container.size()) {\r
-        StoreIdentifier sid = (StoreIdentifier) container.getLast();\r
-        container.remove(sid);\r
-        sid.release();\r
-        storeOutCount++;\r
-      }\r
-    }\r
-  }\r
-\r
-  private synchronized void moveToHead(StoreIdentifier sid) {\r
-    if (sid != null) {\r
-      container.remove(sid);\r
-      container.addFirst(sid);\r
-    }\r
-  }\r
-\r
-  /**\r
-   *  Method:       toString()\r
-   *  Description:  gives out statistical Information, viewable via\r
-   *                @see ServletStoreInfo.\r
-   *\r
-   *  @return       String\r
-   */\r
-  public String toString() {\r
-    return toHtml(null);\r
-  }\r
-\r
-  public String toHtml(HttpServletRequest req) {\r
-    boolean showingContent = false;\r
-    float hitRatio = 0;\r
-    long divisor = hitCount + missCount;\r
-    if (divisor > 0)\r
-      hitRatio = (float) hitCount / (float) divisor;\r
-    hitRatio *= 100;\r
-\r
-    StringBuffer sb = new StringBuffer("StoreContainer id: ");\r
-    sb.append(uniqueId).append(" for ");\r
-    sb.append(stocType.toString());\r
-    if (req != null) {\r
-      String show = req.getParameter("stoc_show");\r
-      if (show != null && show.equals("" + uniqueId)) {\r
-        // show all entries in container\r
-        sb.append(" [<b>showing</b>]");\r
-        showingContent = true;\r
-      }\r
-      else\r
-        sb.append(" [<a href=\"?stoc_show=" + uniqueId + "\">show</a>]");\r
-    }\r
-    sb.append("\n  [current/maximum size: ");\r
-    sb.append(container.size()).append("/").append(maxSize);\r
-    sb.append("]\n  [added/stored out/removed: ").append(addCount).append("/");\r
-    sb.append(storeOutCount).append("/").append(removeCount).append(\r
-        "]\n  [hit/miss/ratio: ");\r
-    sb.append(hitCount).append("/").append(missCount).append("/");\r
-    sb.append(hitRatio).append("%]\n");\r
-\r
-    if (showingContent) {\r
-      sb.append("  <b>Container contains following references:</b>\n  ");\r
-      ListIterator it = container.listIterator();\r
-      while (it.hasNext()) {\r
-        StoreIdentifier sid = (StoreIdentifier) it.next();\r
-        sb.append(sid.toString()).append("\n  ");\r
-      }\r
-      sb.append("<b>End of List</b>\n\n");\r
-\r
-    }\r
-\r
-    return sb.toString();\r
-  }\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.storage.store;
+
+/**
+ * Title:         StoreContainer
+ *
+ * Description:   This is the bucket object for one type of StorableObjects,
+ *                mainy a linked list of StoreIdenfiers. On use or creation
+ *                an object stored in StoreIdentifier is put to head of the
+ *                list. if maximum size of the list is reached, the
+ *                StoreIdentifier at the end of the list is released.
+ *
+ * Copyright:     Copyright (c) 2002
+ * Company:       indy
+ * @author        //rk
+ * @version 1.0
+ */
+
+import java.util.LinkedList;
+import java.util.ListIterator;
+
+import javax.servlet.http.HttpServletRequest;
+
+import mir.log.LoggerWrapper;
+import mir.misc.StringUtil;
+
+public class StoreContainer {
+  private final static int DEFAULT_SIZE = 10;
+  private static int uniqueCounter = 10000;
+
+  private LinkedList container;
+  private StoreContainerType stocType;
+  private int maxSize = DEFAULT_SIZE, uniqueId;
+  private int addCount = 0, removeCount = 0, storeOutCount;
+  private int hitCount = 0, missCount = 0;
+  private static ObjectStore o_store = ObjectStore.getInstance();
+
+  protected LoggerWrapper logger = new LoggerWrapper("Database.ObjectStore");
+
+  // avoid construction without parameters
+  private StoreContainer() {};
+
+
+  public StoreContainer(StoreContainerType stoc_type) {
+    this.uniqueId = ++uniqueCounter;
+    this.stocType = stoc_type;
+    this.container = new LinkedList();
+    int defaultSize = stoc_type.getDefaultSize();
+    String confProperty = stoc_type.getConfPrefix() + ".DefaultSize";
+    String confedSize = o_store.getConfProperty(confProperty);
+    if (confedSize != null) {
+      this.maxSize = StringUtil.parseInt(confedSize, defaultSize);
+    }
+  }
+
+  public StoreContainer(StoreContainerType stoc_type, int maxSize) {
+    this();
+    this.maxSize = maxSize;
+  }
+
+  public synchronized StorableObject use(StoreIdentifier sid) {
+    int hit = container.indexOf(sid);
+    if (hit >= 0) {
+      StoreIdentifier hitSid = (StoreIdentifier) container.get(hit);
+      if (hitSid != null) {
+        hitCount++;
+        return hitSid.use();
+      }
+    }
+    missCount++;
+    return null;
+  }
+
+  public boolean has(StoreIdentifier sid) {
+    return container.contains(sid);
+  }
+
+  public void add(StoreIdentifier sid) {
+    if (sid != null && sid.hasReference()) {
+      if (has(sid)) {
+        moveToHead(sid);
+        logger.error("OBJECTStore: tried to add sid " + sid.toString() + " that was already in store.");
+      }
+      else {
+        container.addFirst(sid);
+        shrinkIfNecessary();
+        addCount++;
+      }
+    }
+  }
+
+  /**
+   *  Method:       invalidate(StorableObject sto)
+   *  Description:  finds @see StorableObject, propagates invalidation to
+   *                @see StoreIdentifier and removes StoreIdentifier from
+   *                list.
+   */
+  public synchronized void invalidate(StoreIdentifier search_sid) {
+    if (search_sid != null) {
+      int hit = container.indexOf(search_sid);
+      if (hit >= 0) {
+        StoreIdentifier sid = (StoreIdentifier) container.get(hit);
+        container.remove(sid);
+        sid.invalidate();
+        removeCount++;
+      }
+    }
+  }
+
+  public synchronized void invalidate() {
+    StoreIdentifier sid;
+    while (container.size() > 0) {
+      sid = (StoreIdentifier) container.getLast();
+      container.removeLast();
+      sid.invalidate();
+    }
+  }
+
+  /**
+   *  Method:       setSize
+   *  Description:  readjusts StoreContainer size to value.
+   *
+   */
+  public void setSize(int size) {
+    if (size < 0)
+      return;
+    shrinkToSize(size);
+    this.maxSize = size;
+  }
+
+  private void shrinkIfNecessary() {
+    shrinkToSize(maxSize);
+  }
+
+  private void shrinkToSize(int size) {
+    if (size < container.size()) {
+      // shrink
+      while (size < container.size()) {
+        StoreIdentifier sid = (StoreIdentifier) container.getLast();
+        container.remove(sid);
+        sid.release();
+        storeOutCount++;
+      }
+    }
+  }
+
+  private synchronized void moveToHead(StoreIdentifier sid) {
+    if (sid != null) {
+      container.remove(sid);
+      container.addFirst(sid);
+    }
+  }
+
+  /**
+   *  Method:       toString()
+   *  Description:  gives out statistical Information, viewable via
+   *                @see ServletStoreInfo.
+   *
+   *  @return       String
+   */
+  public String toString() {
+    return toHtml(null);
+  }
+
+  public String toHtml(HttpServletRequest req) {
+    boolean showingContent = false;
+    float hitRatio = 0;
+    long divisor = hitCount + missCount;
+    if (divisor > 0)
+      hitRatio = (float) hitCount / (float) divisor;
+    hitRatio *= 100;
+
+    StringBuffer sb = new StringBuffer("StoreContainer id: ");
+    sb.append(uniqueId).append(" for ");
+    sb.append(stocType.toString());
+    if (req != null) {
+      String show = req.getParameter("stoc_show");
+      if (show != null && show.equals("" + uniqueId)) {
+        // show all entries in container
+        sb.append(" [<b>showing</b>]");
+        showingContent = true;
+      }
+      else
+        sb.append(" [<a href=\"?stoc_show=" + uniqueId + "\">show</a>]");
+    }
+    sb.append("\n  [current/maximum size: ");
+    sb.append(container.size()).append("/").append(maxSize);
+    sb.append("]\n  [added/stored out/removed: ").append(addCount).append("/");
+    sb.append(storeOutCount).append("/").append(removeCount).append(
+        "]\n  [hit/miss/ratio: ");
+    sb.append(hitCount).append("/").append(missCount).append("/");
+    sb.append(hitRatio).append("%]\n");
+
+    if (showingContent) {
+      sb.append("  <b>Container contains following references:</b>\n  ");
+      ListIterator it = container.listIterator();
+      while (it.hasNext()) {
+        StoreIdentifier sid = (StoreIdentifier) it.next();
+        sb.append(sid.toString()).append("\n  ");
+      }
+      sb.append("<b>End of List</b>\n\n");
+
+    }
+
+    return sb.toString();
+  }
+
 }
\ No newline at end of file
index e31af29..eb53cd9 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package  mircoders.media;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;\r
-import mir.entity.Entity;\r
-import mir.log.LoggerWrapper;\r
-import mir.media.MirMedia;\r
-import mir.media.MediaExc;\r
-import mir.media.MediaFailure;\r
-import mir.misc.FileUtil;\r
-import mir.misc.StringUtil;\r
-import freemarker.template.SimpleList;\r
-\r
-\r
-/**\r
- * This is the Generic MediaHandler. It stores the media data on\r
- * the filesystem and keeps basic metadata  (size, type...) in the\r
- * DB. Usually only representation needs to be overridden.\r
- * See the MediaHandlerAudio class to see an example of how one\r
- * could override it.\r
- * <p>\r
- * Most media handlers should override this class.\r
- * <p>\r
- * In theory, it could be used to handle miscellaneous media that\r
- * we don't have entered in the media_type table, (like RTF documents,\r
- * PS, PDF, etc..)\r
- * <p>\r
- * Of course it implements the MirMedia interface.\r
- *\r
- * @see mir.media.MirMedia\r
- * @author mh <mh@nadir.org>\r
- * @version $Id: MediaHandlerGeneric.java,v 1.17 2003/03/09 03:53:11 zapata Exp $\r
- */\r
-\r
-public class MediaHandlerGeneric implements MirMedia\r
-{\r
-    protected static MirPropertiesConfiguration configuration;\r
-    protected static String imageHost;\r
-    protected static String imageRoot;\r
-\r
-    protected LoggerWrapper logger;\r
-\r
-    static {\r
-      try {\r
-        configuration = MirPropertiesConfiguration.instance();\r
-      }\r
-      catch (PropertiesConfigExc e) {\r
-      }\r
-      imageHost = configuration.getString("Producer.Image.Host");\r
-      imageRoot = configuration.getString("Producer.ImageRoot");\r
-    }\r
-\r
-    public MediaHandlerGeneric() {\r
-      logger = new LoggerWrapper("Media.Generic");\r
-    }\r
-\r
-    public void set (InputStream in, Entity ent, Entity mediaTypeEnt ) throws MediaExc, MediaFailure {\r
-      String ext = mediaTypeEnt.getValue("name");\r
-      String mediaFname = ent.getId() + "." + ext;\r
-      String date = ent.getValue("date");\r
-      String datePath = StringUtil.webdbDate2path(date);\r
-      try {\r
-        long size = FileUtil.write(getStoragePath() + File.separator + datePath +\r
-                                   File.separator + mediaFname, in);\r
-        ent.setValueForProperty("publish_path", datePath + mediaFname);\r
-        ent.setValueForProperty("size", new Long(size).toString());\r
-        ent.update();\r
-      }\r
-      catch (Throwable e) {\r
-        logger.error("MediaHandlerGeneric.set: " + e.toString());\r
-        throw new MediaFailure(e);\r
-      }\r
-    }\r
-\r
-    public void produce (Entity ent, Entity mediaTypeEnt ) throws MediaExc, MediaFailure {\r
-      //check first if the media file exist since produced\r
-      //location is also the storage location\r
-\r
-      String date = ent.getValue("date");\r
-      String datePath = StringUtil.webdbDate2path(date);\r
-      String relPath = datePath+ent.getId()+"."+mediaTypeEnt.getValue("name");\r
-      String fname = getStoragePath()+relPath;\r
-      if(! new File(fname).exists())\r
-        throw new MediaExc("error in MirMedia.produce(): " + relPath + " does not exist!");\r
-    }\r
-\r
-    public InputStream getMedia (Entity ent, Entity mediaTypeEnt) throws MediaExc, MediaFailure {\r
-      String publishPath = ent.getValue("publish_path");\r
-      String fname = getStoragePath()+publishPath;\r
-      File f = new File(fname);\r
-      if(! f.exists())\r
-        throw new MediaExc("error in MirMedia.getMedia(): " + fname + " does not exist!");\r
-\r
-      FileInputStream inputStream;\r
-      try {\r
-        inputStream = new FileInputStream(f);\r
-      }\r
-      catch (Throwable e) {\r
-        throw new MediaFailure("MediaHandlerGeneric.getMedia(): " + e.toString(), e);\r
-      }\r
-\r
-      return inputStream;\r
-    }\r
-\r
-    public InputStream getIcon (Entity ent) throws MediaExc, MediaFailure {\r
-        return null;\r
-    }\r
-\r
-    public String getStoragePath()\r
-    {\r
-        return configuration.getString("Producer.Media.Path");\r
-    }\r
-\r
-    public String getIconStoragePath()\r
-    {\r
-        return configuration.getString("Producer.Image.IconPath");\r
-    }\r
-\r
-    public String getPublishHost()\r
-    {\r
-        return StringUtil.removeSlash(configuration.getString("Producer.Media.Host"));\r
-    }\r
-\r
-    public String getTinyIconName()\r
-    {\r
-        return configuration.getString("Producer.Icon.TinyText");\r
-    }\r
-\r
-    public String getBigIconName()\r
-    {\r
-        return configuration.getString("Producer.Icon.BigText");\r
-    }\r
-\r
-    public String getIconAltName()\r
-    {\r
-        return "Generic media";\r
-    }\r
-\r
-    public SimpleList getURL(Entity ent, Entity mediaTypeEnt)\r
-    {\r
-      SimpleList theList = new SimpleList();\r
-      theList.add(ent);\r
-      return theList;\r
-    }\r
-\r
-    public boolean isVideo()\r
-    {\r
-      return false;\r
-    }\r
-\r
-    public boolean isAudio()\r
-    {\r
-      return false;\r
-    }\r
-\r
-    public boolean isImage()\r
-    {\r
-      return false;\r
-    }\r
-\r
-    public String getDescr( Entity mediaType)\r
-    {\r
-      return mediaType.getValue("mime_type");\r
-    }\r
-\r
-}\r
-\r
-\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package  mircoders.media;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
+import mir.entity.Entity;
+import mir.log.LoggerWrapper;
+import mir.media.MediaExc;
+import mir.media.MediaFailure;
+import mir.media.MirMedia;
+import mir.misc.FileUtil;
+import mir.misc.StringUtil;
+import freemarker.template.SimpleList;
+
+
+/**
+ * This is the Generic MediaHandler. It stores the media data on
+ * the filesystem and keeps basic metadata  (size, type...) in the
+ * DB. Usually only representation needs to be overridden.
+ * See the MediaHandlerAudio class to see an example of how one
+ * could override it.
+ * <p>
+ * Most media handlers should override this class.
+ * <p>
+ * In theory, it could be used to handle miscellaneous media that
+ * we don't have entered in the media_type table, (like RTF documents,
+ * PS, PDF, etc..)
+ * <p>
+ * Of course it implements the MirMedia interface.
+ *
+ * @see mir.media.MirMedia
+ * @author mh <mh@nadir.org>
+ * @version $Id: MediaHandlerGeneric.java,v 1.18 2003/03/09 19:14:21 idfx Exp $
+ */
+
+public class MediaHandlerGeneric implements MirMedia
+{
+    protected static MirPropertiesConfiguration configuration;
+    protected static String imageHost;
+    protected static String imageRoot;
+
+    protected LoggerWrapper logger;
+
+    static {
+      try {
+        configuration = MirPropertiesConfiguration.instance();
+      }
+      catch (PropertiesConfigExc e) {
+      }
+      imageHost = configuration.getString("Producer.Image.Host");
+      imageRoot = configuration.getString("Producer.ImageRoot");
+    }
+
+    public MediaHandlerGeneric() {
+      logger = new LoggerWrapper("Media.Generic");
+    }
+
+    public void set (InputStream in, Entity ent, Entity mediaTypeEnt ) throws MediaExc, MediaFailure {
+      String ext = mediaTypeEnt.getValue("name");
+      String mediaFname = ent.getId() + "." + ext;
+      String date = ent.getValue("date");
+      String datePath = StringUtil.webdbDate2path(date);
+      try {
+        long size = FileUtil.write(getStoragePath() + File.separator + datePath +
+                                   File.separator + mediaFname, in);
+        ent.setValueForProperty("publish_path", datePath + mediaFname);
+        ent.setValueForProperty("size", new Long(size).toString());
+        ent.update();
+      }
+      catch (Throwable e) {
+        logger.error("MediaHandlerGeneric.set: " + e.toString());
+        throw new MediaFailure(e);
+      }
+    }
+
+    public void produce (Entity ent, Entity mediaTypeEnt ) throws MediaExc, MediaFailure {
+      //check first if the media file exist since produced
+      //location is also the storage location
+
+      String date = ent.getValue("date");
+      String datePath = StringUtil.webdbDate2path(date);
+      String relPath = datePath+ent.getId()+"."+mediaTypeEnt.getValue("name");
+      String fname = getStoragePath()+relPath;
+      if(! new File(fname).exists())
+        throw new MediaExc("error in MirMedia.produce(): " + relPath + " does not exist!");
+    }
+
+    public InputStream getMedia (Entity ent, Entity mediaTypeEnt) throws MediaExc, MediaFailure {
+      String publishPath = ent.getValue("publish_path");
+      String fname = getStoragePath()+publishPath;
+      File f = new File(fname);
+      if(! f.exists())
+        throw new MediaExc("error in MirMedia.getMedia(): " + fname + " does not exist!");
+
+      FileInputStream inputStream;
+      try {
+        inputStream = new FileInputStream(f);
+      }
+      catch (Throwable e) {
+        throw new MediaFailure("MediaHandlerGeneric.getMedia(): " + e.toString(), e);
+      }
+
+      return inputStream;
+    }
+
+    public InputStream getIcon (Entity ent) throws MediaExc, MediaFailure {
+        return null;
+    }
+
+    public String getStoragePath()
+    {
+        return configuration.getString("Producer.Media.Path");
+    }
+
+    public String getIconStoragePath()
+    {
+        return configuration.getString("Producer.Image.IconPath");
+    }
+
+    public String getPublishHost()
+    {
+        return StringUtil.removeSlash(configuration.getString("Producer.Media.Host"));
+    }
+
+    public String getTinyIconName()
+    {
+        return configuration.getString("Producer.Icon.TinyText");
+    }
+
+    public String getBigIconName()
+    {
+        return configuration.getString("Producer.Icon.BigText");
+    }
+
+    public String getIconAltName()
+    {
+        return "Generic media";
+    }
+
+    public SimpleList getURL(Entity ent, Entity mediaTypeEnt)
+    {
+      SimpleList theList = new SimpleList();
+      theList.add(ent);
+      return theList;
+    }
+
+    public boolean isVideo()
+    {
+      return false;
+    }
+
+    public boolean isAudio()
+    {
+      return false;
+    }
+
+    public boolean isImage()
+    {
+      return false;
+    }
+
+    public String getDescr( Entity mediaType)
+    {
+      return mediaType.getValue("mime_type");
+    }
+
+}
+
+
+
index ce62a95..5edb12e 100755 (executable)
@@ -39,12 +39,11 @@ import mir.config.MirPropertiesConfiguration;
 import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
 import mir.entity.Entity;
 import mir.log.LoggerWrapper;
-import mir.media.MirMedia;
 import mir.media.MediaExc;
 import mir.media.MediaFailure;
+import mir.media.MirMedia;
 import mir.misc.FileUtil;
 import mir.misc.StringUtil;
-import mir.storage.StorageObjectFailure;
 import mircoders.entity.EntityImages;
 import freemarker.template.SimpleList;
 
@@ -62,7 +61,7 @@ import freemarker.template.SimpleList;
  *
  * @see mir.media.MirMedia
  * @author mh
- * @version $Id: MediaHandlerImages.java,v 1.20 2003/03/09 03:53:11 zapata Exp $
+ * @version $Id: MediaHandlerImages.java,v 1.21 2003/03/09 19:14:21 idfx Exp $
  */
 
 
index 2d4bbae..984de73 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package  mircoders.media;\r
-\r
-import java.io.StringReader;\r
-\r
-import mir.entity.Entity;\r
-import mir.log.LoggerWrapper;\r
-import mir.media.MirMedia;\r
-import mir.media.MediaExc;\r
-import mir.media.MediaFailure;\r
-import mir.misc.FileUtil;\r
-import mir.misc.StringUtil;\r
-import freemarker.template.SimpleHash;\r
-import freemarker.template.SimpleList;\r
-\r
-/**\r
- * Please note: this media handler produces\r
- * 3 media files, the raw .mp3, a .m3u which is\r
- * contains the URL for the mp3 and a .pls which\r
- * contains the URL to the mp3 in shoutcast playlist\r
- * format. What's important is that the web server (of\r
- * the media host) must recognize the .m3u and .pls file\r
- * extensions and send the proper "audio/x-mpegurl"\r
- * and "audio/x-scpls" mime-types respectively.\r
- * If the web server is apache, it's easy, just\r
- * add:\r
- *\r
- * audio/x-mpegurl                 m3u\r
- * audio/x-scpl                    pls\r
- *\r
- * to the file pointed to by the "TypesConfig"\r
- * command in your apache config file. Or add\r
- * and equivalent AddType command to your httpd.conf.\r
- * Of course this assumes that the mod_mime is loaded.\r
- *\r
- * If the web server is not apache, then your on your own.\r
- *\r
- * @see mir.media.MirMedia\r
- * @author mh <mh@nadir.org>\r
- * @version $Id: MediaHandlerMp3.java,v 1.13 2003/03/09 03:53:11 zapata Exp $\r
- */\r
-\r
-public class MediaHandlerMp3 extends MediaHandlerAudio implements MirMedia\r
-{\r
-  protected LoggerWrapper logger;\r
-\r
-  public MediaHandlerMp3() {\r
-    logger = new LoggerWrapper("Media.Audio.Mp3");\r
-  }\r
-\r
-  public void produce(Entity ent, Entity mediaTypeEnt) throws MediaExc, MediaFailure {\r
-\r
-    // first check if the file exists\r
-    super.produce(ent, mediaTypeEnt);\r
-\r
-    String baseName = ent.getId();\r
-    String date = ent.getValue("date");\r
-    String datePath = StringUtil.webdbDate2path(date);\r
-    String mp3Pointer = getPublishHost() + ent.getValue("publish_path");\r
-    String mpegURLFile = baseName + ".m3u";\r
-    String playlistFile = baseName + ".pls";\r
-\r
-    try {\r
-      //write the "meta" files\r
-      //first the .m3u since it only contains one line\r
-      FileUtil.write(getStoragePath() + "/" + datePath + "/" + mpegURLFile,\r
-                     new StringReader(mp3Pointer), "US-ASCII");\r
-      //now the .pls file\r
-      FileUtil.write(getStoragePath() + "/" + datePath + "/" + playlistFile,\r
-                     new StringReader(mp3Pointer), "US-ASCII");\r
-    }\r
-    catch (Throwable e) {\r
-      logger.error("MediaHandlerMp3.produce: " + e.toString());\r
-\r
-      throw new MediaFailure(e);\r
-    }\r
-  }\r
-\r
-  public SimpleList getURL(Entity ent, Entity mediaTypeEnt) {\r
-    SimpleList theList = new SimpleList();\r
-\r
-    //String stringSize = ent.getValue("size");\r
-    //int size = Integer.parseInt(stringSize, 10)/1024;\r
-    theList.add(ent);\r
-\r
-    String basePath = StringUtil.regexpReplace(ent.getValue("publish_path"),\r
-                                               ".mp3$", "");\r
-\r
-    // @todo the texts ("title") below urgently need to be sanely localizaeble\r
-    // somehow\r
-    SimpleHash m3uHash = new SimpleHash();\r
-    m3uHash.put("publish_path", basePath + ".m3u");\r
-    m3uHash.put("publish_server", ent.getValue("publish_server"));\r
-    m3uHash.put("title", "stream URL");\r
-    theList.add(m3uHash);\r
-\r
-    SimpleHash plsHash = new SimpleHash();\r
-    plsHash.put("publish_path", basePath + ".pls");\r
-    plsHash.put("publish_server", ent.getValue("publish_server"));\r
-    plsHash.put("title", "playlist URL");\r
-    theList.add(plsHash);\r
-\r
-    return theList;\r
-\r
-  }\r
-\r
-  public String getDescr(Entity mediaType) {\r
-    return "mp3";\r
-  }\r
-}\r
-\r
-\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package  mircoders.media;
+
+import java.io.StringReader;
+
+import mir.entity.Entity;
+import mir.log.LoggerWrapper;
+import mir.media.MediaExc;
+import mir.media.MediaFailure;
+import mir.media.MirMedia;
+import mir.misc.FileUtil;
+import mir.misc.StringUtil;
+import freemarker.template.SimpleHash;
+import freemarker.template.SimpleList;
+
+/**
+ * Please note: this media handler produces
+ * 3 media files, the raw .mp3, a .m3u which is
+ * contains the URL for the mp3 and a .pls which
+ * contains the URL to the mp3 in shoutcast playlist
+ * format. What's important is that the web server (of
+ * the media host) must recognize the .m3u and .pls file
+ * extensions and send the proper "audio/x-mpegurl"
+ * and "audio/x-scpls" mime-types respectively.
+ * If the web server is apache, it's easy, just
+ * add:
+ *
+ * audio/x-mpegurl                 m3u
+ * audio/x-scpl                    pls
+ *
+ * to the file pointed to by the "TypesConfig"
+ * command in your apache config file. Or add
+ * and equivalent AddType command to your httpd.conf.
+ * Of course this assumes that the mod_mime is loaded.
+ *
+ * If the web server is not apache, then your on your own.
+ *
+ * @see mir.media.MirMedia
+ * @author mh <mh@nadir.org>
+ * @version $Id: MediaHandlerMp3.java,v 1.14 2003/03/09 19:14:21 idfx Exp $
+ */
+
+public class MediaHandlerMp3 extends MediaHandlerAudio implements MirMedia
+{
+  protected LoggerWrapper logger;
+
+  public MediaHandlerMp3() {
+    logger = new LoggerWrapper("Media.Audio.Mp3");
+  }
+
+  public void produce(Entity ent, Entity mediaTypeEnt) throws MediaExc, MediaFailure {
+
+    // first check if the file exists
+    super.produce(ent, mediaTypeEnt);
+
+    String baseName = ent.getId();
+    String date = ent.getValue("date");
+    String datePath = StringUtil.webdbDate2path(date);
+    String mp3Pointer = getPublishHost() + ent.getValue("publish_path");
+    String mpegURLFile = baseName + ".m3u";
+    String playlistFile = baseName + ".pls";
+
+    try {
+      //write the "meta" files
+      //first the .m3u since it only contains one line
+      FileUtil.write(getStoragePath() + "/" + datePath + "/" + mpegURLFile,
+                     new StringReader(mp3Pointer), "US-ASCII");
+      //now the .pls file
+      FileUtil.write(getStoragePath() + "/" + datePath + "/" + playlistFile,
+                     new StringReader(mp3Pointer), "US-ASCII");
+    }
+    catch (Throwable e) {
+      logger.error("MediaHandlerMp3.produce: " + e.toString());
+
+      throw new MediaFailure(e);
+    }
+  }
+
+  public SimpleList getURL(Entity ent, Entity mediaTypeEnt) {
+    SimpleList theList = new SimpleList();
+
+    //String stringSize = ent.getValue("size");
+    //int size = Integer.parseInt(stringSize, 10)/1024;
+    theList.add(ent);
+
+    String basePath = StringUtil.regexpReplace(ent.getValue("publish_path"),
+                                               ".mp3$", "");
+
+    // @todo the texts ("title") below urgently need to be sanely localizaeble
+    // somehow
+    SimpleHash m3uHash = new SimpleHash();
+    m3uHash.put("publish_path", basePath + ".m3u");
+    m3uHash.put("publish_server", ent.getValue("publish_server"));
+    m3uHash.put("title", "stream URL");
+    theList.add(m3uHash);
+
+    SimpleHash plsHash = new SimpleHash();
+    plsHash.put("publish_path", basePath + ".pls");
+    plsHash.put("publish_server", ent.getValue("publish_server"));
+    plsHash.put("title", "playlist URL");
+    theList.add(plsHash);
+
+    return theList;
+
+  }
+
+  public String getDescr(Entity mediaType) {
+    return "mp3";
+  }
+}
+
+
+
index 4c3cc6f..47c758d 100755 (executable)
@@ -35,9 +35,9 @@ import java.io.StringReader;
 
 import mir.entity.Entity;
 import mir.log.LoggerWrapper;
-import mir.media.MirMedia;
 import mir.media.MediaExc;
 import mir.media.MediaFailure;
+import mir.media.MirMedia;
 import mir.misc.FileUtil;
 import mir.misc.StringUtil;
 import freemarker.template.SimpleHash;
@@ -53,7 +53,7 @@ import freemarker.template.SimpleList;
  * @see mir.media.MediaHandlerGeneric
  * @see mir.media.MirMedia
  * @author john <john@manifestor.org>, mh <heckmann@hbe.ca>
- * @version $Id: MediaHandlerRealAudio.java,v 1.17 2003/03/09 03:53:11 zapata Exp $
+ * @version $Id: MediaHandlerRealAudio.java,v 1.18 2003/03/09 19:14:21 idfx Exp $
  */
 
 
index ec78572..1fada7e 100755 (executable)
@@ -36,9 +36,9 @@ import java.io.StringReader;
 
 import mir.entity.Entity;
 import mir.log.LoggerWrapper;
-import mir.media.MirMedia;
 import mir.media.MediaExc;
 import mir.media.MediaFailure;
+import mir.media.MirMedia;
 import mir.misc.FileUtil;
 import mir.misc.StringUtil;
 import freemarker.template.SimpleHash;
@@ -54,7 +54,7 @@ import freemarker.template.SimpleList;
  * @see mir.media.MediaHandlerGeneric
  * @see mir.media.MirMedia
  * @author john <john@manifestor.org>, mh <mh@nadir.org>
- * @version $Id: MediaHandlerRealVideo.java,v 1.17 2003/03/09 03:53:11 zapata Exp $
+ * @version $Id: MediaHandlerRealVideo.java,v 1.18 2003/03/09 19:14:21 idfx Exp $
  */
 
 
index 6d94e77..473051c 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002  The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two.  You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries.  If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so.  If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.media;\r
-\r
-import java.util.GregorianCalendar;\r
-import java.util.Iterator;\r
-import java.util.Map;\r
-\r
-import javax.servlet.ServletContext;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.entity.Entity;\r
-import mir.entity.EntityList;\r
-import mir.log.LoggerWrapper;\r
-import mir.media.MediaHelper;\r
-import mir.media.MirMedia;\r
-\r
-import mir.misc.FileHandler;\r
-import mir.misc.StringUtil;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObjectExc;\r
-import mir.storage.StorageObjectFailure;\r
-import mircoders.storage.DatabaseMediaType;\r
-\r
-import com.oreilly.servlet.multipart.FilePart;\r
-\r
-\r
-/*\r
- *  MediaRequest.java -\r
- *    Takes an HTTPServletRequest from a mutltipart form and finds the files\r
- *    uploaded via the com.oreilly.servlet.multipart package. Finally the\r
- *    appropriate media objects are set.\r
- *\r
- * @author mh\r
- * @version $Id: MediaRequest.java,v 1.17 2003/03/09 03:53:11 zapata Exp $\r
- *\r
- */\r
-\r
-public class MediaRequest implements FileHandler\r
-{\r
-  private String _user;\r
-  private EntityList _returnList = new EntityList();\r
-  private boolean _publish;\r
-  private LoggerWrapper logger;\r
-\r
-  public MediaRequest(String user, boolean publish) {\r
-    _user = user;\r
-    _publish = publish;\r
-    logger = new LoggerWrapper("Media.Request");\r
-  }\r
-\r
-  public EntityList getEntityList() {\r
-    return _returnList;\r
-  }\r
-\r
-  /*\r
-   * parses the files in the uploaded media and creates media Entity's out of\r
-   * them.  Produces them if the "produce" argument is true. The "publish"\r
-   * parameter determines if it should publish per default in the case where no\r
-   * is_published parameter (from the upload form) is supplied. (for backwards\r
-   * compatibility.)\r
-   */\r
-  public void setFile(FilePart filePart, int fileNum, Map mediaValues) throws FileHandlerExc, FileHandlerFailure {\r
-\r
-    String mediaId=null;\r
-    MirMedia mediaHandler;\r
-    Database mediaStorage = null;\r
-\r
-    try {\r
-      String fileName = filePart.getFileName();\r
-\r
-      //get the content-type from what the client browser\r
-      //sends us. (the "Oreilly method")\r
-      String contentType = filePart.getContentType();\r
-\r
-      //theLog.printInfo("FROM BROWSER: "+contentType);\r
-\r
-      //if the client browser sent us unknown (text/plain is default)\r
-      //or if we got application/octet-stream, it's possible that\r
-      //the browser is in error, better check against the file extension\r
-      if (contentType.equals("text/plain") ||\r
-          contentType.equals("application/octet-stream")) {\r
-        /**\r
-         * Fallback to finding the mime-type through the standard ServletApi\r
-         * ServletContext getMimeType() method.\r
-         *\r
-         * This is a way to get the content-type via the .extension,\r
-         * we could maybe use a magic method as an additional method of\r
-         * figuring out the content-type, by looking at the header (first\r
-         * few bytes) of the file. (like the file(1) command). We could\r
-         * also call the "file" command through Runtime. This is an\r
-         * option that I almost prefer as it is already implemented and\r
-         * exists with an up-to-date map on most modern Unix like systems.\r
-         * I haven't found a really nice implementation of the magic method\r
-         * in pure java yet.\r
-         *\r
-         * The first method we try thought is the "Oreilly method". It\r
-         * relies on the content-type that the client browser sends and\r
-         * that sometimes is application-octet stream with\r
-         * broken/mis-configured browsers.\r
-         *\r
-         * The map file we use for the extensions is the standard web-app\r
-         * deployment descriptor file (web.xml). See Mir's web.xml or see\r
-         * your Servlet containers (most likely Tomcat) documentation.\r
-         * So if you support a new media type you have to make sure that\r
-         * it is in this file -mh\r
-         */\r
-        ServletContext ctx = MirPropertiesConfiguration.getContext();\r
-        contentType = ctx.getMimeType(fileName);\r
-        if (contentType==null)\r
-          contentType = "text/plain"; // rfc1867 says this is the default\r
-      }\r
-      //theLog.printInfo("CONTENT TYPE IS: "+contentType);\r
-\r
-      if (contentType.equals("text/plain") ||\r
-          contentType.equals("application/octet-stream")) {\r
-        _throwBadContentType(fileName, contentType);\r
-      }\r
-\r
-      // call the routines that escape html\r
-      for (Iterator i=mediaValues.keySet().iterator(); i.hasNext(); ){\r
-        String k=(String)i.next();\r
-        String v=(String)mediaValues.get(k);\r
-\r
-        if (k.equals("description")) {\r
-          String tmp = StringUtil.deleteForbiddenTags(v);\r
-          mediaValues.put(k,StringUtil.deleteHTMLTableTags(tmp));\r
-        } else {\r
-          //we don't want people fucking with the author/title, etc..\r
-          mediaValues.put(k,StringUtil.removeHTMLTags(v));\r
-        }\r
-\r
-      }\r
-\r
-      String mediaTitle = (String)mediaValues.get("media_title"+fileNum);\r
-      if ( (mediaTitle == null) || (mediaTitle.length() == 0)) {\r
-        //  uncomment the next line and comment out the exception throw\r
-        //  if you'd rather just assign missing media titles automatically\r
-        //  mediaTitle="media item "+fileNum;\r
-//        throw new FileHandlerUserException("Missing field: media title "+mediaTitle+fileNum);\r
-      }\r
-\r
-      // TODO: need to add all the extra fields that can be present in the\r
-      // admin upload form. -mh\r
-      mediaValues.put("title", mediaTitle);\r
-      mediaValues.put("date", StringUtil.date2webdbDate(\r
-                                                    new GregorianCalendar()));\r
-      mediaValues.put("to_publisher", _user);\r
-      //mediaValues.put("to_media_folder", "7"); // op media_folder\r
-      mediaValues.put("is_produced", "0");\r
-\r
-      // icky backwards compatibility code -mh\r
-      if (_publish == true) {\r
-        mediaValues.put("is_published", "1");\r
-      } else {\r
-        if (!mediaValues.containsKey("is_published"))\r
-          mediaValues.put("is_published", "0");\r
-      }\r
-\r
-      // @todo this should probably be moved to DatabaseMediaType -mh\r
-      String[] cTypeSplit = StringUtil.split(contentType, "/");\r
-      String wc = " mime_type LIKE '"+cTypeSplit[0]+"%'";\r
-\r
-      DatabaseMediaType mediaTypeStor = DatabaseMediaType.getInstance();\r
-      EntityList mediaTypesList = mediaTypeStor.selectByWhereClause(wc);\r
-\r
-      String mediaTypeId = null;\r
-\r
-      //if we didn't find an entry matching the\r
-      //content-type int the table.\r
-      if (mediaTypesList.size() == 0) {\r
-       _throwBadContentType(fileName, contentType);\r
-      }\r
-\r
-      Entity mediaType = null;\r
-      Entity mediaType2 = null;\r
-\r
-      // find out if we an exact content-type match if so take it.\r
-      // otherwise try to match majortype/*\r
-      // @todo this should probably be moved to DatabaseMediaType -mh\r
-      for(int j=0;j<mediaTypesList.size();j++) {\r
-        if(contentType.equals(\r
-              mediaTypesList.elementAt(j).getValue("mime_type")))\r
-          mediaType = mediaTypesList.elementAt(j);\r
-        else if ((mediaTypesList.elementAt(j).getValue("mime_type")).equals(\r
-                  cTypeSplit[0]+"/*") )\r
-          mediaType2= mediaTypesList.elementAt(j);\r
-      }\r
-\r
-      if ( (mediaType == null) && (mediaType2 == null) ) {\r
-        _throwBadContentType(fileName, contentType);\r
-      } else if( (mediaType == null) && (mediaType2 != null) ) {\r
-        mediaType = mediaType2;\r
-      }\r
-\r
-      //get the class names from the media_type table.\r
-      mediaTypeId = mediaType.getId();\r
-      // ############### @todo: merge these and the getURL call into one\r
-      // getURL helper call that just takes the Entity as a parameter\r
-      // along with media_type\r
-      try {\r
-        mediaHandler = MediaHelper.getHandler(mediaType);\r
-        mediaStorage = MediaHelper.getStorage(mediaType, "mircoders.storage.Database");\r
-      }\r
-      catch (Throwable e) {\r
-        throw new FileHandlerFailure(e);\r
-      }\r
-      mediaValues.put("to_media_type",mediaTypeId);\r
-\r
-      //load the classes via reflection\r
-      String MediaId;\r
-      Entity mediaEnt = null;\r
-\r
-      try {\r
-        mediaEnt = (Entity)mediaStorage.getEntityClass().newInstance();\r
-      }\r
-      catch (Throwable e) {\r
-        throw new FileHandlerFailure("MediaRequest.setFile: "+e.toString(), e);\r
-      }\r
-\r
-      mediaEnt.setStorage(mediaStorage);\r
-      mediaEnt.setValues(mediaValues);\r
-      mediaId = mediaEnt.insert();\r
-\r
-      //save and store the media data/metadata\r
-      try {\r
-        mediaHandler.set(filePart.getInputStream(), mediaEnt, mediaType);\r
-      }\r
-      catch (Throwable e) {\r
-        throw new FileHandlerFailure("MediaRequest.setFile: "+e.toString(), e);\r
-      }\r
-\r
-      _returnList.add(mediaEnt);\r
-    }\r
-    catch (StorageObjectFailure e) {\r
-      // first try to delete it.. don't catch exception as we've already..\r
-      try {\r
-        mediaStorage.delete(mediaId);\r
-      }\r
-      catch (Exception e2) {\r
-      }\r
-      throw new FileHandlerFailure("MediaRequest.setFile: "+e.toString(), e);\r
-    }\r
-    catch (Throwable e) {\r
-      throw new FileHandlerFailure("MediaRequest.setFile: "+e.toString(), e);\r
-    } //end try/catch block\r
-\r
-  } // method setFile()\r
-\r
-  private void _throwBadContentType (String fileName, String contentType) throws FileHandlerExc, FileHandlerFailure {\r
-    try {\r
-      throw new UnsupportedMediaFormatExc(\r
-          "The file you uploaded is of the following mime-type: " + contentType +\r
-          ", we do not support this mime-type. "\r
-          + "Error One or more files of unrecognized type. Sorry");\r
-    }\r
-    catch (Throwable t) {\r
-      throw new FileHandlerFailure(t);\r
-    }\r
-  }\r
-\r
-}\r
-\r
+/*
+ * Copyright (C) 2001, 2002  The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with the com.oreilly.servlet library, any library
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of
+ * the above that use the same license as the above), and distribute linked
+ * combinations including the two.  You must obey the GNU General Public
+ * License in all respects for all of the code used other than the above
+ * mentioned libraries.  If you modify this file, you may extend this exception
+ * to your version of the file, but you are not obligated to do so.  If you do
+ * not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.media;
+
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.entity.Entity;
+import mir.entity.EntityList;
+import mir.log.LoggerWrapper;
+import mir.media.MediaHelper;
+import mir.media.MirMedia;
+import mir.misc.FileHandler;
+import mir.misc.StringUtil;
+import mir.storage.Database;
+import mir.storage.StorageObjectFailure;
+import mircoders.storage.DatabaseMediaType;
+
+import com.oreilly.servlet.multipart.FilePart;
+
+
+/*
+ *  MediaRequest.java -
+ *    Takes an HTTPServletRequest from a mutltipart form and finds the files
+ *    uploaded via the com.oreilly.servlet.multipart package. Finally the
+ *    appropriate media objects are set.
+ *
+ * @author mh
+ * @version $Id: MediaRequest.java,v 1.18 2003/03/09 19:14:21 idfx Exp $
+ *
+ */
+
+public class MediaRequest implements FileHandler
+{
+  private String _user;
+  private EntityList _returnList = new EntityList();
+  private boolean _publish;
+  private LoggerWrapper logger;
+
+  public MediaRequest(String user, boolean publish) {
+    _user = user;
+    _publish = publish;
+    logger = new LoggerWrapper("Media.Request");
+  }
+
+  public EntityList getEntityList() {
+    return _returnList;
+  }
+
+  /*
+   * parses the files in the uploaded media and creates media Entity's out of
+   * them.  Produces them if the "produce" argument is true. The "publish"
+   * parameter determines if it should publish per default in the case where no
+   * is_published parameter (from the upload form) is supplied. (for backwards
+   * compatibility.)
+   */
+  public void setFile(FilePart filePart, int fileNum, Map mediaValues) throws FileHandlerExc, FileHandlerFailure {
+
+    String mediaId=null;
+    MirMedia mediaHandler;
+    Database mediaStorage = null;
+
+    try {
+      String fileName = filePart.getFileName();
+
+      //get the content-type from what the client browser
+      //sends us. (the "Oreilly method")
+      String contentType = filePart.getContentType();
+
+      //theLog.printInfo("FROM BROWSER: "+contentType);
+
+      //if the client browser sent us unknown (text/plain is default)
+      //or if we got application/octet-stream, it's possible that
+      //the browser is in error, better check against the file extension
+      if (contentType.equals("text/plain") ||
+          contentType.equals("application/octet-stream")) {
+        /**
+         * Fallback to finding the mime-type through the standard ServletApi
+         * ServletContext getMimeType() method.
+         *
+         * This is a way to get the content-type via the .extension,
+         * we could maybe use a magic method as an additional method of
+         * figuring out the content-type, by looking at the header (first
+         * few bytes) of the file. (like the file(1) command). We could
+         * also call the "file" command through Runtime. This is an
+         * option that I almost prefer as it is already implemented and
+         * exists with an up-to-date map on most modern Unix like systems.
+         * I haven't found a really nice implementation of the magic method
+         * in pure java yet.
+         *
+         * The first method we try thought is the "Oreilly method". It
+         * relies on the content-type that the client browser sends and
+         * that sometimes is application-octet stream with
+         * broken/mis-configured browsers.
+         *
+         * The map file we use for the extensions is the standard web-app
+         * deployment descriptor file (web.xml). See Mir's web.xml or see
+         * your Servlet containers (most likely Tomcat) documentation.
+         * So if you support a new media type you have to make sure that
+         * it is in this file -mh
+         */
+        ServletContext ctx = MirPropertiesConfiguration.getContext();
+        contentType = ctx.getMimeType(fileName);
+        if (contentType==null)
+          contentType = "text/plain"; // rfc1867 says this is the default
+      }
+      //theLog.printInfo("CONTENT TYPE IS: "+contentType);
+
+      if (contentType.equals("text/plain") ||
+          contentType.equals("application/octet-stream")) {
+        _throwBadContentType(fileName, contentType);
+      }
+
+      // call the routines that escape html
+      for (Iterator i=mediaValues.keySet().iterator(); i.hasNext(); ){
+        String k=(String)i.next();
+        String v=(String)mediaValues.get(k);
+
+        if (k.equals("description")) {
+          String tmp = StringUtil.deleteForbiddenTags(v);
+          mediaValues.put(k,StringUtil.deleteHTMLTableTags(tmp));
+        } else {
+          //we don't want people fucking with the author/title, etc..
+          mediaValues.put(k,StringUtil.removeHTMLTags(v));
+        }
+
+      }
+
+      String mediaTitle = (String)mediaValues.get("media_title"+fileNum);
+      if ( (mediaTitle == null) || (mediaTitle.length() == 0)) {
+        //  uncomment the next line and comment out the exception throw
+        //  if you'd rather just assign missing media titles automatically
+        //  mediaTitle="media item "+fileNum;
+//        throw new FileHandlerUserException("Missing field: media title "+mediaTitle+fileNum);
+      }
+
+      // TODO: need to add all the extra fields that can be present in the
+      // admin upload form. -mh
+      mediaValues.put("title", mediaTitle);
+      mediaValues.put("date", StringUtil.date2webdbDate(
+                                                    new GregorianCalendar()));
+      mediaValues.put("to_publisher", _user);
+      //mediaValues.put("to_media_folder", "7"); // op media_folder
+      mediaValues.put("is_produced", "0");
+
+      // icky backwards compatibility code -mh
+      if (_publish == true) {
+        mediaValues.put("is_published", "1");
+      } else {
+        if (!mediaValues.containsKey("is_published"))
+          mediaValues.put("is_published", "0");
+      }
+
+      // @todo this should probably be moved to DatabaseMediaType -mh
+      String[] cTypeSplit = StringUtil.split(contentType, "/");
+      String wc = " mime_type LIKE '"+cTypeSplit[0]+"%'";
+
+      DatabaseMediaType mediaTypeStor = DatabaseMediaType.getInstance();
+      EntityList mediaTypesList = mediaTypeStor.selectByWhereClause(wc);
+
+      String mediaTypeId = null;
+
+      //if we didn't find an entry matching the
+      //content-type int the table.
+      if (mediaTypesList.size() == 0) {
+       _throwBadContentType(fileName, contentType);
+      }
+
+      Entity mediaType = null;
+      Entity mediaType2 = null;
+
+      // find out if we an exact content-type match if so take it.
+      // otherwise try to match majortype/*
+      // @todo this should probably be moved to DatabaseMediaType -mh
+      for(int j=0;j<mediaTypesList.size();j++) {
+        if(contentType.equals(
+              mediaTypesList.elementAt(j).getValue("mime_type")))
+          mediaType = mediaTypesList.elementAt(j);
+        else if ((mediaTypesList.elementAt(j).getValue("mime_type")).equals(
+                  cTypeSplit[0]+"/*") )
+          mediaType2= mediaTypesList.elementAt(j);
+      }
+
+      if ( (mediaType == null) && (mediaType2 == null) ) {
+        _throwBadContentType(fileName, contentType);
+      } else if( (mediaType == null) && (mediaType2 != null) ) {
+        mediaType = mediaType2;
+      }
+
+      //get the class names from the media_type table.
+      mediaTypeId = mediaType.getId();
+      // ############### @todo: merge these and the getURL call into one
+      // getURL helper call that just takes the Entity as a parameter
+      // along with media_type
+      try {
+        mediaHandler = MediaHelper.getHandler(mediaType);
+        mediaStorage = MediaHelper.getStorage(mediaType, "mircoders.storage.Database");
+      }
+      catch (Throwable e) {
+        throw new FileHandlerFailure(e);
+      }
+      mediaValues.put("to_media_type",mediaTypeId);
+
+      //load the classes via reflection
+      String MediaId;
+      Entity mediaEnt = null;
+
+      try {
+        mediaEnt = (Entity)mediaStorage.getEntityClass().newInstance();
+      }
+      catch (Throwable e) {
+        throw new FileHandlerFailure("MediaRequest.setFile: "+e.toString(), e);
+      }
+
+      mediaEnt.setStorage(mediaStorage);
+      mediaEnt.setValues(mediaValues);
+      mediaId = mediaEnt.insert();
+
+      //save and store the media data/metadata
+      try {
+        mediaHandler.set(filePart.getInputStream(), mediaEnt, mediaType);
+      }
+      catch (Throwable e) {
+        throw new FileHandlerFailure("MediaRequest.setFile: "+e.toString(), e);
+      }
+
+      _returnList.add(mediaEnt);
+    }
+    catch (StorageObjectFailure e) {
+      // first try to delete it.. don't catch exception as we've already..
+      try {
+        mediaStorage.delete(mediaId);
+      }
+      catch (Exception e2) {
+      }
+      throw new FileHandlerFailure("MediaRequest.setFile: "+e.toString(), e);
+    }
+    catch (Throwable e) {
+      throw new FileHandlerFailure("MediaRequest.setFile: "+e.toString(), e);
+    } //end try/catch block
+
+  } // method setFile()
+
+  private void _throwBadContentType (String fileName, String contentType) throws FileHandlerExc, FileHandlerFailure {
+    try {
+      throw new UnsupportedMediaFormatExc(
+          "The file you uploaded is of the following mime-type: " + contentType +
+          ", we do not support this mime-type. "
+          + "Error One or more files of unrecognized type. Sorry");
+    }
+    catch (Throwable t) {
+      throw new FileHandlerFailure(t);
+    }
+  }
+
+}
+
index d34b81c..7e66c25 100755 (executable)
@@ -39,8 +39,6 @@ import mir.module.AbstractModule;
 import mir.module.ModuleExc;
 import mir.module.ModuleFailure;
 import mir.storage.StorageObject;
-import mir.storage.StorageObjectExc;
-import mir.storage.StorageObjectFailure;
 import mircoders.storage.DatabaseComment;
 import mircoders.storage.DatabaseContent;
 import freemarker.template.SimpleList;
index 4bb40ce..f697f8b 100755 (executable)
 
 package mircoders.module;
 
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-
 import mir.entity.EntityList;
 import mir.log.LoggerWrapper;
 import mir.module.AbstractModule;
 import mir.module.ModuleExc;
 import mir.module.ModuleFailure;
 import mir.storage.StorageObject;
-import mir.storage.StorageObjectFailure;
-import mir.util.JDBCStringRoutines;
-import mircoders.entity.EntityUsers;
-import mircoders.storage.DatabaseContentToMedia;
 
 /*
  *  ContentObjekt -
  *
- * @version $Id: ModuleContent.java,v 1.17 2003/03/09 03:53:11 zapata Exp $
+ * @version $Id: ModuleContent.java,v 1.18 2003/03/09 19:14:21 idfx Exp $
  *
  * @author RK, mir-coders
  *
index 715530f..cfcfcfd 100755 (executable)
@@ -33,12 +33,7 @@ package mircoders.module;
 
 import mir.log.LoggerWrapper;
 import mir.module.AbstractModule;
-import mir.module.ModuleExc;
-import mir.module.ModuleFailure;
 import mir.storage.StorageObject;
-import mir.storage.StorageObjectFailure;
-import mircoders.storage.DatabaseImages;
-import freemarker.template.SimpleList;
 
 public class ModuleImages extends AbstractModule {
   static LoggerWrapper logger = new LoggerWrapper("Module.Images");
index e8efdfd..6cdce27 100755 (executable)
@@ -40,8 +40,6 @@ import mir.module.AbstractModule;
 import mir.module.ModuleExc;
 import mir.module.ModuleFailure;
 import mir.storage.StorageObject;
-import mir.storage.StorageObjectExc;
-import mir.storage.StorageObjectFailure;
 import mircoders.storage.DatabaseTopics;
 import freemarker.template.SimpleList;
 
index 37c8ab2..bb66674 100755 (executable)
@@ -45,7 +45,6 @@ import mir.entity.adapter.EntityAdapterModel;
 import mir.entity.adapter.EntityIteratorAdapter;
 import mir.log.LoggerWrapper;
 import mir.misc.StringUtil;
-import mir.module.ModuleExc;
 import mir.servlet.ServletModule;
 import mir.servlet.ServletModuleExc;
 import mir.servlet.ServletModuleFailure;
@@ -72,7 +71,7 @@ import freemarker.template.SimpleHash;
  *  ServletModuleContent -
  *  deliver html for the article admin form.
  *
- * @version $Id: ServletModuleContent.java,v 1.42 2003/03/09 03:53:11 zapata Exp $
+ * @version $Id: ServletModuleContent.java,v 1.43 2003/03/09 19:14:21 idfx Exp $
  * @author rk, mir-coders
  *
  */
index b87c5d1..1c6c76f 100755 (executable)
@@ -54,25 +54,6 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
-import org.apache.commons.net.smtp.SMTPClient;
-import org.apache.commons.net.smtp.SMTPReply;
-import org.apache.fop.apps.Driver;
-import org.apache.fop.apps.XSLTInputHandler;
-import org.apache.log.Hierarchy;
-import org.apache.log.Priority;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Hits;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.Searcher;
-
-import freemarker.template.SimpleHash;
-import freemarker.template.SimpleList;
-import freemarker.template.SimpleScalar;
-import freemarker.template.TemplateModelRoot;
-
 import mir.entity.Entity;
 import mir.entity.EntityList;
 import mir.log.LoggerWrapper;
@@ -85,8 +66,8 @@ import mir.servlet.ServletModuleExc;
 import mir.servlet.ServletModuleFailure;
 import mir.servlet.ServletModuleUserExc;
 import mir.storage.StorageObjectFailure;
-import mir.util.StringRoutines;
 import mir.util.ExceptionFunctions;
+import mir.util.StringRoutines;
 import mircoders.entity.EntityComment;
 import mircoders.entity.EntityContent;
 import mircoders.global.MirGlobal;
@@ -112,6 +93,25 @@ import mircoders.storage.DatabaseImages;
 import mircoders.storage.DatabaseLanguage;
 import mircoders.storage.DatabaseTopics;
 
+import org.apache.commons.net.smtp.SMTPClient;
+import org.apache.commons.net.smtp.SMTPReply;
+import org.apache.fop.apps.Driver;
+import org.apache.fop.apps.XSLTInputHandler;
+import org.apache.log.Hierarchy;
+import org.apache.log.Priority;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.Hits;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.Searcher;
+
+import freemarker.template.SimpleHash;
+import freemarker.template.SimpleList;
+import freemarker.template.SimpleScalar;
+import freemarker.template.TemplateModelRoot;
+
 /*
  *  ServletModuleOpenIndy -
  *   is the open-access-servlet, which is responsible for
@@ -119,7 +119,7 @@ import mircoders.storage.DatabaseTopics;
  *    open-postings to the newswire
  *
  * @author mir-coders group
- * @version $Id: ServletModuleOpenIndy.java,v 1.66 2003/03/09 05:52:13 zapata Exp $
+ * @version $Id: ServletModuleOpenIndy.java,v 1.67 2003/03/09 19:14:21 idfx Exp $
  *
  */
 
index e74ada6..88dfa68 100755 (executable)
@@ -31,7 +31,6 @@
 
 package mircoders.servlet;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.net.URLEncoder;
 import java.util.Map;
@@ -42,11 +41,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
-import freemarker.template.SimpleHash;
-import freemarker.template.SimpleList;
-
 import mir.config.MirPropertiesConfiguration;
-import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
 import mir.entity.Entity;
 import mir.entity.EntityList;
 import mir.log.LoggerWrapper;
@@ -58,7 +53,6 @@ import mir.servlet.ServletModule;
 import mir.servlet.ServletModuleExc;
 import mir.servlet.ServletModuleFailure;
 import mir.servlet.ServletModuleUserExc;
-import mir.storage.StorageObjectFailure;
 import mir.util.ExceptionFunctions;
 import mircoders.entity.EntityContent;
 import mircoders.entity.EntityUploadedMedia;
@@ -67,12 +61,14 @@ import mircoders.media.MediaRequest;
 import mircoders.media.UnsupportedMediaFormatExc;
 import mircoders.storage.DatabaseContent;
 import mircoders.storage.DatabaseMediafolder;
+import freemarker.template.SimpleHash;
+import freemarker.template.SimpleList;
 
 /*
  *  ServletModuleBilder -
  *  liefert HTML fuer Bilder
  *
- * @version $Id: ServletModuleUploadedMedia.java,v 1.22 2003/03/09 05:52:13 zapata Exp $
+ * @version $Id: ServletModuleUploadedMedia.java,v 1.23 2003/03/09 19:14:21 idfx Exp $
  * @author RK, the mir-coders group
  */