there's still a little more left to do..
-[Updated 26.10.2001. -mh]
+[Updated 29.01.2002. -mh]
Version 1.0:
b) code-cleaning
- the variable-names for the freemarker should be better: the same name for the same thing
c) We have to make sure that all errors are handled intelligently. e.g. if an
-article is corrupt, do we just ignore it, etc..
+article is corrupt, do we just ignore it, etc.. (almost there, mh)
d) Admin interface needs to be made aware of media handlers (mj)
-e) insposting() in ServletModuleOpenIndy should not insert article text if any associated media upload is wrong. (mh)
+e) insposting() in ServletModuleOpenIndy should not insert article text if any associated media upload is wrong. (done, mh)
c) documentation
- it lacks a documentation for creating the producer-templates
-d) new layout Mir/OpenMir (gilad)
-e) translating the templates/code-comments to english
+d) new layout Mir/OpenMir (gilad, indy de team??)
+e) translating the templates/code-comments to english (underway, mir-coders)
f) mission-statement and licensing
-g) there are no memory-leaks
+g) there are no memory-leaks (done, confirmed by indy NL)
New Features:
protected String imageHost = MirConfig.getProp("Producer.Image.Host");
protected String imageRoot = MirConfig.getProp("Producer.ImageRoot");
protected Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home")+"log/media.log");
- public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ) {
+ public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt )
+ throws MirMediaException {
+
String ext = mediaTypeEnt.getValue("name");
String dir = MirConfig.getProp("Producer.Media.Path");
String mediaHost = MirConfig.getProp("Producer.Media.Host");
String date = ent.getValue("date");
String datePath = StringUtil.webdbDate2path(date);
Integer size = new Integer(uploadedData.length);
- if(FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData)) {
- //if(FileUtil.write(dir+"/"+mediaFname, uploadedData)) {
+ try {
+ FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData);
+ //if(FileUtil.write(dir+"/"+mediaFname, uploadedData)) {
//were done with the data, dereference.
uploadedData=null;
- try {
- ent.setValueForProperty("is_produced", "1");
- ent.setValueForProperty("icon_is_produced", "1");
- ent.setValueForProperty("publish_path",datePath+"/"+mediaFname);
- //ent.setValueForProperty("publish_path", mediaFname);
- ent.setValueForProperty("publish_server", mediaHost);
- ent.setValueForProperty("size", size.toString());
- ent.update();
- } catch (StorageObjectException e) {
- theLog.printError("StorageObjectException: "+e.toString());
- return false;
- }
- } else {
- theLog.printError("could not write FILE!");
- return false;
+ ent.setValueForProperty("is_produced", "1");
+ ent.setValueForProperty("icon_is_produced", "1");
+ ent.setValueForProperty("publish_path",datePath+"/"+mediaFname);
+ //ent.setValueForProperty("publish_path", mediaFname);
+ ent.setValueForProperty("publish_server", mediaHost);
+ ent.setValueForProperty("size", size.toString());
+ ent.update();
+ } catch (Exception e) {
+ theLog.printError(e.toString());
+ throw new MirMediaException(e.toString());
}
return true;
}
//a class that will probably never get used..
- private byte[] getFile (String fileName) {
+ private byte[] getFile (String fileName)
+ throws MirMediaException {
+
long size = FileUtil.getSize(fileName);
if (size < 0) return null;
byte[] container = new byte[(int)size];
- if(!FileUtil.read(fileName, container))
- return null;
+ try {
+ FileUtil.read(fileName, container);
+ } catch (Exception e) {
+ theLog.printError(e.toString());
+ throw new MirMediaException(e.toString());
+ }
return container;
}
}
public byte[] getIcon (Entity ent) {
- String name = "/path/to/some/generic/icon";
- return getFile(name);
+ return null;
}
public String getStoragePath()
protected String imageType="0";
private Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home")+"log/media.log");
- public byte[] get(Entity ent, Entity mediaTypeEnt)
+ public byte[] get(Entity ent, Entity mediaTypeEnt) throws MirMediaException
{
byte[] image_data = null;
image_data = (byte[])method.invoke(ent, null);
} catch ( NoSuchMethodException e) {
theLog.printDebugInfo("method lookup unsuccesful: "+e.toString());
+ throw new MirMediaException(e.toString());
} catch ( IllegalAccessException e) {
theLog.printDebugInfo("method illegal: "+e.toString());
+ throw new MirMediaException(e.toString());
} catch ( InvocationTargetException e) {
theLog.printDebugInfo("get: invocation target illegal: "+e.toString());
+ throw new MirMediaException(e.toString());
}
}
protected boolean set(byte[] uploadData, Entity ent, Entity mediaTypeEnt)
- {
+ throws MirMediaException {
+
try {
Class[] params = {byte[].class, String.class};
theLog.printDebugInfo("NAME: "+ent.getClass().getName()+" "+
method.invoke(ent, new Object[] {uploadData, imageType});
} catch ( NoSuchMethodException e) {
theLog.printDebugInfo("method lookup unsuccesful: "+e.toString());
- return false;
+ throw new MirMediaException(e.toString());
} catch ( IllegalAccessException e) {
theLog.printDebugInfo("method illegal: "+e.toString());
- return false;
+ throw new MirMediaException(e.toString());
} catch ( InvocationTargetException e) {
theLog.printDebugInfo("set: invocation target illegal: "+e.toString());
- return false;
+ throw new MirMediaException(e.toString());
}
//deref. -mh
uploadData=null;
return true;
}
- public byte[] getIcon(Entity ent)
+ public byte[] getIcon(Entity ent) throws MirMediaException
{
byte[] icon_data = null;
icon_data = (byte[])method.invoke(ent, null);
} catch ( NoSuchMethodException e) {
theLog.printDebugInfo("method lookup unsuccesful: "+e.toString());
+ throw new MirMediaException(e.toString());
} catch ( IllegalAccessException e) {
theLog.printDebugInfo("method illegal: "+e.toString());
+ throw new MirMediaException(e.toString());
} catch ( InvocationTargetException e) {
theLog.printDebugInfo("getIcon: invocation target illegal: "+e.toString());
+ throw new MirMediaException(e.toString());
}
return icon_data;
{
public boolean set(byte[] uploadData, Entity ent, Entity mediaTypeEnt)
- {
+ throws MirMediaException {
+
imageType = WEBDB_GIF;
- return super.set(uploadData, ent, mediaTypeEnt);
+ try {
+ return super.set(uploadData, ent, mediaTypeEnt);
+ } catch (Exception e) {
+ throw new MirMediaException(e.toString());
+ }
}
}
public class MediaHandlerImagesJpeg extends MediaHandlerImages implements MirMedia
{
public boolean set(byte[] uploadData, Entity ent, Entity mediaTypeEnt)
- {
+ throws MirMediaException {
+
imageType = WEBDB_JPG;
- return super.set(uploadData, ent, mediaTypeEnt);
+ try {
+ return super.set(uploadData, ent, mediaTypeEnt);
+ } catch (Exception e) {
+ throw new MirMediaException(e.toString());
+ }
}
}
public class MediaHandlerMp3 extends MediaHandlerAudio implements MirMedia
{
- public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ) {
+ public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt )
+ throws MirMediaException {
+
String ext = mediaTypeEnt.getValue("name");
String dir = MirConfig.getProp("Producer.Media.Path");
String mediaHost = MirConfig.getProp("Producer.Media.Host");
String mpegURLFile = baseName+".m3u";
String playlistFile = baseName+".pls";
Integer size = new Integer(uploadedData.length);
- if(FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData)) {
- //if(FileUtil.write(dir+"/"+mediaFname, uploadedData)) {
+ try {
+ FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData);
+ //FileUtil.write(dir+"/"+mediaFname, uploadedData);
//were done with the data, dereference.
uploadedData=null;
- try {
- //write the "meta" files
- //first the .m3u since it only contains one line
- FileUtil.write(dir+"/"+datePath+"/"+mpegURLFile,mp3Pointer.getBytes());
- //now the .pls file
- FileUtil.write(dir+"/"+datePath+"/"+playlistFile,mp3Pointer.getBytes());
- ent.setValueForProperty("is_produced", "1");
- ent.setValueForProperty("icon_is_produced", "1");
- ent.setValueForProperty("publish_path",datePath+"/"+mediaFname);
- //ent.setValueForProperty("publish_path", mediaFname);
- ent.setValueForProperty("publish_server", mediaHost);
- ent.setValueForProperty("size", size.toString());
- ent.update();
- } catch (StorageObjectException e) {
- theLog.printError("StorageObjectException: "+e.toString());
- return false;
- }
- } else {
- theLog.printError("could not write FILE!");
- return false;
+ //write the "meta" files
+ //first the .m3u since it only contains one line
+ FileUtil.write(dir+"/"+datePath+"/"+mpegURLFile,mp3Pointer.getBytes());
+ //now the .pls file
+ FileUtil.write(dir+"/"+datePath+"/"+playlistFile,mp3Pointer.getBytes());
+ ent.setValueForProperty("is_produced", "1");
+ ent.setValueForProperty("icon_is_produced", "1");
+ ent.setValueForProperty("publish_path",datePath+"/"+mediaFname);
+ //ent.setValueForProperty("publish_path", mediaFname);
+ ent.setValueForProperty("publish_server", mediaHost);
+ ent.setValueForProperty("size", size.toString());
+ ent.update();
+ } catch (Exception e) {
+ theLog.printError(e.toString());
+ throw new MirMediaException(e.toString());
}
return true;
public class MediaHandlerRealAudio extends MediaHandlerAudio implements MirMedia
{
- public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ) {
+ public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt )
+ throws MirMediaException {
String ext = mediaTypeEnt.getValue("name");
String dir = MirConfig.getProp("Producer.Media.Path");
String rtspDir = MirConfig.getProp("Producer.RealMedia.Path");
String realMediaPointer = rtspMediaHost+datePath+mediaFname;
String realMediaFile = ent.getId()+".ram";
Integer size = new Integer(uploadedData.length);
- if(FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData)) {
- //if(FileUtil.write(rtspDir+"/"+mediaFname, uploadedData)) {
+ try {
+ FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData);
+ //FileUtil.write(rtspDir+"/"+mediaFname, uploadedData);
//were done with the data, dereference.
uploadedData=null;
- try {
- //write a ram file
- FileUtil.write(dir+"/"+datePath+"/"+realMediaFile,realMediaPointer.getBytes());
- ent.setValueForProperty("is_produced", "1");
- ent.setValueForProperty("icon_is_produced", "1");
- ent.setValueForProperty("publish_path",datePath+"/"+realMediaFile);
- //ent.setValueForProperty("publish_path", realMediaFile);
- ent.setValueForProperty("publish_server", mediaHost);
- ent.setValueForProperty("size", size.toString());
- ent.update();
- } catch (StorageObjectException e) {
- theLog.printError("StorageObjectException: "+e.toString());
- return false;
- }
- } else {
- theLog.printError("could not write FILE!");
- return false;
+ //write a ram file
+ FileUtil.write(dir+"/"+datePath+"/"+realMediaFile,realMediaPointer.getBytes());
+ ent.setValueForProperty("is_produced", "1");
+ ent.setValueForProperty("icon_is_produced", "1");
+ ent.setValueForProperty("publish_path",datePath+"/"+realMediaFile);
+ //ent.setValueForProperty("publish_path", realMediaFile);
+ ent.setValueForProperty("publish_server", mediaHost);
+ ent.setValueForProperty("size", size.toString());
+ ent.update();
+ } catch (Exception e) {
+ theLog.printError(e.toString());
+ throw new MirMediaException(e.toString());
}
return true;
private String imageHost = MirConfig.getProp("Producer.Image.Host");
private static String imageRoot = MirConfig.getProp("Producer.ImageRoot");
private Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home")+"log/media.log");
- public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ) {
+
+ public boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt )
+ throws MirMediaException {
+
String ext = mediaTypeEnt.getValue("name");
String dir = MirConfig.getProp("Producer.Media.Path");
String rtspDir = MirConfig.getProp("Producer.RealMedia.Path");
String rtspMediaHost = MirConfig.getProp("Producer.RealMedia.Host");
String mediaFname = ent.getId()+"."+ext;
- String RealMediaPointer = rtspMediaHost+mediaFname;
- String RealMediaFile = ent.getId()+".ram";
+ String RealMediaPointer = rtspMediaHost+mediaFname;
+ String RealMediaFile = ent.getId()+".ram";
String date = ent.getValue("date");
String datePath = StringUtil.webdbDate2path(date);
Integer size = new Integer(uploadedData.length);
- if(FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData)) {
- //if(FileUtil.write(rtspDir+"/"+mediaFname, uploadedData)) {
+ try {
+ FileUtil.write(dir+"/"+datePath+"/"+mediaFname, uploadedData);
+ //FileUtil.write(rtspDir+"/"+mediaFname, uploadedData);
//were done with the data, dereference.
uploadedData=null;
-
- try {
-//write an rm file
-FileUtil.write(dir+"/"+RealMediaFile,RealMediaPointer.getBytes());
-
- ent.setValueForProperty("is_produced", "1");
- ent.setValueForProperty("icon_is_produced", "1");
- ent.setValueForProperty("publish_path",datePath+"/"+mediaFname);
- //ent.setValueForProperty("publish_path", RealMediaFile);
- ent.setValueForProperty("publish_server", mediaHost);
- ent.setValueForProperty("size", size.toString());
- ent.update();
- } catch (StorageObjectException e) {
- theLog.printError("StorageObjectException: "+e.toString());
- return false;
- }
- } else {
- theLog.printError("could not write FILE!");
- return false;
+
+ //write an rm file
+ FileUtil.write(dir+"/"+RealMediaFile,RealMediaPointer.getBytes());
+ ent.setValueForProperty("is_produced", "1");
+ ent.setValueForProperty("icon_is_produced", "1");
+ ent.setValueForProperty("publish_path",datePath+"/"+mediaFname);
+ //ent.setValueForProperty("publish_path", RealMediaFile);
+ ent.setValueForProperty("publish_server", mediaHost);
+ ent.setValueForProperty("size", size.toString());
+ ent.update();
+ } catch (Exception e) {
+ theLog.printError(e.toString());
+ throw new MirMediaException(e.toString());
}
return true;
private static String tinyIcon = MirConfig.getProp("Producer.Icon.TinyVideo");
private static String bigIcon = MirConfig.getProp("Producer.Icon.BigVideo");
- public String getTinyIcon()
- {
- return tinyIcon;
- }
-
- public String getBigIcon()
- {
- return bigIcon;
- }
-
- public String getIconAlt()
- {
- return "Video";
- }
-
- public boolean isVideo()
- {
- return true;
- }
+ public String getTinyIcon()
+ {
+ return tinyIcon;
+ }
+
+ public String getBigIcon()
+ {
+ return bigIcon;
+ }
+
+ public String getIconAlt()
+ {
+ return "Video";
+ }
+
+ public boolean isVideo()
+ {
+ return true;
+ }
}
* @return boolean, success/fail
* @see mir.entity.Entity
*/
- public abstract boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt );
+ public abstract boolean set (byte[] uploadedData, Entity ent, Entity mediaTypeEnt ) throws MirMediaException;
/**
* Get's the media data from storage and returns it as a byte array
* @return byte[]
* @see mir.entity.Entity
*/
- public abstract byte[] get (Entity ent, Entity mediaTypeEnt);
+ public abstract byte[] get (Entity ent, Entity mediaTypeEnt)
+ throws MirMediaException;
/**
* Pretty much like get() above. But get's the specific Icon
* @return byte[]
* @see mir.entity.Entity
*/
- public abstract byte[] getIcon (Entity ent);
+ public abstract byte[] getIcon (Entity ent) throws MirMediaException;
/**
* gets the final content representation for the media
* @see mir.entity.Entity
* @see mir.misc.StringUtil
*/
- public abstract String getURL (Entity ent, Entity mediaTypeEnt);
+ public abstract String getURL (Entity ent, Entity mediaTypeEnt)
+ throws MirMediaException;
/**
* gets the summary representation for the media
* @see mir.entity.Entity
* @see mir.misc.StringUtil
*/
- public abstract String getListView (Entity ent, Entity mediaTypeEnt);
+ public abstract String getListView (Entity ent, Entity mediaTypeEnt)
+ throws MirMediaException;
/**
* Returns the absolute filesystem path to where the media
* @return String, the path.
* @see mir.misc.MirConfig
*/
- public abstract String getStoragePath ();
+ public abstract String getStoragePath () throws MirMediaException;
/**
* Returns the *relative* filesystem path to where the media
* @return String, the path.
* @see mir.misc.MirConfig
*/
- public abstract String getIconStoragePath ();
+ public abstract String getIconStoragePath () throws MirMediaException;
/**
* Returns the base URL to that the media is accessible from
* This is used in the Metadata stored in the DB and later on
* ,the templates use it.
* It is usually defined
- * in the configuration wich is accessible through the MirConfig
+ * in the configuration witch is accessible through the MirConfig
* class.
* @return String, the base URL to the host.
* @see mir.misc.MirConfig
*/
- public abstract String getPublishHost ();
+ public abstract String getPublishHost () throws MirMediaException;
/**
* Returns the file name of the Icon representing the media type.
static {
System.setProperty("content.types.user.table", MirConfig.getProp("Home")+"content-types.properties");
- System.err.println("DDD: "+MirConfig.getProp("Home")+"content-types.properties");
fileNameMap = sun.net.www.MimeTable.loadTable();
producerStorageRoot = MirConfig.getProp("Producer.StorageRoot");
}
private FileUtil () {
}
- public static boolean write(String filename, byte[] in) {
+ public static boolean write(String filename, byte[] in)
+ throws IOException {
boolean retVal = false;
outStream.write(in);
outStream.close();
retVal = true;
- } catch(IOException exception) {}
+ } catch(IOException e) {
+ throw new IOException(e.toString());
+ }
}
return retVal;
}
- public static boolean read(String filename, byte out[]) {
+ public static boolean read(String filename, byte out[])
+ throws IOException {
File f = null;
f = new File(filename);
inStream = new FileInputStream(f);
inStream.read(out);
inStream.close();
- } catch(IOException exception) {
- return false;
+ } catch(IOException e) {
+ throw new IOException(e.toString());
}
} else {
return false;
public static String guessContentTypeFromName(String fname) {
String contentType = null;
- System.err.println("NAME: "+fname);
contentType = getFileNameMap().getContentTypeFor(fname);
- System.err.println("TYPE: "+contentType);
+
return contentType;
}
(String)configHash.get(propName);
}
- public static void addBroker(String driver, String URL){
+ public static void addBroker(String driver, String URL) throws Exception {
String username,passwd,min,max,log,reset;
}
} catch(Exception e){
System.err.println("Der ConnectionBroker konnte nicht initializiert werden"+ e.toString());e.printStackTrace();
+ throw new Exception(e.toString());
}
} // end if
}
import java.lang.*;
import java.io.*;
import java.util.*;
-import freemarker.template.*;
+import freemarker.template.SimpleList;
+import freemarker.template.SimpleHash;
import com.javaexchange.dbConnectionBroker.*;
import mir.storage.StorageObject;
import mir.entity.*;
*
* @param String confFilename Dateiname der Konfigurationsdatei
*/
- public Database() {
- //theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Database.Logfile"));
- theLog = Logfile.getInstance(this.getClass().getName());
- String database_username=DatabaseConfig.getProp("Database.Username");
- String database_password=DatabaseConfig.getProp("Database.Password");
- String database_host=DatabaseConfig.getProp("Database.Host");
- String theAdaptorName=DatabaseConfig.getProp("Database.Adaptor");
+ public Database() throws StorageObjectException {
+ theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Database.Logfile"));
+ String database_username=MirConfig.getProp("Database.Username");
+ String database_password=MirConfig.getProp("Database.Password");
+ String database_host=MirConfig.getProp("Database.Host");
+ String theAdaptorName=MirConfig.getProp("Database.Adaptor");
try {
theEntityClass = Class.forName("mir.entity.GenericEntity");
theAdaptor = (DatabaseAdaptor)Class.forName(theAdaptorName).newInstance();
- defaultLimit = Integer.parseInt(DatabaseConfig.getProp("Database.Limit"));
+ defaultLimit = Integer.parseInt(MirConfig.getProp("Database.Limit"));
database_driver=theAdaptor.getDriver();
database_url=theAdaptor.getURL(database_username,database_password,database_host);
theLog.printDebugInfo("adding Broker with: " +database_driver+":"+database_url );
- DatabaseConfig.addBroker(database_driver,database_url);
- myBroker=DatabaseConfig.getBroker();
+ MirConfig.addBroker(database_driver,database_url);
+ myBroker=MirConfig.getBroker();
}
catch (Exception e){
theLog.printError("Bei Konstruktion von Database() with " + theAdaptorName + " -- " +e.toString());
+ throw new StorageObjectException(e.toString());
}
}
* eine SimpleList mit Standard-Popupdaten erzeugt werden koennen soll.
* @return null
*/
- public SimpleList getPopupData () {
+ public SimpleList getPopupData () throws StorageObjectException {
return null;
}
* @param hasNullValue Wenn true wird eine leerer Eintrag fuer die Popups erzeugt.
* @return SimpleList Gibt freemarker.template.SimpleList zurueck.
*/
- public SimpleList getPopupData (String name, boolean hasNullValue) {
+ public SimpleList getPopupData (String name, boolean hasNullValue)
+ throws StorageObjectException {
return getPopupData(name, hasNullValue, null);
}
* @param where Schraenkt die Selektion der Datensaetze ein.
* @return SimpleList Gibt freemarker.template.SimpleList zurueck.
*/
- public SimpleList getPopupData (String name, boolean hasNullValue, String where) {
- return getPopupData(name, hasNullValue, where, null);
+ public SimpleList getPopupData (String name, boolean hasNullValue, String where) throws StorageObjectException {
+ return getPopupData(name, hasNullValue, where, null);
}
/**
* @param order Gibt ein Feld als Sortierkriterium an.
* @return SimpleList Gibt freemarker.template.SimpleList zurueck.
*/
- public SimpleList getPopupData (String name, boolean hasNullValue, String where,
- String order) {
+ public SimpleList getPopupData (String name, boolean hasNullValue, String where, String order) throws StorageObjectException {
// caching
if (hasPopupCache && popupCache != null)
return popupCache;
}
} catch (Exception e) {
theLog.printDebugInfo(e.toString());
+ throw new StorageObjectException(e.toString());
} finally {
freeConnection(con, stmt);
}
pstmt = con.prepareStatement(sql);
result = pstmt.executeUpdate();
}
- catch (Exception e) {theLog.printDebugInfo("settimage :: setImage gescheitert: "+e.toString());}
+ catch (Exception e) {
+ theLog.printDebugInfo("settimage :: setImage gescheitert: "+e.toString());
+ throw new StorageObjectException("executeUpdate failed: "+e.toString());
+ }
finally { freeConnection(con,pstmt); }
theLog.printInfo((new java.util.Date().getTime() - startTime) + "ms. for: " + sql);
return result;
/**
* Datenbankverbindung wird geschlossen
*/
- public void disconnectPool () {
+ public void disconnectPool () throws StorageObjectException {
try {
myBroker.destroy(100);
} catch (SQLException sqe) {
- ;
+ throwSQLException(sqe, "disconnectPool");
}
}
* @param con Connection zur Datenbank
* @param stmt Statement-Objekt
*/
- public void freeConnection (Connection con, Statement stmt) {
+ public void freeConnection (Connection con, Statement stmt)
+ throws StorageObjectException {
try {
if (stmt != null)
stmt.close();
} catch (SQLException e1) {
theLog.printDebugInfo(e1.toString());
+ throw new StorageObjectException("DB, in freeConnection: "+e1.toString());
}
if (con != null)
myBroker.freeConnection(con);
- else
+ else {
theLog.printDebugInfo("Con was null!");
+ throw new StorageObjectException("Con was null!");
+ }
}
/**
* @param con
* @param stmt
*/
- abstract public void freeConnection(Connection con, Statement stmt);
+ abstract public void freeConnection(Connection con, Statement stmt)
+ throws StorageObjectException;
* Dokumentation siehe Database.java
* @return
*/
- abstract public SimpleList getPopupData ();
+ abstract public SimpleList getPopupData () throws StorageObjectException;
abstract public int executeUpdate(Statement a, String sql) throws StorageObjectException, SQLException ;
abstract public int executeUpdate(String sql) throws StorageObjectException, SQLException ;
* set is_produced flag for the article
*/
- public void setProduced(boolean yesno)
+ public void setProduced(boolean yesno) throws StorageObjectException
{
Connection con=null;Statement stmt=null;
String value = (yesno) ? "1":"0";
* dettach from media
*/
- public void dettach(String cid,String mid)
+ public void dettach(String cid,String mid) throws StorageObjectException
{
if (mid!=null){
try{
* attach to media
*/
- public void attach(String mid)
+ public void attach(String mid) throws StorageObjectException
{
if (mid!=null) {
//write media-id mid and content-id in table content_x_media
- public byte[] getImage()
+ public byte[] getImage() throws StorageObjectException
{
theLog.printDebugInfo("--getimage started");
Connection con=null;Statement stmt=null;
}
public void setImage(byte[] uploadData, String imageType)
- {
+ throws StorageObjectException {
int type = 0;
//hack -mh
super.setValues(theStringValues);
}
- public byte[] getIcon()
+ public byte[] getIcon() throws StorageObjectException
{
Connection con=null;Statement stmt=null;
byte[] img_data=null;
*
* @return mir.entity.Entity
*/
- public Entity getMediaType() {
- return ((DatabaseMedia)theStorageObject).getMediaType(this);
+ public Entity getMediaType() throws StorageObjectException {
+ try {
+ return ((DatabaseMedia)theStorageObject).getMediaType(this);
+ } catch (StorageObjectException e) {
+ throw new StorageObjectException("getMediaType(): "+e.toString());
+ }
+
}
public void finalize() {
//
// methods
- public byte[] getVideoData()
+ public byte[] getVideoData() throws StorageObjectException
{
Connection con=null;Statement stmt=null;
return video_data;
}
- public void setVideoData(byte[] uploadData)
+ public void setVideoData(byte[] uploadData) throws StorageObjectException
{
if (uploadData!=null) {
Connection con=null;PreparedStatement pstmt=null;
// Contructor
public ModuleComment(StorageObject theStorage)
{
- //if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Comment.Logfile"));
- //if (theStorage == null) theLog.printWarning("StorageObject was null!");
+ if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Comment.Logfile"));
+ if (theStorage == null) theLog.printWarning("StorageObject was null!");
this.theStorage = theStorage;
}
// Methoden
- public SimpleList getCommentAsSimpleList() {
- return ((DatabaseComment)theStorage).getPopupData();
+ public SimpleList getCommentAsSimpleList() throws ModuleException {
+ try {
+ return ((DatabaseComment)theStorage).getPopupData();
+ } catch (StorageObjectException e) {
+ throw new ModuleException(e.toString());
+ }
}
/**
this.theStorage = theStorage;
if (theLog == null)
- theLog = Logfile.getInstance(this.getClass().getName());
+ theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Feature.Logfile"));
}
- public SimpleList getSchwerpunktAsSimpleList() {
- return ((DatabaseFeature)theStorage).getPopupData();
+ public SimpleList getSchwerpunktAsSimpleList()
+ throws ModuleException {
+ try {
+ return ((DatabaseFeature)theStorage).getPopupData();
+ } catch (StorageObjectException e) {
+ throw new ModuleException(e.toString());
+ }
}
}
public ModuleImages(StorageObject theStorage) {
- if (theLog == null) theLog = Logfile.getInstance(this.getClass().getName());
+ if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home")+MirConfig.getProp("Module.Bilder.Logfile"));
if (theStorage == null) theLog.printWarning("StorageObject was null!");
this.theStorage = theStorage;
// Methoden
- public SimpleList getBilderAsSimpleList() {
+ public SimpleList getBilderAsSimpleList()
+ throws ModuleException {
// String sql = "select id, name from Bilder order by name";
- return ((DatabaseImages)theStorage).getPopupData();
+ try {
+ return ((DatabaseImages)theStorage).getPopupData();
+ } catch (StorageObjectException e) {
+ throw new ModuleException(e.toString());
+ }
}
}
public ModuleMediafolder(StorageObject theStorage)
{
- if (theLog == null) theLog = Logfile.getInstance(this.getClass().getName());
+ if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Mediafolder.Logfile"));
if (theStorage == null) theLog.printWarning("StorageObject was null!");
this.theStorage = theStorage;
}
// Methoden
- public SimpleList getPopupData() {
- return ((DatabaseMediafolder)theStorage).getPopupData();
+ public SimpleList getPopupData() throws ModuleException {
+ try {
+ return ((DatabaseMediafolder)theStorage).getPopupData();
+ } catch (Exception e) {
+ throw new ModuleException(e.toString());
+ }
}
this.theStorage = theStorage;
if (theLog == null)
- theLog = Logfile.getInstance(this.getClass().getName());
+ theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Schwerpunkt.Logfile"));
}
- public SimpleList getSchwerpunktAsSimpleList() {
- return ((DatabaseFeature)theStorage).getPopupData();
+ public SimpleList getSchwerpunktAsSimpleList()
+ throws ModuleException {
+ try {
+ return ((DatabaseFeature)theStorage).getPopupData();
+ } catch (StorageObjectException e) {
+ throw new ModuleException(e.toString());
+ }
}
}
public ModuleTopics(StorageObject theStorage) {
this.theStorage = theStorage;
if (theLog == null)
- theLog = Logfile.getInstance(this.getClass().getName());
+ theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Themen.Logfile"));
}
- public SimpleList getTopicsAsSimpleList() {
- return ((DatabaseTopics)theStorage).getPopupData();
+ public SimpleList getTopicsAsSimpleList() throws ModuleException {
+ try {
+ return ((DatabaseTopics)theStorage).getPopupData();
+ } catch(StorageObjectException e) {
+ throw new ModuleException(e.toString());
+ }
}
}
public ModuleUploadedMedia(StorageObject theStorage) {
this.theStorage = theStorage;
if (theLog == null)
- theLog = Logfile.getInstance(this.getClass().getName());
+ theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Themen.Logfile"));
}
- public SimpleList getUploadedMediaAsSimpleList() {
- return ((DatabaseUploadedMedia)theStorage).getPopupData();
+ public SimpleList getUploadedMediaAsSimpleList()
+ throws ModuleException {
+ try {
+ return ((DatabaseUploadedMedia)theStorage).getPopupData();
+ } catch (StorageObjectException e) {
+ throw new ModuleException(e.toString());
+ }
}
}
public ModuleUsers(StorageObject theStorage)
{
- if (theLog == null) theLog = Logfile.getInstance(this.getClass().getName());
+ if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Users.Logfile"));
if (theStorage == null) theLog.printWarning("StorageObject was null!");
this.theStorage = theStorage;
}
}
- public SimpleList getUsersAsSimpleList() {
+ public SimpleList getUsersAsSimpleList() throws ModuleException {
// String sql = "select id, name from Users order by name";
- return ((DatabaseUsers)theStorage).getPopupData();
+ try {
+ return ((DatabaseUsers)theStorage).getPopupData();
+ } catch(StorageObjectException e) {
+ throw new ModuleException(e.toString());
+ }
}
}
protected static String producerStorageRoot = MirConfig.getProp("Producer.StorageRoot");
protected static String producerProductionHost = MirConfig.getProp("Producer.ProductionHost");
protected static String producerOpenAction = MirConfig.getProp("Producer.OpenAction");;
- protected static Logfile theLog = Logfile.getInstance("Producer");
+ protected static Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Producer.Logfile"));
protected static ModuleTopics topicsModule;
protected static ModuleLinksImcs linksImcsModule;
protected static ModuleSchwerpunkt schwerpunktModule;
try {
contentModule = new ModuleContent(DatabaseContent.getInstance());
topicsModule = new ModuleTopics(DatabaseTopics.getInstance());
- linksImcsModule = new ModuleLinksImcs(DatabaseLinksImcs.getInstance());
+ linksImcsModule = new ModuleLinksImcs(DatabaseLinksImcs.getInstance());
schwerpunktModule = new ModuleSchwerpunkt(DatabaseFeature.getInstance());
featureModule = new ModuleFeature(DatabaseFeature.getInstance());
imageModule = new ModuleImages(DatabaseImages.getInstance());
while (batchEntityList != null) {
for(int i=0;i<batchEntityList.size();i++) {
currentContent = (EntityContent)batchEntityList.elementAt(i);
- currentContentValues = currentContent.getValues();
-
- //because of postgres 7.1.* not needed anymore
- //currentContentValues.put("content_data",currentContent.getContentData());
- String date = (String)currentContentValues.get("date");
- String year = date.substring(0,4);
- String month = date.substring(4,6);
-
- htmlFileName = producerDocRoot
- + "/" + year + "/" + month + "/" + currentContentValues.get("id") + ".shtml";
-
- currentContentValues.put("content_data",StringUtil.deleteForbiddenTags((String)currentContentValues.get("content_data")));
- currentContentValues.put("description",StringUtil.deleteForbiddenTags((String)currentContentValues.get("description")));
-
-
- //create http-links and email-links
- if (currentContentValues.get("is_html").equals("0")) {
- String temp = (String)currentContentValues.get("content_data");
- if(temp!=null && temp.length()>0){
- temp = StringUtil.createHTML(temp,imageRoot,mailLinkName,extLinkName,intLinkName);
- temp = StringUtil.decodeHTMLinTags(temp);
- currentContentValues.put("content_data",temp);
- }
- temp = (String)currentContentValues.get("description");
- if(temp!=null && temp.length()>0){
- temp = StringUtil.createHTML(temp,imageRoot,mailLinkName,extLinkName,intLinkName);
- temp = StringUtil.decodeHTMLinTags(temp);
- currentContentValues.put("description",temp);
- }
- } else {
- String temp = (String)currentContentValues.get("content_data");
- if(temp!=null && temp.length()>0){
- temp = StringUtil.decodeHTMLinTags(temp);
- currentContentValues.put("content_data",temp);
- }
- temp = (String)currentContentValues.get("description");
- if(temp!=null && temp.length()>0){
- temp = StringUtil.decodeHTMLinTags(temp);
- currentContentValues.put("description",temp);
- }
- }
-
- //create the freemarker-model
- SimpleHash mergeData = HTMLTemplateProcessor.makeSimpleHash(currentContentValues);
-
- // get the uploaded media
- EntityList currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
- if (currentMediaList!=null && currentMediaList.getCount()>=1) {
- SimpleList mediaList = new SimpleList();
- for (int n=0; n < currentMediaList.size();n++) {
- upMedia = currentMediaList.elementAt(n);
- upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
- mediaType = ((EntityMedia)upMedia).getMediaType();
- //in case it's a non-existant to_media_type entry..
- if (mediaType != null) {
- try {
- mediaHandlerName = mediaType.getValue("classname");
- mediaStorageName = mediaType.getValue("tablename");
- mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
- mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
- mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
- Method m = mediaStorageClass.getMethod("getInstance", null);
- mediaStorage = (Database)m.invoke(null, null);
- //we most likely need further info
- upMedia = mediaStorage.selectById(upMedia.getId());
- } catch (Exception e) {
- theLog.printError("ProducerStartpage:problem in reflection: "+mediaHandlerName);
- } //end catch
- upMediaSimpleHash.put("url", mediaHandler.getURL(upMedia, mediaType));
- upMediaSimpleHash.put("type",mediaType.getValue("classname"));
- mediaList.add(upMediaSimpleHash);
- } //end if media_type != null
- } //end for
- mergeData.put("to_media", mediaList);
- } //end if currentMediaList != null
-
- // get the comments for the article
- // and html-ize them
- SimpleList commentList = currentContent.getComments();
- try{
- if(commentList.isEmpty()==false){
- while(commentList.hasNext()){
- SimpleHash comment = (SimpleHash)commentList.next();
- SimpleScalar commentText = (SimpleScalar)comment.get("description");
- comment.put("description",new SimpleScalar(StringUtil.createHTML(commentText.getAsString(),imageRoot,mailLinkName,extLinkName,intLinkName)));
+ try {
+ currentContentValues = currentContent.getValues();
+
+ //because of postgres 7.1.* not needed anymore
+ //currentContentValues.put("content_data",currentContent.getContentData());
+ String date = (String)currentContentValues.get("date");
+ String year = date.substring(0,4);
+ String month = date.substring(4,6);
+
+ htmlFileName = producerDocRoot
+ + "/" + year + "/" + month + "/" + currentContentValues.get("id") + ".shtml";
+
+ currentContentValues.put("content_data",StringUtil.deleteForbiddenTags((String)currentContentValues.get("content_data")));
+ currentContentValues.put("description",StringUtil.deleteForbiddenTags((String)currentContentValues.get("description")));
+
+
+ //create http-links and email-links
+ if (currentContentValues.get("is_html").equals("0")) {
+ String temp = (String)currentContentValues.get("content_data");
+ if(temp!=null && temp.length()>0){
+ temp = StringUtil.createHTML(temp,imageRoot,mailLinkName,extLinkName,intLinkName);
+ temp = StringUtil.decodeHTMLinTags(temp);
+ currentContentValues.put("content_data",temp);
+ }
+ temp = (String)currentContentValues.get("description");
+ if(temp!=null && temp.length()>0){
+ temp = StringUtil.createHTML(temp,imageRoot,mailLinkName,extLinkName,intLinkName);
+ temp = StringUtil.decodeHTMLinTags(temp);
+ currentContentValues.put("description",temp);
+ }
+ } else {
+ String temp = (String)currentContentValues.get("content_data");
+ if(temp!=null && temp.length()>0){
+ temp = StringUtil.decodeHTMLinTags(temp);
+ currentContentValues.put("content_data",temp);
+ }
+ temp = (String)currentContentValues.get("description");
+ if(temp!=null && temp.length()>0){
+ temp = StringUtil.decodeHTMLinTags(temp);
+ currentContentValues.put("description",temp);
+ }
}
- }
- } catch(Exception e){}
- mergeData.put("comments", commentList);
-
- // get the topics of this article
- mergeData.put("topics",HTMLTemplateProcessor.makeSimpleList(DatabaseContentToTopics.getInstance().getTopics(currentContent)));
- //produce html
- boolean retVal = produce(contentTemplate, htmlFileName, mergeData, htmlout);
- sessionConnectTime = new java.util.Date().getTime() - startTime;
- if (retVal == true && !"1".equals(currentContent.getValue("is_produced")))
- currentContent.setProduced(true);
- }//while
+ //create the freemarker-model
+ SimpleHash mergeData = HTMLTemplateProcessor.makeSimpleHash(currentContentValues);
+
+ // get the uploaded media
+ EntityList currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
+ if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+ SimpleList mediaList = new SimpleList();
+ for (int n=0; n < currentMediaList.size();n++) {
+ upMedia = currentMediaList.elementAt(n);
+ upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
+ mediaType = ((EntityMedia)upMedia).getMediaType();
+ //must be a non-existant to_media_type entry..
+ if (mediaType != null) {
+ mediaHandlerName = mediaType.getValue("classname");
+ mediaStorageName = mediaType.getValue("tablename");
+ mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
+ mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
+ mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
+ Method m = mediaStorageClass.getMethod("getInstance", null);
+ mediaStorage = (Database)m.invoke(null, null);
+ //we most likely need further info
+ upMedia = mediaStorage.selectById(upMedia.getId());
+ upMediaSimpleHash.put("url", mediaHandler.getURL(upMedia, mediaType));
+ upMediaSimpleHash.put("type",mediaType.getValue("classname"));
+ mediaList.add(upMediaSimpleHash);
+ } //end if media_type != null
+ } //end for
+ mergeData.put("to_media", mediaList);
+ } //end if currentMediaList != null
+
+ // get the comments for the article
+ // and html-ize them
+ SimpleList commentList = currentContent.getComments();
+ if(commentList.isEmpty()==false){
+ while(commentList.hasNext()){
+ SimpleHash comment = (SimpleHash)commentList.next();
+ SimpleScalar commentText = (SimpleScalar)comment.get("description");
+ comment.put("description",new SimpleScalar(StringUtil.createHTML(commentText.getAsString(),imageRoot,mailLinkName,extLinkName,intLinkName)));
+ }
+ }
+ mergeData.put("comments", commentList);
+
+ // get the topics of this article
+ mergeData.put("topics",HTMLTemplateProcessor.makeSimpleList(DatabaseContentToTopics.getInstance().getTopics(currentContent)));
+
+ //produce html
+ boolean retVal = produce(contentTemplate, htmlFileName, mergeData, htmlout);
+ sessionConnectTime = new java.util.Date().getTime() - startTime;
+ if (retVal == true && !"1".equals(currentContent.getValue("is_produced")))
+ currentContent.setProduced(true);
+ } catch(Exception e) {
+ logHTML(htmlout, "Producer.Content ERROR while producing content ID: " + currentContent.getId()+",skipping it :: "+e.toString());
+ theLog.printError("Producer.Content ERROR while producing content ID: " + currentContent.getId() +",skipping it :: "+e.toString());
+ }
+
+
+ }//for
if (batchEntityList.hasNextBatch()){
batchEntityList = contentModule.getContent(whereClause, orderBy, batchEntityList.getNextBatch(),contentBatchsize, userEntity);
}
}
- // timing an message to browser
+ // timing and message to browser
sessionConnectTime = new java.util.Date().getTime() - startTime;
logHTML(htmlout, "Producer.Content finished: " + sessionConnectTime + " ms.");
}
//now produce the pages
if (list!=null || force==true) {
SimpleHash mergeData = HTMLTemplateProcessor.makeSimpleHashWithEntitylistInfos(list);
- //first we try to get the images
+ //first we try to get the media
if(list!=null){
for (int k=0; k < list.size();k++) {
currentContent = (EntityContent)list.elementAt(k);
- //images to content
- EntityList currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
- if (currentMediaList!=null && currentMediaList.getCount()>=1) {
- SimpleList mediaListAudio = new SimpleList();
- SimpleList mediaListImages = new SimpleList();
- SimpleList mediaListVideo = new SimpleList();
- SimpleList mediaListOther = new SimpleList();
- //SimpleHash allMediaSimpleHash = new SimpleHash();
- for (int n=0; n < currentMediaList.size();n++) {
- upMedia = currentMediaList.elementAt(n);
- upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
- mediaType = ((EntityMedia)upMedia).getMediaType();
- //must be a non-existant to_media_type entry..
- if (mediaType != null) {
- try {
- mediaHandlerName = mediaType.getValue("classname");
- mediaStorageName = mediaType.getValue("tablename");
- mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
- mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
- mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
- Method m = mediaStorageClass.getMethod("getInstance", null);
- mediaStorage = (Database)m.invoke(null, null);
- //we most likely need further info
- upMedia = mediaStorage.selectById(upMedia.getId());
- } catch (Exception e) {
- theLog.printError("ProducerList: problem in reflection: "+mediaHandlerName);
- } //end catch
- upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
- if (upMedia.getValue("is_published") == "1") {
- if (mediaHandler.isImage()) {
- mediaListImages.add(upMediaSimpleHash);
- } else if (mediaHandler.isAudio()) {
- mediaListAudio.add(upMediaSimpleHash);
- } else if (mediaHandler.isVideo()) {
- mediaListVideo.add(upMediaSimpleHash);
- } else {
- mediaListOther.add(upMediaSimpleHash);
- }
- } //end if is_published
- } //end if media_type != null
- } //end for
- try{
- SimpleList contentList = (SimpleList)mergeData.get("contentlist");
- SimpleHash contentHash = (SimpleHash)contentList.get(k);
- contentHash.put("to_media_audio", mediaListAudio);
- contentHash.put("to_media_images", mediaListImages);
- contentHash.put("to_media_video", mediaListVideo);
- contentHash.put("to_media_other", mediaListOther);
- } catch (Exception e){}
- } //end if currentMediaList != null
-
- //content to html
- if(currentContent.getValue("is_html").equals("0")){
- String temp = (String)currentContent.getValue("description");
- if(temp!=null && temp.length()>0){
- temp = StringUtil.createHTML(temp);
- temp = StringUtil.decodeHTMLinTags(temp);
- currentContent.setValueForProperty("description",temp);
- }
- } else {
- String temp = (String)currentContent.getValue("description");
- if(temp!=null && temp.length()>0){
- temp = StringUtil.decodeHTMLinTags(temp);
- currentContent.setValueForProperty("description",temp);
- }
+ try {
+ //media to content
+ EntityList currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
+ if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+ SimpleList mediaListAudio = new SimpleList();
+ SimpleList mediaListImages = new SimpleList();
+ SimpleList mediaListVideo = new SimpleList();
+ SimpleList mediaListOther = new SimpleList();
+ //SimpleHash allMediaSimpleHash = new SimpleHash();
+ for (int n=0; n < currentMediaList.size();n++) {
+ upMedia = currentMediaList.elementAt(n);
+ upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
+ mediaType = ((EntityMedia)upMedia).getMediaType();
+ //must be a non-existant to_media_type entry..
+ if (mediaType != null) {
+ mediaHandlerName = mediaType.getValue("classname");
+ mediaStorageName = mediaType.getValue("tablename");
+ mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
+ mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
+ mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
+ Method m = mediaStorageClass.getMethod("getInstance", null);
+ mediaStorage = (Database)m.invoke(null, null);
+ //we most likely need further info
+ upMedia = mediaStorage.selectById(upMedia.getId());
+ upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
+ if (upMedia.getValue("is_published") == "1") {
+ if (mediaHandler.isImage()) {
+ mediaListImages.add(upMediaSimpleHash);
+ } else if (mediaHandler.isAudio()) {
+ mediaListAudio.add(upMediaSimpleHash);
+ } else if (mediaHandler.isVideo()) {
+ mediaListVideo.add(upMediaSimpleHash);
+ } else {
+ mediaListOther.add(upMediaSimpleHash);
+ }
+ } //end if is_published
+ } //end if media_type != null
+ } //end for
+ SimpleList contentList = (SimpleList)mergeData.get("contentlist");
+ SimpleHash contentHash = (SimpleHash)contentList.get(k);
+ contentHash.put("to_media_audio", mediaListAudio);
+ contentHash.put("to_media_images", mediaListImages);
+ contentHash.put("to_media_video", mediaListVideo);
+ contentHash.put("to_media_other", mediaListOther);
+ } //end if currentMediaList != null
+
+ //content to html
+ if(currentContent.getValue("is_html").equals("0")){
+ String temp = (String)currentContent.getValue("description");
+ if(temp!=null && temp.length()>0){
+ temp = StringUtil.createHTML(temp);
+ temp = StringUtil.decodeHTMLinTags(temp);
+ currentContent.setValueForProperty("description",temp);
+ }
+ } else {
+ String temp = (String)currentContent.getValue("description");
+ if(temp!=null && temp.length()>0){
+ temp = StringUtil.decodeHTMLinTags(temp);
+ currentContent.setValueForProperty("description",temp);
+ }
+ }
+ } catch (Exception e) {
+ logHTML(htmlout, "Producer.List id " +currentContent.getId()+ " seems corrupt, skipping it :: "+e.toString());
+ theLog.printError("Producer.List id " +currentContent.getId()+ " seems corrupt, skipping it :: "+e.toString());
}
- }
- }
+ } //end for over each article
+ } //end if list != null
SimpleList itemList = HTMLTemplateProcessor.makeSimpleList(list);
//process hashmap additional and add to mergedata
if (additional != null) {
Database mediaStorage=null;
String tinyIcon;
String iconAlt;
- Logfile theLog = Logfile.getInstance(this.getClass().getName());
+ Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Producer.Logfile"));
SimpleList mediaList;
SimpleHash contentHash;
SimpleList newsWireList = HTMLTemplateProcessor.makeSimpleList(entityList);
for (int i=0; i < entityList.size();i++) {
currentContent = (EntityContent)entityList.elementAt(i);
- //fetching/setting the images
- upMediaEntityList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
- if (upMediaEntityList!=null && upMediaEntityList.getCount()>=1) {
- tinyIcon = null;
- iconAlt = null;
- mediaHandler = null;
- mediaHandlerName = null;
- for (int n=0; n < upMediaEntityList.size();n++) {
- uploadedMedia = (EntityMedia)upMediaEntityList.elementAt(n);
- mediaType = uploadedMedia.getMediaType();
+ try {
+ //fetching/setting the images
+ upMediaEntityList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
+ if (upMediaEntityList!=null && upMediaEntityList.getCount()>=1) {
+ tinyIcon = null;
+ iconAlt = null;
+ mediaHandler = null;
+ mediaHandlerName = null;
+ for (int n=0; n < upMediaEntityList.size();n++) {
+ uploadedMedia = (EntityMedia)upMediaEntityList.elementAt(n);
+ mediaType = uploadedMedia.getMediaType();
- //must of had a non-existant to_media_type entry..
- //let's save our ass.
- if (mediaType != null) {
- /*
- * grrr. why doesn't getId return an int! if It
- * did I could just compare the value of getId and
- * pick the biggest one. or is there
- * another way around this that I am missing?
- * can we make getIdasInt() or can we just have
- * another getId() that returns an Int and the VM
- * will handle it transparantly? -mh
- */
- try {
- mediaHandlerName = mediaType.getValue("classname");
- mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
- mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
- } catch (Exception e) {
- theLog.printError("ProducerStartpage:problem in reflection: "+mediaHandlerName);
- }
+ //must of had a non-existant to_media_type entry..
+ //let's save our ass.
+ if (mediaType != null) {
+ mediaHandlerName = mediaType.getValue("classname");
+ mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
+ mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
- //the "best" media type to show
- if (mediaHandler.isVideo()) {
- tinyIcon = MirConfig.getProp("Producer.Icon.TinyVideo");
- iconAlt = "Video";
- break;
- } else if (mediaHandler.isAudio()) {
- tinyIcon = MirConfig.getProp("Producer.Icon.TinyAudio");
- iconAlt = "Audio";
- } else if (tinyIcon == null && !mediaHandler.isImage()) {
- tinyIcon = mediaHandler.getTinyIcon();
- iconAlt = mediaHandler.getIconAlt();
+ //the "best" media type to show
+ if (mediaHandler.isVideo()) {
+ tinyIcon = MirConfig.getProp("Producer.Icon.TinyVideo");
+ iconAlt = "Video";
+ break;
+ } else if (mediaHandler.isAudio()) {
+ tinyIcon = MirConfig.getProp("Producer.Icon.TinyAudio");
+ iconAlt = "Audio";
+ } else if (tinyIcon == null && !mediaHandler.isImage()) {
+ tinyIcon = mediaHandler.getTinyIcon();
+ iconAlt = mediaHandler.getIconAlt();
+ }
}
+ }
+ //it only has image(s)
+ if (tinyIcon == null) {
+ tinyIcon = MirConfig.getProp("Producer.Icon.TinyImage");
+ iconAlt = "Image";
+ }
+
+ // uploadedMedia Entity list is empty.
+ // we only have text
+ } else {
+ tinyIcon = MirConfig.getProp("Producer.Icon.TinyText");
+ iconAlt = "Text";
}
- }
- //it only has image(s)
- if (tinyIcon == null) {
- tinyIcon = MirConfig.getProp("Producer.Icon.TinyImage");
- iconAlt = "Image";
- }
- // uploadedMedia Entity list is empty.
- // we only have text
- } else {
- tinyIcon = MirConfig.getProp("Producer.Icon.TinyText");
- iconAlt = "Text";
+ //mediaList = HTMLTemplateProcessor.makeSimpleList(upMediaEntityList);
+ contentHash = (SimpleHash)newsWireList.get(i);
+ contentHash.put("tiny_icon", imageRoot+"/"+tinyIcon);
+ contentHash.put("icon_alt", iconAlt);
+ } catch (Exception e) {
+ logHTML(htmlout, "Producer.StartPage error id: " + currentContent.getId() + ", skipping");
+ theLog.printError("Producer.StartPage error id: " + currentContent.getId() + ", skipping"+e.toString());
}
-
- try{
- //mediaList = HTMLTemplateProcessor.makeSimpleList(upMediaEntityList);
- contentHash = (SimpleHash)newsWireList.get(i);
- contentHash.put("tiny_icon", imageRoot+"/"+tinyIcon);
- contentHash.put("icon_alt", iconAlt);
- } catch (Exception e){}
}
// get the startarticle and the related images
SimpleList startItemList = HTMLTemplateProcessor.makeSimpleList(entityList);
for (int k=0; k < entityList.size();k++) {
currentContent = (EntityContent)entityList.elementAt(k);
- //media to content
- currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
- if (currentMediaList!=null && currentMediaList.getCount()>=1) {
- SimpleList mediaListAudio = new SimpleList();
- SimpleList mediaListImages = new SimpleList();
- SimpleList mediaListVideo = new SimpleList();
- SimpleList mediaListOther = new SimpleList();
- for (int n=0; n < currentMediaList.size();n++) {
- upMedia = currentMediaList.elementAt(n);
- upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
- mediaType = ((EntityMedia)upMedia).getMediaType();
- //must be a non-existant to_media_type entry..
- if (mediaType != null) {
- try {
- mediaHandlerName = mediaType.getValue("classname");
- mediaStorageName = mediaType.getValue("tablename");
- mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
- mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
- mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
- Method m = mediaStorageClass.getMethod("getInstance", null);
- mediaStorage = (Database)m.invoke(null, null);
- //we most likely need further info
- upMedia = mediaStorage.selectById(upMedia.getId());
- } catch (Exception e) {
- theLog.printError("ProducerList: problem in reflection: "+mediaHandlerName);
- } //end catch
- upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
- if (upMedia.getValue("is_published") == "1") {
- if (mediaHandler.isImage()) {
- mediaListImages.add(upMediaSimpleHash);
- } else if (mediaHandler.isAudio()) {
- mediaListAudio.add(upMediaSimpleHash);
- } else if (mediaHandler.isVideo()) {
- mediaListVideo.add(upMediaSimpleHash);
- } else {
- mediaListOther.add(upMediaSimpleHash);
- }
- } //end if is_published
- } //end if media_type != null
- } //end for
- try{
- contentHash = (SimpleHash)startItemList.get(k);
- contentHash.put("to_media_audio", mediaListAudio);
- contentHash.put("to_media_images", mediaListImages);
- contentHash.put("to_media_video", mediaListVideo);
- contentHash.put("to_media_other", mediaListOther);
- } catch (Exception e){}
- } //end if currentMediaList != null
+ try {
+ //media to content
+ currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
+ if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+ SimpleList mediaListAudio = new SimpleList();
+ SimpleList mediaListImages = new SimpleList();
+ SimpleList mediaListVideo = new SimpleList();
+ SimpleList mediaListOther = new SimpleList();
+ for (int n=0; n < currentMediaList.size();n++) {
+ upMedia = currentMediaList.elementAt(n);
+ upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
+ mediaType = ((EntityMedia)upMedia).getMediaType();
+ //must be a non-existant to_media_type entry..
+ if (mediaType != null) {
+ mediaHandlerName = mediaType.getValue("classname");
+ mediaStorageName = mediaType.getValue("tablename");
+ mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
+ mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
+ mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
+ Method m = mediaStorageClass.getMethod("getInstance", null);
+ mediaStorage = (Database)m.invoke(null, null);
+ //we most likely need further info
+ upMedia = mediaStorage.selectById(upMedia.getId());
+ upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
+ if (upMedia.getValue("is_published") == "1") {
+ if (mediaHandler.isImage()) {
+ mediaListImages.add(upMediaSimpleHash);
+ } else if (mediaHandler.isAudio()) {
+ mediaListAudio.add(upMediaSimpleHash);
+ } else if (mediaHandler.isVideo()) {
+ mediaListVideo.add(upMediaSimpleHash);
+ } else {
+ mediaListOther.add(upMediaSimpleHash);
+ }
+ } //end if is_published
+ } //end if media_type != null
+ } //end for
+ contentHash = (SimpleHash)startItemList.get(k);
+ contentHash.put("to_media_audio", mediaListAudio);
+ contentHash.put("to_media_images", mediaListImages);
+ contentHash.put("to_media_video", mediaListVideo);
+ contentHash.put("to_media_other", mediaListOther);
+ } //end if currentMediaList != null
+ } catch (Exception e) {
+ logHTML(htmlout, "Producer.StartPage error id: " + currentContent.getId() + ", skipping");
+ theLog.printError("Producer.StartPage error id: " + currentContent.getId() + ", skipping"+e.toString());
+ }
} //enf for featurueList.size..
// get the breaking news
SimpleList featureList = HTMLTemplateProcessor.makeSimpleList(entityList);
for (int k=0; k < entityList.size();k++) {
currentContent = (EntityContent)entityList.elementAt(k);
- //media to content
- currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
- if (currentMediaList!=null && currentMediaList.getCount()>=1) {
- SimpleList mediaListAudio = new SimpleList();
- SimpleList mediaListImages = new SimpleList();
- SimpleList mediaListVideo = new SimpleList();
- SimpleList mediaListOther = new SimpleList();
- for (int n=0; n < currentMediaList.size();n++) {
- upMedia = currentMediaList.elementAt(n);
- upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
- mediaType = ((EntityMedia)upMedia).getMediaType();
- //must be a non-existant to_media_type entry..
- if (mediaType != null) {
- try {
- mediaHandlerName = mediaType.getValue("classname");
- mediaStorageName = mediaType.getValue("tablename");
- mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
- mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
- mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
- Method m = mediaStorageClass.getMethod("getInstance", null);
- mediaStorage = (Database)m.invoke(null, null);
- //we most likely need further info
- upMedia = mediaStorage.selectById(upMedia.getId());
- } catch (Exception e) {
- theLog.printError("ProducerList: problem in reflection: "+mediaHandlerName);
- } //end catch
- upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
- if (upMedia.getValue("is_published") == "1") {
- if (mediaHandler.isImage()) {
- mediaListImages.add(upMediaSimpleHash);
- } else if (mediaHandler.isAudio()) {
- mediaListAudio.add(upMediaSimpleHash);
- } else if (mediaHandler.isVideo()) {
- mediaListVideo.add(upMediaSimpleHash);
- } else {
- mediaListOther.add(upMediaSimpleHash);
- }
- } //end if is_published
- } //end if media_type != null
- } //end for
- try{
- contentHash = (SimpleHash)featureList.get(k);
- contentHash.put("to_media_audio", mediaListAudio);
- contentHash.put("to_media_images", mediaListImages);
- contentHash.put("to_media_video", mediaListVideo);
- contentHash.put("to_media_other", mediaListOther);
- } catch (Exception e){}
- } //end if currentMediaList != null
+ try {
+ //media to content
+ currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
+ if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+ SimpleList mediaListAudio = new SimpleList();
+ SimpleList mediaListImages = new SimpleList();
+ SimpleList mediaListVideo = new SimpleList();
+ SimpleList mediaListOther = new SimpleList();
+ for (int n=0; n < currentMediaList.size();n++) {
+ upMedia = currentMediaList.elementAt(n);
+ upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
+ mediaType = ((EntityMedia)upMedia).getMediaType();
+ //must be a non-existant to_media_type entry..
+ if (mediaType != null) {
+ mediaHandlerName = mediaType.getValue("classname");
+ mediaStorageName = mediaType.getValue("tablename");
+ mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
+ mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
+ mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
+ Method m = mediaStorageClass.getMethod("getInstance", null);
+ mediaStorage = (Database)m.invoke(null, null);
+ //we most likely need further info
+ upMedia = mediaStorage.selectById(upMedia.getId());
+ upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
+ if (upMedia.getValue("is_published") == "1") {
+ if (mediaHandler.isImage()) {
+ mediaListImages.add(upMediaSimpleHash);
+ } else if (mediaHandler.isAudio()) {
+ mediaListAudio.add(upMediaSimpleHash);
+ } else if (mediaHandler.isVideo()) {
+ mediaListVideo.add(upMediaSimpleHash);
+ } else {
+ mediaListOther.add(upMediaSimpleHash);
+ }
+ } //end if is_published
+ } //end if media_type != null
+ } //end for
+ contentHash = (SimpleHash)featureList.get(k);
+ contentHash.put("to_media_audio", mediaListAudio);
+ contentHash.put("to_media_images", mediaListImages);
+ contentHash.put("to_media_video", mediaListVideo);
+ contentHash.put("to_media_other", mediaListOther);
+ } //end if currentMediaList != null
+ } catch (Exception e) {
+ logHTML(htmlout, "Producer.StartPage error id: " + currentContent.getId() + ", skipping");
+ theLog.printError("Producer.StartPage error id: " + currentContent.getId() + ", skipping"+e.toString());
+ }
} //enf for featurueList.size..
// Zusaetzlich Informationen
EntityContent currentContent;
if(entityList != null && entityList.size()==1){
currentContent = (EntityContent)entityList.elementAt(0);
- SimpleHash specialHash = HTMLTemplateProcessor.makeSimpleHash(currentContent);
-
- currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
- if (currentMediaList!=null && currentMediaList.getCount()>=1) {
- SimpleList mediaListAudio = new SimpleList();
- SimpleList mediaListImages = new SimpleList();
- SimpleList mediaListVideo = new SimpleList();
- SimpleList mediaListOther = new SimpleList();
- for (int n=0; n < currentMediaList.size();n++) {
- upMedia = currentMediaList.elementAt(n);
- upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
- mediaType = ((EntityMedia)upMedia).getMediaType();
- //must be a non-existant to_media_type entry..
- if (mediaType != null) {
- try {
- mediaHandlerName = mediaType.getValue("classname");
- mediaStorageName = mediaType.getValue("tablename");
- mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
- mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
- mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
- Method m = mediaStorageClass.getMethod("getInstance", null);
- mediaStorage = (Database)m.invoke(null, null);
- //we most likely need further info
- upMedia = mediaStorage.selectById(upMedia.getId());
- } catch (Exception e) {
- theLog.printError("ProducerList: problem in reflection: "+mediaHandlerName);
- } //end catch
- upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
- if (upMedia.getValue("is_published") == "1") {
- if (mediaHandler.isImage()) {
- mediaListImages.add(upMediaSimpleHash);
- } else if (mediaHandler.isAudio()) {
- mediaListAudio.add(upMediaSimpleHash);
- } else if (mediaHandler.isVideo()) {
- mediaListVideo.add(upMediaSimpleHash);
- } else {
- mediaListOther.add(upMediaSimpleHash);
- }
- } //end if is_published
- } //end if media_type != null
- } //end for
- try{
- specialHash.put("to_media_audio", mediaListAudio);
- specialHash.put("to_media_images", mediaListImages);
- specialHash.put("to_media_video", mediaListVideo);
- specialHash.put("to_media_other", mediaListOther);
- } catch (Exception e){}
- } //end if currentMediaList != null
- setAdditional("special",specialHash);
+ try {
+ SimpleHash specialHash = HTMLTemplateProcessor.makeSimpleHash(currentContent);
+
+ currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
+ if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+ SimpleList mediaListAudio = new SimpleList();
+ SimpleList mediaListImages = new SimpleList();
+ SimpleList mediaListVideo = new SimpleList();
+ SimpleList mediaListOther = new SimpleList();
+ for (int n=0; n < currentMediaList.size();n++) {
+ upMedia = currentMediaList.elementAt(n);
+ upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
+ mediaType = ((EntityMedia)upMedia).getMediaType();
+ //must be a non-existant to_media_type entry..
+ if (mediaType != null) {
+ mediaHandlerName = mediaType.getValue("classname");
+ mediaStorageName = mediaType.getValue("tablename");
+ mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
+ mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
+ mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
+ Method m = mediaStorageClass.getMethod("getInstance", null);
+ mediaStorage = (Database)m.invoke(null, null);
+ //we most likely need further info
+ upMedia = mediaStorage.selectById(upMedia.getId());
+ upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
+ if (upMedia.getValue("is_published") == "1") {
+ if (mediaHandler.isImage()) {
+ mediaListImages.add(upMediaSimpleHash);
+ } else if (mediaHandler.isAudio()) {
+ mediaListAudio.add(upMediaSimpleHash);
+ } else if (mediaHandler.isVideo()) {
+ mediaListVideo.add(upMediaSimpleHash);
+ } else {
+ mediaListOther.add(upMediaSimpleHash);
+ }
+ } //end if is_published
+ } //end if media_type != null
+ } //end for
+ specialHash.put("to_media_audio", mediaListAudio);
+ specialHash.put("to_media_images", mediaListImages);
+ specialHash.put("to_media_video", mediaListVideo);
+ specialHash.put("to_media_other", mediaListOther);
+ } //end if currentMediaList != null
+ setAdditional("special",specialHash);
+ } catch (Exception e) {
+ theLog.printError("ProducerTopics: problem with start special: "+currentContent.getId()+" "+e.toString());
+ }
}
//set the list of topics
private ServletModuleContent() {
try {
- theLog = Logfile.getInstance(this.getClass().getName());
+ theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Content.Logfile"));
templateListString = MirConfig.getProp("ServletModule.Content.ListTemplate");
templateOpString = MirConfig.getProp("ServletModule.Content.OpTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Content.ObjektTemplate");
mergeData.put("is_published", "1");
String now = StringUtil.date2webdbDate(new GregorianCalendar());
mergeData.put("date", new SimpleScalar(now));
- mergeData.put("themenPopupData", themenModule.getTopicsAsSimpleList());
+ try {
+ mergeData.put("themenPopupData", themenModule.getTopicsAsSimpleList());
+ } catch (ModuleException e) {
+ theLog.printError("cannot get topics as simple list.");
+ throw new ServletModuleException(e.toString());
+ }
try {
mergeData.put("articletypePopupData", DatabaseArticleType.getInstance().getPopupData());
} catch (Exception e) {
theLog.printError("articletype could not be fetched.");
+ throw new ServletModuleException("articletype could not be fetched: "
+ +e.toString());
}
try {
mergeData.put("languagePopupData", DatabaseLanguage.getInstance().getPopupData());
+ mergeData.put("schwerpunktPopupData", schwerpunktModule.getSchwerpunktAsSimpleList());
} catch (Exception e) {
- theLog.printError("language-popup could not be fetched.");
+ theLog.printError("language-popup or scwerpunk list could not be fetched.");
+ throw new ServletModuleException("language/schwerpunkt list could not be fetched.: "
+ +e.toString());
}
- mergeData.put("schwerpunktPopupData", schwerpunktModule.getSchwerpunktAsSimpleList());
mergeData.put("login_user", HTMLTemplateProcessor.makeSimpleHash(user));
deliver(req, res, mergeData, templateObjektString);
}
EntityContent entContent = (EntityContent)mainModule.getById(idParam);
entContent.attach(mediaIdParam);
}
- catch(ModuleException e) {
+ catch(Exception e) {
theLog.printError("smod content :: attach :: could not get entityContent");
}
_showObject(idParam, req, res);
EntityContent entContent = (EntityContent)mainModule.getById(cidParam);
entContent.dettach(cidParam,midParam);
}
- catch(ModuleException e) {
+ catch(Exception e) {
theLog.printError("smod content :: dettach :: could not get entityContent");
}
_showObject(cidParam, req, res);
}
catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());}
catch (ModuleException e) { throw new ServletModuleException("upload -- moduleexception " + e.toString());}
+ catch (StorageObjectException e) { throw new ServletModuleException("upload -- storageobjectexception " + e.toString());}
}
else // keine id
throw new ServletModuleException("Keine id angegeben");
}
mergeData.put("medianum",numOfMedia);
mergeData.put("mediafields",mediaFields);
- mergeData.put("themenPopupData", themenModule.getTopicsAsSimpleList());
/** @todo popups missing */
try{
mergeData.put("languagePopUpData",DatabaseLanguage.getInstance().getPopupData());
+ mergeData.put("themenPopupData", themenModule.getTopicsAsSimpleList());
} catch (Exception e) {
- theLog.printError("languagePopUpData failed");
+ theLog.printError("languagePopUpData or getTopicslist failed");
+ throw new ServletModuleException("smod -- openindy -- getting language or topics failed: "+e.toString());
}
deliver(req, res, mergeData, postingFormTemplate);
}
theLog.printError("setting content_x_topic success");
} catch (Exception e) {
theLog.printError("setting content_x_topic failed");
+ contentModule.deleteById(cid);
+ throw new ServletModuleException("smod - openindy :: insposting: setting content_x_topic failed: "+e.toString());
} //end try
} //end if
String MediaId;
Entity mediaEnt = null;
try {
- Class mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
- Method m = mediaStorageClass.getMethod("getInstance", null);
- Database mediaStorage = (Database)m.invoke(null, null);
- mediaEnt = (Entity)mediaStorage.getEntityClass().newInstance();
- mediaEnt.setStorage(mediaStorage);
- mediaEnt.setValues(mediaValues);
- mediaId = mediaEnt.insert();
-
- Class mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
- MirMedia mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
- //save and store the media data/metadata
- mediaHandler.set(mpReq.getMedia(), mediaEnt,mediaTypesList.elementAt(0));
-
- //were done with mpReq at this point, dereference it.
- //as it contains mucho mem. -mh 01.10.2001
- mpReq=null;
-
- } catch (Exception e) {
- theLog.printError("setting uploaded_media failed: "+e.toString());
- } //end try-catch
+ Class mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
+ Method m = mediaStorageClass.getMethod("getInstance", null);
+ Database mediaStorage = (Database)m.invoke(null, null);
+ mediaEnt = (Entity)mediaStorage.getEntityClass().newInstance();
+ mediaEnt.setStorage(mediaStorage);
+ mediaEnt.setValues(mediaValues);
+ mediaId = mediaEnt.insert();
+
+ Class mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
+ MirMedia mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
+ //save and store the media data/metadata
+ mediaHandler.set(mpReq.getMedia(), mediaEnt,mediaTypesList.elementAt(0));
+
+ //were done with mpReq at this point, dereference it.
+ //as it contains mucho mem. -mh 01.10.2001
+ mpReq=null;
- //we got this far, associate the media to the article
- try{
- theLog.printError("ID"+mediaId);
- DatabaseContentToMedia.getInstance().addMedia(cid,mediaId);
- mediaEnt.setValueForProperty("is_published","1");
- mediaEnt.update();
- new ProducerMedia().handle(null,null,false,false,mediaId);
- theLog.printError("setting content_x_media success");
+ //we got this far, associate the media to the article
+ theLog.printError("ID"+mediaId);
+ mediaEnt.setValueForProperty("is_published","1");
+ mediaEnt.update();
+ new ProducerMedia().handle(null,null,false,false,mediaId);
+ DatabaseContentToMedia.getInstance().addMedia(cid,mediaId);
} catch (Exception e) {
- theLog.printError("setting content_x_media failed");
+ theLog.printError("setting media failed: "+e.toString());
+ contentModule.deleteById(cid);
+ throw new ServletModuleException("setting media failed: "+e.toString());
}
} else {
contentModule.deleteById(cid);
- theLog.printDebugInfo("Wrong file uploaded!: " + fileName);
+ theLog.printDebugInfo("Wrong file type uploaded!: " + fileName);
throw new ServletModuleUserException("One or more files of unrecognized types");
} // end if-else mediaTypesList.size() > 0
this.theTable="article_type";
}
- public SimpleList getPopupData() { return getPopupData("name",false); }
+ public SimpleList getPopupData()
+ throws StorageObjectException { return getPopupData("name",false); }
}
catch (Exception e) { throw new StorageObjectException(e.toString()); }
}
- public SimpleList getPopupData() { return getPopupData("title",true); }
+ public SimpleList getPopupData()
+ throws StorageObjectException { return getPopupData("title",true); }
public boolean deleteByContentId(String id)
throws StorageObjectException {
* sets the database flag is_produced to unproduced
*/
- public void setUnproduced(String where)
+ public void setUnproduced(String where) throws StorageObjectException
{
Connection con=null;Statement stmt=null;
String sql = "update content set is_produced='0' where " + where;
}
- public void setMedia(String contentId, String[] mediaId) {
+ public void setMedia(String contentId, String[] mediaId)
+ throws StorageObjectException {
if (contentId == null){
return;
}
}
}
- public void addMedia(String contentId, String mediaId) {
+ public void addMedia(String contentId, String mediaId)
+ throws StorageObjectException {
if (contentId == null && mediaId == null) {
return;
}
}
}
- public void setMedia(String contentId, String mediaId) {
+ public void setMedia(String contentId, String mediaId)
+ throws StorageObjectException {
if (contentId == null && mediaId == null) {
return;
}
}
}
- public void deleteByContentId(String contentId) {
+ public void deleteByContentId(String contentId)
+ throws StorageObjectException {
if (contentId == null) {
//theLog.printDebugInfo("-- delete topics failed -- no content id");
return;
}
}
- public void deleteByMediaId(String mediaId) {
+ public void deleteByMediaId(String mediaId)
+ throws StorageObjectException {
if (mediaId == null) {
//theLog.printDebugInfo("-- delete topics failed -- no topic id");
return;
}
}
- public void delete(String contentId, String mediaId) {
+ public void delete(String contentId, String mediaId)
+ throws StorageObjectException {
if (mediaId == null || contentId==null) {
theLog.printDebugInfo("-- delete media failed -- missing parameter");
return;
}
- public EntityList getContent(EntityMedia media) {
+ public EntityList getContent(EntityMedia media)
+ throws StorageObjectException {
EntityList returnList=null;
if (media != null) {
String id = media.getId();
* Returns a EntityList with all content-objects having a relation to a media
*/
-public EntityList getContent() {
+public EntityList getContent()
+ throws StorageObjectException {
EntityList returnList=null;
String select = "select distinct content_id from " + theTable;
* Returns a ArrayList of Integer-Objects from a content-id.
* @returns ArrayList
*/
- public ArrayList getTopicsOfContent(String contentId) {
+ public ArrayList getTopicsOfContent(String contentId)
+ throws StorageObjectException {
ArrayList returnList = new ArrayList();
if (contentId != null) {
String sql = "select topic_id from " + theTable + " where content_id=" + contentId;
/**
* Set new topics
*/
- public void setTopics(String contentId, String[] topicId) {
+ public void setTopics(String contentId, String[] topicId)
+ throws StorageObjectException {
if (contentId == null){
return;
}
}
}
- public void deleteByContentId(String contentId) {
+ public void deleteByContentId(String contentId)
+ throws StorageObjectException {
if (contentId == null) {
//theLog.printDebugInfo("-- delete topics failed -- no content id");
return;
}
}
- public void deleteByTopicId(String topicId) {
+ public void deleteByTopicId(String topicId)
+ throws StorageObjectException {
if (topicId == null) {
//theLog.printDebugInfo("-- delete topics failed -- no topic id");
return;
}
- public EntityList getContent(EntityTopics topic) {
+ public EntityList getContent(EntityTopics topic)
+ throws StorageObjectException {
EntityList returnList=null;
if (topic != null) {
String id = topic.getId();
}
}
- public SimpleList getPopupData() {
+ public SimpleList getPopupData() throws StorageObjectException {
return getPopupData("title",true);
}
this.theTable="img_color";
}
- public SimpleList getPopupData() { return getPopupData("name",true); }
+ public SimpleList getPopupData()
+ throws StorageObjectException { return getPopupData("name",true); }
}
this.theTable="img_format";
}
- public SimpleList getPopupData() { return getPopupData("name",true); }
+ public SimpleList getPopupData()
+ throws StorageObjectException { return getPopupData("name",true); }
}
this.theTable="img_layout";
}
- public SimpleList getPopupData() { return getPopupData("name",true); }
+ public SimpleList getPopupData()
+ throws StorageObjectException { return getPopupData("name",true); }
}
this.theTable="img_type";
}
- public SimpleList getPopupData() { return getPopupData("name",true); }
+ public SimpleList getPopupData()
+ throws StorageObjectException { return getPopupData("name",true); }
}
catch (Exception e) { throw new StorageObjectException(e.toString()); }
}
- public SimpleList getPopupData() {
+ public SimpleList getPopupData() throws StorageObjectException {
return getPopupData("title",true);
}
this.theTable="language";
}
- public SimpleList getPopupData() { return getPopupData("name",false); }
+ public SimpleList getPopupData() throws StorageObjectException { return getPopupData("name",false); }
}
return getHashData();
}
- public SimpleList getPopupData () {
+ public SimpleList getPopupData () throws StorageObjectException {
return getPopupData();
}
}
* returns the comments that belong to the article (via entityrelation)
* where db-flag is_published is true
*/
- public Entity getMediaType(Entity ent) {
+ public Entity getMediaType(Entity ent) throws StorageObjectException {
Entity type=null;
try {
type = relationMediaType.getOne(ent);
}
catch (StorageObjectException e) {
theLog.printError("DatabaseUploadedMedia :: failed to get media_type");
+ throw new StorageObjectException("DatabaseUploadedMedia :"+e.toString());
}
return type;
}
this.theTable="media_folder";
}
- public SimpleList getPopupData() {
+ public SimpleList getPopupData() throws StorageObjectException {
return getPopupData("name",true);
}
this.theTable="rights";
}
- public SimpleList getPopupData() { return getPopupData("name",true); }
+ public SimpleList getPopupData() throws StorageObjectException
+ { return getPopupData("name",true); }
}
}
- public SimpleList getPopupData() {
+ public SimpleList getPopupData() throws StorageObjectException {
return getPopupData("title",true);
}
}
}
- public SimpleList getPopupData() {
+ public SimpleList getPopupData() throws StorageObjectException {
return getPopupData("login",true);
}
}
catch (Exception e) { throw new StorageObjectException(e.toString()); }
}
- public SimpleList getPopupData() {
+ public SimpleList getPopupData() throws StorageObjectException {
return getPopupData("title",true);
}