cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r586223 - in /cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail: ./ command/ datasource/ transformation/
Date Fri, 19 Oct 2007 01:56:02 GMT
Author: vgritsenko
Date: Thu Oct 18 18:56:01 2007
New Revision: 586223

URL: http://svn.apache.org/viewvc?rev=586223&view=rev
Log:
switching to new AbstractLogEnabled

Modified:
    cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailAction.java
    cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailCommandBuilder.java
    cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailCommandManager.java
    cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailContentHandlerDelegate.java
    cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailContext.java
    cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailContextHttpSession.java
    cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailMessageSender.java
    cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/command/AbstractMailCommand.java
    cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/AbstractDataSource.java
    cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java

Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailAction.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailAction.java?rev=586223&r1=586222&r2=586223&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailAction.java
(original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailAction.java
Thu Oct 18 18:56:01 2007
@@ -22,7 +22,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-
 import javax.mail.Folder;
 import javax.mail.Message;
 import javax.mail.Provider;
@@ -31,9 +30,9 @@
 import javax.servlet.http.HttpSession;
 
 import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.avalon.framework.thread.ThreadSafe;
+
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.acting.ServiceableAction;
 import org.apache.cocoon.environment.ObjectModelHelper;
@@ -108,7 +107,6 @@
             // no mailContext is yet available
             // create it and put it into http-session
             mailContext = new MailContextHttpSession(null);
-            mailContext.enableLogging(getLogger());
             session.setAttribute(MailContext.SESSION_MAIL_CONTEXT, mailContext);
         }
 
@@ -316,39 +314,32 @@
      */
     protected void putXMLizerToRequestAttribute(Request request, Iterator resultIterator)
{
         if (resultIterator != null) {
-            // marshal java mail objects
-            Logger logger = getLogger();
-
             // make it an optional parameter?
             String datePattern = "dd.MM.yyyy HH:mm";
             SimpleDateFormat sdf = new SimpleDateFormat(datePattern);
 
+            // marshal java mail objects
             while (resultIterator.hasNext()) {
                 Object objRef = resultIterator.next();
-
                 getLogger().debug("Creating XMLizer for " + String.valueOf(objRef));
 
                 if (objRef instanceof Folder) {
                     MailContentHandlerDelegate.FolderXMLizer fx = new MailContentHandlerDelegate.FolderXMLizer((Folder)
objRef);
-                    fx.enableLogging(logger);
                     request.setAttribute(REQUEST_ATTRIBUTE_FOLDER, fx);
                 } else if (objRef instanceof Folder[]) {
                     Folder[] folders = (Folder[]) objRef;
                     MailContentHandlerDelegate.FolderXMLizer[] fxs = new MailContentHandlerDelegate.FolderXMLizer[folders.length];
                     for (int i = 0; i < folders.length; i++) {
                         fxs[i] = new MailContentHandlerDelegate.FolderXMLizer(folders[i]);
-                        fxs[i].enableLogging(logger);
                     }
                     // trust that array of XMLizable is handled
                     request.setAttribute(REQUEST_ATTRIBUTE_FOLDERS, fxs);
                 } else if (objRef instanceof Message) {
                     MailContentHandlerDelegate.MessageXMLizer mx = new MailContentHandlerDelegate.MessageXMLizer((Message)
objRef);
-                    mx.enableLogging(logger);
                     mx.setSimpleDateFormat(sdf);
                     request.setAttribute(REQUEST_ATTRIBUTE_MESSAGE, mx);
                 } else if (objRef instanceof Message[]) {
                     MailContentHandlerDelegate.MessageEnvelopeXMLizer mex = new MailContentHandlerDelegate.MessageEnvelopeXMLizer((Message[])
objRef);
-                    mex.enableLogging(logger);
                     mex.setSimpleDateFormat(sdf);
                     request.setAttribute(REQUEST_ATTRIBUTE_MESSAGES, mex);
                 }
@@ -370,11 +361,9 @@
         try {
             // do we have a MailCommandManager ?
             MailCommandManager mam = new MailCommandManager();
-            mam.enableLogging(getLogger());
 
             // build the MailCommand(s)
             MailCommandBuilder mab = new MailCommandBuilder();
-            mab.enableLogging(getLogger());
             AbstractMailCommand ama = mab.buildAbstractMailCommand(mailContext);
 
             getLogger().debug("Executing " + String.valueOf(ama));

Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailCommandBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailCommandBuilder.java?rev=586223&r1=586222&r2=586223&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailCommandBuilder.java
(original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailCommandBuilder.java
Thu Oct 18 18:56:01 2007
@@ -20,8 +20,9 @@
 import java.util.Map;
 
 import org.apache.avalon.framework.context.Contextualizable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
+
 import org.apache.cocoon.mail.command.AbstractMailCommand;
+import org.apache.cocoon.util.AbstractLogEnabled;
 
 /**
  * Build an AbstractMailCommand from MailContext.
@@ -60,13 +61,12 @@
             // request parameter say "what"
             String cmd = mailContext.getParameter("cmd");
             if (cmd == null) {
-                cmd = (String)mailContext.get( MailContext.MAIL_CURRENT_WORKING_COMMAND_ENTRY
);
+                cmd = (String) mailContext.get(MailContext.MAIL_CURRENT_WORKING_COMMAND_ENTRY);
             }
+
             Class clazz = getClassForCommand(cmd);
             if (clazz != null) {
                 ama = (AbstractMailCommand) clazz.newInstance();
-                // enable logging of the mail command
-                ama.enableLogging(getLogger());
                 // contextualize the mail command
                 if (ama instanceof Contextualizable) {
                     ((Contextualizable) ama).contextualize(mailContext);
@@ -79,6 +79,7 @@
             String message = "Cannto build AbstractMailCommand";
             getLogger().error(message, e);
         }
+
         return ama;
     }
 

Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailCommandManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailCommandManager.java?rev=586223&r1=586222&r2=586223&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailCommandManager.java
(original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailCommandManager.java
Thu Oct 18 18:56:01 2007
@@ -30,12 +30,14 @@
 import javax.mail.search.OrTerm;
 import javax.mail.search.SearchTerm;
 import javax.mail.search.SubjectTerm;
+
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.context.ContextException;
 import org.apache.avalon.framework.context.Contextualizable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
+
 import org.apache.cocoon.mail.command.AbstractMailCommand;
 import org.apache.cocoon.mail.command.MailCommands;
+import org.apache.cocoon.util.AbstractLogEnabled;
 
 /**
  * Manage invocation of mail commands.

Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailContentHandlerDelegate.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailContentHandlerDelegate.java?rev=586223&r1=586222&r2=586223&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailContentHandlerDelegate.java
(original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailContentHandlerDelegate.java
Thu Oct 18 18:56:01 2007
@@ -17,7 +17,6 @@
 package org.apache.cocoon.mail;
 
 import java.io.IOException;
-//import java.io.InputStream;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Enumeration;
@@ -35,8 +34,11 @@
 import javax.mail.internet.MimePart;
 import javax.mail.internet.ParameterList;
 import javax.mail.internet.ParseException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
+
 import org.apache.excalibur.xml.sax.XMLizable;
+
+import org.apache.cocoon.util.AbstractLogEnabled;
+
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
@@ -833,7 +835,6 @@
          */
         public void toSAX(ContentHandler handler) throws SAXException {
             MailContentHandlerDelegate mailContentHandlerDelegate = new MailContentHandlerDelegate(handler);
-            mailContentHandlerDelegate.enableLogging(getLogger());
             mailContentHandlerDelegate.startDocumentXMLizer();
             for (int i = 0; i < folders.length; i++) {
                 mailContentHandlerDelegate.marshalFolderToSAX(folders[i]);
@@ -902,7 +903,6 @@
          */
         public void toSAX(ContentHandler handler) throws SAXException {
             MailContentHandlerDelegate mailContentHandlerDelegate = new MailContentHandlerDelegate(handler);
-            mailContentHandlerDelegate.enableLogging(getLogger());
             mailContentHandlerDelegate.setSimpleDateFormat(sdf);
             mailContentHandlerDelegate.startDocumentXMLizer();
 
@@ -963,7 +963,6 @@
          */
         public void toSAX(ContentHandler handler) throws SAXException {
             MailContentHandlerDelegate mailContentHandlerDelegate = new MailContentHandlerDelegate(handler);
-            mailContentHandlerDelegate.enableLogging(getLogger());
             mailContentHandlerDelegate.setSimpleDateFormat(sdf);
             mailContentHandlerDelegate.startDocumentXMLizer();
             mailContentHandlerDelegate.marshalMessageToSAX(message);

Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailContext.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailContext.java?rev=586223&r1=586222&r2=586223&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailContext.java
(original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailContext.java
Thu Oct 18 18:56:01 2007
@@ -22,12 +22,13 @@
 import javax.mail.Folder;
 import javax.mail.MessagingException;
 import javax.mail.Store;
-//import javax.mail.Session;
+
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.context.ContextException;
 import org.apache.avalon.framework.context.DefaultContext;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.logger.LogEnabled;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import org.apache.cocoon.environment.Request;
 
 /**
@@ -36,7 +37,7 @@
  * @since 29 December 2002
  * @version $Id$
  */
-public class MailContext extends DefaultContext implements LogEnabled {
+public class MailContext extends DefaultContext {
 
     /**
      * attribute name of MailContext object in an application session, eg http-session
@@ -62,8 +63,9 @@
      */
     public final static String MAIL_CURRENT_WORKING_COMMAND_ENTRY = "mail-current-working-command";
 
+    private final Log logger = LogFactory.getLog(getClass());
+
     private Request request;
-    private Logger logger;
 
 
     /**
@@ -320,17 +322,6 @@
 
 
     /**
-     *  Description of the Method
-     *
-     * @param  logger  Description of the Parameter
-     */
-    public void enableLogging(Logger logger) {
-        this.logger = logger;
-    }
-
-
-
-    /**
      *  Gets the parameter attribute of the MailContext object
      *
      * @param  key  Description of the Parameter
@@ -358,7 +349,7 @@
      *
      * @return    The logger value
      */
-    protected Logger getLogger() {
+    protected Log getLogger() {
         return this.logger;
     }
 
@@ -373,5 +364,4 @@
         //
         return fn;
     }
-
 }

Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailContextHttpSession.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailContextHttpSession.java?rev=586223&r1=586222&r2=586223&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailContextHttpSession.java
(original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailContextHttpSession.java
Thu Oct 18 18:56:01 2007
@@ -61,6 +61,6 @@
         getLogger().info("value unbound " + String.valueOf(event));
 
         // This should not happen, removeStore of this
-        this.removeStore();
+        removeStore();
     }
 }

Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailMessageSender.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailMessageSender.java?rev=586223&r1=586222&r2=586223&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailMessageSender.java
(original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailMessageSender.java
Thu Oct 18 18:56:01 2007
@@ -45,8 +45,6 @@
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
@@ -58,6 +56,7 @@
 import org.apache.cocoon.mail.datasource.InputStreamDataSource;
 import org.apache.cocoon.mail.datasource.SourceDataSource;
 import org.apache.cocoon.servlet.multipart.Part;
+import org.apache.cocoon.util.AbstractLogEnabled;
 
 /**
  * A helper class used by the {@link org.apache.cocoon.acting.Sendmail}
@@ -101,11 +100,6 @@
     private Exception exception;
 
 
-    /** Java 1.3 Accessor */
-    private Logger getMyLogger() {
-        return getLogger();
-    }
-
     /**
      * Check string for null, empty, and "null".
      * @param str
@@ -230,9 +224,6 @@
                 throw new MessagingException("Not yet supported: " + getObject());
             }
 
-            if (ds != null) {
-                ds.enableLogging(getMyLogger());
-            }
             return ds;
         }
 

Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/command/AbstractMailCommand.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/command/AbstractMailCommand.java?rev=586223&r1=586222&r2=586223&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/command/AbstractMailCommand.java
(original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/command/AbstractMailCommand.java
Thu Oct 18 18:56:01 2007
@@ -20,7 +20,8 @@
 import java.util.Iterator;
 import java.util.List;
 import javax.mail.MessagingException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
+
+import org.apache.cocoon.util.AbstractLogEnabled;
 
 /**
  * An abstract MailCommand template

Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/AbstractDataSource.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/AbstractDataSource.java?rev=586223&r1=586222&r2=586223&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/AbstractDataSource.java
(original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/AbstractDataSource.java
Thu Oct 18 18:56:01 2007
@@ -21,7 +21,7 @@
 import java.io.OutputStream;
 import javax.activation.DataSource;
 
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.cocoon.util.AbstractLogEnabled;
 
 /**
  * The AbstractDataSource class is a base class for other {@link DataSource}

Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java?rev=586223&r1=586222&r2=586223&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java
(original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java
Thu Oct 18 18:56:01 2007
@@ -205,6 +205,7 @@
     /*
      * constants, related to elements in configuration-file
      */
+
     public static final String NAMESPACE                  = "http://apache.org/cocoon/transformation/sendmail";
     public static final String ELEMENT_SENDMAIL           = "sendmail";
     public static final String ELEMENT_SMTPHOST           = "smtphost";
@@ -227,6 +228,7 @@
     /*
      * mode-constants
      */
+
     protected static final int MODE_NONE               = 0;
     protected static final int MODE_SMTPHOST           = 1;
     protected static final int MODE_FROM               = 2;
@@ -612,8 +614,7 @@
                     this.usedSources.add(inputSource);
     
                     DataSource dataSource = new SourceDataSource(inputSource, aD.strAttrMimeType,
aD.strAttrName);
-                    ((SourceDataSource) dataSource).enableLogging(getLogger());
-    
+
                     messageBodyPart.setDataHandler(new DataHandler(dataSource));
                 } else {
                     messageBodyPart.setContent(aD.strContent, aD.strAttrMimeType);



Mime
View raw message