<property name="dist.src" value="${app.name}.jar"/>
<property name="dist.war" value="${app.name}.war"/>
<property name="javadoc.home" value="${deploy.home}/javadoc"/>
+ <property name="build.compiler" value="jikes"/>
<!-- The "prepare" target is used to construct the deployment home
</copy>
<copy todir="${deploy.home}">
<fileset dir="source" includes="**/content-types.properties"/>
+ <fileset dir="source" includes="**/server.xml"/>
</copy>
</target>
now customize config.properties for your needs.
+ modify etc/web.xml to change the xml-config
+ parameter to point to where your server.xml file is
+ (in ../Mir i.e /path/to/Mir/server.xml)
+
3. configure the build.sh file with java_home
cp build.sh-dist build.sh
"password" in /etc/postgresql/pg_hba.conf into "trust". This should disable
any authentication method and make the database accessible again.
+15. configure apache's mod_mime to recognize .m3u and .pls files:
+
+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.
+
that's it :)
now the admin-application is accesable via:
<param-name>Config</param-name>
<param-value>config</param-value>
</init-param>
+ <init-param>
+ <param-name>xml-config</param-name>
+ <param-value>/home/heckmann/mir/Mir/server.xml</param-value>
+ </init-param>
</servlet>
<param-name>Config</param-name>
<param-value>config</param-value>
</init-param>
+ <init-param>
+ <param-name>xml-config</param-name>
+ <param-value>/home/heckmann/mir/Mir/server.xml</param-value>
+ </init-param>
</servlet>
import freemarker.template.*;
import mir.misc.*;
+import mir.xml.XmlConfigurator;
import mir.servlet.*;
import mircoders.servlet.*;
doPost(req,res);
}
+ public void init() throws ServletException {
+ try {
+ XmlConfigurator xmlXonfigurator = XmlConfigurator.getInstance();
+ xmlXonfigurator.addRequiredTag("/mir/class:mir.storage.DatabaseConfig/property:username");
+ xmlXonfigurator.addRequiredTag("/mir/class:mir.storage.DatabaseConfig/property:password");
+ xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:password");
+ xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:username");
+ xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:host");
+ xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:adaptor");
+ xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:limit");
+ xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:poolMax");
+ xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:poolMin");
+ xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:poolResetTime");
+ xmlXonfigurator.addComesFirstTag("/mir/class:mir.storage.DatabaseConfig/property:poolLog");
+ xmlXonfigurator.configure(new File(getInitParameter("xml-config")));
+ System.err.println("INIT");
+ /*try {
+ MirXmlParser xmlParser = new MirXmlParser();
+ xmlParser.parse("/home/heckmann/server.xml");*/
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new UnavailableException ("Error loading Config file: "+e.toString(), 0);
+ }
+ System.err.println("DONE INIT");
+ }
+
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
protected static Logfile theLog;
protected ArrayList streamedInput=null;
private static int instances = 0;
- static {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Entity.Logfile"));
- }
public AbstractEntity() {
+ theLog = Logfile.getInstance(this.getClass().getName());
this.changed = false;
instances++;
+ Integer i = new Integer(instances);
+ System.err.println("New abstract entity instance: "+i.toString());
}
/**
public EntityList(){
this.theEntityArrayList = new ArrayList();
if (theLog == null)
- this.theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Entity.Logfile"));
+ this.theLog = Logfile.getInstance(this.getClass().getName());
}
/**
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");
}
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;
}
templateCache = new FileTemplateCache(templateDir);
templateCache.setLoadingPolicy(templateCache.LOAD_ON_DEMAND);
templateCache.startAutoUpdate();
- theLog = Logfile.getInstance(MirConfig.getPropWithHome("HTMLTemplateProcessor.Logfile"));
docRoot = MirConfig.getProp("RootUri");
+ theLog=Logfile.getInstance("HTMLTemplateProcessor");
//the quick hack is back in effect as it was more broken than ever before
// -mh
// sorry: nadir back in town, i have to debug the mirbase.jar in the
/**
* empty private constructor, to avoid instantiation
*/
- private HTMLTemplateProcessor () { }
+ private HTMLTemplateProcessor () {}
// process-methods to merge different datastructures
private RandomAccessFile raf;
private String fileName;
+ //config var, required since it's "null"
+ //TODO: should have a defaul value once I figure out
+ //how to disperse home dir. -mh
+ private static String logDir="/tmp/";
+
/**
* lineSeparator ermitteln und Repository anlegen
*/
* @return Logfile
*/
public static Logfile getInstance(String fileName) {
+ //TODO: tokenize the CallerClass name (fileName)
Logfile returnLogfile = null;
System.err.println(fileName);
if (fileName != null) {
} else {
returnLogfile = new Logfile(fileName);
instanceRepository.put(fileName, returnLogfile);
+ Integer i = new Integer(instanceRepository.size());
+ System.err.println("SIZZE: "+i.toString());
}
} else {
System.err.println("Fehler bei Instantiierung von Logfile");
* Privater Konstruktor
* @param String fileName
*/
- private Logfile(String fileName){
- this.fileName = fileName;
+ private Logfile(String file){
+ this.fileName = logDir+file;
+ System.err.println("FILENAME "+fileName+"DD");
try {
- File f = new File(fileName);
+ File f = new File(this.fileName);
File dir = new File(f.getParent());
dir.mkdirs();
raf = new RandomAccessFile(fileName, "rw");
}
}
+ //TODO: should have a defaul value once I figure out
+ //how to disperse home dir. -mh
+ public static void setLogDir(String dir) {
+ logDir=StringUtil.addSeparator(dir);
+ System.err.println("set logDir "+logDir);
+ }
+
/**
* Private Methode, um eine Zeile auszugeben
*
return buf.toString();
}
+ /**
+ * Ersetzt in String <code>s</code> das Regexp <code>pattern</code> durch <code>substitute</code>
+ * @param s
+ * @param pattern
+ * @param substitute
+ * @return String mit den Ersetzungen
+ */
+ public static String regexpReplace(String haystack, String pattern, String substitute) {
+ try {
+ RE regex = new RE(pattern);
+ return regex.substituteAll(haystack,substitute);
+ } catch(REException ex){
+ return null;
+ }
+ }
+
+
+
/**
* Fügt einen Separator an den Pfad an
// init config
MirConfig.initConfig(RealPath, RootUri, Name, getInitParameter("Config"));
- theLog = Logfile.getInstance(MirConfig.getPropWithHome(Name+".Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
theLog.printInfo(Name + " started.");
theLog.printInfo("Path is: " + MirConfig.getProp("Home"));
theLog.printInfo("Root URI is: " + MirConfig.getProp("RootUri"));
static Logfile theLog;
static {
- theLog = Logfile.getInstance("/tmp/smod.dispatch");
+ theLog = Logfile.getInstance("ServletModuleDispatch");
}
/**
* @param String confFilename Dateiname der Konfigurationsdatei
*/
public Database() {
- 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");
+ //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");
try {
theEntityClass = Class.forName("mir.entity.GenericEntity");
theAdaptor = (DatabaseAdaptor)Class.forName(theAdaptorName).newInstance();
- defaultLimit = Integer.parseInt(MirConfig.getProp("Database.Limit"));
+ defaultLimit = Integer.parseInt(DatabaseConfig.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 );
- MirConfig.addBroker(database_driver,database_url);
- myBroker=MirConfig.getBroker();
+ DatabaseConfig.addBroker(database_driver,database_url);
+ myBroker=DatabaseConfig.getBroker();
}
catch (Exception e){
theLog.printError("Bei Konstruktion von Database() with " + theAdaptorName + " -- " +e.toString());
public final class DatabaseAdaptorPostgresql implements DatabaseAdaptor{
+ private static String url = "jdbc:postgresql://localhost:5432/mir";
+ private static String driver = "org.postgresql.Driver";
+
public String getDriver() {
- return MirConfig.getProp("Adaptor.PostgreSQL.Driver");
+ return driver;
}
public String getURL(String user, String pass, String host) {
- return MirConfig.getProp("Adaptor.PostgreSQL.URL");
+ return url;
+ }
+
+ public static void setUrl(String u) throws Exception {
+ if (!url.startsWith("jdbc:"))
+ throw new Exception("Database Adaptor URL must begin with: \"jdbc:\"");
+ url = u;
+ }
+
+ public static void setDriver(String d) {
+ driver = d;
}
public boolean hasLimit() {
--- /dev/null
+
+package mir.storage;
+
+import java.util.*;
+import java.lang.*;
+import com.javaexchange.dbConnectionBroker.*;
+
+/**
+ * Title: Mir
+ * Description: Class that allows access to all Database Config values
+ * Copyright: Copyright (c) 2001
+ * Company: Indymedia
+ * @author mh <heckmann@hbe.ca>
+ * @version 0.1
+ */
+
+
+public class DatabaseConfig {
+
+ private static HashMap configHash;
+ private static HashMap brokerHash;
+ private static int instances=0;
+
+ static {
+ configHash = new HashMap();
+ brokerHash = new HashMap();
+ configHash.put("Database.Host", "localhost");
+ configHash.put("Database.Adaptor", "mir.storage.DatabaseAdaptorPostgresql");
+ configHash.put("Database.Limit", "20");
+ configHash.put("Database.poolMin", "1");
+ configHash.put("Database.poolMax", "10");
+ configHash.put("Database.poolLog", "/tmp/pool.log");
+ configHash.put("Database.poolResetTime", "1.0");
+ }
+
+ public static void setUsername(String user) {
+ configHash.put("Database.Username", user);
+ }
+
+ public static void setPassword(String pass) {
+ configHash.put("Database.Password", pass);
+ }
+
+ public static void setHost(String host) {
+ configHash.put("Database.Host", host);
+ }
+
+ public static void setAdaptor(String adaptor) {
+ configHash.put("Database.Adaptor", adaptor);
+ }
+
+ public static void setDefaultLimit(int limit) {
+ configHash.put("Database.Limit", Integer.toString(limit));
+ }
+
+ public static void setPoolMin(int min) {
+ configHash.put("Database.poolMin", Integer.toString(min));
+ }
+
+ public static void setPoolMax(int max) {
+ configHash.put("Database.poolMax", Integer.toString(max));
+ }
+
+ public static void setPoolResetTime(float t) {
+ configHash.put("Database.poolResetTime", Float.toString(t));
+ }
+
+ public static void setPoolLog(String l) {
+ configHash.put("Database.poolLog", l);
+ }
+
+ /**
+ * Returns the property asked for by pulling it out a HashMap
+ * @param a String containing the property name (key)
+ * @return a String containing the prop. value
+ */
+ public static String getProp(String propName) {
+ return (String)configHash.get(propName);
+ }
+
+ public static void addBroker(String driver, String URL){
+
+ String username,passwd,min,max,log,reset;
+
+ if(!brokerHash.containsKey("Pool.broker")){
+ username=getProp("Database.Username");
+ passwd=getProp("Database.Password");
+ min=getProp("Database.poolMin");
+ max=getProp("Database.poolMax");
+ log= getProp("Database.poolLog");
+ reset=getProp("Database.poolResetTime");
+
+ try{
+ System.err.println("-- making Broker for -"
+ +driver+" - " +URL
+ + " log " + log + " user "
+ + username + " pass: " + passwd);
+
+ DbConnectionBroker br = new DbConnectionBroker(driver,URL,username,passwd,(new Integer(min)).intValue(),
+ (new Integer(max)).intValue(),log,(new Float(reset)).floatValue());
+ if (br!=null){
+ instances++;
+ brokerHash.put("Pool.broker",br);
+ } else {
+ throw new Exception();
+ }
+ } catch(Exception e){
+ System.err.println("Der ConnectionBroker konnte nicht initializiert werden"+ e.toString());e.printStackTrace();
+ }
+ } // end if
+ }
+
+ /**
+ * Liefert DBConnectionBroker einer Configuration zurueck
+ * @param confFilename
+ * @return DBConnectionBroker
+ */
+ public static DbConnectionBroker getBroker() {
+ DbConnectionBroker broker=null;
+ broker=(DbConnectionBroker)brokerHash.get("Pool.broker");
+ if (broker==null) {
+ System.err.println("Konnte kein ConnectionPoolBroker initialisiert werden");
+ }
+ return broker;
+ }
+
+ /**
+ * Liefert Anzahl der Instantiierten DBConnectionBroker zurueck
+ * @return
+ */
+ public static int getBrokerInstances() {
+ return instances;
+ }
+
+ public static DbConnectionBroker getBrokerInfo(){
+ return (DbConnectionBroker)brokerHash.get("Pool.broker");
+ }
+
+ /**
+ * Finalize method
+ */
+ public void finalize(){
+ instances --;
+ try {
+ super.finalize();
+ } catch (Throwable t) {}
+ }
+
+}
* classes as well as the inclusion of a method to
* add parameters (nested tags) that are required.
* (the addRequired method) in the config file.
+ * that part is from tomcat.
+ *
+ * much code is stolen from ant ProjectHelper.java.
*
* @author -mh <heckmann@hbe.ca>
* @version 2001.10.21
boolean matched[] = new boolean[256];
int matchedCount=0;
+ XmlMatch mustComeFirstMatch[]=new XmlMatch[256]; //maximum amount of rules
+ int comeFirstMatchCount=0;
+
+ Property comesFirstArr[]=new Property[128];
+ int comesFirstCount=0;
+
+ Property propertyArr[]=new Property[128];
+ int propertyCount=0;
+
private static XmlConfigurator instance = new XmlConfigurator();
public static XmlConfigurator getInstance() { return instance; }
throw new ConfigException("Error parsing config file, missing required element: "+requiredXmlMatch[i].toString());
}
}
- }
+ try {
+ for(int i=0; i<comesFirstCount;i++) {
+ comesFirstArr[i].set();
+ }
+ for(int i=0; i<propertyCount;i++) {
+ propertyArr[i].set();
+ System.out.println("about to set: "+i);
+ }
+ } catch (Exception e) {
+ throw new SAXParseException(e.toString(), locator);
+ }
+}
catch(ParserConfigurationException exc) {
throw new ConfigException("Parser has not been configured correctly", exc);
}
saxContext.push(tag+":"+name);
matchedCount += checkRequiredTag(saxContext);
try {
- classN=Class.forName(name);
+ classN=Class.forName(name, false, this.getClass().getClassLoader());
} catch (ClassNotFoundException e) {
throw new ConfigException("Error invoking class: \""+name+
"\"",e);
saxContext.push(tag+":"+name);
matchedCount += checkRequiredTag(saxContext);
- //finally try to set the property
- try {
- setProperty(classN, name, value);
- } catch (Exception e) {
- throw new SAXParseException(e.toString(), locator);
+ //finally add it to the lists
+ //to be processed later
+ if (checkComesFirstTag(saxContext)) {
+ comesFirstArr[comesFirstCount]=new Property(classN, name, value);
+ comesFirstCount++;
+ } else {
+ propertyArr[propertyCount]=new Property(classN, name, value);
+ propertyCount++;
}
}
}
+ public void addComesFirstTag(String xmlPath) {
+ mustComeFirstMatch[comeFirstMatchCount]=new XmlMatch(xmlPath);
+ comeFirstMatchCount++;
+ }
+
+ private boolean checkComesFirstTag(SaxContext ctx) {
+ for( int i=0; i<comeFirstMatchCount; i++ ) {
+ if( mustComeFirstMatch[i].match(ctx) ) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public void addRequiredTag(String xmlPath) {
requiredXmlMatch[requiredXmlMatchCount]=new XmlMatch(xmlPath);
matched[requiredXmlMatchCount]=false;
return new String(chars);
}
- /** Find a method with the right name
- * If found, call the method ( if param is int or boolean we'll convert
- * value to the right type before) - that means you can have setDebug(1).
- */
- static void setProperty( Class classN, String name, String value )
- throws Exception {
-
- String setter= "set" +capitalize(name);
+ private class Property {
+ Class classN;
+ String name;
+ String value;
- try {
- Method methods[]=classN.getMethods();
- Method setPropertyMethod=null;
-
- // First, the ideal case - a setFoo( String ) method
- for( int i=0; i< methods.length; i++ ) {
- Class paramT[]=methods[i].getParameterTypes();
- if( setter.equals( methods[i].getName() ) &&
- paramT.length == 1 &&
- "java.lang.String".equals( paramT[0].getName())) {
-
- methods[i].invoke( null, new Object[] { value } );
- return;
- }
- } //end for
-
- // Try a setFoo ( int ) or ( boolean )
- for( int i=0; i< methods.length; i++ ) {
- boolean ok=true;
- if( setter.equals( methods[i].getName() ) &&
- methods[i].getParameterTypes().length == 1) {
-
- // match - find the type and invoke it
- Class paramType=methods[i].getParameterTypes()[0];
- Object params[]=new Object[1];
- if ("java.lang.Integer".equals( paramType.getName()) ||
- "int".equals( paramType.getName())) {
- try {
- params[0]=new Integer(value);
- } catch( NumberFormatException ex ) {ok=false;}
- } else if ("java.lang.Boolean".equals( paramType.getName()) ||
- "boolean".equals( paramType.getName())) {
- params[0]=new Boolean(value);
- } else {
- throw new Exception("Unknown type " + paramType.getName() + "for property \""+name+"\"with value \""+value+"\"");
- }
+ public Property( Class classN, String name, String value) {
+ this.classN=classN;
+ this.name=name;
+ this.value=value;
+ }
+
+ /** Find a method with the right name
+ * If found, call the method ( if param is int or boolean we'll convert
+ * value to the right type before) - that means you can have setDebug(1).
+ */
+ public void set() throws Exception {
+
+ String setter= "set" +capitalize(name);
- if( ok ) {
- System.out.println("XXX: " + methods[i] + " " + classN + " " + params[0] );
- methods[i].invoke( null, params );
- return;
- } //end if
- } //end if setter
- } //end for
-
- //if we got this far it means we were not successful in setting the
- //property
- throw new Exception("Count not find method \""+setter+"\" in Class \""+classN.getName()+"\" in order to set property \""+name+"\"");
-
- } catch( SecurityException ex1 ) {
- throw new Exception("SecurityException for " + classN.getName() + " " + name + "=" + value +")" );
- //if( ctx.getDebug() > 1 ) ex1.printStackTrace();
- } catch (IllegalAccessException iae) {
- throw new Exception("IllegalAccessException for " + classN.getName() + " " + name + "=" + value +")" );
- //if( ctx.getDebug() > 1 ) iae.printStackTrace();
- } catch (InvocationTargetException ie) {
- throw new Exception("InvocationTargetException for " + classN.getName() + " " + name + "=" + value +")" );
- //if( ctx.getDebug() > 1 ) ie.printStackTrace();
+ try {
+ Method methods[]=classN.getMethods();
+ Method setPropertyMethod=null;
+
+ // First, the ideal case - a setFoo( String ) method
+ for( int i=0; i< methods.length; i++ ) {
+ Class paramT[]=methods[i].getParameterTypes();
+ if( setter.equals( methods[i].getName() ) &&
+ paramT.length == 1 &&
+ "java.lang.String".equals( paramT[0].getName())) {
+
+ methods[i].invoke( null, new Object[] { value } );
+ return;
+ }
+ } //end for
+
+ // Try a setFoo ( int ), (float) or ( boolean )
+ for( int i=0; i< methods.length; i++ ) {
+ boolean ok=true;
+ if( setter.equals( methods[i].getName() ) &&
+ methods[i].getParameterTypes().length == 1) {
+
+ // match - find the type and invoke it
+ Class paramType=methods[i].getParameterTypes()[0];
+ Object params[]=new Object[1];
+ if ("java.lang.Integer".equals( paramType.getName()) ||
+ "int".equals( paramType.getName())) {
+ try {
+ params[0]=new Integer(value);
+ } catch( NumberFormatException ex ) {ok=false;}
+ } else if ("java.lang.Float".equals( paramType.getName()) ||
+ "float".equals( paramType.getName())) {
+ try {
+ params[0]=new Float(value);
+ } catch( NumberFormatException ex ) {ok=false;}
+ } else if ("java.lang.Boolean".equals( paramType.getName()) ||
+ "boolean".equals( paramType.getName())) {
+ params[0]=new Boolean(value);
+ } else {
+ throw new Exception("Unknown type " + paramType.getName() + "for property \""+name+"\"with value \""+value+"\"");
+ }
+
+ if( ok ) {
+ System.out.println("XXX: " + methods[i] + " " + classN + " " + params[0] );
+ methods[i].invoke( null, params );
+ return;
+ } //end if
+ } //end if setter
+ } //end for
+
+ //if we got this far it means we were not successful in setting the
+ //property
+ throw new Exception("Count not find method \""+setter+"\" in Class \""+classN.getName()+"\" in order to set property \""+name+"\"");
+
+ } catch( SecurityException ex1 ) {
+ throw new Exception("SecurityException for " + classN.getName() + " " + name + "=" + value +")" );
+ //if( ctx.getDebug() > 1 ) ex1.printStackTrace();
+ } catch (IllegalAccessException iae) {
+ throw new Exception("IllegalAccessException for " + classN.getName() + " " + name + "=" + value +")" );
+ //if( ctx.getDebug() > 1 ) iae.printStackTrace();
+ } catch (InvocationTargetException ie) {
+ throw new Exception("InvocationTargetException for " + classN.getName() + " " + name + "=" + value +")" );
+ //if( ctx.getDebug() > 1 ) ie.printStackTrace();
+ }
}
}
}
public String toString() {
- return "Tag("+names+")";
+ String tag="/";
+ int i=0;
+ while ( names[i] != null) {
+ tag=tag+names[i]+"/";
+ i++;
+ }
+ return tag;
}
}
if (!logDir.exists()) {
logDir.mkdir();
}
- logger = Logfile.getInstance(args[0] + "LOG/xml.log");
+ logger = Logfile.getInstance("Inputlog");
XmlInputParser xmlInputParser = new XmlInputParser();
//get the config-file
/* Commented out for now since it seems unused and need more
public ModuleBreaking (StorageObject theStorage)
{
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Breaking.Logfile"));
+ if (theLog == null) theLog = Logfile.getInstance(this.getClass().getName());
if (theStorage == null) theLog.printWarning("ModuleBreaking -- StorageObject was null!");
this.theStorage = theStorage;
}
// 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;
}
public ModuleContent() {
super();
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Content.Logfile"));
+ if (theLog == null) theLog = Logfile.getInstance(this.getClass().getName());
}
public ModuleContent(StorageObject theStorage) {
this.theStorage = theStorage;
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Content.Logfile"));
+ if (theLog == null) theLog = Logfile.getInstance(this.getClass().getName());
}
//
this.theStorage = theStorage;
if (theLog == null)
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Feature.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
}
public ModuleImages(StorageObject theStorage) {
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home")+MirConfig.getProp("Module.Bilder.Logfile"));
+ if (theLog == null) theLog = Logfile.getInstance(this.getClass().getName());
if (theStorage == null) theLog.printWarning("StorageObject was null!");
this.theStorage = theStorage;
// Kontruktor
public ModuleLanguage (StorageObject theStorage) {
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Language.Logfile"));
+ if (theLog == null) theLog = Logfile.getInstance(this.getClass().getName());
if (theStorage == null) theLog.printWarning("ModuleLanguage -- StorageObject was null!");
this.theStorage = theStorage;
public ModuleLinksImcs(StorageObject theStorage) {
this.theStorage = theStorage;
if (theLog == null)
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.LinksImcs.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
}
public SimpleHash getLinksImcsAsSimpleHash() {
public ModuleMediafolder(StorageObject theStorage)
{
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Mediafolder.Logfile"));
+ if (theLog == null) theLog = Logfile.getInstance(this.getClass().getName());
if (theStorage == null) theLog.printWarning("StorageObject was null!");
this.theStorage = theStorage;
}
public ModuleMessage (StorageObject theStorage)
{
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Messages.Logfile"));
+ if (theLog == null) theLog = Logfile.getInstance(this.getClass().getName());
if (theStorage == null) theLog.printWarning("ModuleMessage -- StorageObject was null!");
this.theStorage = theStorage;
this.theStorage = theStorage;
if (theLog == null)
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Schwerpunkt.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
}
public ModuleTopics(StorageObject theStorage) {
this.theStorage = theStorage;
if (theLog == null)
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Themen.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
}
public SimpleList getTopicsAsSimpleList() {
public ModuleUploadedMedia(StorageObject theStorage) {
this.theStorage = theStorage;
if (theLog == null)
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Themen.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
}
public SimpleList getUploadedMediaAsSimpleList() {
public ModuleUsers(StorageObject theStorage)
{
- if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Users.Logfile"));
+ if (theLog == null) theLog = Logfile.getInstance(this.getClass().getName());
if (theStorage == null) theLog.printWarning("StorageObject was null!");
this.theStorage = theStorage;
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(MirConfig.getProp("Home") + MirConfig.getProp("Producer.Logfile"));
+ protected static Logfile theLog = Logfile.getInstance("Producer");
protected static ModuleTopics topicsModule;
protected static ModuleLinksImcs linksImcsModule;
protected static ModuleSchwerpunkt schwerpunktModule;
new ProducerContent().handle(htmlout, user, force,sync);
new ProducerOpenPosting().handle(htmlout, user, force,sync);
new ProducerTopics().handle(htmlout, user, force,sync);
- new ProducerNavigation().handle(htmlout, user, force,sync);
+ new ProducerNavigation().handle(htmlout, user, force,sync);
// Finish
sessionConnectTime = new java.util.Date().getTime() - startTime;
upMedia = currentMediaList.elementAt(n);
upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
mediaType = ((EntityMedia)upMedia).getMediaType();
- //must be a non-existant to_media_type entry..
+ //in case it's a non-existant to_media_type entry..
if (mediaType != null) {
try {
mediaHandlerName = mediaType.getValue("classname");
Database mediaStorage=null;
String tinyIcon;
String iconAlt;
- Logfile theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Producer.Logfile"));
+ Logfile theLog = Logfile.getInstance(this.getClass().getName());
SimpleList mediaList;
SimpleHash contentHash;
private ServletModuleBreaking() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Breaking.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
templateListString = MirConfig.getProp("ServletModule.Breaking.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Breaking.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Breaking.ConfirmTemplate");
public static ServletModule getInstance() { return instance; }
private ServletModuleComment() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Comment.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
templateListString = MirConfig.getProp("ServletModule.Comment.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Comment.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Comment.ConfirmTemplate");
private ServletModuleContent() {
try {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Content.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
templateListString = MirConfig.getProp("ServletModule.Content.ListTemplate");
templateOpString = MirConfig.getProp("ServletModule.Content.OpTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Content.ObjektTemplate");
private ServletModuleImages() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Bilder.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
templateListString = MirConfig.getProp("ServletModule.Bilder.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Bilder.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Bilder.ConfirmTemplate");
public static ServletModule getInstance() { return instance; }
private ServletModuleLanguage() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Language.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
templateListString = MirConfig.getProp("ServletModule.Language.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Language.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Language.ConfirmTemplate");
private ServletModuleLinksImcs() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.LinksImcs.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
templateListString = MirConfig.getProp("ServletModule.LinksImcs.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.LinksImcs.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.LinksImcs.ConfirmTemplate");
private static ServletModuleMediafolder instance = new ServletModuleMediafolder();
private ServletModuleMediafolder() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Mediafolder.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
templateListString = MirConfig.getProp("ServletModule.Mediafolder.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Mediafolder.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Mediafolder.ConfirmTemplate");
public static ServletModule getInstance() { return instance; }
private ServletModuleMessage() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Messages.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
templateListString = MirConfig.getProp("ServletModule.Messages.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Messages.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Messages.ConfirmTemplate");
public class ServletModuleOpenIndy extends ServletModule
{
-
- private String commentFormTemplate, commentFormDoneTemplate, commentFormDupeTemplate;
- private String postingFormTemplate, postingFormDoneTemplate, postingFormDupeTemplate;
private ModuleContent contentModule;
private ModuleImages imageModule;
private ModuleTopics themenModule;
- private String directOp ="yes";
+
+ //config values
+ private static String commentFormTemplate = "open/comment.template";
+ private static String commentFormDoneTemplate = "open/comment_done.template";
+ private static String commentFormDupeTemplate = "open/comment_dupe.template";
+ private static String postingFormTemplate = "open/posting.template";
+ private static String postingFormDoneTemplate = "open/posting_done.template";
+ private static String postingFormDupeTemplate = "open/posting_dupe.template";
+ private static boolean directOp = true;
// Singelton / Kontruktor
private static ServletModuleOpenIndy instance = new ServletModuleOpenIndy();
public static ServletModule getInstance() { return instance; }
+ public static void setDirectOp(boolean v) {
+ directOp=v;
+ }
+
+// public static setCommentFormTemplate(String template) throws {
+ // if
+
private ServletModuleOpenIndy() {
try {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.OpenIndy.Logfile"));
- commentFormTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentTemplate");
- commentFormDoneTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentDoneTemplate");
- commentFormDupeTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentDupeTemplate");
- postingFormTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingTemplate");
- postingFormDoneTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingDoneTemplate");
- postingFormDupeTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingDupeTemplate");
- directOp = MirConfig.getProp("DirectOpenposting").toLowerCase();
+ theLog = Logfile.getInstance(this.getClass().getName());
+ //commentFormTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentTemplate");
+ //commentFormDoneTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentDoneTemplate");
+ //commentFormDupeTemplate = MirConfig.getProp("ServletModule.OpenIndy.CommentDupeTemplate");
+ //postingFormTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingTemplate");
+ //postingFormDoneTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingDoneTemplate");
+ //postingFormDupeTemplate = MirConfig.getProp("ServletModule.OpenIndy.PostingDupeTemplate");
+ //directOp = MirConfig.getProp("DirectOpenposting").toLowerCase();
mainModule = new ModuleComment(DatabaseComment.getInstance());
contentModule = new ModuleContent(DatabaseContent.getInstance());
themenModule = new ModuleTopics(DatabaseTopics.getInstance());
// op-articles are immediatly published
withValues.put("is_published","1");
// if op direct article-type == newswire
- if (directOp.equals("yes")) withValues.put("to_article_type","1");
+ if (directOp) withValues.put("to_article_type","1");
// owner is openposting user
withValues.put("to_publisher","1");
* sure that it is in this file -mh
*/
contentType = FileUtil.guessContentTypeFromName(fileName);
+ theLog.printError("tYPE: "+contentType);
if (contentType==null)
contentType = "text/plain"; // rfc1867 says this is the default
}
// producing new page
new ProducerContent().handle(null, null, false, false,cid);
//if direct op producing startpage
- if (directOp.equals("yes")) new ProducerStartPage().handle(null,null);
+ if (directOp) new ProducerStartPage().handle(null,null);
// sync the server
//should be configureable
public static ServletModule getInstance() { return instance; }
private ServletModuleProducer() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Producer.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
defaultAction="produce";
}
public static ServletModule getInstance() { return instance; }
private ServletModuleSchwerpunkt() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Schwerpunkt.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
templateListString = MirConfig.getProp("ServletModule.Schwerpunkt.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Schwerpunkt.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Schwerpunkt.ConfirmTemplate");
public static ServletModule getInstance() { return instance; }
private ServletModuleTopics() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Themen.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
templateListString = MirConfig.getProp("ServletModule.Themen.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Themen.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Themen.ConfirmTemplate");
public static ServletModule getInstance() { return instance; }
private ServletModuleUsers() {
- theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("ServletModule.Users.Logfile"));
+ theLog = Logfile.getInstance(this.getClass().getName());
templateListString = MirConfig.getProp("ServletModule.Users.ListTemplate");
templateObjektString = MirConfig.getProp("ServletModule.Users.ObjektTemplate");
templateConfirmString = MirConfig.getProp("ServletModule.Users.ConfirmTemplate");