JBoss JBPM SVN: r7033 - jbpm3/branches/jbpm-3.2-soa/core.
by do-not-reply@jboss.org
Author: marco.rietveld
Date: 2011-10-10 21:47:37 -0400 (Mon, 10 Oct 2011)
New Revision: 7033
Modified:
jbpm3/branches/jbpm-3.2-soa/core/pom.xml
Log:
Preparation for 3.2.11.SP2 release.
Modified: jbpm3/branches/jbpm-3.2-soa/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/pom.xml 2011-10-11 01:46:33 UTC (rev 7032)
+++ jbpm3/branches/jbpm-3.2-soa/core/pom.xml 2011-10-11 01:47:37 UTC (rev 7033)
@@ -18,7 +18,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.2.12-SNAPSHOT</version>
+ <version>3.2.11.SP2-SNAPSHOT</version>
</parent>
<!-- Dependencies -->
12 years, 7 months
JBoss JBPM SVN: r7032 - in jbpm3/branches/jbpm-3.2-soa: db and 10 other directories.
by do-not-reply@jboss.org
Author: marco.rietveld
Date: 2011-10-10 21:46:33 -0400 (Mon, 10 Oct 2011)
New Revision: 7032
Modified:
jbpm3/branches/jbpm-3.2-soa/db/pom.xml
jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml
jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/module/pom.xml
jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/pom.xml
jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml
jbpm3/branches/jbpm-3.2-soa/enterprise/pom.xml
jbpm3/branches/jbpm-3.2-soa/examples/pom.xml
jbpm3/branches/jbpm-3.2-soa/identity/pom.xml
jbpm3/branches/jbpm-3.2-soa/pom.xml
jbpm3/branches/jbpm-3.2-soa/simulation/pom.xml
jbpm3/branches/jbpm-3.2-soa/tomcat/pom.xml
jbpm3/branches/jbpm-3.2-soa/userguide/pom.xml
Log:
Preparation for 3.2.11.SP2 release.
Modified: jbpm3/branches/jbpm-3.2-soa/db/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/db/pom.xml 2011-10-11 01:41:01 UTC (rev 7031)
+++ jbpm3/branches/jbpm-3.2-soa/db/pom.xml 2011-10-11 01:46:33 UTC (rev 7032)
@@ -18,11 +18,11 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.2.11.SP1-SNAPSHOT</version>
+ <version>3.2.11.SP2-SNAPSHOT</version>
</parent>
<properties>
- <previous.version>3.2.11</previous.version>
+ <previous.version>3.2.11.SP1</previous.version>
<previous.version.directory>${project.build.directory}/${previous.version}</previous.version.directory>
</properties>
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml 2011-10-11 01:41:01 UTC (rev 7031)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml 2011-10-11 01:46:33 UTC (rev 7032)
@@ -18,7 +18,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.2.11.SP1-SNAPSHOT</version>
+ <version>3.2.11.SP2-SNAPSHOT</version>
</parent>
<!-- Properties -->
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/module/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/module/pom.xml 2011-10-11 01:41:01 UTC (rev 7031)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/module/pom.xml 2011-10-11 01:46:33 UTC (rev 7032)
@@ -18,7 +18,7 @@
<parent>
<artifactId>jbpm-examples-dist</artifactId>
<groupId>org.jbpm.jbpm3</groupId>
- <version>3.2.11.SP1-SNAPSHOT</version>
+ <version>3.2.11.SP2-SNAPSHOT</version>
</parent>
<build>
@@ -34,4 +34,4 @@
</testResource>
</testResources>
</build>
-</project>
\ No newline at end of file
+</project>
Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/pom.xml 2011-10-11 01:41:01 UTC (rev 7031)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/examples/pom.xml 2011-10-11 01:46:33 UTC (rev 7032)
@@ -19,7 +19,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.2.11.SP1-SNAPSHOT</version>
+ <version>3.2.11.SP2-SNAPSHOT</version>
</parent>
<modules>
Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/pom.xml 2011-10-11 01:41:01 UTC (rev 7031)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/pom.xml 2011-10-11 01:46:33 UTC (rev 7032)
@@ -18,7 +18,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.2.12-SNAPSHOT</version>
+ <version>3.2.11.SP2-SNAPSHOT</version>
</parent>
<!-- Dependencies -->
Modified: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml 2011-10-11 01:41:01 UTC (rev 7031)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml 2011-10-11 01:46:33 UTC (rev 7032)
@@ -17,7 +17,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.2.12-SNAPSHOT</version>
+ <version>3.2.11.SP2-SNAPSHOT</version>
</parent>
<properties>
Modified: jbpm3/branches/jbpm-3.2-soa/examples/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/examples/pom.xml 2011-10-11 01:41:01 UTC (rev 7031)
+++ jbpm3/branches/jbpm-3.2-soa/examples/pom.xml 2011-10-11 01:46:33 UTC (rev 7032)
@@ -18,7 +18,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.2.12-SNAPSHOT</version>
+ <version>3.2.11.SP2-SNAPSHOT</version>
</parent>
<!-- Dependencies -->
Modified: jbpm3/branches/jbpm-3.2-soa/identity/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/identity/pom.xml 2011-10-11 01:41:01 UTC (rev 7031)
+++ jbpm3/branches/jbpm-3.2-soa/identity/pom.xml 2011-10-11 01:46:33 UTC (rev 7032)
@@ -18,7 +18,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.2.12-SNAPSHOT</version>
+ <version>3.2.11.SP2-SNAPSHOT</version>
</parent>
<!-- Dependencies -->
Modified: jbpm3/branches/jbpm-3.2-soa/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/pom.xml 2011-10-11 01:41:01 UTC (rev 7031)
+++ jbpm3/branches/jbpm-3.2-soa/pom.xml 2011-10-11 01:46:33 UTC (rev 7032)
@@ -13,7 +13,7 @@
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
<packaging>pom</packaging>
- <version>3.2.12-SNAPSHOT</version>
+ <version>3.2.11.SP2-SNAPSHOT</version>
<!-- Source Control Management -->
<scm>
@@ -47,7 +47,7 @@
<!-- Dependency versions -->
<cargo.version>1.0.3</cargo.version>
- <jsf.console.version>3.2.12-SNAPSHOT</jsf.console.version>
+ <jsf.console.version>3.2.11.SP2-SNAPSHOT</jsf.console.version>
<!-- Database Driver Versions -->
<db2jcc.version>3.1.57</db2jcc.version>
Modified: jbpm3/branches/jbpm-3.2-soa/simulation/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/simulation/pom.xml 2011-10-11 01:41:01 UTC (rev 7031)
+++ jbpm3/branches/jbpm-3.2-soa/simulation/pom.xml 2011-10-11 01:46:33 UTC (rev 7032)
@@ -18,7 +18,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.2.12-SNAPSHOT</version>
+ <version>3.2.11.SP2-SNAPSHOT</version>
</parent>
<!-- Profiles -->
Modified: jbpm3/branches/jbpm-3.2-soa/tomcat/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/tomcat/pom.xml 2011-10-11 01:41:01 UTC (rev 7031)
+++ jbpm3/branches/jbpm-3.2-soa/tomcat/pom.xml 2011-10-11 01:46:33 UTC (rev 7032)
@@ -7,7 +7,7 @@
<parent>
<artifactId>jbpm</artifactId>
<groupId>org.jbpm.jbpm3</groupId>
- <version>3.2.12-SNAPSHOT</version>
+ <version>3.2.11.SP2-SNAPSHOT</version>
</parent>
<properties>
Modified: jbpm3/branches/jbpm-3.2-soa/userguide/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/userguide/pom.xml 2011-10-11 01:41:01 UTC (rev 7031)
+++ jbpm3/branches/jbpm-3.2-soa/userguide/pom.xml 2011-10-11 01:46:33 UTC (rev 7032)
@@ -18,7 +18,7 @@
<parent>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm</artifactId>
- <version>3.2.12-SNAPSHOT</version>
+ <version>3.2.11.SP2-SNAPSHOT</version>
</parent>
<!-- Plugins -->
12 years, 7 months
JBoss JBPM SVN: r7031 - jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail.
by do-not-reply@jboss.org
Author: marco.rietveld
Date: 2011-10-10 21:41:01 -0400 (Mon, 10 Oct 2011)
New Revision: 7031
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/Mail.java
Log:
JBPM-3386: jBPM Mail Node does not authenticate, results in "Relay access denied" when recipient is not on local server
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/Mail.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/Mail.java 2011-10-11 01:39:55 UTC (rev 7030)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/Mail.java 2011-10-11 01:41:01 UTC (rev 7031)
@@ -1,5 +1,6 @@
package org.jbpm.mail;
+
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
@@ -12,6 +13,7 @@
import javax.mail.Message;
import javax.mail.MessagingException;
+import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
@@ -30,9 +32,12 @@
import org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator;
import org.jbpm.util.ClassLoaderUtil;
import org.jbpm.util.XmlUtil;
+import org.pdfbox.filter.CCITTFaxDecodeFilter;
public class Mail implements ActionHandler {
+ private static final Log log = LogFactory.getLog(Mail.class);
+
private String template;
private String to;
private String actors;
@@ -73,7 +78,6 @@
this.executionContext = executionContext;
send();
}
-
public List getRecipients() {
Collection recipientsCollection = collectRecipients(actors, to);
@@ -183,7 +187,7 @@
}
private Object evaluate(String expression, Class expectedType) {
- VariableResolver variableResolver = new MailVariableResolver(getTemplateVariables(), JbpmExpressionEvaluator.getVariableResolver());
+ VariableResolver variableResolver = new MailVariableResolver(MailTemplates.getTemplateVariables(), JbpmExpressionEvaluator.getVariableResolver());
return JbpmExpressionEvaluator.evaluate(expression, executionContext, expectedType, variableResolver, JbpmExpressionEvaluator.getFunctionMapper());
}
@@ -202,7 +206,7 @@
public void send() {
if (template != null) {
- Properties templateProperties = getTemplateProperties(template);
+ Properties templateProperties = MailTemplates.getTemplateProperties(template);
if (actors == null) actors = templateProperties.getProperty("actors");
if (to == null) to = templateProperties.getProperty("to");
@@ -214,29 +218,32 @@
if (text == null) text = templateProperties.getProperty("text");
}
- String sender = getFromAddress();
- Collection recipients = getRecipients();
- Collection ccRecipients = getCcRecipients();
- Collection bccRecipients = getBccRecipients();
- if (nullOrEmpty(recipients) && nullOrEmpty(ccRecipients) && nullOrEmpty(bccRecipients))
+ MessageInfo msgInfo = new MessageInfo();
+ msgInfo.sender = getFromAddress();
+ msgInfo.recipients = getRecipients();
+ msgInfo.ccRecipients = getCcRecipients();
+ msgInfo.bccRecipients = getBccRecipients();
+ if (nullOrEmpty(msgInfo.recipients) && nullOrEmpty(msgInfo.ccRecipients) && nullOrEmpty(msgInfo.bccRecipients))
return;
- String subject = getSubject();
- String text = getText();
+ msgInfo.subject = getSubject();
+ msgInfo.text = getText();
if (log.isDebugEnabled()) {
StringBuffer detail = new StringBuffer("sending email");
- if (!nullOrEmpty(recipients)) detail.append(" to ").append(recipients);
- if (!nullOrEmpty(ccRecipients)) detail.append(" cc ").append(ccRecipients);
- if (!nullOrEmpty(bccRecipients)) detail.append(" bcc ").append(bccRecipients);
+ if (!nullOrEmpty(msgInfo.recipients)) detail.append(" to ").append(msgInfo.recipients);
+ if (!nullOrEmpty(msgInfo.ccRecipients)) detail.append(" cc ").append(msgInfo.ccRecipients);
+ if (!nullOrEmpty(msgInfo.bccRecipients)) detail.append(" bcc ").append(msgInfo.bccRecipients);
if (subject != null) detail.append(" about '").append(subject).append('\'');
log.debug(detail.toString());
}
- Session session = Session.getInstance(getServerProperties());
+ Properties sessionProperties = getServerProperties();
+ msgInfo.session = getSession(sessionProperties);
+
for (int retries = 4; retries >= 0; retries--) {
try {
- sendInternal(session, sender, recipients, ccRecipients, bccRecipients, subject, text);
+ sendInternal(msgInfo);
break;
}
catch (MessagingException me) {
@@ -255,7 +262,8 @@
}
public static void send(Properties serverProperties, String sender, Collection recipients, String subject, String text) {
- send(serverProperties, sender, recipients, null, subject, text);
+ MessageInfo msgInfo = new MessageInfo(null, sender, recipients, null, null, subject, text);
+ send(serverProperties, msgInfo);
}
/**
@@ -267,20 +275,26 @@
}
public static void send(Properties serverProperties, String sender, Collection recipients, Collection bccRecipients, String subject, String text) {
- if (nullOrEmpty(recipients) && nullOrEmpty(bccRecipients)) return;
+ MessageInfo msgInfo = new MessageInfo(null, sender, recipients, null, bccRecipients, subject, text);
+ send(serverProperties, msgInfo);
+ }
+
+ private static void send(Properties serverProperties, MessageInfo msgInfo) {
+ if (nullOrEmpty(msgInfo.recipients) && nullOrEmpty(msgInfo.bccRecipients)) return;
if (log.isDebugEnabled()) {
StringBuffer detail = new StringBuffer("sending email to ");
- detail.append(recipients);
- if (bccRecipients != null) detail.append(" bcc ").append(bccRecipients);
- if (subject != null) detail.append(" about '").append(subject).append('\'');
+ detail.append(msgInfo.recipients);
+ if (msgInfo.bccRecipients != null) detail.append(" bcc ").append(msgInfo.bccRecipients);
+ if (msgInfo.subject != null) detail.append(" about '").append(msgInfo.subject).append('\'');
log.debug(detail.toString());
}
- Session session = Session.getInstance(serverProperties);
+ msgInfo.session = getSession(serverProperties);
+
for (int retries = 4; retries >= 0; retries--) {
try {
- sendInternal(session, null, recipients, null, bccRecipients, subject, text);
+ sendInternal(msgInfo);
break;
}
catch (MessagingException me) {
@@ -294,49 +308,102 @@
return col == null || col.isEmpty();
}
- private static void sendInternal(Session session, String sender, Collection recipients,
- Collection ccRecipients, Collection bccRecipients, String subject, String text)
- throws MessagingException {
- MimeMessage message = new MimeMessage(session);
+ private static void sendInternal(MessageInfo msgInfo) throws MessagingException {
+
+ Message message = fillMessage(msgInfo);
+
+ // send the message
+ Transport.send(message);
+ }
+
+ private static Message fillMessage(MessageInfo msgInfo) throws MessagingException {
+ MimeMessage message = new MimeMessage(msgInfo.session);
// from
- if (sender != null) {
- message.setFrom(new InternetAddress(sender));
+ if (msgInfo.sender != null) {
+ message.setFrom(new InternetAddress(msgInfo.sender));
}
else {
// read sender from session property "mail.from"
message.setFrom();
}
// to
- if (recipients != null) {
- for (Iterator iter = recipients.iterator(); iter.hasNext();) {
+ if (msgInfo.recipients != null) {
+ for (Iterator iter = msgInfo.recipients.iterator(); iter.hasNext();) {
InternetAddress recipient = new InternetAddress((String) iter.next());
message.addRecipient(Message.RecipientType.TO, recipient);
}
}
// cc
- if (ccRecipients != null) {
- for (Iterator iter = ccRecipients.iterator(); iter.hasNext();) {
+ if (msgInfo.ccRecipients != null) {
+ for (Iterator iter = msgInfo.ccRecipients.iterator(); iter.hasNext();) {
InternetAddress recipient = new InternetAddress((String) iter.next());
message.addRecipient(Message.RecipientType.CC, recipient);
}
}
// bcc
- if (bccRecipients != null) {
- for (Iterator iter = bccRecipients.iterator(); iter.hasNext();) {
+ if (msgInfo.bccRecipients != null) {
+ for (Iterator iter = msgInfo.bccRecipients.iterator(); iter.hasNext();) {
InternetAddress recipient = new InternetAddress((String) iter.next());
message.addRecipient(Message.RecipientType.BCC, recipient);
}
}
// subject
- if (subject != null) message.setSubject(subject);
+ if (msgInfo.subject != null) message.setSubject(msgInfo.subject);
// text
- if (text != null) message.setText(text);
- // send the message
- Transport.send(message);
+ if (msgInfo.text != null) message.setText(msgInfo.text);
+
+ return message;
}
+
+ private static Session getSession(Properties properties) {
+ String userName = (String) properties.remove(JBPM_MAIL_USER);
+ String password = (String) properties.remove(JBPM_MAIL_PASSWORD);
+ Session session;
+ if( userName != null ) {
+ properties.setProperty("mail.smtp.submitter", userName );
+ Authenticator authenticator = new Authenticator(userName, password);
+ session = Session.getInstance(properties, authenticator);
+ if( password != null ) {
+ properties.setProperty("mail.smtp.auth", "true");
+ }
+ }
+ else {
+ properties.remove("mail.smtp.auth");
+ properties.remove("mail.smtp.starttls.enable");
+ session = Session.getInstance(properties);
+ }
+
+ // set debug prop if available
+ String debugStr = (String) properties.remove(JBPM_MAIL_DEBUG);
+ boolean debug = false;
+ if( debugStr != null ) {
+ debug = Boolean.getBoolean(debugStr);
+ }
+ session.setDebug(debug);
+
+ return session;
+ }
+
+ private static class Authenticator extends javax.mail.Authenticator implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private PasswordAuthentication authentication;
+
+ public Authenticator(String username, String password) {
+ authentication = new PasswordAuthentication(username, password);
+ }
+
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return authentication;
+ }
+ }
+
private static final Map serverPropertiesByResource = new HashMap();
+ private static final String JBPM_MAIL_USER = "jbpm.mail.user";
+ private static final String JBPM_MAIL_PASSWORD = "jbpm.mail.password";
+ private static final String JBPM_MAIL_DEBUG = "jbpm.mail.debug";
+
private Properties getServerProperties() {
Properties serverProperties;
@@ -353,92 +420,51 @@
}
}
else {
+ //OCRAM: from address
serverProperties = new Properties();
// host
- if (Configs.hasObject("jbpm.mail.smtp.host")) {
- String smtpHost = Configs.getString("jbpm.mail.smtp.host");
+ String jbpmProperty = "jbpm.mail.smtp.host";
+ if (Configs.hasObject(jbpmProperty)) {
+ String smtpHost = Configs.getString(jbpmProperty);
serverProperties.setProperty("mail.smtp.host", smtpHost);
}
// port
- if (Configs.hasObject("jbpm.mail.smtp.port")) {
- int port = Configs.getInt("jbpm.mail.smtp.port");
+ jbpmProperty = "jbpm.mail.smtp.port";
+ if (Configs.hasObject(jbpmProperty)) {
+ int port = Configs.getInt(jbpmProperty);
serverProperties.setProperty("mail.smtp.port", Integer.toString(port));
}
- }
- return serverProperties;
- }
-
- private static final Map templatePropertiesByResource = new HashMap();
- private static final Map templateVariablesByResource = new HashMap();
-
- private static Properties getTemplateProperties(String templateName) {
- String resource = Configs.getString("resource.mail.templates");
- synchronized (templatePropertiesByResource) {
- Map templateProperties = (Map) templatePropertiesByResource.get(resource);
- if (templateProperties == null) {
- loadTemplates(resource);
- templateProperties = (Map) templatePropertiesByResource.get(resource);
+ // start TLS
+ jbpmProperty = "jbpm.mail.smtp.starttls";
+ if (Configs.hasObject(jbpmProperty)) {
+ boolean enableTLS = Configs.getBoolean(jbpmProperty);
+ serverProperties.setProperty("mail.smtp.starttls.enable", Boolean.toString(enableTLS) );
}
- return (Properties) templateProperties.get(templateName);
- }
- }
-
- private static Map getTemplateVariables() {
- String resource = Configs.getString("resource.mail.templates");
- synchronized (templateVariablesByResource) {
- Map templateVariables = (Map) templateVariablesByResource.get(resource);
- if (templateVariables == null) {
- loadTemplates(resource);
- templateVariables = (Map) templateVariablesByResource.get(resource);
+ // SMTP authentication
+ jbpmProperty = "jbpm.mail.smtp.auth";
+ if (Configs.hasObject(jbpmProperty)) {
+ boolean useAuth = Configs.getBoolean(jbpmProperty);
+ serverProperties.setProperty("mail.smtp.auth", Boolean.toString(useAuth) );
}
- return templateVariables;
- }
- }
-
- private static void loadTemplates(String resource) {
- Element templatesElement = XmlUtil.parseXmlResource(resource, true).getDocumentElement();
-
- Map templatePropertiesMap = new HashMap();
- for (Iterator iter = XmlUtil.elementIterator(templatesElement, "mail-template"); iter.hasNext();) {
- Element templateElement = (Element) iter.next();
-
- Properties templateProperties = new Properties();
- addTemplateProperty(templateElement, "to", templateProperties);
- addTemplateProperty(templateElement, "actors", templateProperties);
- addTemplateProperty(templateElement, "subject", templateProperties);
- addTemplateProperty(templateElement, "text", templateProperties);
- addTemplateProperty(templateElement, "cc", templateProperties);
- addTemplateProperty(templateElement, "cc-actors", templateProperties);
- addTemplateProperty(templateElement, "bcc", templateProperties);
- // preserve backwards compatibility with bccActors element
- Element bccActorsElement = XmlUtil.element(templateElement, "bccActors");
- if (bccActorsElement != null) {
- templateProperties.setProperty("bcc-actors", XmlUtil.getContentText(bccActorsElement));
+ // user, password
+ String [] propNameStrings = { JBPM_MAIL_USER, JBPM_MAIL_PASSWORD };
+ for( int i = 0; i < propNameStrings.length; ++i ) {
+ if (Configs.hasObject(propNameStrings[i])) {
+ String propVal = Configs.getString(propNameStrings[i]);
+ serverProperties.setProperty(propNameStrings[i], propVal);
+ }
}
- else {
- addTemplateProperty(templateElement, "bcc-actors", templateProperties);
+ // debug
+ jbpmProperty = JBPM_MAIL_DEBUG;
+ if (Configs.hasObject(jbpmProperty)) {
+ boolean debug = Configs.getBoolean(jbpmProperty);
+ serverProperties.setProperty(JBPM_MAIL_DEBUG, Boolean.toString(debug) );
}
-
- templatePropertiesMap.put(templateElement.getAttribute("name"), templateProperties);
}
- templatePropertiesByResource.put(resource, templatePropertiesMap);
-
- Map templateVariables = new HashMap();
- for (Iterator iter = XmlUtil.elementIterator(templatesElement, "variable"); iter.hasNext();) {
- Element variableElement = (Element) iter.next();
- templateVariables.put(variableElement.getAttribute("name"), variableElement.getAttribute("value"));
- }
- templateVariablesByResource.put(resource, templateVariables);
+
+ return serverProperties;
}
- private static void addTemplateProperty(Element templateElement, String property,
- Properties templateProperties) {
- Element element = XmlUtil.element(templateElement, property);
- if (element != null) {
- templateProperties.setProperty(property, XmlUtil.getContentText(element));
- }
- }
-
static class MailVariableResolver implements VariableResolver, Serializable {
private Map templateVariables;
@@ -459,5 +485,31 @@
}
}
- private static final Log log = LogFactory.getLog(Mail.class);
+ private static class MessageInfo implements Serializable {
+
+ private static final long serialVersionUID = -4252493407344235335L;
+
+ public Session session;
+ public String sender;
+ public Collection recipients;
+ public Collection ccRecipients;
+ public Collection bccRecipients;
+ public String subject;
+ public String text;
+
+ public MessageInfo() { }
+ public MessageInfo(Session session, String sender,
+ Collection recipients, Collection ccRecipients, Collection bccRecipients,
+ String subject, String text) {
+ this.session = session;
+ this.sender = sender;
+ this.recipients = recipients;
+ this.ccRecipients = ccRecipients;
+ this.bccRecipients = bccRecipients;
+ this.subject = subject;
+ this.text = text;
+ }
+
+ }
+
}
12 years, 7 months
JBoss JBPM SVN: r7030 - in jbpm3/branches/jbpm-3.2-soa: core/src/test/java/org/jbpm and 4 other directories.
by do-not-reply@jboss.org
Author: marco.rietveld
Date: 2011-10-10 21:39:55 -0400 (Mon, 10 Oct 2011)
New Revision: 7030
Added:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/MailTemplates.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386IntegrationTest.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386Test.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/gpd.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.cfg.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.integration.cfg.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/mail.templates.xml
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/processdefinition.xml
Modified:
jbpm3/branches/jbpm-3.2-soa/userguide/src/main/docbook/en-US/mail.xml
Log:
JBPM-3386: jBPM Mail Node does not authenticate, results in "Relay access denied" when recipient is not on local server
Added: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/MailTemplates.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/MailTemplates.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/MailTemplates.java 2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,85 @@
+package org.jbpm.mail;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jbpm.JbpmConfiguration.Configs;
+import org.jbpm.util.XmlUtil;
+import org.w3c.dom.Element;
+
+class MailTemplates {
+
+ private static final Map templatePropertiesByResource = new HashMap();
+ private static final Map templateVariablesByResource = new HashMap();
+
+ protected static Properties getTemplateProperties(String templateName) {
+ String resource = Configs.getString("resource.mail.templates");
+ synchronized (templatePropertiesByResource) {
+ Map templateProperties = (Map) templatePropertiesByResource.get(resource);
+ if (templateProperties == null) {
+ loadTemplates(resource);
+ templateProperties = (Map) templatePropertiesByResource.get(resource);
+ }
+ return (Properties) templateProperties.get(templateName);
+ }
+ }
+
+ protected static Map getTemplateVariables() {
+ String resource = Configs.getString("resource.mail.templates");
+ synchronized (templateVariablesByResource) {
+ Map templateVariables = (Map) templateVariablesByResource.get(resource);
+ if (templateVariables == null) {
+ loadTemplates(resource);
+ templateVariables = (Map) templateVariablesByResource.get(resource);
+ }
+ return templateVariables;
+ }
+ }
+
+ protected static void loadTemplates(String resource) {
+ Element templatesElement = XmlUtil.parseXmlResource(resource, true).getDocumentElement();
+
+ Map templatePropertiesMap = new HashMap();
+ for (Iterator iter = XmlUtil.elementIterator(templatesElement, "mail-template"); iter.hasNext();) {
+ Element templateElement = (Element) iter.next();
+
+ Properties templateProperties = new Properties();
+ addTemplateProperty(templateElement, "to", templateProperties);
+ addTemplateProperty(templateElement, "actors", templateProperties);
+ addTemplateProperty(templateElement, "subject", templateProperties);
+ addTemplateProperty(templateElement, "text", templateProperties);
+ addTemplateProperty(templateElement, "cc", templateProperties);
+ addTemplateProperty(templateElement, "cc-actors", templateProperties);
+ addTemplateProperty(templateElement, "bcc", templateProperties);
+ // preserve backwards compatibility with bccActors element
+ Element bccActorsElement = XmlUtil.element(templateElement, "bccActors");
+ if (bccActorsElement != null) {
+ templateProperties.setProperty("bcc-actors", XmlUtil.getContentText(bccActorsElement));
+ }
+ else {
+ addTemplateProperty(templateElement, "bcc-actors", templateProperties);
+ }
+
+ templatePropertiesMap.put(templateElement.getAttribute("name"), templateProperties);
+ }
+ templatePropertiesByResource.put(resource, templatePropertiesMap);
+
+ Map templateVariables = new HashMap();
+ for (Iterator iter = XmlUtil.elementIterator(templatesElement, "variable"); iter.hasNext();) {
+ Element variableElement = (Element) iter.next();
+ templateVariables.put(variableElement.getAttribute("name"), variableElement.getAttribute("value"));
+ }
+ templateVariablesByResource.put(resource, templateVariables);
+ }
+
+ protected static void addTemplateProperty(Element templateElement, String property,
+ Properties templateProperties) {
+ Element element = XmlUtil.element(templateElement, property);
+ if (element != null) {
+ templateProperties.setProperty(property, XmlUtil.getContentText(element));
+ }
+ }
+
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/mail/MailTemplates.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386IntegrationTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386IntegrationTest.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386IntegrationTest.java 2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.Jbpm3386;
+
+import java.io.IOException;
+import java.util.Random;
+
+import javax.mail.MessagingException;
+
+import org.jbpm.AbstractJbpmTestCase;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.mail.Mail;
+
+/**
+ * CC support in mail nodes and mail templates.
+ *
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-3386">JBPM-3386</a>
+ */
+public class JBPM3386IntegrationTest extends AbstractJbpmTestCase {
+
+ private static Random random = new Random();
+ int uniqueTestNum;
+
+ private JbpmContext jbpmContext;
+ private ProcessInstance processInstance;
+
+ private static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseResource("org/jbpm/jbpm3386/jbpm.integration.cfg.xml");
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ jbpmContext = jbpmConfiguration.createJbpmContext();
+
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("org/jbpm/jbpm3386/processdefinition.xml");
+ processInstance = new ProcessInstance(processDefinition);
+
+ ContextInstance contextInstance = processInstance.getContextInstance();
+ contextInstance.setVariable("to", "mrietvel(a)redhat.com");
+
+ uniqueTestNum = random.nextInt(Integer.MAX_VALUE);
+ }
+
+ protected void tearDown() throws Exception {
+ jbpmContext.close();
+ super.tearDown();
+ }
+
+ public void testDoNothing() {
+
+ }
+
+ /**
+ * This test sends an actual e-mail to a redhat e-mail address via the gmail smtp domain,
+ * which does NOT permit unauthenticated relaying -- and thus tests what we want it to.
+ * @throws MessagingException
+ * @throws IOException
+ */
+ public void dontTestSendViaAnotherDomainGmail() throws MessagingException, IOException {
+ String testMethod = (new Throwable()).getStackTrace()[0].getMethodName();
+ System.out.println( testMethod + ": " + uniqueTestNum );
+
+ String to = "mrietvel(a)redhat.com";
+ String subject = this.getClass().getName() + " test message [" + uniqueTestNum + "]";
+ String text = "\nThis is an automatic message generated by the " + testMethod + " test.\n";
+
+ Mail mail = new Mail(null, null, to, subject, text);
+ mail.send();
+ }
+
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386IntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386Test.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386Test.java 2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,185 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.Jbpm3386;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.mail.AuthenticationFailedException;
+import javax.mail.Message.RecipientType;
+import javax.mail.MessagingException;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+
+import junit.framework.Test;
+
+import org.apache.log4j.Logger;
+import org.jbpm.AbstractJbpmTestCase;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.JbpmException;
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.mail.MailTestSetup;
+import org.subethamail.smtp.AuthenticationHandler;
+import org.subethamail.smtp.AuthenticationHandlerFactory;
+import org.subethamail.smtp.auth.LoginAuthenticationHandler;
+import org.subethamail.smtp.auth.LoginFailedException;
+import org.subethamail.smtp.auth.PlainAuthenticationHandler;
+import org.subethamail.smtp.auth.PluginAuthenticationHandler;
+import org.subethamail.smtp.auth.UsernamePasswordValidator;
+import org.subethamail.smtp.server.MessageListenerAdapter;
+import org.subethamail.wiser.Wiser;
+import org.subethamail.wiser.WiserMessage;
+
+/**
+ * Auth/relay support in mail nodes.
+ *
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-3386">JBPM-3386</a>
+ */
+public class JBPM3386Test extends AbstractJbpmTestCase {
+
+ protected static Logger log = Logger.getLogger(JBPM3386Test.class);
+
+ private JbpmContext jbpmContext;
+ private ProcessInstance processInstance;
+
+ private static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseResource("org/jbpm/jbpm3386/jbpm.cfg.xml");
+ private static Wiser wiser;
+
+ private static String authUsername = "doug(a)newcastle.uk";
+ private static String authPassword = "newcastlePoolHustler#1!";
+
+ private static final String toAddress = "tester(a)jboss.org";
+
+ protected void setUp() throws Exception {
+ wiser = new Wiser();
+ MessageListenerAdapter serverMessageListenerAdapter = (MessageListenerAdapter) wiser.getServer()
+ .getMessageHandlerFactory();
+ serverMessageListenerAdapter.setAuthenticationHandlerFactory(new JBPM3386AuthHandlerFactory());
+ wiser.setPort(2525);
+ wiser.start();
+
+ // jbpm test setup
+ super.setUp();
+
+ jbpmContext = jbpmConfiguration.createJbpmContext();
+
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("org/jbpm/jbpm3386/processdefinition.xml");
+ processInstance = new ProcessInstance(processDefinition);
+
+ ContextInstance contextInstance = processInstance.getContextInstance();
+ contextInstance.setVariable("to", toAddress);
+
+ // start process
+ processInstance.signal();
+ }
+
+ protected void tearDown() throws Exception {
+ if (wiser != null) {
+ wiser.getMessages().clear();
+ wiser.stop();
+ wiser = null;
+ }
+ jbpmContext.close();
+ super.tearDown();
+ }
+
+ public void testMailWithAuthentication() throws MessagingException {
+ processInstance.signal();
+ assertEquals("end", processInstance.getRootToken().getNode().getName());
+
+ List messages = wiser.getMessages();
+ assertEquals(1, messages.size());
+
+ for (Iterator iter = messages.iterator(); iter.hasNext();) {
+ WiserMessage wiserMessage = (WiserMessage) iter.next();
+ MimeMessage message = wiserMessage.getMimeMessage();
+ assertEquals("Test message for jbpm 3386", message.getSubject());
+ assertTrue(Arrays.equals(InternetAddress.parse(toAddress), message.getRecipients(RecipientType.TO)));
+ }
+ }
+
+ public void testMailWithAuthenticationFailPassword() throws MessagingException {
+ authPassword = "bad password";
+ try {
+ processInstance.signal();
+ fail("An exception should have been thrown here.");
+ }
+ catch (Exception e) {
+ if (!(e instanceof JbpmException)) {
+ e.printStackTrace();
+ fail("Expected an JbpmException, not an exception of type " + e.getClass().getName() + ": " + e.getMessage());
+ }
+
+ Throwable cause = e.getCause();
+ if(cause == null || !(cause instanceof AuthenticationFailedException)) {
+ e.printStackTrace();
+ fail("Expected an AuthenticationFailedException, not an exception of type "
+ + e.getClass().getName() + ": " + e.getMessage());
+ }
+ }
+ }
+
+ public void testMailWithAuthenticationFailUser() throws MessagingException {
+ authUsername = "trevor";
+ try {
+ processInstance.signal();
+ fail("An exception should have been thrown here.");
+ }
+ catch (Exception e) {
+ if (!(e instanceof JbpmException)) {
+ e.printStackTrace();
+ fail("Expected an JbpmException, not an exception of type " + e.getClass().getName() + ": " + e.getMessage());
+ }
+
+ Throwable cause = e.getCause();
+ if(cause == null || !(cause instanceof AuthenticationFailedException)) {
+ e.printStackTrace();
+ fail("Expected an AuthenticationFailedException, not an exception of type "
+ + e.getClass().getName() + ": " + e.getMessage());
+ }
+ }
+ }
+
+ public static class JBPM3386AuthHandlerFactory implements AuthenticationHandlerFactory {
+ public AuthenticationHandler create() {
+ PluginAuthenticationHandler ret = new PluginAuthenticationHandler();
+ UsernamePasswordValidator validator = new UsernamePasswordValidator() {
+ public void login(String username, String password) throws LoginFailedException {
+ if (!authUsername.equals(username) || !authPassword.equals(password)) {
+ String message = "Tried to login with user/password [" + username + "/" + password
+ + "]";
+ log.info(message);
+ System.out.println(message);
+ throw new LoginFailedException("Incorrect password for user " + authUsername);
+ }
+ }
+ };
+ ret.addPlugin(new PlainAuthenticationHandler(validator));
+ ret.addPlugin(new LoginAuthenticationHandler(validator));
+ return ret;
+ }
+ }
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/Jbpm3386/JBPM3386Test.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/gpd.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/gpd.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/gpd.xml 2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<root-container name="jbpm2852" width="1156" height="898">
+ <node name="start" x="138" y="144" width="121" height="37">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="send mail" x="139" y="220" width="124" height="36">
+ <edge>
+ <label x="5" y="-10"/>
+ </edge>
+ </node>
+ <node name="end" x="129" y="298" width="132" height="36"/>
+ <deployment serverName="" serverPort="" serverDeployer=""/>
+</root-container>
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/gpd.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.cfg.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.cfg.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.cfg.xml 2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbpm-configuration>
+ <jbpm-context />
+ <string name="resource.mail.templates" value="org/jbpm/jbpm3386/mail.templates.xml" />
+ <int name="jbpm.mail.smtp.port" value="2525" />
+ <string name="jbpm.mail.user" value="doug(a)newcastle.uk" />
+ <string name="jbpm.mail.password" value="newcastlePoolHustler#1!" />
+</jbpm-configuration>
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.cfg.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.integration.cfg.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.integration.cfg.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.integration.cfg.xml 2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbpm-configuration>
+ <jbpm-context />
+ <string name="resource.mail.templates" value="org/jbpm/jbpm3386/mail.templates.xml" />
+
+ <!-- Existing (standard) properties -->
+ <bean name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResolver" singleton="true" />
+ <string name="jbpm.mail.smtp.host" value="smtp.gmail.com" />
+ <int name="jbpm.mail.smtp.port" value="25" />
+ <string name="jbpm.mail.from.address" value="marcolof(a)gmail.com" />
+
+ <!-- Authentication -->
+ <string name="jbpm.mail.user" value="marcolof(a)gmail.com" />
+ <string name="jbpm.mail.password" value="this is not marco's gmail password" />
+ <boolean name="jbpm.mail.smtp.starttls" value="true" />
+ <boolean name="jbpm.mail.smtp.auth" value="true" />
+
+ <!-- the client had this set to false -->
+ <boolean name="jbpm.mail.debug" value="true" />
+
+</jbpm-configuration>
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/jbpm.integration.cfg.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/mail.templates.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/mail.templates.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/mail.templates.xml 2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mail-templates>
+ <mail-template name='jbpm3386-mail-template'>
+ <to>${to}</to>
+ <subject>Test message for jbpm 3386</subject>
+ <text><![CDATA[Keep up the good work!]]></text>
+ </mail-template>
+</mail-templates>
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/mail.templates.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/processdefinition.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/processdefinition.xml (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/processdefinition.xml 2011-10-11 01:39:55 UTC (rev 7030)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="jbpm2852">
+
+ <start-state name="start">
+ <transition to="send mail" />
+ </start-state>
+
+ <state name="send mail">
+ <transition to="end">
+ <mail name="send mail" template="jbpm3386-mail-template" />
+ </transition>
+ </state>
+
+ <end-state name="end" />
+
+</process-definition>
Property changes on: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm3386/processdefinition.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Modified: jbpm3/branches/jbpm-3.2-soa/userguide/src/main/docbook/en-US/mail.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/userguide/src/main/docbook/en-US/mail.xml 2011-09-08 10:53:16 UTC (rev 7029)
+++ jbpm3/branches/jbpm-3.2-soa/userguide/src/main/docbook/en-US/mail.xml 2011-10-11 01:39:55 UTC (rev 7030)
@@ -6,7 +6,7 @@
<chapter id="mail">
<title>
- E. Mail Support
+ Email Support
</title>
<para>
@@ -26,10 +26,9 @@
in turn.
</para>
-
<section id="mailaction">
<title>
- Mail Action
+ Mail Action
</title>
<para>
@@ -86,7 +85,7 @@
</note>
<para>
- E. mails can be defined by the use of templates. Overwrite
+ Emails can be defined by the use of templates. Overwrite
template properties in this way:
</para>
@@ -133,7 +132,7 @@
<section id="taskassignmails">
<title>
- "Task Assigned" E. Mail
+ "Task Assigned" Email
</title>
<para>
@@ -156,11 +155,11 @@
<section id="taskremindermails">
<title>
- "Task Reminder" E. Mail
+ "Task Reminder" Email
</title>
<para>
- E. mails can be sent as task reminders. JPDL's
+ Emails can be sent as task reminders. JPDL's
<property>reminder</property> element utilizes the timer. The
most commonly used attributes are <property>duedate</property>
and <property>repeat</property>. Note that actions do not have
@@ -214,7 +213,7 @@
<section id="specifyingmailrecipients">
<title>
- Specifying E. Mail Recipients
+ Specifying Email Recipients
</title>
<section id="multiplerecipients">
@@ -228,7 +227,7 @@
<section id="BCC">
<title>
- Sending E. Mail to a BCC Address
+ Sending Email to a BCC Address
</title>
<para>
@@ -313,7 +312,7 @@
<section id="mailtemplates">
<title>
- E. Mail Templates
+ Email Templates
</title>
@@ -364,6 +363,93 @@
</section>
+ <section id="emailauthorization">
+ <title>
+ Email Authentication
+ </title>
+
+ <section id="emailauthorizationparameters">
+ <title>
+ Email authentication configuration
+ </title>
+
+ <para>
+ The following settings can be used to enable (SMTP) authentication when sending email.
+ </para>
+
+ <table>
+ <title>jBPM mail authentication properties</title>
+ <tgroup cols="3" colsep="1" rowsep="1">
+ <colspec colwidth="*"/>
+ <colspec colwidth="3"/>
+ <colspec colwidth="*"/>
+ <thead>
+ <row><entry>Property</entry><entry>Type</entry><entry>Description</entry></row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><property>jbpm.mail.user</property></entry>
+ <entry><para>string</para></entry>
+ <entry><para>The email address of the user</para></entry>
+ </row>
+ <row>
+ <entry><property>jbpm.mail.password</property></entry>
+ <entry><para>string</para></entry>
+ <entry><para>The password for that email address</para></entry>
+ </row>
+ <row>
+ <entry><property>jbpm.mail.smtp.starttls</property></entry>
+ <entry><para>boolean</para></entry>
+ <entry><para>Whether or not to use the STARTTLS protocol with the SMTP server</para></entry>
+ </row>
+ <row>
+ <entry><property>jbpm.mail.smtp.auth</property></entry>
+ <entry><para>boolean</para></entry>
+ <entry><para>Whether or not to use the SMTP authentication protocol</para></entry>
+ </row>
+ <row>
+ <entry><property>jbpm.mail.debug</property></entry>
+ <entry><para>boolean</para></entry>
+ <entry><para>Whether or not to set the javax.mail.Session instance to debug mode</para></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+
+ <section id="emailauthorizationparameters">
+ <title>
+ Email authentication logic
+ </title>
+
+ <para>
+ The following logic is applied with regards to the above properties:
+ </para>
+
+ <para>
+ If neither the jbpm.mail.user nor the jbpm.mail.password property is set, authentication is
+ not used regardless of other settings set.
+ </para>
+
+ <para>
+ If the jbpm.mail.user property is set, then the following is done:
+ <itemizedlist>
+ <listitem><para>The mail.smtp.submitter property is set with the value of the jbpm.mail.user property</para></listitem>
+ <listitem><para>The jbpm engine will try to login into the smtp server when sending email.</para></listitem>
+ </itemizedlist>
+ </para>
+
+ <para>
+ If the jbpm.mail.user property and the jbpm.mail.password property are set, then the following is done:
+ <itemizedlist>
+ <listitem><para>Everything that is done when at least the jbpm.mail.user is set, is also done in this case</para></listitem>
+ <listitem><para>The mail.smtp.auth property is set to true, regardless of the value of the jbpm.mail.smtp.auth property</para></listitem>
+ </itemizedlist>
+ </para>
+ </section>
+
+ </section>
+
<section id="fromaddressconfiguration">
<title>
"From" Address Configuration
@@ -381,7 +467,7 @@
<section id="customizingmailsupport">
<title>
- Customizing E. Mail Support
+ Customizing Email Support
</title>
<para>
12 years, 7 months