You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by he...@apache.org on 2005/05/26 09:38:07 UTC
svn commit: r178617 - in /webservices/axis/trunk/java/modules:
core/src/org/apache/axis/deployment/
core/src/org/apache/axis/transport/mail/ core/src/org/apache/axis/util/
samples/ samples/test/org/apache/axis/engine/
samples/test/org/apache/axis/integration/
Author: hemapani
Date: Thu May 26 00:38:05 2005
New Revision: 178617
URL: http://svn.apache.org/viewcvs?rev=178617&view=rev
Log:
working on the mail tranport, colabrated work with chamil, check in, on his behalf
Added:
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/MailEchoRawXMLTest.java
Modified:
webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/client.xml
webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/server.xml
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/MailConstants.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/MailTransportSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/SimpleMailListener.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/util/Utils.java
webservices/axis/trunk/java/modules/samples/project.xml
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/integration/UtilServer.java
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java?rev=178617&r1=178616&r2=178617&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java Thu May 26 00:38:05 2005
@@ -32,7 +32,6 @@
import java.io.InputStream;
import java.util.ArrayList;
-
/**
* This class is used to parse the following xml douments
* 1 server.xml
@@ -61,7 +60,8 @@
* @param inputStream
* @param engine
*/
- public DeploymentParser(InputStream inputStream, DeploymentEngine engine) throws XMLStreamException {
+ public DeploymentParser(InputStream inputStream, DeploymentEngine engine)
+ throws XMLStreamException {
this.dpengine = engine;
pullparser = XMLInputFactory.newInstance().createXMLStreamReader(inputStream);
}
@@ -91,7 +91,8 @@
/**
* To process server.xml
*/
- public void processGlobalConfig(AxisConfigurationImpl axisGlobal, String starttag) throws DeploymentException {
+ public void processGlobalConfig(AxisConfigurationImpl axisGlobal, String starttag)
+ throws DeploymentException {
String START_TAG = starttag;
try {
boolean END_DOCUMENT = false;
@@ -128,22 +129,33 @@
if (CLASSNAME.equals(attname)) {
try {
Class messageReceiver = null;
- ClassLoader loader1 = Thread.currentThread().getContextClassLoader();
+ ClassLoader loader1 =
+ Thread.currentThread().getContextClassLoader();
if (attvalue != null && !"".equals(attvalue)) {
- messageReceiver = Class.forName(attvalue, true, loader1);
- axisGlobal.addMessageReceiver(name, (MessageReceiver) messageReceiver.newInstance());
+ messageReceiver =
+ Class.forName(attvalue, true, loader1);
+ axisGlobal.addMessageReceiver(
+ name,
+ (MessageReceiver) messageReceiver.newInstance());
}
} catch (ClassNotFoundException e) {
- throw new DeploymentException("Error in loading messageRecivers " + e.getMessage());
+ throw new DeploymentException(
+ "Error in loading messageRecivers " + e.getMessage());
} catch (IllegalAccessException e) {
- throw new DeploymentException("Error in loading messageRecivers " + e.getMessage());
+ throw new DeploymentException(
+ "Error in loading messageRecivers " + e.getMessage());
} catch (InstantiationException e) {
- throw new DeploymentException("Error in loading messageRecivers " + e.getMessage());
+ throw new DeploymentException(
+ "Error in loading messageRecivers " + e.getMessage());
}
} else
- throw new UnsupportedOperationException("invalid attributes in server.xml (messageReceiver elemet) " + attname);
+ throw new UnsupportedOperationException(
+ "invalid attributes in server.xml (messageReceiver elemet) "
+ + attname);
} else
- throw new UnsupportedOperationException("invalid attributes in server.xml (messageReceiver elemet) " + attname);
+ throw new UnsupportedOperationException(
+ "invalid attributes in server.xml (messageReceiver elemet) "
+ + attname);
} else
throw new UnsupportedOperationException("invalid attributes in server.xml (messageReceiver elemet)");
@@ -175,15 +187,18 @@
} else if (OUT_FAILTFLOW.equals(attvalue)) {
tempdata.setOUT_FaultPhases(processPhaseOrder());
} else {
- throw new DeploymentException("un defined flow type " + ST);
+ throw new DeploymentException(
+ "un defined flow type " + ST);
}
}
}
} else {
- throw new DeploymentException("Flow type is a required attribute in " + ST);
+ throw new DeploymentException(
+ "Flow type is a required attribute in " + ST);
}
} else {
- throw new UnsupportedOperationException(ST + " element is not allowed in the server.xml");
+ throw new UnsupportedOperationException(
+ ST + " element is not allowed in the server.xml");
}
} else if (eventType == XMLStreamConstants.END_ELEMENT) {
String endtagname = pullparser.getLocalName();
@@ -214,15 +229,19 @@
} else if (transportin != null && CLASSNAME.equals(attname)) {
Class reciever = null;
try {
- reciever = Class.forName(attvalue, true, Thread.currentThread().getContextClassLoader());
+ reciever =
+ Class.forName(
+ attvalue,
+ true,
+ Thread.currentThread().getContextClassLoader());
TransportListener trnsrecievr = (TransportListener) reciever.newInstance();
transportin.setReciver(trnsrecievr);
} catch (ClassNotFoundException e) {
- throw new DeploymentException(e.getMessage());
+ throw new DeploymentException(e);
} catch (IllegalAccessException e) {
- throw new DeploymentException(e.getMessage());
+ throw new DeploymentException(e);
} catch (InstantiationException e) {
- throw new DeploymentException(e.getMessage());
+ throw new DeploymentException(e);
}
}
}
@@ -241,7 +260,8 @@
Flow inFlow = processInFlow();
transportin.setInFlow(inFlow);
} else if (transportin != null && OUTFLOWST.equals(tagnae)) {
- throw new DeploymentException("OUTFlow dose not support in AxisTransportIN " + tagnae);
+ throw new DeploymentException(
+ "OUTFlow dose not support in AxisTransportIN " + tagnae);
} else if (transportin != null && IN_FAILTFLOW.equals(tagnae)) {
Flow faultFlow = processInFaultFlow();
transportin.setFaultFlow(faultFlow);
@@ -277,15 +297,19 @@
} else if (transportout != null && CLASSNAME.equals(attname)) {
Class sender = null;
try {
- sender = Class.forName(attvalue, true, Thread.currentThread().getContextClassLoader());
+ sender =
+ Class.forName(
+ attvalue,
+ true,
+ Thread.currentThread().getContextClassLoader());
TransportSender transportSender = (TransportSender) sender.newInstance();
transportout.setSender(transportSender);
} catch (ClassNotFoundException e) {
- throw new DeploymentException(e.getMessage());
+ throw new DeploymentException(e);
} catch (IllegalAccessException e) {
- throw new DeploymentException(e.getMessage());
+ throw new DeploymentException(e);
} catch (InstantiationException e) {
- throw new DeploymentException(e.getMessage());
+ throw new DeploymentException(e);
}
}
}
@@ -301,7 +325,8 @@
Parameter parameter = processParameter();
transportout.addParameter(parameter);
} else if (transportout != null && INFLOWST.equals(tagnae)) {
- throw new DeploymentException("InFlow dose not support in TransportOutDescription " + tagnae);
+ throw new DeploymentException(
+ "InFlow dose not support in TransportOutDescription " + tagnae);
} else if (transportout != null && OUTFLOWST.equals(tagnae)) {
Flow outFlow = processOutFlow();
transportout.setOutFlow(outFlow);
@@ -338,17 +363,24 @@
String attvalue = pullparser.getAttributeValue(i);
if (ATQNAME.equals(attname)) {
if (attvalue == null || attvalue.trim().equals("")) {
- axisService.setName(new QName(getAxisServiceName(dpengine.getCurrentFileItem().getServiceName())));
+ axisService.setName(
+ new QName(
+ getAxisServiceName(
+ dpengine.getCurrentFileItem().getServiceName())));
} else {
axisService.setName(new QName(attvalue));
}
} else {
- throw new DeploymentException(attname + " Bad arguments for the service" + getAxisServiceName(dpengine.getCurrentFileItem().getServiceName()));
+ throw new DeploymentException(
+ attname
+ + " Bad arguments for the service"
+ + getAxisServiceName(dpengine.getCurrentFileItem().getServiceName()));
}
}
} else {
//if user dose not specify the service name then the default name will be the archive name
- axisService.setName(new QName(getAxisServiceName(dpengine.getCurrentFileItem().getServiceName())));
+ axisService.setName(
+ new QName(getAxisServiceName(dpengine.getCurrentFileItem().getServiceName())));
}
boolean END_DOCUMENT = false;
try {
@@ -381,15 +413,24 @@
/**
* Setting default Message Recive as Message Reciever
*/
- ClassLoader loader1 = Thread.currentThread().getContextClassLoader();
- Class messageReceiver = Class.forName("org.apache.axis.receivers.RawXMLINOutMessageRecevier", true, loader1);
- operation.setMessageReciever((MessageReceiver) messageReceiver.newInstance());
+ ClassLoader loader1 =
+ Thread.currentThread().getContextClassLoader();
+ Class messageReceiver =
+ Class.forName(
+ "org.apache.axis.receivers.RawXMLINOutMessageRecevier",
+ true,
+ loader1);
+ operation.setMessageReciever(
+ (MessageReceiver) messageReceiver.newInstance());
} catch (ClassNotFoundException e) {
- throw new DeploymentException("Error in loading messageRecivers " + e.getMessage());
+ throw new DeploymentException(
+ "Error in loading messageRecivers " + e.getMessage());
} catch (IllegalAccessException e) {
- throw new DeploymentException("Error in loading messageRecivers " + e.getMessage());
+ throw new DeploymentException(
+ "Error in loading messageRecivers " + e.getMessage());
} catch (InstantiationException e) {
- throw new DeploymentException("Error in loading messageRecivers " + e.getMessage());
+ throw new DeploymentException(
+ "Error in loading messageRecivers " + e.getMessage());
}
}
axisService.addOperation(operation);
@@ -413,16 +454,20 @@
String attvalue = pullparser.getAttributeValue(i);
if (REF.equals(attname)) {
if (dpengine.getModule(new QName(attvalue)) == null) {
- throw new DeploymentException(ST + " module is invalid or dose not have bean deployed");
+ throw new DeploymentException(
+ ST
+ + " module is invalid or dose not have bean deployed");
} else {
- dpengine.getCurrentFileItem().addModule(new QName(attvalue));
+ dpengine.getCurrentFileItem().addModule(
+ new QName(attvalue));
}
}
}
}
} else {
- throw new DeploymentException("parser Exception : un supported element" + ST);
+ throw new DeploymentException(
+ "parser Exception : un supported element" + ST);
}
}
}
@@ -463,7 +508,7 @@
private Parameter processParameter() throws DeploymentException {
Parameter parameter = new ParameterImpl();
int attribCount = pullparser.getAttributeCount();
- if (attribCount == 2) { // there should be two attributes
+ if (attribCount == 2) { // there should be two attributes
for (int i = 0; i < attribCount; i++) {
String attname = pullparser.getAttributeLocalName(i);
String attvalue = pullparser.getAttributeValue(i);
@@ -533,14 +578,16 @@
handler.setClassName(attvalue);
} else if (ATTNAME.equals(attname)) {
if (ref_name) {
- throw new DeploymentException("Hanlder canot have both name and ref " + attvalue);
+ throw new DeploymentException(
+ "Hanlder canot have both name and ref " + attvalue);
} else {
handler.setName(new QName(attvalue));
ref_name = true;
}
} else if (REF.equals(attname)) {
if (ref_name) {
- throw new DeploymentException("Hanlder canot have both name and ref " + attvalue);
+ throw new DeploymentException(
+ "Hanlder canot have both name and ref " + attvalue);
} else {
ref_name = true;
throw new UnsupportedOperationException("This should be implmented");
@@ -591,7 +638,8 @@
Parameter parameter = processParameter();
handler.addParameter(parameter);
} else {
- throw new DeploymentException("parser Exception : un supported element" + tagnae);
+ throw new DeploymentException(
+ "parser Exception : un supported element" + tagnae);
}
} else if (eventType == XMLStreamConstants.END_ELEMENT) {
String endtagname = pullparser.getLocalName();
@@ -610,7 +658,6 @@
return handler;
}
-
/**
* This method used to process the <typeMapping>..</typeMapping> tag
* in the service.xml
@@ -624,8 +671,8 @@
while (!END_TYPEMAPPING) {
int eventType = pullparser.next();
if (eventType == XMLStreamConstants.END_DOCUMENT) {
-// document end tag met , break the loop
-// but the doc end tag wont meet here :)
+ // document end tag met , break the loop
+ // but the doc end tag wont meet here :)
END_TYPEMAPPING = true;
} else if (eventType == XMLStreamConstants.END_ELEMENT) {
String endtagname = pullparser.getLocalName();
@@ -642,12 +689,11 @@
}
}
-
private OperationDescription processOperation() throws DeploymentException {
// String name = pullparser.getLocalName();
OperationDescription operation = new OperationDescription();
int attribCount = pullparser.getAttributeCount();
- if (attribCount > 0) { // there should be two attributes
+ if (attribCount > 0) { // there should be two attributes
for (int i = 0; i < attribCount; i++) {
String attname = pullparser.getAttributeLocalName(i);
String attvalue = pullparser.getAttributeValue(i);
@@ -673,7 +719,9 @@
String attvalue = pullparser.getAttributeValue(i);
if (REF.equals(attname)) {
if (dpengine.getModule(new QName(attvalue)) == null) {
- throw new DeploymentException(ST + " module is invalid or dose not have bean deployed");
+ throw new DeploymentException(
+ ST
+ + " module is invalid or dose not have bean deployed");
} else {
operation.addModule(new QName(attvalue));
}
@@ -694,20 +742,26 @@
if (CLASSNAME.equals(attname)) {
try {
Class messageReceiver = null;
- ClassLoader loader1 = Thread.currentThread().getContextClassLoader();
+ ClassLoader loader1 =
+ Thread.currentThread().getContextClassLoader();
if (attvalue != null && !"".equals(attvalue)) {
messageReceiver = Class.forName(attvalue, true, loader1);
- operation.setMessageReciever((MessageReceiver) messageReceiver.newInstance());
+ operation.setMessageReciever(
+ (MessageReceiver) messageReceiver.newInstance());
}
} catch (ClassNotFoundException e) {
- throw new DeploymentException("Error in loading messageRecivers " + e.getMessage());
+ throw new DeploymentException(
+ "Error in loading messageRecivers " + e.getMessage());
} catch (IllegalAccessException e) {
- throw new DeploymentException("Error in loading messageRecivers " + e.getMessage());
+ throw new DeploymentException(
+ "Error in loading messageRecivers " + e.getMessage());
} catch (InstantiationException e) {
- throw new DeploymentException("Error in loading messageRecivers " + e.getMessage());
+ throw new DeploymentException(
+ "Error in loading messageRecivers " + e.getMessage());
}
} else {
- throw new UnsupportedOperationException(attname + " is not allowed in messageRecievr element");
+ throw new UnsupportedOperationException(
+ attname + " is not allowed in messageRecievr element");
}
}
}
@@ -728,7 +782,6 @@
return operation;
}
-
/**
* This method used to process the <typeMapping>..</typeMapping> tag
* in the service.xml
@@ -742,8 +795,8 @@
while (!END_BEANMAPPING) {
int eventType = pullparser.next();
if (eventType == XMLStreamConstants.END_DOCUMENT) {
-// document end tag met , break the loop
-// but the doc end tag wont meet here :)
+ // document end tag met , break the loop
+ // but the doc end tag wont meet here :)
END_BEANMAPPING = true;
} else if (eventType == XMLStreamConstants.END_ELEMENT) {
String endtagname = pullparser.getLocalName();
@@ -758,7 +811,6 @@
}
}
-
public void processModule(ModuleDescription module) throws DeploymentException {
int attribCount = pullparser.getAttributeCount();
boolean ref_name = false;
@@ -770,7 +822,8 @@
if (ATTNAME.equals(attname)) {
if (ref_name) {
- throw new DeploymentException("Module canot have both name and ref " + attvalue);
+ throw new DeploymentException(
+ "Module canot have both name and ref " + attvalue);
} else {
module.setName(new QName(attvalue));
ref_name = true;
@@ -780,7 +833,8 @@
dpengine.getCurrentFileItem().setModuleClass(attvalue);
} else if (REF.equals(attname)) {
if (ref_name) {
- throw new DeploymentException("Module canot have both name and ref " + attvalue);
+ throw new DeploymentException(
+ "Module canot have both name and ref " + attvalue);
} else {
// module.setRef(attvalue);
ref_name = true;
@@ -818,7 +872,8 @@
Flow outFlow = processOutFlow();
module.setOutFlow(outFlow);
} else {
- throw new UnsupportedOperationException(ST + "elment is not allowed in module.xml");
+ throw new UnsupportedOperationException(
+ ST + "elment is not allowed in module.xml");
}
// complete implenatation
} else if (eventType == XMLStreamConstants.END_ELEMENT) {
@@ -845,8 +900,8 @@
pullparser.next();
int eventType = pullparser.getEventType();
if (eventType == XMLStreamConstants.END_DOCUMENT) {
-// document end tag met , break the loop
-// but the doc end tag wont meet here :)
+ // document end tag met , break the loop
+ // but the doc end tag wont meet here :)
END_INFLOW = true;
} else if (eventType == XMLStreamConstants.START_ELEMENT) {
String tagnae = pullparser.getLocalName();
@@ -854,7 +909,8 @@
HandlerDescription handler = processHandler();
inFlow.addHandler(handler);
} else {
- throw new DeploymentException("parser Exception : un supported element" + tagnae);
+ throw new DeploymentException(
+ "parser Exception : un supported element" + tagnae);
}
} else if (eventType == XMLStreamConstants.END_ELEMENT) {
String endtagname = pullparser.getLocalName();
@@ -872,7 +928,6 @@
return inFlow;
}
-
public Flow processOutFlow() throws DeploymentException {
Flow outFlow = new FlowImpl();
boolean END_OUTFLOW = false;
@@ -880,8 +935,8 @@
while (!END_OUTFLOW) {
int eventType = pullparser.next();
if (eventType == XMLStreamConstants.END_DOCUMENT) {
-// document end tag met , break the loop
-// but the doc end tag wont meet here :)
+ // document end tag met , break the loop
+ // but the doc end tag wont meet here :)
END_OUTFLOW = true;
} else if (eventType == XMLStreamConstants.START_ELEMENT) {
String tagnae = pullparser.getLocalName();
@@ -889,7 +944,8 @@
HandlerDescription handler = processHandler();
outFlow.addHandler(handler);
} else {
- throw new DeploymentException("parser Exception : un supported element" + tagnae);
+ throw new DeploymentException(
+ "parser Exception : un supported element" + tagnae);
}
} else if (eventType == XMLStreamConstants.END_ELEMENT) {
String endtagname = pullparser.getLocalName();
@@ -908,7 +964,6 @@
return outFlow;
}
-
public Flow processInFaultFlow() throws DeploymentException {
Flow faultFlow = new FlowImpl();
boolean END_FAULTFLOW = false;
@@ -916,8 +971,8 @@
while (!END_FAULTFLOW) {
int eventType = pullparser.next();
if (eventType == XMLStreamConstants.END_DOCUMENT) {
-// document end tag met , break the loop
-// but the doc end tag wont meet here :)
+ // document end tag met , break the loop
+ // but the doc end tag wont meet here :)
END_FAULTFLOW = true;
} else if (eventType == XMLStreamConstants.START_ELEMENT) {
String tagnae = pullparser.getLocalName();
@@ -925,7 +980,8 @@
HandlerDescription handler = processHandler();
faultFlow.addHandler(handler);
} else {
- throw new DeploymentException("parser Exception : un supported element" + tagnae);
+ throw new DeploymentException(
+ "parser Exception : un supported element" + tagnae);
}
} else if (eventType == XMLStreamConstants.END_ELEMENT) {
String endtagname = pullparser.getLocalName();
@@ -950,8 +1006,8 @@
while (!END_FAULTFLOW) {
int eventType = pullparser.next();
if (eventType == XMLStreamConstants.END_DOCUMENT) {
-// document end tag met , break the loop
-// but the doc end tag wont meet here :)
+ // document end tag met , break the loop
+ // but the doc end tag wont meet here :)
END_FAULTFLOW = true;
} else if (eventType == XMLStreamConstants.START_ELEMENT) {
String tagnae = pullparser.getLocalName();
@@ -959,7 +1015,8 @@
HandlerDescription handler = processHandler();
faultFlow.addHandler(handler);
} else {
- throw new DeploymentException("parser Exception : un supported element" + tagnae);
+ throw new DeploymentException(
+ "parser Exception : un supported element" + tagnae);
}
} else if (eventType == XMLStreamConstants.END_ELEMENT) {
String endtagname = pullparser.getLocalName();
@@ -977,7 +1034,6 @@
return faultFlow;
}
-
public ArrayList processPhaseOrder() throws DeploymentException {
boolean END_PHASEORDER = false;
ArrayList pahseList = new ArrayList();
@@ -995,7 +1051,8 @@
pahseList.add(attvalue);
}
} else {
- throw new DeploymentException("parser Exception : un supported element" + tagnae);
+ throw new DeploymentException(
+ "parser Exception : un supported element" + tagnae);
}
} else if (eventType == XMLStreamConstants.END_ELEMENT) {
String endtagname = pullparser.getLocalName();
@@ -1013,7 +1070,6 @@
return pahseList;
}
-
/**
* this method is to get the value of attribue
* eg xsd:anyVal --> anyVal
@@ -1067,7 +1123,8 @@
// module.setArchiveName(archiveName);
// module.setName(archiveName);
} else {
- throw new DeploymentException("parser Exception : un supported element" + ST);
+ throw new DeploymentException(
+ "parser Exception : un supported element" + ST);
}
//processStartElement();
break;
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/client.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/client.xml?rev=178617&r1=178616&r2=178617&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/client.xml (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/client.xml Thu May 26 00:38:05 2005
@@ -15,5 +15,22 @@
<parameter name="port" locked="xsd:false">6060</parameter>
</transportReceiver>
<transportSender name="tcp" class="org.apache.axis.transport.tcp.TCPTransportSender"/>
+
+ <transportReceiver name="mail" class="org.apache.axis.transport.mail.SimpleMailListener">
+ <parameter name="transport.mail.pop3.host" locked="xsd:false">mail.itambalama.com</parameter>
+ <parameter name="transport.mail.pop3.user" locked="xsd:false">axis2.mail.test@itambalama.com</parameter>
+ <parameter name="transport.mail.pop3.password" locked="xsd:false">2sixa.mail</parameter>
+ <parameter name="transport.mail.pop3.port" locked="xsd:false">110</parameter>
+ <parameter name="transport.mail.replyToAddress" locked="xsd:false">axis2.mail.test@itambalama.com</parameter>
+ </transportReceiver>
+ <transportSender name="mail" class="org.apache.axis.transport.mail.MailTransportSender">
+ <parameter name="transport.mail.smtp.host" locked="xsd:false">mail.itambalama.com</parameter>
+ <parameter name="transport.mail.smtp.user" locked="xsd:false">axis2.mail.test</parameter>
+ <parameter name="transport.mail.smtp.password" locked="xsd:false">2sixa.mail</parameter>
+ <parameter name="transport.mail.smtp.port" locked="xsd:false">25</parameter>
+ </transportSender>
+
+
+
</client>
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/server.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/server.xml?rev=178617&r1=178616&r2=178617&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/server.xml (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/server.xml Thu May 26 00:38:05 2005
@@ -17,7 +17,19 @@
<transportSender name="tcp" class="org.apache.axis.transport.tcp.TCPTransportSender"/>
-
+ <transportReceiver name="mail" class="org.apache.axis.transport.mail.SimpleMailListener">
+ <parameter name="transport.mail.pop3.host" locked="xsd:false">mail.itambalama.com</parameter>
+ <parameter name="transport.mail.pop3.user" locked="xsd:false">axis2.mail.test@itambalama.com</parameter>
+ <parameter name="transport.mail.pop3.password" locked="xsd:false">2sixa.mail</parameter>
+ <parameter name="transport.mail.pop3.port" locked="xsd:false">110</parameter>
+ <parameter name="transport.mail.replyToAddress" locked="xsd:false">axis2.mail.test@itambalama.com</parameter>
+ </transportReceiver>
+ <transportSender name="mail" class="org.apache.axis.transport.mail.MailTransportSender">
+ <parameter name="transport.mail.smtp.host" locked="xsd:false">mail.itambalama.com</parameter>
+ <parameter name="transport.mail.smtp.user" locked="xsd:false">axis2.mail.test</parameter>
+ <parameter name="transport.mail.smtp.password" locked="xsd:false">2sixa.mail</parameter>
+ <parameter name="transport.mail.smtp.port" locked="xsd:false">25</parameter>
+ </transportSender>
<!-- <module ref="addressing"/> -->
<phaseOrder type="inflow">
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/MailConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/MailConstants.java?rev=178617&r1=178616&r2=178617&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/MailConstants.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/MailConstants.java Thu May 26 00:38:05 2005
@@ -13,14 +13,15 @@
public final static String SUBJECT = "transport.mail.subject";
- public final static String SMTP_HOST = "transport.mail.smtp.host";
-
- public final static String POP3_HOST = "transport.mail.pop3.host";
+
- public final static String POP3_USERID = "transport.mail.pop3.userid";
+ public final static String POP3_HOST = "transport.mail.pop3.host";
+ public final static String POP3_USER = "transport.mail.pop3.user";
public final static String POP3_PASSWORD = "transport.mail.pop3.password";
+ public final static String POP3_PORT = "transport.mail.pop3.port";
+ public final static String RAPLY_TO = "transport.mail.replyToAddress";
public final static String HEADER_SOAP_ACTION = "transport.mail.soapaction";
public final static String CONTENT_TYPE = "transport.mail.contenttype";
@@ -28,7 +29,10 @@
public final static String CONTENT_LOCAION = "transport.mail.contentlocation";
- public final static String HOST = "host";
- public final static String USER = "user";
- public final static String PASSWORD = "password";
+
+
+ public final static String SMTP_HOST = "transport.mail.smtp.host";
+ public final static String SMTP_USER = "transport.mail.smtp.user";
+ public final static String SMTP_PASSWORD = "transport.mail.smtp.password";
+ public final static String SMTP_PORT = "transport.mail.smtp.port";
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/MailTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/MailTransportSender.java?rev=178617&r1=178616&r2=178617&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/MailTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/MailTransportSender.java Thu May 26 00:38:05 2005
@@ -23,6 +23,7 @@
import java.io.Writer;
import java.util.Properties;
+import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
@@ -32,8 +33,10 @@
import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.context.MessageContext;
+import org.apache.axis.description.TransportOutDescription;
import org.apache.axis.engine.AxisFault;
import org.apache.axis.transport.AbstractTransportSender;
+import org.apache.axis.util.Utils;
public class MailTransportSender extends AbstractTransportSender {
private String host;
@@ -49,13 +52,10 @@
public void finalizeSendWithToAddress(MessageContext msgContext, Writer writer)
throws AxisFault {
- throw new UnsupportedOperationException();
}
public void startSendWithToAddress(MessageContext msgContext, Writer writer) throws AxisFault {
- throw new UnsupportedOperationException();
-
}
protected Writer openTheConnection(EndpointReference epr) throws AxisFault {
@@ -85,24 +85,50 @@
Writer writer)
throws AxisFault {
try {
- PasswordAuthentication authentication = new PasswordAuthentication(user, password);
- Properties props = new Properties();
- props.put("mail.user", user);
- props.put("mail.host", host);
- props.put("mail.store.protocol", "pop3");
- props.put("mail.transport.protocol", "smtp");
- props.put("mail.smtp.port", smtpPort);
- Session session = Session.getInstance(props);
-
- MimeMessage msg = new MimeMessage(session, in);
- String action = msgContext.getWSAAction();
- if (action != null) {
- msg.setHeader("transport.mail.soapaction", action);
- }
+ TransportOutDescription transportOut = msgContext.getTransportOut();
+ user = Utils.getParameterValue(transportOut.getParameter(MailConstants.SMTP_USER));
+ host = Utils.getParameterValue(transportOut.getParameter(MailConstants.SMTP_HOST));
+ 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) {
+ final PasswordAuthentication authentication =
+ new PasswordAuthentication(user, password);
+ Properties props = new Properties();
+ props.put("mail.user", user);
+ props.put("mail.host", host);
+ props.put("mail.store.protocol", "pop3");
+ props.put("mail.transport.protocol", "smtp");
+ props.put("mail.smtp.port", smtpPort);
+ Session session = Session.getInstance(props, new Authenticator() {
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return authentication;
+ }
+ });
+
+ MimeMessage msg = new MimeMessage(session, in);
+ String action = msgContext.getWSAAction();
+ if (action != null) {
+ msg.setHeader("transport.mail.soapaction", action);
+ }
+
+ msg.addRecipients(Message.RecipientType.TO, msgContext.getTo().getAddress());
+ msg.setSubject(msgContext.getTo().getAddress());
+ Transport.send(msg);
+
+ } 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));
- msg.addRecipients(Message.RecipientType.TO, msgContext.getTo().getAddress());
- msg.setSubject(msgContext.getTo().getAddress());
- Transport.send(msg);
+ }
} catch (MessagingException e) {
throw new AxisFault(e);
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/SimpleMailListener.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/SimpleMailListener.java?rev=178617&r1=178616&r2=178617&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/SimpleMailListener.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/SimpleMailListener.java Thu May 26 00:38:05 2005
@@ -18,6 +18,7 @@
import java.util.Properties;
+import javax.mail.Authenticator;
import javax.mail.Flags;
import javax.mail.Folder;
import javax.mail.Message;
@@ -26,8 +27,14 @@
import javax.mail.Store;
import javax.mail.internet.MimeMessage;
+import org.apache.axis.addressing.AddressingConstants;
+import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.context.ConfigurationContext;
import org.apache.axis.context.ConfigurationContextFactory;
+import org.apache.axis.description.TransportInDescription;
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.transport.TransportListener;
+import org.apache.axis.util.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.net.pop3.POP3Client;
@@ -51,28 +58,38 @@
*
*/
-public class SimpleMailListener implements Runnable {
+public class SimpleMailListener extends TransportListener implements Runnable {
protected static Log log = LogFactory.getLog(SimpleMailListener.class.getName());
private String host;
- private int port;
+ private String port;
- private String userid;
+ private String user;
private String password;
- private ConfigurationContext er = null;
+ private ConfigurationContext configurationContext = null;
- public SimpleMailListener(String host, int port, String userid, String password, String dir) {
+ private String replyTo;
+
+ public SimpleMailListener() {
+ }
+
+ public SimpleMailListener(
+ String host,
+ String port,
+ String userid,
+ String password,
+ String dir) {
this.host = host;
this.port = port;
- this.userid = userid;
+ this.user = userid;
this.password = password;
try {
ConfigurationContextFactory builder = new ConfigurationContextFactory();
- er = builder.buildEngineContext(dir);
+ configurationContext = builder.buildEngineContext(dir);
} catch (Exception e) {
e.printStackTrace();
}
@@ -86,15 +103,15 @@
public SimpleMailListener(
String host,
- int port,
+ String port,
String userid,
String password,
ConfigurationContext er) {
this.host = host;
this.port = port;
- this.userid = userid;
+ this.user = userid;
this.password = password;
- this.er = er;
+ this.configurationContext = er;
}
// Are we doing threads?
@@ -123,7 +140,7 @@
if (!stopped) {
String logMessage =
"Mail listner is being setup to listen to the address "
- + userid
+ + user
+ "@"
+ host
+ " On port "
@@ -133,14 +150,17 @@
}
while (!stopped) {
try {
- PasswordAuthentication authentication =
- new PasswordAuthentication(userid, password);
+ final PasswordAuthentication authentication = new PasswordAuthentication(user, password);
Properties props = new Properties();
- props.put("mail.user", userid);
+ props.put("mail.user", user);
props.put("mail.host", host);
props.put("mail.store.protocol", "pop3");
props.put("mail.transport.protocol", "smtp");
- Session session = Session.getInstance(props);
+ Session session = Session.getInstance(props,new Authenticator() {
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return authentication;
+ }
+ });
Store store = session.getStore();
store.connect();
Folder root = store.getDefaultFolder();
@@ -154,7 +174,7 @@
for (int i = 0; i < msgs.length; i++) {
MimeMessage msg = (MimeMessage) msgs[i];
if (msg != null) {
- MailWorker worker = new MailWorker(msg, er);
+ MailWorker worker = new MailWorker(msg, configurationContext);
if (doThreads) {
Thread thread = new Thread(worker);
thread.setDaemon(true);
@@ -227,7 +247,7 @@
* @param daemon
* a boolean indicating if the thread should be a daemon.
*/
- public void start(boolean daemon) throws Exception {
+ public void start(boolean daemon) {
if (doThreads) {
Thread thread = new Thread(this);
thread.setDaemon(daemon);
@@ -240,7 +260,7 @@
/**
* Start this server as a NON-daemon.
*/
- public void start() throws Exception {
+ public void start() {
start(false);
}
@@ -249,7 +269,7 @@
*
* This will interrupt any pending accept().
*/
- public void stop() throws Exception {
+ public void stop() {
/*
* Close the server socket cleanly, but avoid fresh accepts while the
* socket is closing.
@@ -283,7 +303,7 @@
try {
doThreads = optDoThreads; //(opts.isFlagSet('t') > 0);
String host = optHostName; //opts.getHost();
- int port = ((optUseCustomPort) ? optCustomPortToUse : 110);
+ String port = String.valueOf(((optUseCustomPort) ? optCustomPortToUse : 110));
POP3Client pop3 = new POP3Client();
SimpleMailListener sas =
new SimpleMailListener(host, port, optUserName, optPassword, optDir);
@@ -298,4 +318,41 @@
}
}
+ /* (non-Javadoc)
+ * @see org.apache.axis.transport.TransportListener#init(org.apache.axis.context.ConfigurationContext, org.apache.axis.description.TransportInDescription)
+ */
+ public void init(ConfigurationContext configurationContext, TransportInDescription transportIn)
+ throws AxisFault {
+ this.configurationContext = configurationContext;
+
+ user = Utils.getParameterValue(transportIn.getParameter(MailConstants.POP3_USER));
+ host = Utils.getParameterValue(transportIn.getParameter(MailConstants.POP3_HOST));
+ password = Utils.getParameterValue(transportIn.getParameter(MailConstants.POP3_PASSWORD));
+ port = Utils.getParameterValue(transportIn.getParameter(MailConstants.POP3_PORT));
+ replyTo = 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));
+ }
+
+ POP3Client pop3 = new POP3Client();
+ this.setPOP3(pop3);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.axis.transport.TransportListener#replyToEPR(java.lang.String)
+ */
+ public EndpointReference replyToEPR(String serviceName) throws AxisFault {
+ // TODO Auto-generated method stub
+ return new EndpointReference(AddressingConstants.WSA_REPLY_TO, replyTo);
+ }
+
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/util/Utils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/util/Utils.java?rev=178617&r1=178616&r2=178617&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/util/Utils.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/util/Utils.java Thu May 26 00:38:05 2005
@@ -20,6 +20,7 @@
import org.apache.axis.description.Flow;
import org.apache.axis.description.HandlerDescription;
import org.apache.axis.description.OperationDescription;
+import org.apache.axis.description.Parameter;
import org.apache.axis.description.ParameterImpl;
import org.apache.axis.description.PhaseRule;
import org.apache.axis.description.ServiceDescription;
@@ -125,4 +126,13 @@
PhaseResolver pr = new PhaseResolver(axisconfig,serviceDesc);
pr.buildchains();
}
+
+ public static String getParameterValue(Parameter param){
+ if(param == null){
+ return null;
+ }else{
+ return (String)param.getValue();
+ }
+ }
+
}
Modified: webservices/axis/trunk/java/modules/samples/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/project.xml?rev=178617&r1=178616&r2=178617&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/project.xml (original)
+++ webservices/axis/trunk/java/modules/samples/project.xml Thu May 26 00:38:05 2005
@@ -123,7 +123,7 @@
<exclude>**/*Abstract*.java</exclude>
<exclude>**/*Util*.java</exclude>
<exclude>**/*InteropStubTest.java</exclude>
- <!-- <exclude>**/*TCPEchoRawXMLTest.java</exclude> -->
+ <exclude>**/*MailEchoRawXMLTest.java</exclude>
</excludes>
<includes>
<include>**/*Test.java</include>
Added: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/MailEchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/MailEchoRawXMLTest.java?rev=178617&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/MailEchoRawXMLTest.java (added)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/MailEchoRawXMLTest.java Thu May 26 00:38:05 2005
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.engine;
+
+//todo
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+
+import junit.framework.TestCase;
+
+import org.apache.axis.Constants;
+import org.apache.axis.addressing.AddressingConstants;
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.clientapi.AsyncResult;
+import org.apache.axis.clientapi.Callback;
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.context.ServiceContext;
+import org.apache.axis.description.ServiceDescription;
+import org.apache.axis.integration.UtilServer;
+import org.apache.axis.om.OMAbstractFactory;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.soap.SOAPFactory;
+import org.apache.axis.transport.http.SimpleHTTPServer;
+import org.apache.axis.util.Utils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class MailEchoRawXMLTest extends TestCase {
+ private EndpointReference targetEPR =
+ new EndpointReference(AddressingConstants.WSA_TO,
+ "http://127.0.0.1:"
+ + (UtilServer.TESTING_PORT)
+ + "/axis/services/EchoXMLService/echoOMElement");
+ private Log log = LogFactory.getLog(getClass());
+ private QName serviceName = new QName("EchoXMLService");
+ private QName operationName = new QName("echoOMElement");
+ private QName transportName = new QName("http://localhost/my", "NullTransport");
+
+ private AxisConfiguration engineRegistry;
+ private MessageContext mc;
+ //private Thread thisThread;
+ // private SimpleHTTPServer sas;
+ private ServiceContext serviceContext;
+ private ServiceDescription service;
+
+ private boolean finish = false;
+
+ public MailEchoRawXMLTest() {
+ super(MailEchoRawXMLTest.class.getName());
+ }
+
+ public MailEchoRawXMLTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ UtilServer.start();
+ service =
+ Utils.createSimpleService(serviceName,
+ org.apache.axis.engine.Echo.class.getName(),
+ operationName);
+ UtilServer.deployService(service);
+ serviceContext =
+ UtilServer.getConfigurationContext().createServiceContext(service.getName());
+
+ }
+
+ protected void tearDown() throws Exception {
+ UtilServer.unDeployService(serviceName);
+ UtilServer.stop();
+ }
+
+ private OMElement createEnvelope() {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
+ OMElement method = fac.createOMElement("echoOMElement", omNs);
+ OMElement value = fac.createOMElement("myValue", omNs);
+ value.addChild(fac.createText(value, "Isaac Assimov, the foundation Sega"));
+ method.addChild(value);
+
+ return method;
+ }
+
+// public void testEchoXMLASync() throws Exception {
+// OMElement payload = createEnvelope();
+//
+// org.apache.axis.clientapi.Call call = new org.apache.axis.clientapi.Call();
+//
+// call.setTo(targetEPR);
+// call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);
+//
+// Callback callback = new Callback() {
+// public void onComplete(AsyncResult result) {
+// try {
+// result.getResponseEnvelope().serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out));
+// } catch (XMLStreamException e) {
+// reportError(e);
+// } finally {
+// finish = true;
+// }
+// }
+//
+// public void reportError(Exception e) {
+// e.printStackTrace();
+// finish = true;
+// }
+// };
+//
+// call.invokeNonBlocking(operationName.getLocalPart(), payload, callback);
+// int index = 0;
+// while (!finish) {
+// Thread.sleep(1000);
+// index++;
+// if(index > 10 ){
+// throw new AxisFault("Server is shutdown as the Async response take too longs time");
+// }
+// }
+//
+//
+// log.info("send the reqest");
+// }
+
+ public void testEchoXMLSync() throws Exception {
+ SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
+
+ OMElement payload = createEnvelope();
+
+ org.apache.axis.clientapi.Call call = new org.apache.axis.clientapi.Call();
+
+ call.setTo(targetEPR);
+ call.setTransportInfo(Constants.TRANSPORT_MAIL, Constants.TRANSPORT_MAIL, true);
+
+ OMElement result =
+ (OMElement) call.invokeBlocking(operationName.getLocalPart(), payload);
+ result.serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out));
+ }
+}
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/integration/UtilServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/integration/UtilServer.java?rev=178617&r1=178616&r2=178617&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/integration/UtilServer.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/integration/UtilServer.java Thu May 26 00:38:05 2005
@@ -39,7 +39,7 @@
public static final int TESTING_PORT = 5555;
public static final String FAILURE_MESSAGE = "Intentional Faliure";
public static final String TESTING_REPOSITORY = "target/test-resources/samples";
- // public static final String TESTING_REPOSITORY = "modules/samples/target/test-resources/samples";
+ //public static final String TESTING_REPOSITORY = "modules/samples/target/test-resources/samples";
public static synchronized void deployService(ServiceDescription service) throws AxisFault {
reciver.getSystemContext().getAxisConfiguration().addService(service);