[Amavisadmin-svn] SF.net SVN: amavisadmin: [36] amavisadmin/trunk
Status: Beta
Brought to you by:
streindl
From: <str...@us...> - 2007-01-21 14:45:24
|
Revision: 36 http://amavisadmin.svn.sourceforge.net/amavisadmin/?rev=36&view=rev Author: streindl Date: 2007-01-21 06:45:25 -0800 (Sun, 21 Jan 2007) Log Message: ----------- Fixes for several small issues and * 1640418 * 1636552 Modified Paths: -------------- amavisadmin/trunk/docs/Makefile amavisadmin/trunk/docs/cust/titlepage.templates.xml amavisadmin/trunk/docs/installationguide.xml amavisadmin/trunk/src/java/de/sreindl/amavisadmin/ApproveRequests.java amavisadmin/trunk/src/java/de/sreindl/amavisadmin/EditJobs.java amavisadmin/trunk/src/java/de/sreindl/amavisadmin/EditSingleJob.java amavisadmin/trunk/src/java/de/sreindl/amavisadmin/HandlePendingReleases.java amavisadmin/trunk/src/java/de/sreindl/amavisadmin/MyRequests.java amavisadmin/trunk/src/java/de/sreindl/amavisadmin/SessionBean1.java amavisadmin/trunk/src/java/de/sreindl/amavisadmin/bo/ConfigurationBO.java amavisadmin/trunk/src/java/de/sreindl/amavisadmin/db/Job.hbm.xml amavisadmin/trunk/src/java/de/sreindl/amavisadmin/db/MsgReceipientDAO.java amavisadmin/trunk/src/java/de/sreindl/amavisadmin/jobs/AdminNotifierJob.java amavisadmin/trunk/src/java/de/sreindl/amavisadmin/jobs/RetentionCleanupJob.java amavisadmin/trunk/src/java/hibernate.cfg.xml amavisadmin/trunk/src/java/log4j.properties amavisadmin/trunk/web/EditSingleJob.jsp Added Paths: ----------- amavisadmin/trunk/docs/images amavisadmin/trunk/src/java/de/sreindl/amavisadmin/jobs/ReleaseMailJob.java amavisadmin/trunk/src/java/de/sreindl/amavisadmin/templates/ReleaseError.vm amavisadmin/trunk/src/java/de/sreindl/amavisadmin/templates/ReleaseSuccess.vm Modified: amavisadmin/trunk/docs/Makefile =================================================================== --- amavisadmin/trunk/docs/Makefile 2007-01-20 16:51:50 UTC (rev 35) +++ amavisadmin/trunk/docs/Makefile 2007-01-21 14:45:25 UTC (rev 36) @@ -254,7 +254,7 @@ <xsl:param name="paper.type">A4</xsl:param> \ <xsl:param name="draft.watermark.image"></xsl:param> \ <xsl:param name="hyphenation">false</xsl:param> \ - <xsl:param name="hyphenate.verbatim">1</xsl:param> \ + <xsl:param name="hyphenate.verbatim">0</xsl:param> \ <xsl:param name="alignment">left</xsl:param> \ <xsl:param name="refentry.generate.name">1</xsl:param> \ <xsl:param name="refentry.generate.title">0</xsl:param> \ @@ -365,7 +365,7 @@ # and foo.1.txt from it. .PRECIOUS: %.1 %.2 %.3 %.4 %.5 %.6 %.7 %.8 %.9 -docbook: cust/titlepage.templates.xsl $(DOCBOOK_OUTPUT_FORMATS) +docbook: $(DOCBOOK_OUTPUT_FORMATS) man: $(LISTS_MAN) @@ -383,7 +383,7 @@ txt: $(FILES_TXT) -pdf: $(FILES_PDF) +pdf: cust/titlepage.templates.xsl $(FILES_PDF) info: $(FILES_INFO) Modified: amavisadmin/trunk/docs/cust/titlepage.templates.xml =================================================================== --- amavisadmin/trunk/docs/cust/titlepage.templates.xml 2007-01-20 16:51:50 UTC (rev 35) +++ amavisadmin/trunk/docs/cust/titlepage.templates.xml 2007-01-21 14:45:25 UTC (rev 36) @@ -33,17 +33,33 @@ font-family="{$title.fontset}"> <t:titlepage-content t:side="recto" - start-indent="0pt" text-align="center"> - <title t:named-template="component.title" +<!--t:named-template="component.title"--> + <title param:node="ancestor-or-self::article[1]" keep-with-next.within-column="always" + space-before="2cm" font-size="&hsize5;" font-weight="bold"/> - <subtitle/> + <subtitle + keep-with-next.within-column="always" + space-before="2cm" + font-size="&hsize3;" + font-weight="bold" + /> + <author space-before="0.5em" + font-size="&hsize2;"/> + </t:titlepage-content> + + <t:titlepage-content t:side="verso"> + <title + t:named-template="book.verso.title" + font-size="&hsize2;" + font-weight="bold" + font-family="{$title.fontset}"/> <corpauthor space-before="0.5em" font-size="&hsize2;"/> <authorgroup space-before="0.5em" @@ -58,19 +74,10 @@ margin-left="0.5in" margin-right="0.5in" font-family="{$body.fontset}"/> - <pubdate space-before="0.5em"/> <revision space-before="0.5em"/> <revhistory space-before="0.5em"/> - <abstract space-before="0.5em" - text-align="start" - margin-left="0.5in" - margin-right="0.5in" - font-family="{$body.fontset}"/> </t:titlepage-content> - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - <t:titlepage-separator> <fo:block break-after="page"/> </t:titlepage-separator> @@ -79,6 +86,7 @@ </t:titlepage-before> <t:titlepage-before t:side="verso"> + <fo:block break-after="page"/> </t:titlepage-before> </t:titlepage> Added: amavisadmin/trunk/docs/images =================================================================== --- amavisadmin/trunk/docs/images (rev 0) +++ amavisadmin/trunk/docs/images 2007-01-21 14:45:25 UTC (rev 36) @@ -0,0 +1 @@ +link docbook-xsl-1.71.1/images/ \ No newline at end of file Property changes on: amavisadmin/trunk/docs/images ___________________________________________________________________ Name: svn:special + * Modified: amavisadmin/trunk/docs/installationguide.xml =================================================================== --- amavisadmin/trunk/docs/installationguide.xml 2007-01-20 16:51:50 UTC (rev 35) +++ amavisadmin/trunk/docs/installationguide.xml 2007-01-21 14:45:25 UTC (rev 36) @@ -6,14 +6,19 @@ ]> <article> <articleinfo> - <title>&aa;</title> + <title>AmavisAdmin</title> + <subtitle>Installation Guide</subtitle> <author> - <firstname>Stephen</firstname> <surname>Reindl</surname> + <firstname>Stephen</firstname> + + <surname>Reindl</surname> + <address><street>Langster Str. 28</street> <postcode>40668</postcode> <city>Meerbusch</city> -<country>Germany></country></address> +<country>Germany></country></address> + <email>sr...@sr...</email> </author> @@ -21,7 +26,9 @@ <copyright> <year>2006</year> + <year>2007</year> + <holder>Stephen Reindl</holder> </copyright> @@ -30,7 +37,8 @@ you may not use this file except in compliance with the License. You may obtain a copy of the License at</para> - <para><ulink url="http://www.apache.org/licenses/LICENSE-2.0"/></para> + <para><ulink + url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink></para> <para>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" @@ -38,161 +46,177 @@ implied. See the License for the specific language governing permissions and limitations under the License.</para> </legalnotice> + + <revhistory> + <revision><revnumber>0.1</revnumber><date>2007-01-20</date><authorinitials>sr</authorinitials><revdescription><para>Initial document</para></revdescription></revision> + </revhistory> </articleinfo> <section id="preface"> <title>Preface</title> - <para> - This document describes how to install and use the &aa; tool. In addition - the document describes which tools are necessary to build an developement - platform that is suitable to develop and maintain &aa;. - </para> + <para>This document describes how to install and use the AmavisAdmin tool. + In addition the document describes which tools are necessary to build an + developement platform that is suitable to develop and maintain + AmavisAdmin.</para> - <para> - As &aa; is heavily based on Java and other open platform tools, building - a working production or development environment can be done without - creating any costs (except maybe for hardware, please see below ...). - </para> + <para>As AmavisAdmin is heavily based on Java and other open platform + tools, building a working production or development environment can be + done without creating any costs (except maybe for hardware, please see + below ...).</para> </section> <section id="sec-system-requirements"> <title>System Requirements</title> - <para> - The following requirements have to be met to run &aa; on a Computer: - </para> + <para>The following requirements have to be met to run AmavisAdmin on a + Computer:</para> <itemizedlist> <listitem> - <para> - Java runtime Version 1.5.0 (Tested with 1.5.0-10) from Sun (<ulink - url="http://java.sun.com"></ulink>) - </para> + <para>Java runtime Version 1.5.0 (Tested with 1.5.0-10) from Sun + (<ulink url="http://java.sun.com">http://java.sun.com</ulink>)</para> </listitem> <listitem> - <para> - An java application server. The software has been tested with Apache - Tomcat release <ulink url="http://tomcat.apache.org/">5.5.</ulink> - </para> + <para>An java application server. The software has been tested with + Apache Tomcat release <ulink + url="http://tomcat.apache.org/">5.5.</ulink></para> </listitem> <listitem> - <para> - <ulink url="http://www.ijs.si/software/amavisd/">Amavisd-new</ulink> - as the SPAM and Virus filter engine. At least version 2.4.2 has to - be used. - </para> - - <para> - The Amavisd-new package doesn't need to run on the same machine but - both the database Amavisd-new and a specific TCP port need to be - available to perform neccessary operations. - </para> + <para><ulink + url="http://www.ijs.si/software/amavisd/">Amavisd-new</ulink> as the + SPAM and Virus filter engine. At least version 2.4.2 has to be + used.</para> + + <para>The Amavisd-new package doesn't need to run on the same machine + but both the database Amavisd-new and a specific TCP port need to be + available to perform neccessary operations.</para> </listitem> - + <listitem> - <para> - A Database server where the Amavisd-Server stores it's mails and - &aa; is doing the administration. For development <ulink - url="http://www.postgresql.org">PostgreSQL</ulink> version <ulink - url="http://www.postgresql.org/docs/8.1/static/index.html">8.1</ulink> - is used. - </para> + <para>A Database server where the Amavisd-Server stores it's mails and + AmavisAdmin is doing the administration. For development <ulink + url="http://www.postgresql.org">PostgreSQL</ulink> version <ulink + url="http://www.postgresql.org/docs/8.1/static/index.html">8.1</ulink> + is used.</para> </listitem> - + <listitem> - <para> - The JDBC-driver suitable for your database system. As mentioned - before the development is based on PostgreSQL, therefore the - appropriate driver for the database server is located at <ulink - url="http://jdbc.postgresql.org/" />. - </para> + <para>The JDBC-driver suitable for your database system. As mentioned + before the development is based on PostgreSQL, therefore the + appropriate driver for the database server is located at <ulink + url="http://jdbc.postgresql.org/">http://jdbc.postgresql.org/</ulink>.</para> </listitem> </itemizedlist> </section> - + <section id="sec-downloading-and-installing"> <title>Downloading and installing the components</title> <section id="sec-download-java-sdk"> <title>Java JDK/JRE</title> - <para> - The java package can be installed usually by using standard packages - provided by you operating system vendor (e.g SuSE/OpenSuSE is - providing java packages as part of their distribution) or you can - download them as add-ons either by Sun or by other vendors (IBM, - ...). The following list gives some example of additional packages to - be installed. For further reference please contact your operating - system vendor: - </para> + <para>The java package can be installed usually by using standard + packages provided by you operating system vendor (e.g SuSE/OpenSuSE is + providing java packages as part of their distribution) or you can + download them as add-ons either by Sun or by other vendors (IBM, ...). + The following list gives some example of additional packages to be + installed. For further reference please contact your operating system + vendor:</para> <variablelist> - <varlistentry> - <term><trademark>Microsoft Windows</trademark></term> - <listitem> - <para>On Windows you might use the standard packages downloadable - from <ulink url="http://java.sun.com">Sun's java - pages</ulink>.</para> - </listitem> - </varlistentry> + <varlistentry> + <term><trademark>Microsoft Windows</trademark></term> - <varlistentry> - <term>OpenSuSE</term> - <listitem> - <para>On OpenSuSE the following package needs to be - installed:</para> - <itemizedlist> - <listitem><para>java-1_5_0-sun-1.5.0_update10-2.1</para> - </listitem> - </itemizedlist> - </listitem> - </varlistentry> + <listitem> + <para>On Windows you might use the standard packages downloadable + from <ulink url="http://java.sun.com">Sun's java + pages</ulink>.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term>OpenSuSE</term> + + <listitem> + <para>On OpenSuSE the following package needs to be + installed:</para> + + <itemizedlist> + <listitem> + <para>java-1_5_0-sun-1.5.0_update10-2.1</para> + </listitem> + </itemizedlist> + </listitem> + </varlistentry> </variablelist> </section> <section id="sec-download-and-install-tomcat"> <title>Apache Tomcat</title> - <para> - Apache Tomcat can be downloaded and installed for various Operating - Systems. For Microsoft Windows and other operating systems and several - Linux distributions there are binary packages available that work - usually out of the box. - </para> - - <para> - For the development and testing Apache Tomcat release 5.5.17 has been - used. The current version 5.5.20 lacks some files for mail handling and - therefore this version has not been taken into consideration as there's - from my point of view no need to install the newer version if the old - version is working fine. - </para> + <para>Apache Tomcat can be downloaded and installed for various + Operating Systems. For Microsoft Windows and other operating systems and + several Linux distributions there are binary packages available that + work usually out of the box.</para> - <para> - Version 5.5.17 of Apache Tomcat can be downloaded for example from - </para> + <para>For the development and testing Apache Tomcat release 5.5.17 has + been used. The current version 5.5.20 lacks some files for mail handling + and therefore this version has not been taken into consideration as + there's from my point of view no need to install the newer version if + the old version is working fine.</para> - <para> - <ulink url="http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.17/"/> - </para> + <para>Version 5.5.17 of Apache Tomcat can be downloaded for example + from</para> - <para> - You should also look for <ulink - url="http://www.apache.org/dyn/closer.cgi">mirrors</ulink> to reduce - load on the apache servers. - </para> + <para><ulink + url="http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.17/">http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.17/</ulink></para> - <para> - After downloading the (usually) binary distribution you can install - tomcat. This is dependend on your operating system and - vendor. Therefore please check the manuals how to install tomcat. You - might find <ulink - url="http://tomcat.apache.org/tomcat-5.5-doc/setup.html" /> an - intersting source of information about how to install tomcat. - </para> + <para>You should also look for <ulink + url="http://www.apache.org/dyn/closer.cgi">mirrors</ulink> to reduce + load on the apache servers.</para> + + <para>After downloading the (usually) binary distribution you can + install tomcat. This is dependend on your operating system and vendor. + Therefore please check the manuals how to install tomcat. You might find + <ulink + url="http://tomcat.apache.org/tomcat-5.5-doc/setup.html">http://tomcat.apache.org/tomcat-5.5-doc/setup.html</ulink> + an intersting source of information about how to install tomcat.</para> </section> + + <section> + <title>Amavisd-new</title> + + <para>The Amavisd-new application can be downloaded from the <ulink + url="http://www.ijs.si/software/amavisd/">Amavisd-new home page</ulink>. + Please ensure to at least use version 2.4.1, as this version is at least + from documentation point of view SQL save according to the current data + model. The following commands taken from the file + <filename>INSTALL</filename> that is part of the Amavisd-new + distribution explains how to download a particular version of the + software:</para> + + <screen><prompt>$ </prompt><userinput>curl -s -S -O http://www.ijs.si/software/amavisd/amavisd-new-<replaceable><version></replaceable></userinput><co id="sc-amavis-curl" /> +<prompt>$ </prompt><userinput>gzip -d -c amavisd-new-<replaceable><version></replaceable>.tar.gz | tar xvf -</userinput> +<computeroutput >amavisd-new-2.4.4 +amavisd-new-2.4.4/README_FILES +amavisd-new-2.4.4/helper-progs +amavisd-new-2.4.4/test-messages +amavisd-new-2.4.4/AAAREADME.first +amavisd-new-2.4.4/INSTALL +... +tar: Read 4608 bytes from -</computeroutput> +<prompt>$ </prompt><userinput>cd amavisd-new-<replaceable><version></replaceable></userinput></screen> + + <calloutlist> + <callout arearefs="sc-amavis-curl"> + <para>Other tools like <command>wget</command> or downloading via + your favourite web browser should work also.</para> + </callout> + </calloutlist> + + </section> </section> -</article> +</article> \ No newline at end of file Modified: amavisadmin/trunk/src/java/de/sreindl/amavisadmin/ApproveRequests.java =================================================================== --- amavisadmin/trunk/src/java/de/sreindl/amavisadmin/ApproveRequests.java 2007-01-20 16:51:50 UTC (rev 35) +++ amavisadmin/trunk/src/java/de/sreindl/amavisadmin/ApproveRequests.java 2007-01-21 14:45:25 UTC (rev 36) @@ -31,14 +31,23 @@ import com.sun.rave.web.ui.component.TableColumn; import com.sun.rave.web.ui.component.TableRowGroup; import de.sreindl.amavisadmin.bo.ConfigurationBO; +import de.sreindl.amavisadmin.bo.UserBO; +import de.sreindl.amavisadmin.db.MailQueueEntry; +import de.sreindl.amavisadmin.db.MailQueueEntryDAO; +import de.sreindl.amavisadmin.db.MailQueueReceipient; +import de.sreindl.amavisadmin.db.MailQueueReceipientDAO; import de.sreindl.amavisadmin.db.MessageDAO; import de.sreindl.amavisadmin.db.MsgReceipient; import de.sreindl.amavisadmin.db.MsgReceipientDAO; import de.sreindl.amavisadmin.db.MsgReceipientId; import de.sreindl.amavisadmin.db.User; +import de.sreindl.amavisadmin.db.UserDAO; import de.sreindl.amavisadmin.db.util.HibernateSessionFactory; import java.io.IOException; import java.io.StringWriter; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; import javax.faces.FacesException; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; @@ -128,173 +137,173 @@ public void setForm1(Form f) { this.form1 = f; } - + private Table table1 = new Table(); - + public Table getTable1() { return table1; } - + public void setTable1(Table t) { this.table1 = t; } - + private TableRowGroup tableRowGroup1 = new TableRowGroup(); - + public TableRowGroup getTableRowGroup1() { return tableRowGroup1; } - + public void setTableRowGroup1(TableRowGroup trg) { this.tableRowGroup1 = trg; } - + private TableColumn tableColumn1 = new TableColumn(); - + public TableColumn getTableColumn1() { return tableColumn1; } - + public void setTableColumn1(TableColumn tc) { this.tableColumn1 = tc; } - + private StaticText staticText1 = new StaticText(); - + public StaticText getStaticText1() { return staticText1; } - + public void setStaticText1(StaticText st) { this.staticText1 = st; } - + private TableColumn tableColumn2 = new TableColumn(); - + public TableColumn getTableColumn2() { return tableColumn2; } - + public void setTableColumn2(TableColumn tc) { this.tableColumn2 = tc; } - + private StaticText staticText2 = new StaticText(); - + public StaticText getStaticText2() { return staticText2; } - + public void setStaticText2(StaticText st) { this.staticText2 = st; } - + private TableColumn tableColumn3 = new TableColumn(); - + public TableColumn getTableColumn3() { return tableColumn3; } - + public void setTableColumn3(TableColumn tc) { this.tableColumn3 = tc; } - + private Hyperlink hlFrom = new Hyperlink(); - + public Hyperlink getHlFrom() { return hlFrom; } - + public void setHlFrom(Hyperlink h) { this.hlFrom = h; } - + private TableColumn tableColumn4 = new TableColumn(); - + public TableColumn getTableColumn4() { return tableColumn4; } - + public void setTableColumn4(TableColumn tc) { this.tableColumn4 = tc; } - + private Hyperlink hlSubject = new Hyperlink(); - + public Hyperlink getHlSubject() { return hlSubject; } - + public void setHlSubject(Hyperlink h) { this.hlSubject = h; } - + private TableColumn tableColumn5 = new TableColumn(); - + public TableColumn getTableColumn5() { return tableColumn5; } - + public void setTableColumn5(TableColumn tc) { this.tableColumn5 = tc; } - + private StaticText staticText3 = new StaticText(); - + public StaticText getStaticText3() { return staticText3; } - + public void setStaticText3(StaticText st) { this.staticText3 = st; } - + private TableColumn tableColumn6 = new TableColumn(); - + public TableColumn getTableColumn6() { return tableColumn6; } - + public void setTableColumn6(TableColumn tc) { this.tableColumn6 = tc; } - + private Hyperlink hlApprove = new Hyperlink(); - + public Hyperlink getHlApprove() { return hlApprove; } - + public void setHlApprove(Hyperlink h) { this.hlApprove = h; } - + private Hyperlink hlReject = new Hyperlink(); - + public Hyperlink getHlReject() { return hlReject; } - + public void setHlReject(Hyperlink h) { this.hlReject = h; } - + private Button btnBack = new Button(); - + public Button getBtnBack() { return btnBack; } - + public void setBtnBack(Button b) { this.btnBack = b; } - + private PanelGroup groupPanel1 = new PanelGroup(); - + public PanelGroup getGroupPanel1() { return groupPanel1; } - + public void setGroupPanel1(PanelGroup pg) { this.groupPanel1 = pg; } @@ -388,28 +397,28 @@ public void destroy() { HibernateSessionFactory.closeSession(); } - + /** * <p>Return a reference to the scoped data bean.</p> */ protected ApplicationBean1 getApplicationBean1() { return (ApplicationBean1)getBean("ApplicationBean1"); } - + /** * <p>Return a reference to the scoped data bean.</p> */ protected SessionBean1 getSessionBean1() { return (SessionBean1)getBean("SessionBean1"); } - + /** * <p>Return a reference to the scoped data bean.</p> */ protected RequestBean1 getRequestBean1() { return (RequestBean1)getBean("RequestBean1"); } - + /** * <p>Return the content type as a visible representation for the user</p> * <p>The following mappings are performed: @@ -446,14 +455,14 @@ return "Unknown " + content; } } - + public String hlApprove_action() { Session session = HibernateSessionFactory.getSession(); Transaction trx = null; MsgReceipient msgr = null; TableRowDataProvider trdp = (TableRowDataProvider)getBean("currentRow"); if (trdp == null) { - error ("Cannot retrieve current row?"); + error("Cannot retrieve current row?"); return null; } @@ -488,12 +497,12 @@ } return null; } - - + + public String hlFrom_action() { TableRowDataProvider trdp = (TableRowDataProvider)getBean("currentRow"); if (trdp == null) { - error ("internal error - Cannot find current row"); + error("internal error - Cannot find current row"); return null; } String mailId = (String)trdp.getValue("mail_id"); @@ -504,22 +513,22 @@ getSessionBean1().setParameter(SessionBean1.PARAM_PREV_PAGE_ID, "approveRequests"); return "showSingleMail"; } - + public String hlSubject_action() { // same code return hlFrom_action(); } - + public String hlReject_action() { Session session = HibernateSessionFactory.getSession(); Transaction trx = null; MsgReceipient msgr = null; TableRowDataProvider trdp = (TableRowDataProvider)getBean("currentRow"); if (trdp == null) { - error ("Cannot retrieve current row?"); + error("Cannot retrieve current row?"); return null; } - + String mailId = (String)trdp.getValue("mail_id"); Integer rid = (Integer)trdp.getValue("rid"); try { @@ -556,20 +565,43 @@ private void sendRejectionMail(MsgReceipient msgr) { VelocityContext context = new VelocityContext(); + UserDAO dao = new UserDAO(); + List adminUsers = dao.findByAdmin(Boolean.TRUE); + + if (adminUsers.size() == 0) { + warn("Warning: No admin users defined"); + return; + } User currentUser = getSessionBean1().getCurrentUser(); context.put("user", msgr.getRequestUser()); context.put("signature", ConfigurationBO.getConfValue(ConfigurationBO.APP_TITLE)); - context.put("baselink", ConfigurationBO.getConfValue(ConfigurationBO.CONF_BASE_URL) + "/"); + context.put("baselink", ConfigurationBO.getConfValue(ConfigurationBO.CONF_BASE_URL)); context.put("message", msgr.getMsgs()); context.put("admin", currentUser); + Session session = HibernateSessionFactory.getSession(); + Transaction trx = session.beginTransaction(); try { Template lostPwd = Velocity.getTemplate("/de/sreindl/amavisadmin/templates/RejectRelease.vm"); StringWriter w = new StringWriter(); lostPwd.merge(context, w); - InternetAddress sender = new InternetAddress(currentUser.getEmail(), currentUser.getFullname()); - InternetAddress receipient = new InternetAddress(msgr.getRequestUser().getEmail(), msgr.getRequestUser().getFullname()); - System.err.println(w.toString()); - //MailHandler.sendMail(sender, receipients, (String) context.get("subject"), w.toString()); + + MailQueueEntry mqe = new MailQueueEntry(); + MailQueueReceipient mqr = new MailQueueReceipient(); + + mqe.setEncoding("text/plain"); + mqe.setStatus(MailQueueEntryDAO.STATUS_NEW); + mqe.setFrom(UserBO.formatMailAddress(currentUser)); + mqe.setMailText(w.toString()); + mqe.setSubject((String)context.get("subject")); + mqe.setReceipients(new HashSet()); + session.save(mqe); + + mqr.setReceipient(UserBO.formatMailAddress(msgr.getRequestUser())); + mqr.setType(MailQueueReceipientDAO.TYPE_TO); + mqe.getReceipients().add(mqr); + mqr.setMailQueueEntry(mqe); + session.save(mqr); + trx.commit(); } catch (Exception ex) { log(ex.getMessage(), ex); getFacesContext().addMessage(null, @@ -577,6 +609,6 @@ ex.getMessage())); } } - + } Modified: amavisadmin/trunk/src/java/de/sreindl/amavisadmin/EditJobs.java =================================================================== --- amavisadmin/trunk/src/java/de/sreindl/amavisadmin/EditJobs.java 2007-01-20 16:51:50 UTC (rev 35) +++ amavisadmin/trunk/src/java/de/sreindl/amavisadmin/EditJobs.java 2007-01-21 14:45:25 UTC (rev 36) @@ -36,6 +36,8 @@ import de.sreindl.amavisadmin.jobs.BaseJob; import de.sreindl.amavisadmin.jobs.MailSendJob; import de.sreindl.amavisadmin.jobs.MessagesCleanupJob; +import de.sreindl.amavisadmin.jobs.NewMailNotifierJob; +import de.sreindl.amavisadmin.jobs.ReleaseMailJob; import de.sreindl.amavisadmin.jobs.ReminderJob; import de.sreindl.amavisadmin.jobs.RetentionCleanupJob; import java.io.IOException; @@ -440,7 +442,8 @@ return null; } String jobName = (String)trdp.getValue("job_name"); - getSessionBean1().setParameter("JOB_NAME", jobName); + getSessionBean1().setParameter(EditSingleJob.KEY_JOB_NAME, jobName); + getSessionBean1().setParameter(EditSingleJob.KEY_JOB, null); return "editJob"; } @@ -541,9 +544,16 @@ job.setJobName("New SPAM Mail Notifier"); job.setDescription("Send mails to users about new mails arrived. Please review parameters before enabling this job!"); job.setCronSettings("0 0 7 * * ?"); - job.setJobClass(AdminNotifierJob.class); + job.setJobClass(NewMailNotifierJob.class); job.setEnabled(Boolean.FALSE); session.save(job); + job = new Job(); + job.setJobName("Release Mail Daemon"); + job.setDescription("Job responsible for releasing mails approved by an admin. Please review parameters before enabling this job!"); + job.setCronSettings("0 2/15 * * * ?"); + job.setJobClass(ReleaseMailJob.class); + job.setEnabled(Boolean.FALSE); + session.save(job); trx.commit(); getSessionBean1().getJobsDataProvider().refresh(); StdSchedulerFactory factory = @@ -573,6 +583,8 @@ } public String btnAddNewEntry_action() { + getSessionBean1().setParameter(EditSingleJob.KEY_JOB_NAME, null); + getSessionBean1().setParameter(EditSingleJob.KEY_JOB, null); return "editJob"; } Modified: amavisadmin/trunk/src/java/de/sreindl/amavisadmin/EditSingleJob.java =================================================================== --- amavisadmin/trunk/src/java/de/sreindl/amavisadmin/EditSingleJob.java 2007-01-20 16:51:50 UTC (rev 35) +++ amavisadmin/trunk/src/java/de/sreindl/amavisadmin/EditSingleJob.java 2007-01-21 14:45:25 UTC (rev 36) @@ -397,6 +397,46 @@ this.groupPanel2 = pg; } + private Message message3 = new Message(); + + public Message getMessage3() { + return message3; + } + + public void setMessage3(Message m) { + this.message3 = m; + } + + private Message message4 = new Message(); + + public Message getMessage4() { + return message4; + } + + public void setMessage4(Message m) { + this.message4 = m; + } + + private Message message5 = new Message(); + + public Message getMessage5() { + return message5; + } + + public void setMessage5(Message m) { + this.message5 = m; + } + + private Message message6 = new Message(); + + public Message getMessage6() { + return message6; + } + + public void setMessage6(Message m) { + this.message6 = m; + } + // </editor-fold> /** @@ -422,7 +462,6 @@ super.init(); // Perform application initialization that must complete // *before* managed components are initialized - // TODO - add your own initialiation code here // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization"> // Initialize automatically managed components @@ -453,15 +492,34 @@ } } - String[] classes = findJobClasses(); + + Class[] classes = findJobClasses(); Option[] options = new Option[classes.length]; for (int i = 0; i < classes.length; i++) { - options[i] = new Option(classes[i]); + options[i] = new Option(classes[i].getName()); } dropDown1DefaultOptions.setOptions(options); configurationTableEntries = getSessionBean1().getConfigurationTableEntries(); + currentJob = (Job)getSessionBean1().getParameter(KEY_JOB); + if (currentJob == null) { + String jobName = (String)getSessionBean1().getParameter(KEY_JOB_NAME); + if (jobName != null) { + JobDAO dao = new JobDAO(); + currentJob = dao.findById(jobName); + if (currentJob == null) { + error("Cannot find job " + jobName); + currentJob = new Job(); + currentJob.setJobName(jobName); + } + } else { + currentJob = new Job(); + } + loadConfigData(); + getSessionBean1().setParameter(KEY_JOB, currentJob); + } + } /** @@ -472,7 +530,6 @@ * resources that will be required in your event handlers.</p> */ public void preprocess() { - String jobName = (String)getSessionBean1().getParameter("JOB_NAME"); } /** @@ -484,42 +541,7 @@ * this page.</p> */ public void prerender() { - // regular startup - String jobName = (String)getSessionBean1().getParameter("JOB_NAME"); - this.erase(); - if (jobName != null) { - JobDAO dao = new JobDAO(); - Job currentJob = dao.findById(jobName); - fldJobName.setText(currentJob.getJobName()); - fldDescription.setText(currentJob.getDescription()); - fldCRONSchedule.setText(currentJob.getCronSettings()); - dropDown1.setValue(currentJob.getJobClass().getName()); - chkEnabled.setSelected(currentJob.getEnabled()); - try { - BaseJob job = (BaseJob)currentJob.getJobClass().newInstance(); - ArrayList<ConfigurationDataEntry> entries = - job.getConfigurationDataTable(); - // add job's configuration entries to array - Iterator<ConfigurationDataEntry> iKeys = entries.iterator(); - while (iKeys.hasNext()) { - ConfigurationDataEntry entry = iKeys.next(); - if (currentJob.getConfItems().containsKey(entry.getKey())) { - ConfigurationSetting confEntry = - (ConfigurationSetting)currentJob.getConfItems().get(entry.getKey()); - entry.setValue(confEntry.getValue()); - } - } - ConfigurationDataEntry[] deArray = - entries.toArray(new ConfigurationDataEntry[entries.size()]); - configurationTableEntries.setArray(deArray); - } catch (InstantiationException ie) { - log("Error ", ie); - } catch (IllegalAccessException iae) { - log("Error ", iae); - } - } else { - configurationTableEntries.setArray(null); - } + dropDown1.setSelected(currentJob.getJobClass().getName()); } /** @@ -620,8 +642,8 @@ return url; } - private String[] findJobClasses() { - ArrayList jobs = new ArrayList(); + private Class[] findJobClasses() { + ArrayList<Class> jobs = new ArrayList<Class>(); Package[] packages = Package.getPackages(); for (int i = 0 ; i < packages.length; i++) { try { @@ -633,32 +655,21 @@ } if (sup != null) { // found - jobs.add(classes[clazz].getName()); + jobs.add(classes[clazz]); } } } catch(ClassNotFoundException cnfe) { System.err.println("Cannot find package " + packages[i].getName()); } } - String[] result = new String[jobs.size()]; - return (String[]) jobs.toArray(result); + return jobs.toArray(new Class[jobs.size()]); } public String btnSave_action() { - String jobName = (String)getSessionBean1().getParameter("JOB_NAME"); - getSessionBean1().setParameter("JOB_NAME", null); - Job currentJob = null; - if (jobName != null) { - JobDAO dao = new JobDAO(); - currentJob = dao.findById(jobName); - } else { - currentJob = new Job(); - } - currentJob.setJobName((String)fldJobName.getText()); - currentJob.setDescription((String)fldDescription.getText()); - currentJob.setCronSettings((String)fldCRONSchedule.getText()); - String className = (String)dropDown1.getValue(); + getSessionBean1().setParameter(KEY_JOB_NAME, null); + getSessionBean1().setParameter(KEY_JOB, null); + String className = (String) dropDown1.getValue(); try { Class clazz = Class.forName(className); currentJob.setJobClass(clazz); @@ -667,26 +678,18 @@ log(cnfe.getMessage(), cnfe); return null; } - currentJob.setEnabled(Boolean.valueOf(chkEnabled.isChecked())); Session session = null; Transaction trx = null; try { session = HibernateSessionFactory.getSession(); trx = session.beginTransaction(); // save job - if (currentJob.getConfItems() != null) { - currentJob.getConfItems().clear(); - } else { - currentJob.setConfItems(new HashMap()); - } if (currentJob.getVersion() == null) { session.save(currentJob); } else { session.update(currentJob); } - currentJob.setConfItems(new HashMap()); - saveConfEntries(currentJob, - (ConfigurationDataEntry[])configurationTableEntries.getArray()); + saveConfEntries(currentJob, configurationTableEntries); trx.commit(); // refresh data set getSessionBean1().getJobsDataProvider().refresh(); @@ -714,6 +717,8 @@ } public String btnCancel_action() { + getSessionBean1().setParameter(KEY_JOB_NAME, null); + getSessionBean1().setParameter(KEY_JOB, null); return "goBack"; } @@ -763,42 +768,50 @@ return null; } - private void saveConfEntries(Job currentJob, ConfigurationDataEntry[] confEntries) { + private void saveConfEntries(Job currentJob, ConfigurationDataTable confEntries) { Session session = HibernateSessionFactory.getSession(); - for (int i = 0; i < confEntries.length; i++) { + ConfigurationDataEntry[] entries = + (ConfigurationDataEntry[]) confEntries.getArray(); + for (int i = 0; i < entries.length; i++) { // #1638972 - ConfigurationDataEntry ent = confEntries[i]; + ConfigurationDataEntry ent = entries[i]; ConfigurationSettingId key = new ConfigurationSettingId(ent.getKey(), currentJob); ConfigurationSetting conf = (ConfigurationSetting)session.get(ConfigurationSetting.class, key); - if (conf == null) { - conf = new ConfigurationSetting(key, ent.getValue()); + //#1640418 + if (ent.getValue() != null) { + if (conf == null) { + conf = new ConfigurationSetting(key, ent.getValue()); + session.save(conf); + } else { + conf.setValue(ent.getValue()); + session.update(conf); + } + } else { + if (conf != null) { + // delete old entry + session.delete(conf); + } } - conf.setValue(ent.getValue()); - session.save(conf); currentJob.getConfItems().put(ent.getKey(), conf); } } public void dropDown1_processValueChange(ValueChangeEvent event) { + String className = (String)dropDown1.getValue(); try { - String className = (String)dropDown1.getValue(); Class clazz = Class.forName(className); - BaseJob job = (BaseJob)clazz.newInstance(); - ArrayList<ConfigurationDataEntry> entries = - job.getConfigurationDataTable(); - ConfigurationDataEntry[] deArray = - entries.toArray(new ConfigurationDataEntry[entries.size()]); - configurationTableEntries.setArray(deArray); - } catch (ClassNotFoundException cnfe) { - log("Error ", cnfe); - } catch (InstantiationException ie) { - log("Error ", ie); - } catch (IllegalAccessException iae) { - log("Error ", iae); + currentJob.setJobClass(clazz); + } catch (ClassNotFoundException e) { + fatal("Class " + className + " not found even if looked up in object code"); + return; } + if (currentJob.getConfItems() == null) { + currentJob.setConfItems(new HashMap()); + } + loadConfigData(); } /** @@ -846,5 +859,69 @@ return defaultValue == null || defaultValue.length() == 0; } + private void loadConfigData() { + try { + Class clazz = currentJob.getJobClass(); + if (clazz == null) { + // take class from from first element in list as this + // happens only on new jobs. + String className = + (String) dropDown1DefaultOptions.getOptions()[0].getValue(); + clazz = Class.forName(className); + currentJob.setJobClass(clazz); + } + BaseJob job = (BaseJob)clazz.newInstance(); + ArrayList<ConfigurationDataEntry> entries = + job.getConfigurationDataTable(); + // add job's configuration entries to array + Iterator<ConfigurationDataEntry> iKeys = entries.iterator(); + while (iKeys.hasNext()) { + ConfigurationDataEntry entry = iKeys.next(); + if (currentJob.getConfItems().containsKey(entry.getKey())) { + ConfigurationSetting confEntry = + (ConfigurationSetting)currentJob.getConfItems().get(entry.getKey()); + entry.setValue(confEntry.getValue()); + } + } + ConfigurationDataEntry[] deArray = + entries.toArray(new ConfigurationDataEntry[entries.size()]); + configurationTableEntries.setArray(deArray); + } catch (ClassNotFoundException ie) { + log("Error ", ie); + } catch (InstantiationException ie) { + log("Error ", ie); + } catch (IllegalAccessException iae) { + log("Error ", iae); + } + } + + /** + * Holds value of property currentJob. + */ + private Job currentJob; + + /** + * Getter for property currentJob. + * @return Value of property currentJob. + */ + public Job getCurrentJob() { + return this.currentJob; + } + + /** + * Setter for property currentJob. + * @param currentJob New value of property currentJob. + */ + public void setCurrentJob(Job currentJob) { + this.currentJob = currentJob; + } + + /** Session key for the job name to be handled */ + public static final String KEY_JOB_NAME = "editSinglePage.JOB_NAME"; + /** Session key for the current job being edited */ + public static final String KEY_JOB = "editSinglePage.JOB"; + + /** Job name used to identify, that a new job is going to be created */ + public static final String KEY_CREATE_TOKEN = "$$Create"; } Modified: amavisadmin/trunk/src/java/de/sreindl/amavisadmin/HandlePendingReleases.java =================================================================== --- amavisadmin/trunk/src/java/de/sreindl/amavisadmin/HandlePendingReleases.java 2007-01-20 16:51:50 UTC (rev 35) +++ amavisadmin/trunk/src/java/de/sreindl/amavisadmin/HandlePendingReleases.java 2007-01-21 14:45:25 UTC (rev 36) @@ -32,6 +32,11 @@ import com.sun.rave.web.ui.component.TableRowGroup; import de.sreindl.amavisadmin.bo.ConfigurationBO; import de.sreindl.amavisadmin.bo.MailHandler; +import de.sreindl.amavisadmin.bo.UserBO; +import de.sreindl.amavisadmin.db.MailQueueEntry; +import de.sreindl.amavisadmin.db.MailQueueEntryDAO; +import de.sreindl.amavisadmin.db.MailQueueReceipient; +import de.sreindl.amavisadmin.db.MailQueueReceipientDAO; import de.sreindl.amavisadmin.db.MsgReceipient; import de.sreindl.amavisadmin.db.MsgReceipientDAO; import de.sreindl.amavisadmin.db.MsgReceipientId; @@ -41,6 +46,7 @@ import java.io.IOException; import java.io.StringWriter; import java.sql.SQLException; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import javax.faces.FacesException; @@ -242,13 +248,13 @@ public void setBtnRevert(Button b) { this.btnRevert = b; } - + private PanelGroup groupPanel1 = new PanelGroup(); - + public PanelGroup getGroupPanel1() { return groupPanel1; } - + public void setGroupPanel1(PanelGroup pg) { this.groupPanel1 = pg; } @@ -478,31 +484,46 @@ */ private void sendRequestMailToAdmins(int requestsReleased) { VelocityContext context = new VelocityContext(); + UserDAO dao = new UserDAO(); + List adminUsers = dao.findByAdmin(Boolean.TRUE); + + if (adminUsers.size() == 0) { + warn("Warning: No admin users defined"); + return; + } context.put("user", getSessionBean1().getCurrentUser()); context.put("signature", ConfigurationBO.getConfValue(ConfigurationBO.APP_TITLE)); - context.put("baselink", ConfigurationBO.getConfValue(ConfigurationBO.CONF_BASE_URL) + "/"); + context.put("baselink", ConfigurationBO.getConfValue(ConfigurationBO.CONF_BASE_URL)); context.put("newRequestCount", new Integer(requestsReleased)); context.put("totalReqCount", new Integer(getSessionBean1().getPendingReleases())); + Session session = HibernateSessionFactory.getSession(); + Transaction trx = session.beginTransaction(); try { Template lostPwd = Velocity.getTemplate("/de/sreindl/amavisadmin/templates/RequestRelease.vm"); StringWriter w = new StringWriter(); lostPwd.merge(context, w); - UserDAO udao = new UserDAO(); - List admins = udao.findByAdmin(Boolean.TRUE); - InternetAddress sender = new InternetAddress(ConfigurationBO.getConfValue(ConfigurationBO.MAIL_SENDER)); - InternetAddress[] receipients = new InternetAddress[admins.size()]; - Iterator i = admins.iterator(); - int cnt = 0; + + MailQueueEntry mqe = new MailQueueEntry(); + + mqe.setEncoding("text/plain"); + mqe.setStatus(MailQueueEntryDAO.STATUS_NEW); + mqe.setFrom(UserBO.formatMailAddress(getSessionBean1().getCurrentUser())); + mqe.setMailText(w.toString()); + mqe.setSubject((String)context.get("subject")); + mqe.setReceipients(new HashSet()); + session.save(mqe); + + Iterator i = adminUsers.iterator(); while (i.hasNext()) { - User admin = (User)i.next(); - receipients[cnt] = new InternetAddress(admin.getEmail()); - if (admin.getFullname() != null) { - receipients[cnt].setPersonal(admin.getFullname()); - } - cnt++; + User user = (User)i.next(); + MailQueueReceipient mqr = new MailQueueReceipient(); + mqr.setReceipient(UserBO.formatMailAddress(user)); + mqr.setType(MailQueueReceipientDAO.TYPE_TO); + mqe.getReceipients().add(mqr); + mqr.setMailQueueEntry(mqe); + HibernateSessionFactory.getSession().save(mqr); } - System.err.println(w.toString()); - //MailHandler.sendMail(sender, receipients, (String) context.get("subject"), w.toString()); + trx.commit(); } catch (Exception ex) { log(ex.getMessage(), ex); getFacesContext().addMessage(null, Modified: amavisadmin/trunk/src/java/de/sreindl/amavisadmin/MyRequests.java =================================================================== --- amavisadmin/trunk/src/java/de/sreindl/amavisadmin/MyRequests.java 2007-01-20 16:51:50 UTC (rev 35) +++ amavisadmin/trunk/src/java/de/sreindl/amavisadmin/MyRequests.java 2007-01-21 14:45:25 UTC (rev 36) @@ -475,7 +475,7 @@ return "SPAM (" + ((spam_level != null) ? spam_level.toString() : "unknown") + ")"; case MessageDAO.CONTENT_VIRUS: String smtpResp = (String)trdp.getValue("smtp_resp"); - return "VIRUS " + smtpResp.substring(smtpResp.indexOf("VIRUS: ")+7) + ")"; + return "VIRUS " + smtpResp.substring(smtpResp.indexOf("VIRUS: ")+7); case MessageDAO.CONTENT_BLOCKED: return "Banned"; default: Modified: amavisadmin/trunk/src/java/de/sreindl/amavisadmin/SessionBean1.java =================================================================== --- amavisadmin/trunk/src/java/de/sreindl/amavisadmin/SessionBean1.java 2007-01-20 16:51:50 UTC (rev 35) +++ amavisadmin/trunk/src/java/de/sreindl/amavisadmin/SessionBean1.java 2007-01-21 14:45:25 UTC (rev 36) @@ -73,7 +73,7 @@ approvePendingRowSet.setTableName("msgrcpt"); approvePendingDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet)getValue("#{SessionBean1.approvePendingRowSet}")); jobsRowSet.setDataSourceName("java:comp/env/jdbc/amavisDB"); - jobsRowSet.setCommand("SELECT ALL PUBLIC.jobs.job_name, \n PUBLIC.jobs.job_description, \n PUBLIC.jobs.job_cron_settings, \n PUBLIC.jobs.job_class, \n PUBLIC.jobs.job_enabled, \n PUBLIC.jobs.job_last_run_date \nFROM PUBLIC.jobs\nWHERE PUBLIC.jobs.job_special = 'false'\nORDER BY PUBLIC.jobs.job_name ASC "); + jobsRowSet.setCommand("SELECT ALL job_name, \n job_description, \n job_cron_settings, \n job_class, \n job_enabled, \n job_last_run_date \nFROM PUBLIC.job\nWHERE job_special = 'false'\nORDER BY job_name ASC "); jobsRowSet.setTableName("jobs"); jobsDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet)getValue("#{SessionBean1.jobsRowSet}")); } Modified: amavisadmin/trunk/src/java/de/sreindl/amavisadmin/bo/ConfigurationBO.java =================================================================== --- amavisadmin/trunk/src/java/de/sreindl/amavisadmin/bo/ConfigurationBO.java 2007-01-20 16:51:50 UTC (rev 35) +++ amavisadmin/trunk/src/java/de/sreindl/amavisadmin/bo/ConfigurationBO.java 2007-01-21 14:45:25 UTC (rev 36) @@ -98,8 +98,8 @@ if (log.isDebugEnabled()) { log.debug("setValue (" + key + ", " + value + ")"); } - JobDAO dao = new JobDAO(); - Job globalJob = dao.findById(GLOBAL_JOB); + JobDAO dao = new JobDAO(); + Job globalJob = dao.findById(GLOBAL_JOB); if (confMap != null) { ConfigurationSetting c = (ConfigurationSetting)confMap.get(key); if (c == null) { @@ -139,8 +139,27 @@ if (c == null) { c = new ConfigurationSetting(new ConfigurationSettingId(key, globalJob)); } - c.setValue(((ConfigurationSetting)confMap.get(key)).getValue()); - sess.saveOrUpdate(c); + //#1640418 + String value = ((ConfigurationSetting)confMap.get(key)).getValue(); + if (value == null) { + // remove old entry if exist + if (c.getVersion() != null) { + // data exists in database + sess.delete(c); + } + } else { // new or chagned value + if (c.getValue() != null) { // old value exists + if (!c.getValue().equals(value)) { + // update only in case of changed data + c.setValue(value); + sess.saveOrUpdate(c); + } + } else { + // new entry + c.setValue(value); + sess.save(c); + } + } } trx.commit(); HibernateSessionFactory.closeSession(); Modified: amavisadmin/trunk/src/java/de/sreindl/amavisadmin/db/Job.hbm.xml =================================================================== --- amavisadmin/trunk/src/java/de/sreindl/amavisadmin/db/Job.hbm.xml 2007-01-20 16:51:50 UTC (rev 35) +++ amavisadmin/trunk/src/java/de/sreindl/amavisadmin/db/Job.hbm.xml 2007-01-21 14:45:25 UTC (rev 36) @@ -18,7 +18,7 @@ --> <hibernate-mapping> <!-- #1640285 --> - <class name="de.sreindl.amavisadmin.db.Job" table="job" schema="public"> + <class name="de.sreindl.amavisadmin.db.Job" table="job" schema="public" lazy="false"> <id name="jobName"> <column name="job_name" length="64" /> <generator class="assigned" /> @@ -40,7 +40,8 @@ <map name="confItems" inverse="true" - cascade="all"> + cascade="all" + lazy="false"> <key column="job_ref"/> <map-key column="key" type="string" /> Modified: amavisadmin/trunk/src/java/de/sreindl/amavisadmin/db/MsgReceipientDAO.java =================================================================== --- amavisadmin/trunk/src/java/de/sreindl/amavisadmin/db/MsgReceipientDAO.java 2007-01-20 16:51:50 UTC (rev 35) +++ amavisadmin/trunk/src/java/de/sreindl/amavisadmin/db/MsgReceipientDAO.java 2007-01-21 14:45:25 UTC (rev 36) @@ -187,6 +187,11 @@ public static final Character RS_RELEASED = 'R'; /** + * There has been an error during release. + */ + public static final Character RS_RELEASE_ERROR = 'E'; + + /** * Message is marked for deletion */ public static final Character RS_DELETED = 'D'; Modified: amavisadmin/trunk/src/java/de/sreindl/amavisadmin/jobs/AdminNotifierJob.java =================================================================== --- amavisadmin/trunk/src/java/de/sreindl/amavisadmin/jobs/AdminNotifierJob.java 2007-01-20 16:51:50 UTC (rev 35) +++ amavisadmin/trunk/src/java/de/sreindl/amavisadmin/jobs/AdminNotifierJob.java 2007-01-21 14:45:25 UTC (rev 36) @@ -99,7 +99,7 @@ } context.put("appTitle", ConfigurationBO.getConfValue(ConfigurationBO.APP_TITLE)); context.put("signature", ConfigurationBO.getConfValue(ConfigurationBO.APP_TITLE)); - context.put("baselink", ConfigurationBO.getConfValue(ConfigurationBO.CONF_BASE_URL) + "/"); + context.put("baselink", ConfigurationBO.getConfValue(ConfigurationBO.CONF_BASE_URL)); context.put("requestCount", Integer.valueOf(requestCount)); Template lostPwd = Velocity.getTemplate("/de/sreindl/amavisadmin/templates/AdminNotifier.vm"); StringWriter w = new StringWriter(); Added: amavisadmin/trunk/src/java/de/sreindl/amavisadmin/jobs/ReleaseMailJob.java =================================================================== --- amavisadmin/trunk/src/java/de/sreindl/amavisadmin/jobs/ReleaseMailJob.java (rev 0) +++ amavisadmin/trunk/src/java/de/sreindl/amavisadmin/jobs/ReleaseMailJob.java 2007-01-21 14:45:25 UTC (rev 36) @@ -0,0 +1,413 @@ +/* + * Copyright (C) 2007 Stephen Reindl. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package de.sreindl.amavisadmin.jobs; + +import de.sreindl.amavisadmin.bo.ConfigurationBO; +import de.sreindl.amavisadmin.bo.UserBO; +import de.sreindl.amavisadmin.bo.configuration.ConfigurationDataEntry; +import de.sreindl.amavisadmin.db.ConfigurationSetting; +import de.sreindl.amavisadmin.db.MailQueueEntry; +import de.sreindl.amavisadmin.db.MailQueueEntryDAO; +import de.sreindl.amavisadmin.db.MailQueueReceipient; +import de.sreindl.amavisadmin.db.MailQueueReceipientDAO; +import de.sreindl.amavisadmin.db.MsgReceipient; +import de.sreindl.amavisadmin.db.MsgReceipientDAO; +import de.sreindl.amavisadmin.db.User; +import de.sreindl.amavisadmin.db.UserDAO; +import de.sreindl.amavisadmin.db.util.HibernateSessionFactory; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintStream; +import java.io.StringWriter; +import java.net.InetAddress; +import java.net.Socket; +import java.net.SocketException; +import java.net.SocketTimeoutException; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.velocity.Template; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.Velocity; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.Transaction; +import org.quartz.JobExecutionContext; + +/** + * This job is responsible releasing messages to the recipients. + * + * <p>This job is selecting information from msgrcpt table where RS='W' and + * call amavisd-new to release those messages. + * + * @author sreindl... [truncated message content] |