axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hemap...@apache.org
Subject svn commit: r220101 [3/4] - in /webservices/axis/trunk/java/modules: core/src/org/apache/axis2/ core/src/org/apache/axis2/clientapi/ core/src/org/apache/axis2/context/ core/src/org/apache/axis2/deployment/ core/src/org/apache/axis2/description/ core/sr...
Date Thu, 21 Jul 2005 15:12:58 GMT
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractMessageReceiver.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractMessageReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractMessageReceiver.java Thu Jul 21 08:12:52 2005
@@ -24,6 +24,7 @@
 import org.apache.axis2.description.ServiceDescription;
 import org.apache.axis2.engine.AxisFault;
 import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.soap.SOAPFactory;
 import org.apache.axis2.soap.impl.llom.soap11.SOAP11Constants;
@@ -37,7 +38,6 @@
 
     protected SOAPFactory fac;
 
-
     /**
      * Method makeNewServiceObject
      *
@@ -45,33 +45,39 @@
      * @return
      * @throws AxisFault
      */
-    protected Object makeNewServiceObject(MessageContext msgContext) throws AxisFault {
+    protected Object makeNewServiceObject(MessageContext msgContext)
+        throws AxisFault {
         try {
 
             String nsURI = msgContext.getEnvelope().getNamespace().getName();
             if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
                 fac = OMAbstractFactory.getSOAP12Factory();
-            } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
-                    nsURI)) {
+            } else if (
+                SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
                 fac = OMAbstractFactory.getSOAP11Factory();
             } else {
-                throw new AxisFault(
-                        "Unknown SOAP Version. Current Axis handles only SOAP 1.1 and SOAP 1.2 messages");
+                throw new AxisFault(Messages.getMessage("invalidSOAPversion"));
             }
 
             ServiceDescription service =
-                    msgContext.getOperationContext().getServiceContext()
+                msgContext
+                    .getOperationContext()
+                    .getServiceContext()
                     .getServiceConfig();
             ClassLoader classLoader = service.getClassLoader();
             Parameter implInfoParam = service.getParameter(SERVICE_CLASS);
             if (implInfoParam != null) {
                 Class implClass =
-                        Class.forName((String) implInfoParam.getValue(),
-                                true,
-                                classLoader);
+                    Class.forName(
+                        (String) implInfoParam.getValue(),
+                        true,
+                        classLoader);
                 return implClass.newInstance();
             } else {
-                throw new AxisFault("SERVICE_CLASS parameter is not specified");
+                throw new AxisFault(
+                    Messages.getMessage(
+                        "paramIsNotSpecified",
+                        "SERVICE_CLASS"));
             }
 
         } catch (Exception e) {
@@ -86,32 +92,35 @@
      * @return
      * @throws AxisFault
      */
-    protected Object getTheImplementationObject(MessageContext msgContext) throws AxisFault {
+    protected Object getTheImplementationObject(MessageContext msgContext)
+        throws AxisFault {
         ServiceDescription service =
-                msgContext.getOperationContext().getServiceContext()
+            msgContext
+                .getOperationContext()
+                .getServiceContext()
                 .getServiceConfig();
 
         Parameter scopeParam = service.getParameter(SCOPE);
         QName serviceName = service.getName();
-        if (scopeParam != null &&
-                Constants.SESSION_SCOPE.equals(scopeParam.getValue())) {
+        if (scopeParam != null
+            && Constants.SESSION_SCOPE.equals(scopeParam.getValue())) {
             SessionContext sessionContext = msgContext.getSessionContext();
             synchronized (sessionContext) {
-                Object obj = sessionContext.getProperty(
-                        serviceName.getLocalPart());
+                Object obj =
+                    sessionContext.getProperty(serviceName.getLocalPart());
                 if (obj == null) {
                     obj = makeNewServiceObject(msgContext);
-                    sessionContext.setProperty(serviceName.getLocalPart(),
-                            obj);
+                    sessionContext.setProperty(serviceName.getLocalPart(), obj);
                 }
                 return obj;
             }
-        } else if (scopeParam != null &&
-                Constants.APPLICATION_SCOPE.equals(scopeParam.getValue())) {
+        } else if (
+            scopeParam != null
+                && Constants.APPLICATION_SCOPE.equals(scopeParam.getValue())) {
             ConfigurationContext globalContext = msgContext.getSystemContext();
             synchronized (globalContext) {
-                Object obj = globalContext.getProperty(
-                        serviceName.getLocalPart());
+                Object obj =
+                    globalContext.getProperty(serviceName.getLocalPart());
                 if (obj == null) {
                     obj = makeNewServiceObject(msgContext);
                     globalContext.setProperty(serviceName.getLocalPart(), obj);

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java Thu Jul 21 08:12:52 2005
@@ -21,6 +21,7 @@
 import org.apache.axis2.engine.AxisFault;
 import org.apache.axis2.engine.DependencyManager;
 import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMNamespace;
@@ -136,13 +137,10 @@
                         envelope.getBody().addChild(responseMethodName);
                     }
                 } else {
-                    throw new AxisFault("Unknown style ");
+                    throw new AxisFault(Messages.getMessage("unknownStyle",style));
                 }
             } else {
-                throw new AxisFault(
-                        "Raw Xml provider supports only the methods bearing the signature public OMElement "
-                        +
-                        "<method-name>(OMElement) where the method name is anything");
+                throw new AxisFault(Messages.getMessage("rawXmlProivdeIsLimited"));
             }
         } catch (Exception e) {
             throw AxisFault.makeFault(e);

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java Thu Jul 21 08:12:52 2005
@@ -21,6 +21,7 @@
 import org.apache.axis2.engine.AxisFault;
 import org.apache.axis2.engine.DependencyManager;
 import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.soap.SOAPEnvelope;
@@ -96,33 +97,22 @@
                                 .getBody()
                                 .getFirstElement();
                         if (operationElement != null) {
-                            if (method.getName().equals(
-                                    operationElement.getLocalName())
-                                    ||
-                                    operationElement.getLocalName() != null &&
+                            if (operationElement.getLocalName() != null &&
                                     operationElement.getLocalName().startsWith(
                                             method.getName())) {
                                 omElement = operationElement.getFirstElement();
                             } else {
-                                throw new AxisFault(
-                                        "Operation Name does not match the immediate child name, expected " +
-                                        method.getName() +
-                                        " but get " +
-                                        operationElement.getLocalName());
+                                throw new AxisFault(Messages.getMessage("AandBdonotmatch","Operation Name","immediate child name",operationElement.getLocalName(),method.getName()));
                             }
                         } else {
-                            throw new AxisFault(
-                                    "rpc style expect the immediate child of the SOAP body ");
+                            throw new AxisFault(Messages.getMessage("rpcNeedmatchingChild"));
                         }
                     } else {
-                        throw new AxisFault("Unknown style ");
+                        throw new AxisFault(Messages.getMessage("unknownStyle",style));
                     }
                     args = new Object[]{omElement};
                 } else {
-                    throw new AxisFault(
-                            "Raw Xml provider supports only the methods bearing the signature public OMElement "
-                            +
-                            "<method-name>(OMElement) where the method name is anything");
+                    throw new AxisFault(Messages.getMessage("rawXmlProivdeIsLimited"));
                 }
 
                 OMElement result = (OMElement) method.invoke(obj, args);
@@ -145,9 +135,7 @@
                 }
                 newmsgContext.setEnvelope(envelope);
             } else {
-                throw new AxisFault(
-                        "Implementation class does not define a method called" +
-                        opDesc.getName());
+                throw new AxisFault(Messages.getMessage("methodNotImplemented",opDesc.getName().toString()));
             }
         } catch (Exception e) {
             throw AxisFault.makeFault(e);

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/AbstractTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/AbstractTransportSender.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/AbstractTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/AbstractTransportSender.java Thu Jul 21 08:12:52 2005
@@ -24,6 +24,7 @@
 import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.engine.AxisFault;
 import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.impl.OMOutputImpl;
 import org.apache.axis2.soap.SOAPEnvelope;
@@ -136,10 +137,10 @@
                 omOutput.flush();
                 out.flush();
             } catch (Exception e) {
-                throw new AxisFault("Stream error", e);
+                throw new AxisFault(e);
             }
         } else {
-            throw new AxisFault("the OUTPUT message is Null, nothing to write");
+            throw new AxisFault(Messages.getMessage("outMessageNull"));
         }
     }
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/EmailReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/EmailReceiver.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/EmailReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/EmailReceiver.java Thu Jul 21 08:12:52 2005
@@ -18,6 +18,7 @@
 package org.apache.axis2.transport;
 
 import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.i18n.Messages;
 
 import javax.mail.Authenticator;
 import javax.mail.Folder;
@@ -29,12 +30,6 @@
 import javax.mail.Store;
 import java.util.Properties;
 
-/**
- * @author hemapani
- *         <p/>
- *         To change the template for this generated type comment go to
- *         Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
 public class EmailReceiver {
 
     private String user;
@@ -44,21 +39,35 @@
     private Store store;
     private Folder inbox;
 
-    public EmailReceiver(String user,
-                         String host,
-                         String popPort,
-                         String password) {
+    public EmailReceiver(
+        String user,
+        String host,
+        String popPort,
+        String password)
+        throws AxisFault {
         this.user = user;
         this.host = host;
         this.popPort = popPort;
         this.password = password;
-    }
+        if (this.user == null) {
+            throw new AxisFault(Messages.getMessage("canNotBeNull","User"));
+        }
+        if (this.host == null) {
+            throw new AxisFault(Messages.getMessage("canNotBeNull","Host"));
+        }
+        if (this.popPort == null) {
+            throw new AxisFault(Messages.getMessage("canNotBeNull","port"));
+        }
+        if (this.password == null) {
+            throw new AxisFault(Messages.getMessage("canNotBeNull","Password"));
+        }
 
+    }
 
     public void connect() throws AxisFault {
         try {
             final PasswordAuthentication authentication =
-                    new PasswordAuthentication(user, password);
+                new PasswordAuthentication(user, password);
             Properties props = new Properties();
             props.put("mail.user", user);
             props.put("mail.host", host);
@@ -76,7 +85,6 @@
             Folder root = store.getDefaultFolder();
             inbox = root.getFolder("inbox");
 
-
         } catch (NoSuchProviderException e) {
             throw new AxisFault(e);
         } catch (MessagingException e) {
@@ -93,7 +101,6 @@
             throw new AxisFault(e);
         }
     }
-
 
     public Message[] receive() throws AxisFault {
         try {

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/TransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/TransportSender.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/TransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/TransportSender.java Thu Jul 21 08:12:52 2005
@@ -22,11 +22,23 @@
 import org.apache.axis2.engine.Handler;
 
 /**
- * Interface TransportSender
+ * This send the SOAP Message to other SOAP nodes and this alone write the SOAP Message to the 
+ * wire. Out flow must be end with one of this kind.
  */
 public interface TransportSender extends Handler {
-    public void cleanUp(MessageContext msgContext) throws AxisFault;
-
+    /**
+     * Initialize
+     * @param confContext
+     * @param transportOut
+     * @throws AxisFault
+     */
     public void init(ConfigurationContext confContext,
                      TransportOutDescription transportOut) throws AxisFault;
+    /**
+     * Clean up
+     * @param msgContext
+     * @throws AxisFault
+     */                     
+    public void cleanUp(MessageContext msgContext) throws AxisFault;
+
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/TransportUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/TransportUtils.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/TransportUtils.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/TransportUtils.java Thu Jul 21 08:12:52 2005
@@ -18,6 +18,7 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.om.impl.llom.builder.StAXBuilder;
 import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
 import org.apache.axis2.soap.SOAPEnvelope;
@@ -39,8 +40,10 @@
         InputStream inStream = (InputStream) msgContext.getProperty(
                 MessageContext.TRANSPORT_IN);
         msgContext.setProperty(MessageContext.TRANSPORT_IN, null);
+        //this inputstram is set by the TransportSender represents a two way transport or
+        //by a Transport Recevier
         if (inStream == null) {
-            throw new AxisFault("Input stream is Null");
+            throw new AxisFault(Messages.getMessage("inputstreamNull"));
         }
         return createSOAPMessage(msgContext, inStream);
     }
@@ -56,7 +59,7 @@
                         opContext.getProperty(
                                 HTTPConstants.MTOM_RECIVED_CONTENT_TYPE);
             } else {
-                throw new AxisFault("Operation Context can not be Null");
+                throw new AxisFault(Messages.getMessage("cannotBeNullOperationContext"));
             }
 
             StAXBuilder builder = null;

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java Thu Jul 21 08:12:52 2005
@@ -35,6 +35,7 @@
 import java.io.OutputStream;
 import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.Map;
 
 /**
  * Class AxisServlet
@@ -53,9 +54,13 @@
         try {
             ServletContext context = config.getServletContext();
             String repoDir = context.getRealPath("/WEB-INF");
-            ConfigurationContextFactory erfac = new ConfigurationContextFactory();
-            ConfigurationContext configContext = erfac.buildConfigurationContext(repoDir);
-            configContext.setProperty(Constants.CONTAINER_MANAGED, Constants.VALUE_TRUE);
+            ConfigurationContextFactory erfac =
+                new ConfigurationContextFactory();
+            ConfigurationContext configContext =
+                erfac.buildConfigurationContext(repoDir);
+            configContext.setProperty(
+                Constants.CONTAINER_MANAGED,
+                Constants.VALUE_TRUE);
             configContext.setRootDir(new File(context.getRealPath("/WEB-INF")));
             lister = new ListingAgent(configContext);
             context.setAttribute(CONFIGURATION_CONTEXT, configContext);
@@ -78,14 +83,16 @@
         throws ServletException, IOException {
 
         ConfigurationContext configContext =
-            (ConfigurationContext) getServletContext().getAttribute(CONFIGURATION_CONTEXT);
+            (ConfigurationContext) getServletContext().getAttribute(
+                CONFIGURATION_CONTEXT);
 
         httpServletResponse.setContentType("text/xml; charset=utf-8");
         MessageContext msgContext = null;
         OutputStream out = null;
         try {
             Object sessionContext =
-                httpServletRequest.getSession().getAttribute(Constants.SESSION_CONTEXT_PROPERTY);
+                httpServletRequest.getSession().getAttribute(
+                    Constants.SESSION_CONTEXT_PROPERTY);
             if (sessionContext == null) {
                 sessionContext = new SessionContext(null);
                 httpServletRequest.getSession().setAttribute(
@@ -114,6 +121,8 @@
             msgContext.setProperty(
                 HTTPConstants.HTTPOutTransportInfo,
                 new ServletBasedOutTransportInfo(httpServletResponse));
+            msgContext.setProperty(MessageContext.TRANSPORT_HEADERS,getTransportHeaders(httpServletRequest));    
+                
             out = httpServletResponse.getOutputStream();
             boolean processed =
                 HTTPTransportUtils.processHTTPGetRequest(
@@ -121,7 +130,8 @@
                     httpServletRequest.getInputStream(),
                     out,
                     httpServletRequest.getContentType(),
-                    httpServletRequest.getHeader(HTTPConstants.HEADER_SOAP_ACTION),
+                    httpServletRequest.getHeader(
+                        HTTPConstants.HEADER_SOAP_ACTION),
                     httpServletRequest.getRequestURL().toString(),
                     configContext,
                     map);
@@ -132,7 +142,8 @@
             if (msgContext != null) {
                 msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
                 AxisEngine engine = new AxisEngine(configContext);
-                MessageContext faultContext = engine.createFaultMessageContext(msgContext, e);
+                MessageContext faultContext =
+                    engine.createFaultMessageContext(msgContext, e);
                 engine.sendFault(faultContext);
             } else {
                 throw new ServletException(e);
@@ -158,13 +169,17 @@
         throws ServletException, IOException {
         MessageContext msgContext = null;
         ConfigurationContext configContext =
-            (ConfigurationContext) getServletContext().getAttribute(CONFIGURATION_CONTEXT);
+            (ConfigurationContext) getServletContext().getAttribute(
+                CONFIGURATION_CONTEXT);
         try {
             Object sessionContext =
-                req.getSession().getAttribute(Constants.SESSION_CONTEXT_PROPERTY);
+                req.getSession().getAttribute(
+                    Constants.SESSION_CONTEXT_PROPERTY);
             if (sessionContext == null) {
                 sessionContext = new SessionContext(null);
-                req.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY, sessionContext);
+                req.getSession().setAttribute(
+                    Constants.SESSION_CONTEXT_PROPERTY,
+                    sessionContext);
             }
             msgContext =
                 new MessageContext(
@@ -177,6 +192,8 @@
             msgContext.setProperty(
                 HTTPConstants.HTTPOutTransportInfo,
                 new ServletBasedOutTransportInfo(res));
+            msgContext.setProperty(MessageContext.TRANSPORT_HEADERS,getTransportHeaders(req));
+                
             res.setContentType("text/xml; charset=utf-8");
             HTTPTransportUtils.processHTTPPostRequest(
                 msgContext,
@@ -187,19 +204,35 @@
                 req.getRequestURL().toString(),
                 configContext);
             Object contextWritten =
-                msgContext.getOperationContext().getProperty(Constants.RESPONSE_WRITTEN);
-            if (contextWritten == null || !Constants.VALUE_TRUE.equals(contextWritten)) {
+                msgContext.getOperationContext().getProperty(
+                    Constants.RESPONSE_WRITTEN);
+            if (contextWritten == null
+                || !Constants.VALUE_TRUE.equals(contextWritten)) {
                 res.setStatus(HttpServletResponse.SC_ACCEPTED);
             }
         } catch (AxisFault e) {
             if (msgContext != null) {
-                msgContext.setProperty(MessageContext.TRANSPORT_OUT, res.getOutputStream());
+                msgContext.setProperty(
+                    MessageContext.TRANSPORT_OUT,
+                    res.getOutputStream());
                 AxisEngine engine = new AxisEngine(configContext);
-                MessageContext faultContext = engine.createFaultMessageContext(msgContext, e);
+                MessageContext faultContext =
+                    engine.createFaultMessageContext(msgContext, e);
                 engine.sendFault(faultContext);
             } else {
                 throw new ServletException(e);
             }
         }
+    }
+
+    private Map getTransportHeaders(HttpServletRequest req) {
+        HashMap headerMap = new HashMap();
+        Enumeration headerNames = req.getHeaderNames();
+        while (headerNames.hasMoreElements()) {
+            String key = (String) headerNames.nextElement();
+            String value = req.getHeader(key);
+            headerMap.put(key, value);
+        }
+        return headerMap;
     }
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Thu Jul 21 08:12:52 2005
@@ -26,6 +26,7 @@
 import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.engine.AxisFault;
 import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.impl.OMOutputImpl;
 import org.apache.axis2.transport.TransportSender;
@@ -341,13 +342,13 @@
                 }
                 InputStream in = postMethod.getResponseBodyAsStream();
                 if (in == null) {
-                    throw new AxisFault("Input Stream can not be Null");
+                    throw new AxisFault(Messages.getMessage("canNotBeNull","InputStream"));
                 }
                 msgContext.getOperationContext().setProperty(MessageContext.TRANSPORT_IN, in);
             } else if (postMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
                 return;
             } else {
-                throw new AxisFault("Error " + postMethod.getStatusCode() + "  Error Message is " + postMethod.getResponseBodyAsString());
+                throw new AxisFault(Messages.getMessage("transportError",String.valueOf(postMethod.getStatusCode()),postMethod.getResponseBodyAsString()));
             }
 
         }
@@ -364,14 +365,13 @@
 
                 InputStream in = getMehtod.getResponseBodyAsStream();
                 if (in == null) {
-                    throw new AxisFault("Input Stream can not be Null");
+                    throw new AxisFault(Messages.getMessage("canNotBeNull","InputStream"));
                 }
                 msgContext.getOperationContext().setProperty(MessageContext.TRANSPORT_IN, in);
             } else if (getMehtod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
                 return;
             } else {
-                throw new AxisFault("Error " + getMehtod.getStatusCode() + "  Error Message is " + getMehtod.getResponseBodyAsString());
-            }
+                throw new AxisFault(Messages.getMessage("transportError",String.valueOf(getMehtod.getStatusCode()),getMehtod.getResponseBodyAsString()));            }
         }
 
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java Thu Jul 21 08:12:52 2005
@@ -19,6 +19,7 @@
 import org.apache.axis2.description.OperationDescription;
 import org.apache.axis2.description.ServiceDescription;
 import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.i18n.Messages;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -78,62 +79,7 @@
      */
     private boolean done = false;
 
-//
-//    /**
-//     * Method invoke
-//     *
-//     * @param msgContext
-//     * @throws AxisFault
-//     */
-//    public SOAPEnvelope handleHTTPRequest(
-//        MessageContext msgContext,InputStream inStream, Map map)
-//        throws AxisFault {
-//        SOAPEnvelope soapEnvelope = null;
-//
-//
-//
-//            msgContext.setWSAAction(
-//                (String) map.get(HTTPConstants.HEADER_SOAP_ACTION));
-//            Utils.configureMessageContextForHTTP(
-//                (String) map.get(HTTPConstants.HEADER_CONTENT_TYPE),
-//                msgContext.getWSAAction(),
-//                msgContext);
-//
-//            String requestURI = (String) map.get(HTTPConstants.REQUEST_URI);
-//            msgContext.setTo(
-//                new EndpointReference(AddressingConstants.WSA_TO, requestURI));
-//
-//            if (HTTPConstants
-//                .RESPONSE_ACK_CODE_VAL
-//                .equals(map.get(HTTPConstants.RESPONSE_CODE))) {
-//                msgContext.setProperty(
-//                    MessageContext.TRANSPORT_SUCCEED,
-//                    HTTPConstants.RESPONSE_ACK_CODE_VAL);
-//                return null;
-//            } else if (
-//                HTTPConstants.HEADER_GET.equals(
-//                    map.get(HTTPConstants.HTTP_REQ_TYPE))) {
-//                SOAPEnvelope envelope =
-//                    HTTPTransportUtils.createEnvelopeFromGetRequest(
-//                        requestURI,
-//                        getGetRequestParameters(requestURI));
-//                if From axis-cvs-return-7778-apmail-ws-axis-dev-archive=ws.apache.org@ws.apache.org Thu Jul 21 15:13:56 2005
Return-Path: <axis-cvs-return-7778-apmail-ws-axis-dev-archive=ws.apache.org@ws.apache.org>
Delivered-To: apmail-ws-axis-dev-archive@www.apache.org
Received: (qmail 38206 invoked from network); 21 Jul 2005 15:13:55 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199)
  by minotaur.apache.org with SMTP; 21 Jul 2005 15:13:55 -0000
Received: (qmail 17301 invoked by uid 500); 21 Jul 2005 15:13:36 -0000
Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org
Received: (qmail 16996 invoked by uid 500); 21 Jul 2005 15:13:34 -0000
Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm
Precedence: bulk
list-help: <mailto:axis-cvs-help@ws.apache.org>
list-unsubscribe: <mailto:axis-cvs-unsubscribe@ws.apache.org>
List-Post: <mailto:axis-cvs@ws.apache.org>
List-Id: <axis-cvs.ws.apache.org>
Delivered-To: mailing list axis-cvs@ws.apache.org
Received: (qmail 16766 invoked by uid 99); 21 Jul 2005 15:13:32 -0000
X-ASF-Spam-Status: No, hits=-9.8 required=10.0
	tests=ALL_TRUSTED,NO_REAL_NAME
X-Spam-Check-By: apache.org
Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194)
    by apache.org (qpsmtpd/0.29) with SMTP; Thu, 21 Jul 2005 08:13:19 -0700
Received: (qmail 37503 invoked by uid 65534); 21 Jul 2005 15:13:16 -0000
Message-ID: <20050721151316.37501.qmail@minotaur.apache.org>
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r220101 [4/4] - in /webservices/axis/trunk/java/modules:
 core/src/org/apache/axis2/ core/src/org/apache/axis2/clientapi/
 core/src/org/apache/axis2/context/ core/src/org/apache/axis2/deployment/
 core/src/org/apache/axis2/description/ core/sr...
Date: Thu, 21 Jul 2005 15:12:58 -0000
To: axis-cvs@ws.apache.org
From: hemapani@apache.org
X-Mailer: svnmailer-1.0.2
X-Virus-Checked: Checked by ClamAV on apache.org
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailRequestResponseRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailRequestResponseRawXMLTest.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailRequestResponseRawXMLTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailRequestResponseRawXMLTest.java Thu Jul 21 08:12:52 2005
@@ -82,10 +82,8 @@
     }
 
     protected void setUp() throws Exception {
-        ConfigurationContext configContext = createServerConfigurationContext();
-        MailServer server = new MailServer(configContext,
-                MailConstants.POP_SERVER_PORT,
-                MailConstants.SMTP_SERVER_PORT);
+        ConfigurationContext configContext = UtilsMailServer.start();
+        
         SimpleMailListener ml = new SimpleMailListener();
 
 
@@ -93,8 +91,8 @@
                 configContext.getAxisConfiguration().getTransportIn(
                         new QName(Constants.TRANSPORT_MAIL)));
         ml.start();
-        configContext.getAxisConfiguration().engageModule(
-                new QName(Constants.MODULE_ADDRESSING));
+//        configContext.getAxisConfiguration().engageModule(
+//                new QName(Constants.MODULE_ADDRESSING));
         ServiceDescription service =
                 Utils.createSimpleService(serviceName,
                         Echo.class.getName(),
@@ -106,6 +104,7 @@
     }
 
     protected void tearDown() throws Exception {
+        UtilsMailServer.stop();
     }
 
     private OMElement createEnvelope() {
@@ -122,7 +121,7 @@
 
     public void testEchoXMLCompleteASync() throws Exception {
 
-        ConfigurationContext configContext = createClientConfigurationContext();
+        ConfigurationContext configContext = UtilsMailServer.createClientConfigurationContext();
         ServiceDescription service = new ServiceDescription(serviceName);
         OperationDescription operation = new OperationDescription(
                 operationName);
@@ -139,7 +138,7 @@
 
         org.apache.axis2.clientapi.Call call = new org.apache.axis2.clientapi.Call(
                 serviceContext);
-        call.engageModule(new QName(Constants.MODULE_ADDRESSING));
+//        call.engageModule(new QName(Constants.MODULE_ADDRESSING));
 
         call.setTo(targetEPR);
         call.setTransportInfo(Constants.TRANSPORT_MAIL,
@@ -179,88 +178,88 @@
 
     }
 
-    public ConfigurationContext createServerConfigurationContext() throws Exception {
-        ConfigurationContextFactory builder = new ConfigurationContextFactory();
-        ConfigurationContext configContext =
-                builder.buildConfigurationContext(
-                        org.apache.axis2.Constants.TESTING_REPOSITORY);
-
-        TransportInDescription transportIn =
-                new TransportInDescription(new QName(Constants.TRANSPORT_MAIL));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.host", "127.0.0.1"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.user", "foo@127.0.0.1"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.password", "axis2"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.port", "1134"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.replyToAddress",
-                        "foo@127.0.0.1"));
-        transportIn.setReceiver(new SimpleMailListener());
-        transportIn.getReciever().init(configContext, transportIn);
-
-        TransportOutDescription transportOut =
-                new TransportOutDescription(
-                        new QName(Constants.TRANSPORT_MAIL));
-
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.host", "127.0.0.1"));
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.user", "foo"));
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.password", "axis2"));
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.port", "1049"));
-        transportOut.setSender(new MailTransportSender());
-        transportOut.getSender().init(configContext, transportOut);
-
-        configContext.getAxisConfiguration().addTransportIn(transportIn);
-        configContext.getAxisConfiguration().addTransportOut(transportOut);
-        return configContext;
-    }
-
-    public ConfigurationContext createClientConfigurationContext() throws Exception {
-        ConfigurationContextFactory builder = new ConfigurationContextFactory();
-        ConfigurationContext configContext =
-                builder.buildConfigurationContext(
-                        org.apache.axis2.Constants.TESTING_REPOSITORY);
-
-        TransportInDescription transportIn =
-                new TransportInDescription(new QName(Constants.TRANSPORT_MAIL));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.host", "127.0.0.1"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.user", "bar@127.0.0.1"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.password", "axis2"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.port", "1134"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.replyToAddress",
-                        "bar@127.0.0.1"));
-        transportIn.setReceiver(new SimpleMailListener());
-        transportIn.getReciever().init(configContext, transportIn);
-
-        TransportOutDescription transportOut =
-                new TransportOutDescription(
-                        new QName(Constants.TRANSPORT_MAIL));
-
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.host", "127.0.0.1"));
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.user", "bar"));
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.password", "axis2"));
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.port", "1049"));
-        transportOut.setSender(new MailTransportSender());
-        transportOut.getSender().init(configContext, transportOut);
-
-        configContext.getAxisConfiguration().addTransportIn(transportIn);
-        configContext.getAxisConfiguration().addTransportOut(transportOut);
-        return configContext;
-    }
+//    public ConfigurationContext createServerConfigurationContext() throws Exception {
+//        ConfigurationContextFactory builder = new ConfigurationContextFactory();
+//        ConfigurationContext configContext =
+//                builder.buildConfigurationContext(
+//                        org.apache.axis2.Constants.TESTING_REPOSITORY);
+//
+//        TransportInDescription transportIn =
+//                new TransportInDescription(new QName(Constants.TRANSPORT_MAIL));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.host", "127.0.0.1"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.user", "foo@127.0.0.1"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.password", "axis2"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.port", "1134"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.replyToAddress",
+//                        "foo@127.0.0.1"));
+//        transportIn.setReceiver(new SimpleMailListener());
+//        transportIn.getReciever().init(configContext, transportIn);
+//
+//        TransportOutDescription transportOut =
+//                new TransportOutDescription(
+//                        new QName(Constants.TRANSPORT_MAIL));
+//
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.host", "127.0.0.1"));
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.user", "foo"));
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.password", "axis2"));
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.port", "1049"));
+//        transportOut.setSender(new MailTransportSender());
+//        transportOut.getSender().init(configContext, transportOut);
+//
+//        configContext.getAxisConfiguration().addTransportIn(transportIn);
+//        configContext.getAxisConfiguration().addTransportOut(transportOut);
+//        return configContext;
+//    }
+//
+//    public ConfigurationContext createClientConfigurationContext() throws Exception {
+//        ConfigurationContextFactory builder = new ConfigurationContextFactory();
+//        ConfigurationContext configContext =
+//                builder.buildConfigurationContext(
+//                        org.apache.axis2.Constants.TESTING_REPOSITORY);
+//
+//        TransportInDescription transportIn =
+//                new TransportInDescription(new QName(Constants.TRANSPORT_MAIL));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.host", "127.0.0.1"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.user", "bar@127.0.0.1"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.password", "axis2"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.port", "1134"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.replyToAddress",
+//                        "bar@127.0.0.1"));
+//        transportIn.setReceiver(new SimpleMailListener());
+//        transportIn.getReciever().init(configContext, transportIn);
+//
+//        TransportOutDescription transportOut =
+//                new TransportOutDescription(
+//                        new QName(Constants.TRANSPORT_MAIL));
+//
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.host", "127.0.0.1"));
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.user", "bar"));
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.password", "axis2"));
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.port", "1049"));
+//        transportOut.setSender(new MailTransportSender());
+//        transportOut.getSender().init(configContext, transportOut);
+//
+//        configContext.getAxisConfiguration().addTransportIn(transportIn);
+//        configContext.getAxisConfiguration().addTransportOut(transportOut);
+//        return configContext;
+//    }
 
 }

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailetRequestResponceRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailetRequestResponceRawXMLTest.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailetRequestResponceRawXMLTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailetRequestResponceRawXMLTest.java Thu Jul 21 08:12:52 2005
@@ -16,21 +16,22 @@
 package org.apache.axis2.mail;
 
 
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+
 import junit.framework.TestCase;
+
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.clientapi.AsyncResult;
 import org.apache.axis2.clientapi.Callback;
 import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.description.OperationDescription;
-import org.apache.axis2.description.ParameterImpl;
 import org.apache.axis2.description.ServiceDescription;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisFault;
 import org.apache.axis2.engine.Echo;
@@ -40,18 +41,10 @@
 import org.apache.axis2.om.OMFactory;
 import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.soap.SOAPEnvelope;
-import org.apache.axis2.transport.mail.MailTransportSender;
-import org.apache.axis2.transport.mail.SimpleMailListener;
-import org.apache.axis2.transport.mail.server.MailConstants;
-import org.apache.axis2.transport.mail.server.MailServer;
 import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-
 /**
  * This will use the In out functionality to test the mailet functionality. This code was
  * based on the code on the MailRequestResponceRawXMLTest.java.
@@ -85,12 +78,10 @@
     }
 
     protected void setUp() throws Exception {
-        ConfigurationContext configContext = createServerConfigurationContext();
-        MailServer server = new MailServer(configContext,
-                MailConstants.POP_SERVER_PORT,
-                MailConstants.SMTP_SERVER_PORT);
-        configContext.getAxisConfiguration().engageModule(
-                new QName(Constants.MODULE_ADDRESSING));
+        ConfigurationContext configContext = UtilsMailServer.start();
+        
+//        configContext.getAxisConfiguration().engageModule(
+//                new QName(Constants.MODULE_ADDRESSING));
         ServiceDescription service =
                 Utils.createSimpleService(serviceName,
                         Echo.class.getName(),
@@ -102,6 +93,7 @@
     }
 
     protected void tearDown() throws Exception {
+        UtilsMailServer.stop();
     }
 
     private OMElement createEnvelope() {
@@ -118,7 +110,8 @@
 
     public void testEchoXMLCompleteASync() throws Exception {
 
-        ConfigurationContext configContext = createClientConfigurationContext();
+        ConfigurationContext configContext = UtilsMailServer.createClientConfigurationContext();
+        
         ServiceDescription service = new ServiceDescription(serviceName);
         OperationDescription operation = new OperationDescription(
                 operationName);
@@ -135,7 +128,7 @@
 
         org.apache.axis2.clientapi.Call call = new org.apache.axis2.clientapi.Call(
                 serviceContext);
-        call.engageModule(new QName(Constants.MODULE_ADDRESSING));
+//        call.engageModule(new QName(Constants.MODULE_ADDRESSING));
 
         call.setTo(targetEPR);
         call.setTransportInfo(Constants.TRANSPORT_MAIL,
@@ -176,91 +169,91 @@
 
     }
 
-    public ConfigurationContext createServerConfigurationContext() throws Exception {
-        ConfigurationContextFactory builder = new ConfigurationContextFactory();
-        ConfigurationContext configContext =
-                builder.buildConfigurationContext(
-                        org.apache.axis2.Constants.TESTING_REPOSITORY);
-
-        TransportInDescription transportIn =
-                new TransportInDescription(new QName(Constants.TRANSPORT_MAIL));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.host", "127.0.0.1"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.user",
-                        "server@127.0.0.1"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.password", "axis2"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.port", "1134"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.replyToAddress",
-                        "foo@127.0.0.1"));
-        transportIn.setReceiver(new SimpleMailListener());
-        transportIn.getReciever().init(configContext, transportIn);
-
-        TransportOutDescription transportOut =
-                new TransportOutDescription(
-                        new QName(Constants.TRANSPORT_MAIL));
-
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.host", "127.0.0.1"));
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.user", "server"));
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.password", "axis2"));
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.port", "1049"));
-        transportOut.setSender(new MailTransportSender());
-        transportOut.getSender().init(configContext, transportOut);
-
-        configContext.getAxisConfiguration().addTransportIn(transportIn);
-        configContext.getAxisConfiguration().addTransportOut(transportOut);
-        return configContext;
-    }
-
-    public ConfigurationContext createClientConfigurationContext() throws Exception {
-        ConfigurationContextFactory builder = new ConfigurationContextFactory();
-        ConfigurationContext configContext =
-                builder.buildConfigurationContext(
-                        org.apache.axis2.Constants.TESTING_REPOSITORY);
-
-        TransportInDescription transportIn =
-                new TransportInDescription(new QName(Constants.TRANSPORT_MAIL));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.host", "127.0.0.1"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.user",
-                        "client@127.0.0.1"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.password", "axis2"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.pop3.port", "1134"));
-        transportIn.addParameter(
-                new ParameterImpl("transport.mail.replyToAddress",
-                        "client@127.0.0.1"));
-        transportIn.setReceiver(new SimpleMailListener());
-        transportIn.getReciever().init(configContext, transportIn);
-
-        TransportOutDescription transportOut =
-                new TransportOutDescription(
-                        new QName(Constants.TRANSPORT_MAIL));
-
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.host", "127.0.0.1"));
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.user", "client"));
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.password", "axis2"));
-        transportOut.addParameter(
-                new ParameterImpl("transport.mail.smtp.port", "1049"));
-        transportOut.setSender(new MailTransportSender());
-        transportOut.getSender().init(configContext, transportOut);
-
-        configContext.getAxisConfiguration().addTransportIn(transportIn);
-        configContext.getAxisConfiguration().addTransportOut(transportOut);
-        return configContext;
-    }
-
+//    public ConfigurationContext createServerConfigurationContext() throws Exception {
+//        ConfigurationContextFactory builder = new ConfigurationContextFactory();
+//        ConfigurationContext configContext =
+//                builder.buildConfigurationContext(
+//                        org.apache.axis2.Constants.TESTING_REPOSITORY);
+//
+//        TransportInDescription transportIn =
+//                new TransportInDescription(new QName(Constants.TRANSPORT_MAIL));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.host", "127.0.0.1"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.user",
+//                        "server@127.0.0.1"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.password", "axis2"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.port", "1134"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.replyToAddress",
+//                        "foo@127.0.0.1"));
+//        transportIn.setReceiver(new SimpleMailListener());
+//        transportIn.getReciever().init(configContext, transportIn);
+//
+//        TransportOutDescription transportOut =
+//                new TransportOutDescription(
+//                        new QName(Constants.TRANSPORT_MAIL));
+//
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.host", "127.0.0.1"));
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.user", "server"));
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.password", "axis2"));
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.port", "1049"));
+//        transportOut.setSender(new MailTransportSender());
+//        transportOut.getSender().init(configContext, transportOut);
+//
+//        configContext.getAxisConfiguration().addTransportIn(transportIn);
+//        configContext.getAxisConfiguration().addTransportOut(transportOut);
+//        return configContext;
+//    }
+//
+//    public ConfigurationContext createClientConfigurationContext() throws Exception {
+//        ConfigurationContextFactory builder = new ConfigurationContextFactory();
+//        ConfigurationContext configContext =
+//                builder.buildConfigurationContext(
+//                        org.apache.axis2.Constants.TESTING_REPOSITORY);
+//
+//        TransportInDescription transportIn =
+//                new TransportInDescription(new QName(Constants.TRANSPORT_MAIL));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.host", "127.0.0.1"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.user",
+//                        "client@127.0.0.1"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.password", "axis2"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.pop3.port", "1134"));
+//        transportIn.addParameter(
+//                new ParameterImpl("transport.mail.replyToAddress",
+//                        "client@127.0.0.1"));
+//        transportIn.setReceiver(new SimpleMailListener());
+//        transportIn.getReciever().init(configContext, transportIn);
+//
+//        TransportOutDescription transportOut =
+//                new TransportOutDescription(
+//                        new QName(Constants.TRANSPORT_MAIL));
+//
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.host", "127.0.0.1"));
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.user", "client"));
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.password", "axis2"));
+//        transportOut.addParameter(
+//                new ParameterImpl("transport.mail.smtp.port", "1049"));
+//        transportOut.setSender(new MailTransportSender());
+//        transportOut.getSender().init(configContext, transportOut);
+//
+//        configContext.getAxisConfiguration().addTransportIn(transportIn);
+//        configContext.getAxisConfiguration().addTransportOut(transportOut);
+//        return configContext;
+//    }
+//
 
 }

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/UtilsMailServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/UtilsMailServer.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/UtilsMailServer.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/UtilsMailServer.java Thu Jul 21 08:12:52 2005
@@ -24,38 +24,66 @@
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.engine.AxisFault;
 import org.apache.axis2.transport.mail.server.MailConstants;
 import org.apache.axis2.transport.mail.server.MailServer;
 
 public class UtilsMailServer {
-    private static final String MAIL_TRANSPORT_ENABLED_REPO_PATH =
-        Constants.TESTING_PATH + "mail-transport-enabledRepository";
+    private static final String MAIL_TRANSPORT_SERVER_ENABLED_REPO_PATH =
+        Constants.TESTING_PATH + "mail-transport-server-enabledRepository";
+    private static final String MAIL_TRANSPORT_CLIENT_ENABLED_REPO_PATH =
+            Constants.TESTING_PATH + "mail-transport-client-enabledRepository";
 
     private static MailServer server;
-    private static ConfigurationContext configContext;
+    private static ConfigurationContext SERVER_CONFIG_CONTEXT;
+    private static ConfigurationContext CLIENT_CONFIG_CONTEXT;
+    private static int runningServerCount = 0;
 
-    public static ConfigurationContext start() throws Exception {
+    public synchronized static ConfigurationContext start() throws Exception {
         
         //start the mail server      
-        if (server == null) {
-            configContext = createNewConfigurationContext();
-            MailServer server =
+        if (runningServerCount == 0) {
+            SERVER_CONFIG_CONTEXT = createServerConfigurationContext();
+            server =
                 new MailServer(
-                    configContext,
+            SERVER_CONFIG_CONTEXT,
                     MailConstants.POP_SERVER_PORT,
                     MailConstants.SMTP_SERVER_PORT);
         }
-        return configContext;
+        runningServerCount++;
+        return SERVER_CONFIG_CONTEXT;
     }
-    public static ConfigurationContext createNewConfigurationContext() throws Exception {
-        File file = new File(MAIL_TRANSPORT_ENABLED_REPO_PATH);
-        TestCase.assertTrue(
-            "Mail repository directory " + file.getAbsolutePath() + " does not exsist",
-            file.exists());
-        ConfigurationContextFactory builder = new ConfigurationContextFactory();
-        ConfigurationContext configContext =
-            builder.buildConfigurationContext(file.getAbsolutePath());
-        return configContext;
+    public static ConfigurationContext createServerConfigurationContext() throws Exception {
+        if(SERVER_CONFIG_CONTEXT == null){
+            File file = new File(MAIL_TRANSPORT_SERVER_ENABLED_REPO_PATH);
+            TestCase.assertTrue(
+                "Mail repository directory " + file.getAbsolutePath() + " does not exsist",
+                file.exists());
+            ConfigurationContextFactory builder = new ConfigurationContextFactory();
+            SERVER_CONFIG_CONTEXT =
+                builder.buildConfigurationContext(file.getAbsolutePath());
+        }
+        return SERVER_CONFIG_CONTEXT;
+    }
+    
+    
+    public static ConfigurationContext createClientConfigurationContext() throws Exception {
+        if(CLIENT_CONFIG_CONTEXT == null){
+            File file = new File(MAIL_TRANSPORT_CLIENT_ENABLED_REPO_PATH);
+            TestCase.assertTrue(
+                "Mail repository directory " + file.getAbsolutePath() + " does not exsist",
+                file.exists());
+            ConfigurationContextFactory builder = new ConfigurationContextFactory();
+            CLIENT_CONFIG_CONTEXT =
+                builder.buildConfigurationContext(file.getAbsolutePath());
+        }
+        return CLIENT_CONFIG_CONTEXT;
+    }
+
+    public static synchronized void stop() throws AxisFault{
+        runningServerCount--;
+        if(runningServerCount == 0){
+            server.stop();
+        }
     }
-    public static void stop(){}
 }

Added: webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/mail-enabled-client-axis2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/mail-enabled-client-axis2.xml?rev=220101&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/mail-enabled-client-axis2.xml (added)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/mail-enabled-client-axis2.xml Thu Jul 21 08:12:52 2005
@@ -0,0 +1,86 @@
+<axisconfig name="AxisJava2.0">
+    <!-- ================================================= -->
+    <!-- Parameters -->
+    <!-- ================================================= -->
+    <parameter name="hotdeployment" locked="xsd:false">true</parameter>
+    <parameter name="hotupdate" locked="xsd:false">false</parameter>
+
+
+    <parameter name="userName" locked="xsd:false">admin</parameter>
+    <parameter name="password" locked="xsd:false">axis2</parameter>
+
+
+
+    <!-- ================================================= -->
+    <!-- Message Receivers -->
+    <!-- ================================================= -->
+    <!-- This is the Deafult Message Receiver for the Request Response style Operations -->
+    <messageReceiver mep="INOUT" class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+
+    <!-- ================================================= -->
+    <!-- Transport Ins -->
+    <!-- ================================================= -->
+    <transportReceiver name="http" class="org.apache.axis2.transport.http.SimpleHTTPServer">
+        <parameter name="port" locked="xsd:false">6060</parameter>
+    </transportReceiver>
+
+    <transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">
+        <parameter name="transport.mail.pop3.host" locked="xsd:false">127.0.0.1</parameter>
+        <parameter name="transport.mail.pop3.user" locked="xsd:false">bar@127.0.0.1</parameter>
+        <parameter name="transport.mail.pop3.password" locked="xsd:false">axis2</parameter>
+        <parameter name="transport.mail.pop3.port" locked="xsd:false">1134</parameter>
+        <parameter name="transport.mail.replyToAddress" locked="xsd:false">bar@127.0.0.1</parameter>
+    </transportReceiver>
+
+    <transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer">
+        <parameter name="port" locked="xsd:false">6060</parameter>
+    </transportReceiver>
+
+    <!-- ================================================= -->
+    <!-- Transport Outs -->
+    <!-- ================================================= -->
+
+    <transportSender name="http" class="org.apache.axis2.transport.http.HTTPTransportSender"/>
+    <transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
+    <transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"/>
+
+
+    <transportSender name="mail" class="org.apache.axis2.transport.mail.MailTransportSender">
+        <parameter name="transport.mail.smtp.host" locked="xsd:false">127.0.0.1</parameter>
+        <parameter name="transport.mail.smtp.user" locked="xsd:false">bar</parameter>
+        <parameter name="transport.mail.smtp.password" locked="xsd:false">axis2</parameter>
+        <parameter name="transport.mail.smtp.port" locked="xsd:false">1049</parameter>
+    </transportSender>
+
+    <!-- ================================================= -->
+    <!-- Global Modules  -->
+    <!-- ================================================= -->
+    <!-- Uncomment this to enable Addressing -->
+    <module ref="addressing"/>
+
+    <!-- ================================================= -->
+    <!-- Phases  -->
+    <!-- ================================================= -->
+    <phaseOrder type="inflow">
+        <!--  System pre defined phases       -->
+        <phase name="TransportIn"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch"/>
+        <phase name="PostDispatch"/>
+        <!--  System pre defined phases       -->
+        <!--   After Postdispatch phase module author or or service author can add any phase he want      -->
+        <phase name="userphase1"/>
+    </phaseOrder>
+    <phaseOrder type="outflow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="userphase1"/>
+    </phaseOrder>
+    <phaseOrder type="INfaultflow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="userphase1"/>
+    </phaseOrder>
+    <phaseOrder type="Outfaultflow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="userphase1"/>
+    </phaseOrder>
+</axisconfig>

Added: webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/mail-enabled-server-axis2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/mail-enabled-server-axis2.xml?rev=220101&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/mail-enabled-server-axis2.xml (added)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/mail-enabled-server-axis2.xml Thu Jul 21 08:12:52 2005
@@ -0,0 +1,86 @@
+<axisconfig name="AxisJava2.0">
+    <!-- ================================================= -->
+    <!-- Parameters -->
+    <!-- ================================================= -->
+    <parameter name="hotdeployment" locked="xsd:false">true</parameter>
+    <parameter name="hotupdate" locked="xsd:false">false</parameter>
+
+
+    <parameter name="userName" locked="xsd:false">admin</parameter>
+    <parameter name="password" locked="xsd:false">axis2</parameter>
+
+
+
+    <!-- ================================================= -->
+    <!-- Message Receivers -->
+    <!-- ================================================= -->
+    <!-- This is the Deafult Message Receiver for the Request Response style Operations -->
+    <messageReceiver mep="INOUT" class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+
+    <!-- ================================================= -->
+    <!-- Transport Ins -->
+    <!-- ================================================= -->
+    <transportReceiver name="http" class="org.apache.axis2.transport.http.SimpleHTTPServer">
+        <parameter name="port" locked="xsd:false">6060</parameter>
+    </transportReceiver>
+
+    <transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">
+        <parameter name="transport.mail.pop3.host" locked="xsd:false">127.0.0.1</parameter>
+        <parameter name="transport.mail.pop3.user" locked="xsd:false">foo@127.0.0.1</parameter>
+        <parameter name="transport.mail.pop3.password" locked="xsd:false">axis2</parameter>
+        <parameter name="transport.mail.pop3.port" locked="xsd:false">1134</parameter>
+        <parameter name="transport.mail.replyToAddress" locked="xsd:false">foo@127.0.0.1</parameter>
+    </transportReceiver>
+
+    <transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer">
+        <parameter name="port" locked="xsd:false">6060</parameter>
+    </transportReceiver>
+
+    <!-- ================================================= -->
+    <!-- Transport Outs -->
+    <!-- ================================================= -->
+
+    <transportSender name="http" class="org.apache.axis2.transport.http.HTTPTransportSender"/>
+    <transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
+    <transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"(envelope == null) {
-//                    this.handleGETRequest(
-//                        requestURI,
-//                        (OutputStream) map.get(MessageContext.TRANSPORT_OUT),
-//                        msgContext.getSystemContext());
-//                    return null;
-//                } else {
-//                    msgContext.setProperty(
-//                        Constants.Configuration.DO_REST,
-//                        Constants.VALUE_TRUE);
-//                    return envelope;
-//                }
-//
-//            } else {
-//                return TransportUtils.createSOAPMessage(msgContext,inStream);
-//            }
-//    }
+
 
 
     /**
@@ -211,7 +157,7 @@
             while (!done) {
                 length = readLine(in, buf);
                 if (length <= 0) {
-                    throw new AxisFault("Premature end of steam");
+                    throw new AxisFault(Messages.getMessage("preatureEOS"));
                 }
                 for (int i = 0; i < length; i++) {
                     switch (state) {
@@ -262,109 +208,6 @@
         return map;
     }
 
-    // public HashMap parseTheHeaders(Reader reader, boolean serverSide)
-    // throws AxisFault {
-    // HashMap map = new HashMap();
-    // try {
-    // 
-    // StringBuffer str = new StringBuffer();
-    // 
-    // int state = BEFORE_SEPERATOR;
-    // 
-    // String key = null;
-    // String value = null;
-    // 
-    // int start = 0;
-    // 
-    // length = readLine(reader,buf);
-    // 
-    // 
-    // 
-    // if (serverSide) {
-    // if (buf[0] == 'P'
-    // && buf[1] == 'O'
-    // && buf[2] == 'S'
-    // && buf[3] == 'T') {
-    // index = 5;
-    // value = readFirstLineArg(' ');
-    // map.put(HTTPConstants.REQUEST_URI,value );
-    // value = readFirstLineArg('\n');
-    // map.put(
-    // HTTPConstants.PROTOCOL_VERSION,value);
-    // start = index;
-    // } else {
-    // throw new AxisFault("Only the POST requests are supported");
-    // }
-    // } else {
-    // index = 0;
-    // value = readFirstLineArg(' ');
-    // map.put(HTTPConstants.PROTOCOL_VERSION, value);
-    // value = readFirstLineArg(' ');
-    // map.put(HTTPConstants.RESPONSE_CODE,value);
-    // value = readFirstLineArg('\n');
-    // map.put(HTTPConstants.RESPONSE_WORD, value);
-    // start = index;
-    // }
-    // 
-    // while (state != END) {
-    // if(length <= 0){
-    // throw new AxisFault("Premature end of steam");
-    // }
-    // for (int i = start; i < length; i++) {
-    // System.out.println(state);
-    // switch (state) {
-    // case BEFORE_SEPERATOR :
-    // if (buf[i] == ':') {
-    // key = str.toString();
-    // str = new StringBuffer();
-    // state = AFTER_SEPERATOR;
-    // 
-    // if(buf[i+1] == ' '){
-    // i++;//ignore next space
-    // }
-    // } else {
-    // str.append(buf[i]);
-    // }
-    // break;
-    // case AFTER_SEPERATOR :
-    // if (buf[i] == '\n') {
-    // value = str.toString();
-    // map.put(key, value);
-    // str = new StringBuffer();
-    // state = END_OF_LINE;
-    // } else {
-    // str.append(buf[i]);
-    // }
-    // break;
-    // case END_OF_LINE :
-    // if (buf[i] == '\n') {
-    // state = END;
-    // break;
-    // } else {
-    // state = BEFORE_SEPERATOR;
-    // str.append(buf[i]);
-    // }
-    // break;
-    // case END:
-    // break;
-    // default :
-    // throw new AxisFault(
-    // "Error Occured Unknown state " + state);
-    // 
-    // }
-    // }
-    // start = 0;
-    // if(state != END){
-    // length = reader.read(buf);
-    // }
-    // 
-    // 
-    // }
-    // } catch (IOException e) {
-    // throw new AxisFault(e.getMessage(), e);
-    // }
-    // return map;
-    // }
 
     /**
      * Method readFirstLineArg

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java Thu Jul 21 08:12:52 2005
@@ -22,6 +22,7 @@
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.soap.impl.llom.soap11.SOAP11Constants;
 import org.apache.axis2.soap.impl.llom.soap12.SOAP12Constants;
 import org.apache.axis2.transport.AbstractTransportSender;
@@ -147,7 +148,7 @@
                 throw new AxisFault(e.getMessage(), e);
             }
         } else {
-            throw new AxisFault("to EPR must be specified");
+            throw new AxisFault(Messages.getMessage("notFound", "TO EPR"));
         }
     }
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java Thu Jul 21 08:12:52 2005
@@ -23,6 +23,7 @@
 import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.util.threadpool.AxisWorker;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -49,7 +50,7 @@
         try {
             if (socket != null) {
                 if (configurationContext == null) {
-                    throw new AxisFault("Engine Must be null");
+                    throw new AxisFault(Messages.getMessage("cannotBeNullConfigurationContext"));
                 }
 
                 InputStream inStream = socket.getInputStream();
@@ -64,6 +65,7 @@
                             new QName(Constants.TRANSPORT_HTTP)),
                         transportOut);
                 msgContext.setServerSide(true);
+                
 
                 //parse the Transport Headers
                 HTTPTransportReceiver receiver = new HTTPTransportReceiver();
@@ -80,7 +82,9 @@
                     out = new SimpleHTTPOutputStream(socket.getOutputStream(), false);
                 }
                 msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
-
+                //set the transport Headers
+                msgContext.setProperty(MessageContext.TRANSPORT_HEADERS,map);
+                
                 //This is way to provide Accsess to the transport information to the transport Sender
                 msgContext.setProperty(
                     HTTPConstants.HTTPOutTransportInfo,

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java Thu Jul 21 08:12:52 2005
@@ -24,6 +24,7 @@
 import org.apache.axis2.description.ServiceDescription;
 import org.apache.axis2.engine.AxisConfigurationImpl;
 import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.i18n.Messages;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -200,7 +201,7 @@
                 || password == null
                 || username.trim().equals("")
                 || password.trim().equals("")) {
-            throw new AxisFault("invalid user name");
+            throw new AxisFault(Messages.getMessage("invaliduser"));
         }
         String adminUserName =
                 (String) ((AxisConfigurationImpl) configContext.getAxisConfiguration())
@@ -217,7 +218,7 @@
             req.getSession().setAttribute(Constants.LOGGED, "Yes");
             res.sendRedirect(ADMIN_JSP_NAME);
         } else {
-            throw new AxisFault("invalid user name");
+            throw new AxisFault(Messages.getMessage("invaliduser"));
         }
     }
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java Thu Jul 21 08:12:52 2005
@@ -94,7 +94,7 @@
             this.configurationContext = erfac.buildConfigurationContext(dir);
             Thread.sleep(2000);
         } catch (Exception e1) {
-            throw new AxisFault("Thread interuptted", e1);
+            throw new AxisFault(e1);
         }
     }
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailTransportSender.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailTransportSender.java Thu Jul 21 08:12:52 2005
@@ -20,6 +20,7 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.AbstractTransportSender;
 import org.apache.axis2.util.Utils;
 
@@ -39,36 +40,33 @@
 
     }
 
-    public void finalizeSendWithToAddress(MessageContext msgContext,
-                                          OutputStream out)
-            throws AxisFault {
+    public void finalizeSendWithToAddress(
+        MessageContext msgContext,
+        OutputStream out)
+        throws AxisFault {
         try {
             TransportOutDescription transportOut = msgContext.getTransportOut();
             user =
-                    Utils.getParameterValue(
-                            transportOut.getParameter(MailConstants.SMTP_USER));
+                Utils.getParameterValue(
+                    transportOut.getParameter(MailConstants.SMTP_USER));
             host =
-                    Utils.getParameterValue(
-                            transportOut.getParameter(MailConstants.SMTP_HOST));
+                Utils.getParameterValue(
+                    transportOut.getParameter(MailConstants.SMTP_HOST));
             password =
-                    Utils.getParameterValue(
-                            transportOut.getParameter(
-                                    MailConstants.SMTP_PASSWORD));
+                Utils.getParameterValue(
+                    transportOut.getParameter(MailConstants.SMTP_PASSWORD));
             smtpPort =
-                    Utils.getParameterValue(
-                            transportOut.getParameter(MailConstants.SMTP_PORT));
-            if (user != null && host != null && password != null &&
-                    smtpPort != null) {
-                EMailSender sender = new EMailSender(user,
-                        host,
-                        smtpPort,
-                        password);
+                Utils.getParameterValue(
+                    transportOut.getParameter(MailConstants.SMTP_PORT));
+            if (user != null
+                && host != null
+                && password != null
+                && smtpPort != null) {
+                EMailSender sender =
+                    new EMailSender(user, host, smtpPort, password);
 
                 //TODO this is just a temporary hack, fix this to use input streams
 
-
-
-
                 String eprAddress = msgContext.getTo().getAddress();
                 int index = eprAddress.indexOf('/');
                 String subject = "";
@@ -83,51 +81,59 @@
                 System.out.println(subject);
                 System.out.println(email);
 
-                sender.send(subject,
-                        email,
-                        new String(byteArrayOutputStream.toByteArray()));
+                sender.send(
+                    subject,
+                    email,
+                    new String(byteArrayOutputStream.toByteArray()));
             } else {
-                throw new AxisFault("user, port, host or password not set, "
-                        + "   [user null = "
-                        + (user == null)
-                        + ", password null= "
-                        + (password == null)
-                        + ", host null "
-                        + (host == null)
-                        + ",port null "
-                        + (smtpPort == null));
-
+                if (user == null) {
+                    throw new AxisFault(
+                        Messages.getMessage("canNotBeNull", "User"));
+                } else if (smtpPort == null) {
+                    throw new AxisFault(
+                        Messages.getMessage("canNotBeNull", "smtpPort"));
+                } else if (host == null) {
+                    throw new AxisFault(
+                        Messages.getMessage("canNotBeNull", "Host"));
+                } else if (password == null) {
+                    throw new AxisFault(
+                        Messages.getMessage("canNotBeNull", "password"));
+                }
             }
         } catch (IOException e) {
             throw new AxisFault(e);
         }
 
-
     }
 
-    public OutputStream startSendWithToAddress(MessageContext msgContext,
-                                               OutputStream out) throws AxisFault {
+    public OutputStream startSendWithToAddress(
+        MessageContext msgContext,
+        OutputStream out)
+        throws AxisFault {
         return out;
     }
 
-    protected OutputStream openTheConnection(EndpointReference epr,
-                                             MessageContext msgContext) throws AxisFault {
+    protected OutputStream openTheConnection(
+        EndpointReference epr,
+        MessageContext msgContext)
+        throws AxisFault {
         byteArrayOutputStream = new ByteArrayOutputStream();
         return byteArrayOutputStream;
     }
 
     //Output Stream based cases are not supported 
     public OutputStream startSendWithOutputStreamFromIncomingConnection(
-            MessageContext msgContext,
-            OutputStream out)
-            throws AxisFault {
+        MessageContext msgContext,
+        OutputStream out)
+        throws AxisFault {
         throw new UnsupportedOperationException();
 
     }
 
     public void finalizeSendWithOutputStreamFromIncomingConnection(
-            MessageContext msgContext, OutputStream out)
-            throws AxisFault {
+        MessageContext msgContext,
+        OutputStream out)
+        throws AxisFault {
     }
 
     /* (non-Javadoc)

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java Thu Jul 21 08:12:52 2005
@@ -25,6 +25,7 @@
 import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.om.impl.llom.builder.StAXBuilder;
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
@@ -87,6 +88,8 @@
                 msgContext.setWSAAction(soapAction);
                 msgContext.setSoapAction(soapAction);
 
+                //TODO add the transport Headers to the Message Context                
+
                 //Create Mail EPR, EPR is constructed using the format, foo@bar/axis2/services/echo and is constructed 
                 //using the <to-email-address>/<email-subject>
                 InternetAddress[] recepainets = (InternetAddress[]) mimeMessage.getAllRecipients();
@@ -98,7 +101,7 @@
                             AddressingConstants.WSA_TO,
                             emailAddress + "/" + (emailSubject != null ? emailSubject : ""));
                 } else {
-                    throw new AxisFault("No receptineist found in the Email");
+                    throw new AxisFault(Messages.getMessage("noRecep4Email"));
                 }
                 //try to assume the reply to value
                 InternetAddress[] replyToAs = (InternetAddress[]) mimeMessage.getAllRecipients();
@@ -124,7 +127,7 @@
                     engine.receive(msgContext);
                 }
             } else {
-                throw new AxisFault("Unknown transport " + Constants.TRANSPORT_MAIL);
+                throw new AxisFault(Messages.getMessage("unknownTransport",Constants.TRANSPORT_MAIL));
             }
 
         } catch (Exception e) {

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/SimpleMailListener.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/SimpleMailListener.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/SimpleMailListener.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/SimpleMailListener.java Thu Jul 21 08:12:52 2005
@@ -23,6 +23,7 @@
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.description.TransportInDescription;
 import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.EmailReceiver;
 import org.apache.axis2.transport.TransportListener;
 import org.apache.axis2.util.Utils;
@@ -55,8 +56,8 @@
 
 public class SimpleMailListener extends TransportListener implements Runnable {
 
-    protected static Log log = LogFactory.getLog(
-            SimpleMailListener.class.getName());
+    protected static Log log =
+        LogFactory.getLog(SimpleMailListener.class.getName());
 
     private String host;
 
@@ -73,35 +74,38 @@
     public SimpleMailListener() {
     }
 
-    public SimpleMailListener(String host,
-                              String port,
-                              String userid,
-                              String password,
-                              String dir) {
+    public SimpleMailListener(
+        String host,
+        String port,
+        String userid,
+        String password,
+        String dir) {
         this.host = host;
         this.port = port;
         this.user = userid;
         this.password = password;
         try {
-            ConfigurationContextFactory builder = new ConfigurationContextFactory();
+            ConfigurationContextFactory builder =
+                new ConfigurationContextFactory();
             configurationContext = builder.buildConfigurationContext(dir);
         } catch (Exception e) {
             e.printStackTrace();
         }
         try {
             System.out.println(
-                    "Sleeping for a bit to let the engine start up.");
+                "Sleeping for a bit to let the engine start up.");
             Thread.sleep(2000);
         } catch (InterruptedException e1) {
             log.debug(e1.getMessage(), e1);
         }
     }
 
-    public SimpleMailListener(String host,
-                              String port,
-                              String userid,
-                              String password,
-                              ConfigurationContext er) {
+    public SimpleMailListener(
+        String host,
+        String port,
+        String userid,
+        String password,
+        ConfigurationContext er) {
         this.host = host;
         this.port = port;
         this.user = userid;
@@ -134,7 +138,7 @@
         // Accept and process requests from the socket
    />
+
+
+    <transportSender name="mail" class="org.apache.axis2.transport.mail.MailTransportSender">
+        <parameter name="transport.mail.smtp.host" locked="xsd:false">127.0.0.1</parameter>
+        <parameter name="transport.mail.smtp.user" locked="xsd:false">foo</parameter>
+        <parameter name="transport.mail.smtp.password" locked="xsd:false">axis2</parameter>
+        <parameter name="transport.mail.smtp.port" locked="xsd:false">1049</parameter>
+    </transportSender>
+
+    <!-- ================================================= -->
+    <!-- Global Modules  -->
+    <!-- ================================================= -->
+    <!-- Uncomment this to enable Addressing -->
+    <module ref="addressing"/>
+
+    <!-- ================================================= -->
+    <!-- Phases  -->
+    <!-- ================================================= -->
+    <phaseOrder type="inflow">
+        <!--  System pre defined phases       -->
+        <phase name="TransportIn"/>
+     if (!stopped) {
             String logMessage =
-                    "Mail listner is being setup to listen to the address "
+                "Mail listner is being setup to listen to the address "
                     + user
                     + "@"
                     + host
@@ -146,10 +150,8 @@
         while (!stopped) {
             try {
 
-                EmailReceiver receiver = new EmailReceiver(user,
-                        host,
-                        port,
-                        password);
+                EmailReceiver receiver =
+                    new EmailReceiver(user, host, port, password);
                 receiver.connect();
                 Message[] msgs = receiver.receive();
 
@@ -158,8 +160,8 @@
                     for (int i = 0; i < msgs.length; i++) {
                         MimeMessage msg = (MimeMessage) msgs[i];
                         if (msg != null) {
-                            MailWorker worker = new MailWorker(msg,
-                                    configurationContext);
+                            MailWorker worker =
+                                new MailWorker(msg, configurationContext);
                             worker.doWork();
                         }
                         msg.setFlag(Flags.Flag.DELETED, true);
@@ -175,9 +177,9 @@
                 //log.debug(Messages.getMessage("exception00"), e); TODO Issue
                 // #1 CT 07-Feb-2005.
                 log.debug(
-                        "An error occured when running the mail listner." +
-                        e.getMessage(),
-                        e);
+                    "An error occured when running the mail listner."
+                        + e.getMessage(),
+                    e);
                 e.printStackTrace();
                 break;
             }
@@ -197,7 +199,21 @@
      *
      * @param daemon a boolean indicating if the thread should be a daemon.
      */
-    public void start(boolean daemon) {
+    public void start(boolean daemon) throws AxisFault         <phase name="PreDispatch"/>
+        <phase name="Dispatch"/>
+        <phase name="PostDispatch"/>
+        <!--  System pre defined phases       -->
+        <!--   After Postdispatch phase module author or or service author can add any phase he want      -->
+        <phase name="userphase1"/>
+    </phaseOrder>
+    <phaseOrder type="outflow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="userphase1"/>
+    </phaseOrder>
+    <phaseOrder type="INfaultflow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="userphase1"/>
+    </phaseOrder>
+    <phaseOrder type="Outfaultflow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="userphase1"/>
+    </phaseOrder>
+</axisconfig>



{
+        if (this.user == null) {
+            throw new AxisFault(Messages.getMessage("canNotBeNull", "User"));
+        }
+        if (this.host == null) {
+            throw new AxisFault(Messages.getMessage("canNotBeNull", "Host"));
+        }
+        if (this.port == null) {
+            throw new AxisFault(Messages.getMessage("canNotBeNull", "Port"));
+        }
+        if (this.password == null) {
+            throw new AxisFault(
+                Messages.getMessage("canNotBeNull", "Password"));
+        }
+
         if (doThreads) {
             Thread thread = new Thread(this);
             thread.setDaemon(daemon);
@@ -210,7 +226,7 @@
     /**
      * Start this server as a NON-daemon.
      */
-    public void start() {
+    public void start() throws AxisFault {
         start(false);
     }
 
@@ -237,21 +253,23 @@
         if (args.length != 1) {
             System.out.println("java SimpleMailListener <repository>");
         } else {
-            ConfigurationContextFactory builder = new ConfigurationContextFactory();
-            ConfigurationContext configurationContext = builder.buildConfigurationContext(
-                    args[0]);
+            ConfigurationContextFactory builder =
+                new ConfigurationContextFactory();
+            ConfigurationContext configurationContext =
+                builder.buildConfigurationContext(args[0]);
             SimpleMailListener sas = new SimpleMailListener();
             TransportInDescription transportIn =
-                    configurationContext.getAxisConfiguration().getTransportIn(
-                            new QName(Constants.TRANSPORT_MAIL));
+                configurationContext.getAxisConfiguration().getTransportIn(
+                    new QName(Constants.TRANSPORT_MAIL));
             if (transportIn != null) {
                 sas.init(configurationContext, transportIn);
-                System.out.println("Starting the SimpleMailListener with repository "
+                System.out.println(
+                    "Starting the SimpleMailListener with repository "
                         + new File(args[0]).getAbsolutePath());
                 sas.start();
             } else {
                 System.out.println(
-                        "Startup failed, mail transport not configured, Configure the mail trnasport in the axis2.xml file");
+                    "Startup failed, mail transport not configured, Configure the mail trnasport in the axis2.xml file");
             }
         }
     }
@@ -259,36 +277,44 @@
     /* (non-Javadoc)
      * @see org.apache.axis2.transport.TransportListener#init(org.apache.axis2.context.ConfigurationContext, org.apache.axis2.description.TransportInDescription)
      */
-    public void init(ConfigurationContext configurationContext,
-                     TransportInDescription transportIn)
-            throws AxisFault {
+    public void init(
+        ConfigurationContext configurationContext,
+        TransportInDescription transportIn)
+        throws AxisFault {
         this.configurationContext = configurationContext;
 
         user =
-                Utils.getParameterValue(
-                        transportIn.getParameter(MailConstants.POP3_USER));
+            Utils.getParameterValue(
+                transportIn.getParameter(MailConstants.POP3_USER));
         host =
-                Utils.getParameterValue(
-                        transportIn.getParameter(MailConstants.POP3_HOST));
+            Utils.getParameterValue(
+                transportIn.getParameter(MailConstants.POP3_HOST));
         password =
-                Utils.getParameterValue(
-                        transportIn.getParameter(MailConstants.POP3_PASSWORD));
+            Utils.getParameterValue(
+                transportIn.getParameter(MailConstants.POP3_PASSWORD));
         port =
-                Utils.getParameterValue(
-                        transportIn.getParameter(MailConstants.POP3_PORT));
+            Utils.getParameterValue(
+                transportIn.getParameter(MailConstants.POP3_PORT));
         replyTo =
-                Utils.getParameterValue(
-                        transportIn.getParameter(MailConstants.RAPLY_TO));
+            Utils.getParameterValue(
+                transportIn.getParameter(MailConstants.RAPLY_TO));
         if (user == null || host == null || password == null || port == null) {
-            throw new AxisFault("user, port, host or password not set, "
-                    + "   [user null = "
-                    + (user == null)
-                    + ", password null= "
-                    + (password == null)
-                    + ", host null "
-                    + (host == null)
-                    + ",port null "
-                    + (port == null));
+            if (this.user == null) {
+                throw new AxisFault(
+                    Messages.getMessage("canNotBeNull", "User"));
+            }
+            if (this.host == null) {
+                throw new AxisFault(
+                    Messages.getMessage("canNotBeNull", "Host"));
+            }
+            if (this.port == null) {
+                throw new AxisFault(
+                    Messages.getMessage("canNotBeNull", "Port"));
+            }
+            if (this.password == null) {
+                throw new AxisFault(
+                    Messages.getMessage("canNotBeNull", "Password"));
+            };
         }
 
     }
@@ -298,8 +324,9 @@
      */
     public EndpointReference replyToEPR(String serviceName) throws AxisFault {
         // TODO Auto-generated method stub
-        return new EndpointReference(AddressingConstants.WSA_REPLY_TO,
-                replyTo + "/services/" + serviceName);
+        return new EndpointReference(
+            AddressingConstants.WSA_REPLY_TO,
+            replyTo + "/services/" + serviceName);
     }
 
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/MailServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/MailServer.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/MailServer.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/MailServer.java Thu Jul 21 08:12:52 2005
@@ -12,6 +12,8 @@
  */
 public class MailServer {
     Storage st = null;
+    private SMTPServer smtpServer;
+    private POP3Server pop3Server; 
 
     public ConfigurationContext configurationContext = null;
 
@@ -34,10 +36,10 @@
         }
         st = new Storage();
         // Start up the two servers and lets have some fun. - CT
-        SMTPServer smtpServer = new SMTPServer(st, configurationContext,
+        smtpServer = new SMTPServer(st, configurationContext,
                 smtpPort);
         smtpServer.start();
-        POP3Server pop3Server = new POP3Server(st, popPort);
+        pop3Server = new POP3Server(st, popPort);
         pop3Server.start();
 
     }
@@ -55,20 +57,25 @@
 
         st = new Storage();
         // Start up the two servers and lets have some fun. - CT
-        SMTPServer smtpServer = new SMTPServer(st, configurationContext,
+        smtpServer = new SMTPServer(st, configurationContext,
                 smtpPort);
         smtpServer.start();
-        POP3Server pop3Server = new POP3Server(st, popPort);
+        pop3Server = new POP3Server(st, popPort);
         pop3Server.start();
     }
 
     public MailServer(int popPort, int smtpPort) throws AxisFault {
         st = new Storage();
         // Start up the two servers and lets have some fun. - CT
-        SMTPServer smtpServer = new SMTPServer(st, smtpPort);
+        smtpServer = new SMTPServer(st, smtpPort);
         smtpServer.start();
-        POP3Server pop3Server = new POP3Server(st, popPort);
+        pop3Server = new POP3Server(st, popPort);
         pop3Server.start();
+    }
+    
+    public void stop() throws AxisFault{
+        smtpServer.stopServer();
+        pop3Server.stopServer();
     }
 
     public static void main(String args[]){

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/POP3Server.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/POP3Server.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/POP3Server.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/POP3Server.java Thu Jul 21 08:12:52 2005
@@ -16,13 +16,16 @@
     protected static Log log = LogFactory.getLog(POP3Server.class.getName());
     private ServerSocket serverSocket;
     private Storage st = null;
-
+    private boolean running = false;
 
     public POP3Server(Storage st, int port) throws AxisFault {
         this.st = st;
         try {
-            serverSocket = new ServerSocket(port);
-            System.out.println("Server started on port " + port);
+            synchronized (this) {
+                running = true;
+                serverSocket = new ServerSocket(port);
+                System.out.println("Server started on port " + port);
+            }
         } catch (IOException e) {
             throw new AxisFault(e);
         }
@@ -37,6 +40,18 @@
             } catch (Exception e) {
                 log.error(e);
             }
+        }
+    }
+
+    public void stopServer() throws AxisFault {
+        try {
+            synchronized (this) {
+                running = false;
+                serverSocket.close();
+            }
+
+        } catch (IOException e) {
+            throw new AxisFault(e);
         }
     }
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/SMTPServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/SMTPServer.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/SMTPServer.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/SMTPServer.java Thu Jul 21 08:12:52 2005
@@ -1,6 +1,7 @@
 package org.apache.axis2.transport.mail.server;
 
 import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.engine.AxisFault;
 
 import java.io.IOException;
 import java.net.ServerSocket;
@@ -19,9 +20,13 @@
     private int port;
 
     private boolean actAsMailet = false;
+    private ServerSocket ss;
+    private boolean running = false;
 
-    public SMTPServer(Storage st, ConfigurationContext configurationContext,
-            int port) {
+    public SMTPServer(
+        Storage st,
+        ConfigurationContext configurationContext,
+        int port) {
         this.st = st;
         this.configurationContext = configurationContext;
         this.port = port;
@@ -39,15 +44,18 @@
     }
 
     public void runServer() {
-        ServerSocket ss = null;
+
         try {
-            ss = new ServerSocket(port);
-            System.out.println("SMTP Server started on port " + port);
+            synchronized (this) {
+                running = true;
+                ss = new ServerSocket(port);
+                System.out.println("SMTP Server started on port " + port);
+            }
         } catch (IOException ex) {
             ex.printStackTrace();
         }
 
-        while (true) {
+        while (running) {
             try {
                 //wait for a client
                 Socket socket = ss.accept();
@@ -60,9 +68,21 @@
                 thread.start();
 
             } catch (IOException ex) {
-                ex.printStackTrace();
+                if (running) {
+                    ex.printStackTrace();
+                }
             }
         }
     }
 
+    public void stopServer() throws AxisFault {
+        try {
+            synchronized (this) {
+                running = false;
+                ss.close();
+            }
+        } catch (IOException e) {
+            throw new AxisFault(e);
+        }
+    }
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPTransportSender.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPTransportSender.java Thu Jul 21 08:12:52 2005
@@ -18,6 +18,7 @@
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.AbstractTransportSender;
 import org.apache.axis2.util.URL;
 
@@ -93,7 +94,7 @@
                 throw new AxisFault(e.getMessage(), e);
             }
         } else {
-            throw new AxisFault("to EPR must be specified");
+            throw new AxisFault(Messages.getMessage("canNotBeNull","Can not Be Null"));
         }
     }
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPWorker.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPWorker.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPWorker.java Thu Jul 21 08:12:52 2005
@@ -35,6 +35,7 @@
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.om.impl.llom.builder.StAXBuilder;
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
@@ -83,7 +84,7 @@
                     engine.receive(msgContext);
                 }
             } else {
-                throw new AxisFault("Unknown transport " + Constants.TRANSPORT_TCP);
+                throw new AxisFault(Messages.getMessage("unknownTransport",Constants.TRANSPORT_TCP));
             }
 
         } catch (Throwable e) {

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/util/threadpool/ThreadPool.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/util/threadpool/ThreadPool.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/util/threadpool/ThreadPool.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/util/threadpool/ThreadPool.java Thu Jul 21 08:12:52 2005
@@ -1,6 +1,7 @@
 package org.apache.axis2.util.threadpool;
 
 import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.i18n.Messages;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -40,7 +41,7 @@
 
     public void addWorker(AxisWorker worker) throws AxisFault {
         if (shoutDown)
-            throw new AxisFault("Thread Pool is Shutting Down");
+            throw new AxisFault(Messages.getMessage("threadpoolshutdown"));
         tasks.add(worker);
     }
 
@@ -68,7 +69,7 @@
             try {
                 Thread.sleep(SLEEP_INTERVAL);
             } catch (InterruptedException e) {
-                throw new AxisFault("Error while safeShutDown", e);
+                throw new AxisFault(Messages.getMessage("errorWhileSafeShutDown"));
             }
         }
         forceShutDown();

Modified: webservices/axis/trunk/java/modules/samples/maven.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/maven.xml?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/maven.xml (original)
+++ webservices/axis/trunk/java/modules/samples/maven.xml Thu Jul 21 08:12:52 2005
@@ -22,13 +22,22 @@
         <copy file="test/org/apache/axis2/engine/chuncking-enabled-axis2.xml"
             tofile="target/test-resources/chuncked-enabledRepository/axis2.xml"/>
 
-        <!-- Create Mail transport enabled Repository -->
-        <mkdir dir="target/test-resources/mail-transport-enabledRepository"/>
-        <mkdir dir="target/test-resources/mail-transport-enabledRepository/modules"/>
-        <copy file="test/org/apache/axis2/mail/mail-enabled-axis2.xml"
-            tofile="target/test-resources/mail-transport-enabledRepository/axis2.xml"/>
+        <!-- Create Mail Client transport enabled Repository -->
+        <mkdir dir="target/test-resources/mail-transport-client-enabledRepository"/>
+        <mkdir dir="target/test-resources/mail-transport-client-enabledRepository/modules"/>
+        <copy file="test/org/apache/axis2/mail/mail-enabled-client-axis2.xml"
+            tofile="target/test-resources/mail-transport-client-enabledRepository/axis2.xml"/>
         <copy file="../addressing/target/addressing.mar"
-            tofile="target/test-resources/mail-transport-enabledRepository/modules/addressing.mar"/>
+            tofile="target/test-resources/mail-transport-client-enabledRepository/modules/addressing.mar"/>
+
+        <!-- Create Mail Server transport enabled Repository -->
+        <mkdir dir="target/test-resources/mail-transport-server-enabledRepository"/>
+        <mkdir dir="target/test-resources/mail-transport-server-enabledRepository/modules"/>
+        <copy file="test/org/apache/axis2/mail/mail-enabled-server-axis2.xml"
+            tofile="target/test-resources/mail-transport-server-enabledRepository/axis2.xml"/>
+        <copy file="../addressing/target/addressing.mar"
+            tofile="target/test-resources/mail-transport-server-enabledRepository/modules/addressing.mar"/>
+
 
         <!-- Commons transport enabled enabled Repository -->
         <mkdir dir="target/test-resources/commons-http-enabledRepository"/>
@@ -44,8 +53,18 @@
 
     <postGoal name="test:test">
         <attainGoal name="create-samples"/>
+        <attainGoal name="mail-tests"/>
         <!-- <attainGoal name="doInterop-test"/>   -->
     </postGoal>
+    
+    <goal name="mail-tests">
+      <!--   	 TODO call the Mail tests if the mail jar is presents
+        <j:if test="${maven.repo.local}/j2ee/jars/mail.jar"> 
+            <ant:ant antfile="script/mail-test.xml" inheritall="true" inheritrefs="true" dir="."/>
+         </j:if> 
+         maven -Dtestcase=org.foo.bar.MyTest test:single-test
+         -->
+    </goal>
 
     <goal name="create-samples">
 <!--        <mkdir dir="target/samples"/>-->
@@ -269,29 +288,9 @@
         </jar>
     </goal>
 
-    <goal name="test-mtom">
-        <echo message="running MTOM tests"/>
-        <echo message="${maven.repo.local}"/>
-        <junit printsummary="yes" haltonfailure="yes">
-            <classpath>
-                <fileset dir="${maven.repo.local}">
-                    <include name="j2ee/jars/***.jar"/>
-                    <include name="axis/jars/axis2-core-0.9.jar"/>
-                    <include name="axis/jars/axis2-xml-0.9.jar"/>
-                    <include name="axis/jars/axis2-wsdl-0.9.jar"/>
-                    <include name="axis/jars/axis-wsdl4j-1.2.jar"/>
-                    <include name="commons-logging/jars/commons-logging-1.0.3.jar"/>
-                    <include name="stax/jars/stax-1.1.1-dev.jar"/>
-                    <include name="stax/jars/stax-api-1.0.jar"/>
-                </fileset>
-                <pathelement location="target/test-classes"/>
-                <path refid="maven.dependency.classpath"/>
-            </classpath>
-            <formatter type="plain"/>
-            <test name="org.apache.axis2.engine.EchoRawMTOMToBase64Test"/>
-            <test name="org.apache.axis2.engine.EchoRawMTOMTest"/>
-        </junit>
-    </goal>
+    <!-- ================================================================ -->
+    <!--- Google Mail Sample -->
+    <!-- ================================================================ -->
 
     <goal name="test-mail">
         <echo message="running Mail tests"/>
@@ -318,6 +317,9 @@
         </junit>
     </goal>
 
+    <!-- ================================================================ -->
+    <!--- Run the Interop Tests -->
+    <!-- ================================================================ -->
 
     <goal name="doInterop-test">
         <taskdef name="wsdl2java"

Copied: webservices/axis/trunk/java/modules/samples/script/mail-test.xml (from r219926, webservices/axis/trunk/java/modules/samples/script/mtom-test.xml)
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/script/mail-test.xml?p2=webservices/axis/trunk/java/modules/samples/script/mail-test.xml&p1=webservices/axis/trunk/java/modules/samples/script/mtom-test.xml&r1=219926&r2=220101&rev=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/script/mtom-test.xml (original)
+++ webservices/axis/trunk/java/modules/samples/script/mail-test.xml Thu Jul 21 08:12:52 2005
@@ -9,7 +9,7 @@
                    
                                                                      
      ====================================================================== -->
-<project name="samples" basedir=".." default="mtom-test">
+<project name="samples" basedir=".." default="mail-test">
     <property name="maven.repo.local" value="${user.home}/.maven/repository/"/>
     <property name="class.dir" value="${basedir}/target/test-classes"/>
     <property name="report.dir" value="${basedir}/target/test-reports"/>
@@ -17,8 +17,8 @@
 
     <path id="test.classpath">
         <fileset dir="${maven.repo.local}">
-            <include name="j2ee/jars/activation.jar"/>
-            <include name="j2ee/jars/mailapi.jar"/>
+            <include name="geronimo-spec/jars/geronimo-spec-activation-1.0.2-SNAPSHOT.jar"/>
+            <include name="j2ee/jars/mail.jar"/>
             <include name="axis/jars/axis2-core-0.9.jar"/>
             <include name="axis/jars/axis2-xml-0.9.jar"/>
             <include name="axis/jars/axis2-wsdl-0.9.jar"/>
@@ -30,9 +30,10 @@
             <include name="junit/jars/*.jar"/>
         </fileset>
     </path>
+    
 
-    <target name="mtom-test" description="Delete all generated files">
-        <echo message="running MTOM tests"/>
+    <target name="mail-test" description="Delete all generated files">
+        <echo message="running Mail tests"/>
         <mkdir dir="${report.dir}"/>
         <mkdir dir="${class.dir}"/>
 
@@ -46,14 +47,29 @@
         </copy>
         <junit printsummary="yes" haltonfailure="yes">
             <formatter type="plain"/>
-            <test name="org.apache.axis2.mtom.EchoRawMTOMTest" todir="${report.dir}"/>
-            <test name="org.apache.axis2.mtom.EchoRawMTOMLoadTest" todir="${report.dir}"/>
-            <test name="org.apache.axis2.mtom.EchoRawMTOMToBase64Test" todir="${report.dir}"/>
+            <test name="org.apache.axis2.mail.MailetRequestResponceRawXMLTest" todir="${report.dir}"/>
             <classpath>
                 <pathelement location="${class.dir}"/>
                 <path refid="test.classpath"/>
             </classpath>
         </junit>
+        <junit printsummary="yes" haltonfailure="yes">
+            <formatter type="plain"/>
+            <test name="org.apache.axis2.mail.MailOneWayRawXMLTest" todir="${report.dir}"/>
+            <classpath>
+                <pathelement location="${class.dir}"/>
+                <path refid="test.classpath"/>
+            </classpath>
+        </junit>
+        <junit printsummary="yes" haltonfailure="yes">
+            <formatter type="plain"/>
+            <test name="org.apache.axis2.mail.MailRequestResponseRawXMLTest" todir="${report.dir}"/>
+            <classpath>
+                <pathelement location="${class.dir}"/>
+                <path refid="test.classpath"/>
+            </classpath>
+        </junit>
+
     </target>
 </project>
 

Modified: webservices/axis/trunk/java/modules/samples/src/sample/groovy/GroovyReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/sample/groovy/GroovyReceiver.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/sample/groovy/GroovyReceiver.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/sample/groovy/GroovyReceiver.java Thu Jul 21 08:12:52 2005
@@ -3,6 +3,7 @@
 import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.ServiceDescription;
 import org.apache.axis2.description.Parameter;
@@ -59,14 +60,14 @@
                 inMessage.getOperationContext().getServiceContext().getServiceConfig();
         Parameter implInfoParam = service.getParameter("ServiceClass");
         if (implInfoParam==null){
-            throw new AxisFault("Service class not specified!");
+            throw new AxisFault(Messages.getMessage("paramIsNotSpecified","ServiceClass"));
         }
         InputStream groovyFileStream = this.getClass().getResourceAsStream(implInfoParam.getValue().toString());
 
         //look at the method name. if available this should be a groovy method
         OperationDescription op = inMessage.getOperationContext().getAxisOperation();
         if (op == null) {
-            throw new AxisFault("Operation is not located");
+            throw new AxisFault(Messages.getMessage("notFound","Operation"));
         }
         String methodName = op.getName().getLocalPart();
         OMElement firstChild = (OMElement)inMessage.getEnvelope().getBody().getFirstChild();
@@ -86,7 +87,7 @@
                     Object[] arg = {in};
                     Object obj =groovyObject.invokeMethod(methodName, arg );
                     if (obj==null){
-                        throw new AxisFault("No answer recieved from groovy side!!!!");
+                        throw new AxisFault(Messages.getMessage("groovryNoanswer"));
                     }
 
                     SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
@@ -101,11 +102,11 @@
                     envelope.getBody().addChild(responseElement);
                     outMessage.setEnvelope(envelope);
                 } catch (CompilationFailedException e) {
-                    throw new AxisFault("Groovy compilation error!",e);
+                    throw new AxisFault(e);
                 } catch (InstantiationException e) {
-                    throw new AxisFault("Groovy instantiation problem!",e);
+                    throw new AxisFault(e);
                 } catch (IllegalAccessException e) {
-                    throw new AxisFault("Groovy illegal access!",e);
+                    throw new AxisFault(e);
                 }
             }
         } catch (XMLStreamException e) {

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/util/MyInOutMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/util/MyInOutMEPClient.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/util/MyInOutMEPClient.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/util/MyInOutMEPClient.java Thu Jul 21 08:12:52 2005
@@ -54,7 +54,7 @@
 //            axisConfig = new OperationDescription(new QName(axisop));
 //            serviceContext.getServiceConfig().addOperation(axisConfig);
 //        }
-        MessageContext msgctx = prepareTheSystem(toSend);
+        MessageContext msgctx = prepareTheSOAPEnvelope(toSend);
 
         MessageContext responseContext = super.invokeBlocking(axisConfig,
                 msgctx);

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailOneWayRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailOneWayRawXMLTest.java?rev=220101&r1=220100&r2=220101&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailOneWayRawXMLTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailOneWayRawXMLTest.java Thu Jul 21 08:12:52 2005
@@ -18,13 +18,15 @@
 
 //todo
 
+import javax.xml.namespace.QName;
+
 import junit.framework.TestCase;
+
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.clientapi.MessageSender;
 import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.description.OperationDescription;
@@ -38,23 +40,14 @@
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.SOAPFactory;
 import org.apache.axis2.transport.mail.SimpleMailListener;
-import org.apache.axis2.transport.mail.server.MailConstants;
-import org.apache.axis2.transport.mail.server.MailServer;
 import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.xml.namespace.QName;
-import java.io.File;
-
 public class MailOneWayRawXMLTest extends TestCase {
-    private static final String MAIL_TRANSPORT_ENABLED_REPO_PATH = Constants.TESTING_PATH +
-            "mail-transport-enabledRepository";
-
-
     private EndpointReference targetEPR =
             new EndpointReference(AddressingConstants.WSA_TO,
-                    "axis2@127.0.0.1" +
+                    "foo@127.0.0.1" +
             "/axis/services/EchoXMLService/echoOMElement");
     private Log log = LogFactory.getLog(getClass());
     private QName serviceName = new QName("EchoXMLService");
@@ -76,11 +69,8 @@
     }
 
     protected void setUp() throws Exception {
-        configContext = createNewConfigurationContext();  
         //start the mail server      
-        MailServer server = new MailServer(configContext,
-                MailConstants.POP_SERVER_PORT,
-                MailConstants.SMTP_SERVER_PORT);
+        configContext = UtilsMailServer.start();
 
         SimpleMailListener ml = new SimpleMailListener();
         ml.init(configContext,
@@ -104,6 +94,7 @@
     }
 
     protected void tearDown() throws Exception {
+        UtilsMailServer.stop();
     }
 
     private OMElement createEnvelope() {
@@ -154,16 +145,16 @@
         }
     }
 
-    public ConfigurationContext createNewConfigurationContext() throws Exception {
-        File file = new File(MAIL_TRANSPORT_ENABLED_REPO_PATH);
-        assertTrue(
-                "Mail repository directory " + file.getAbsolutePath() +
-                " does not exsist",
-                file.exists());
-        ConfigurationContextFactory builder = new ConfigurationContextFactory();
-        ConfigurationContext configContext =
-                builder.buildConfigurationContext(file.getAbsolutePath());
-        return configContext;
-    }
-
+//    public ConfigurationContext createNewConfigurationContext() throws Exception {
+//        File file = new File(MAIL_TRANSPORT_ENABLED_REPO_PATH);
+//        assertTrue(
+//                "Mail repository directory " + file.getAbsolutePath() +
+//                " does not exsist",
+//                file.exists());
+//        ConfigurationContextFactory builder = new ConfigurationContextFactory();
+//        ConfigurationContext configContext =
+//                builder.buildConfigurationContext(file.getAbsolutePath());
+//        return configContext;
+//    }
+//
 }



Mime
View raw message