JBoss JBPM SVN: r4464 - jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/filter.
by do-not-reply@jboss.org
Author: bradsdavis
Date: 2009-04-06 20:13:47 -0400 (Mon, 06 Apr 2009)
New Revision: 4464
Modified:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilter.java
Log:
Fixed issue with null pointer exception.
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilter.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilter.java 2009-04-06 23:06:13 UTC (rev 4463)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/filter/WildCardAddressFilter.java 2009-04-07 00:13:47 UTC (rev 4464)
@@ -12,7 +12,7 @@
* @author Brad Davis
*
*/
-public abstract class WildCardAddressFilter implements AddressFilter {
+public class WildCardAddressFilter implements AddressFilter {
protected Collection<String> includePatterns;
protected Collection<String> excludePatterns;
@@ -51,11 +51,14 @@
}
}
}
- for(String pattern : excludePatterns)
+ if(excludePatterns!=null)
{
- if(Pattern.matches(pattern, address.toString()))
+ for(String pattern : excludePatterns)
{
- return false;
+ if(Pattern.matches(pattern, address.toString()))
+ {
+ return false;
+ }
}
}
if(includePatterns==null||includePatterns.isEmpty())
17 years
JBoss JBPM SVN: r4463 - jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-04-06 19:06:13 -0400 (Mon, 06 Apr 2009)
New Revision: 4463
Modified:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java
Log:
replace String.isEmpty() with code compatible with jdk 5
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java 2009-04-06 22:54:34 UTC (rev 4462)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java 2009-04-06 23:06:13 UTC (rev 4463)
@@ -76,11 +76,11 @@
protected String constructName(User user)
{
String name = null;
- if(user.getGivenName()!=null&&!user.getGivenName().isEmpty())
+ if(user.getGivenName()!=null&&user.getGivenName().length()>0)
{
name = user.getGivenName();
}
- if(user.getFamilyName()!=null&&!user.getFamilyName().isEmpty())
+ if(user.getFamilyName()!=null&&user.getFamilyName().length()>0)
{
if(name==null)
{
17 years
JBoss JBPM SVN: r4462 - jbpm4/branches/email/modules/integration.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-04-06 18:54:34 -0400 (Mon, 06 Apr 2009)
New Revision: 4462
Added:
jbpm4/branches/email/modules/integration/.project
Modified:
jbpm4/branches/email/modules/integration/
Log:
Property changes on: jbpm4/branches/email/modules/integration
___________________________________________________________________
Name: svn:ignore
+ target
Added: jbpm4/branches/email/modules/integration/.project
===================================================================
--- jbpm4/branches/email/modules/integration/.project (rev 0)
+++ jbpm4/branches/email/modules/integration/.project 2009-04-06 22:54:34 UTC (rev 4462)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jbpm-integration</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
17 years
JBoss JBPM SVN: r4461 - jbpm3/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/console.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-04-06 18:49:42 -0400 (Mon, 06 Apr 2009)
New Revision: 4461
Removed:
jbpm3/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/console/Base64Coder.java
jbpm3/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/console/HTTP.java
Modified:
jbpm3/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/console/ConsoleAvailabilityTest.java
Log:
simplify console test
Deleted: jbpm3/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/console/Base64Coder.java
===================================================================
--- jbpm3/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/console/Base64Coder.java 2009-04-06 22:22:55 UTC (rev 4460)
+++ jbpm3/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/console/Base64Coder.java 2009-04-06 22:49:42 UTC (rev 4461)
@@ -1,147 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.enterprise.console;
-
-/**
- * A Base64 Encoder/Decoder.
- */
-public class Base64Coder
-{
-
- // Mapping table from 6-bit nibbles to Base64 characters.
- private static char[] map1 = new char[64];
- static {
- int i=0;
- for (char c='A'; c<='Z'; c++) map1[i++] = c;
- for (char c='a'; c<='z'; c++) map1[i++] = c;
- for (char c='0'; c<='9'; c++) map1[i++] = c;
- map1[i++] = '+'; map1[i++] = '/'; }
-
- // Mapping table from Base64 characters to 6-bit nibbles.
- private static byte[] map2 = new byte[128];
- static {
- for (int i=0; i<map2.length; i++) map2[i] = -1;
- for (int i=0; i<64; i++) map2[map1[i]] = (byte)i; }
-
- /**
- * Encodes a string into Base64 format.
- * No blanks or line breaks are inserted.
- * @param s a String to be encoded.
- * @return A String with the Base64 encoded data.
- */
- public static String encodeString (String s) {
- return new String(encode(s.getBytes())); }
-
- /**
- * Encodes a byte array into Base64 format.
- * No blanks or line breaks are inserted.
- * @param in an array containing the data bytes to be encoded.
- * @return A character array with the Base64 encoded data.
- */
- public static char[] encode (byte[] in) {
- return encode(in,in.length); }
-
- /**
- * Encodes a byte array into Base64 format.
- * No blanks or line breaks are inserted.
- * @param in an array containing the data bytes to be encoded.
- * @param iLen number of bytes to process in <code>in</code>.
- * @return A character array with the Base64 encoded data.
- */
- public static char[] encode (byte[] in, int iLen) {
- int oDataLen = (iLen*4+2)/3; // output length without padding
- int oLen = ((iLen+2)/3)*4; // output length including padding
- char[] out = new char[oLen];
- int ip = 0;
- int op = 0;
- while (ip < iLen) {
- int i0 = in[ip++] & 0xff;
- int i1 = ip < iLen ? in[ip++] & 0xff : 0;
- int i2 = ip < iLen ? in[ip++] & 0xff : 0;
- int o0 = i0 >>> 2;
- int o1 = ((i0 & 3) << 4) | (i1 >>> 4);
- int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6);
- int o3 = i2 & 0x3F;
- out[op++] = map1[o0];
- out[op++] = map1[o1];
- out[op] = op < oDataLen ? map1[o2] : '='; op++;
- out[op] = op < oDataLen ? map1[o3] : '='; op++; }
- return out; }
-
- /**
- * Decodes a string from Base64 format.
- * @param s a Base64 String to be decoded.
- * @return A String containing the decoded data.
- * @throws IllegalArgumentException if the input is not valid Base64 encoded data.
- */
- public static String decodeString (String s) {
- return new String(decode(s)); }
-
- /**
- * Decodes a byte array from Base64 format.
- * @param s a Base64 String to be decoded.
- * @return An array containing the decoded data bytes.
- * @throws IllegalArgumentException if the input is not valid Base64 encoded data.
- */
- public static byte[] decode (String s) {
- return decode(s.toCharArray()); }
-
- /**
- * Decodes a byte array from Base64 format.
- * No blanks or line breaks are allowed within the Base64 encoded data.
- * @param in a character array containing the Base64 encoded data.
- * @return An array containing the decoded data bytes.
- * @throws IllegalArgumentException if the input is not valid Base64 encoded data.
- */
- public static byte[] decode (char[] in) {
- int iLen = in.length;
- if (iLen%4 != 0) throw new IllegalArgumentException ("Length of Base64 encoded input string is not a multiple of 4.");
- while (iLen > 0 && in[iLen-1] == '=') iLen--;
- int oLen = (iLen*3) / 4;
- byte[] out = new byte[oLen];
- int ip = 0;
- int op = 0;
- while (ip < iLen) {
- int i0 = in[ip++];
- int i1 = in[ip++];
- int i2 = ip < iLen ? in[ip++] : 'A';
- int i3 = ip < iLen ? in[ip++] : 'A';
- if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127)
- throw new IllegalArgumentException ("Illegal character in Base64 encoded data.");
- int b0 = map2[i0];
- int b1 = map2[i1];
- int b2 = map2[i2];
- int b3 = map2[i3];
- if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0)
- throw new IllegalArgumentException ("Illegal character in Base64 encoded data.");
- int o0 = ( b0 <<2) | (b1>>>4);
- int o1 = ((b1 & 0xf)<<4) | (b2>>>2);
- int o2 = ((b2 & 3)<<6) | b3;
- out[op++] = (byte)o0;
- if (op<oLen) out[op++] = (byte)o1;
- if (op<oLen) out[op++] = (byte)o2; }
- return out; }
-
- // Dummy constructor.
- private Base64Coder() {}
-
-} // end class Base64Coder
Modified: jbpm3/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/console/ConsoleAvailabilityTest.java
===================================================================
--- jbpm3/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/console/ConsoleAvailabilityTest.java 2009-04-06 22:22:55 UTC (rev 4460)
+++ jbpm3/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/console/ConsoleAvailabilityTest.java 2009-04-06 22:49:42 UTC (rev 4461)
@@ -21,6 +21,14 @@
*/
package org.jbpm.enterprise.console;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
import junit.framework.TestCase;
/**
@@ -28,20 +36,69 @@
*/
public class ConsoleAvailabilityTest extends TestCase
{
-
/**
* Verify if the console has been deployed successfully
- * @throws Exception
*/
- public void testConsoleDeployment()
- throws Exception
+ public void testConsoleDeployment() throws IOException
{
+ String host = "localhost";
+ int port = 8080;
+
String bindAddress = System.getProperty("jboss.bind.address");
- String host = bindAddress !=null ? bindAddress : "localhost:8080";
- if(host.indexOf(":")==-1) host = (host+":8080"); // default port
+ if (bindAddress != null)
+ {
+ int colonIndex = bindAddress.lastIndexOf(':');
+ if (colonIndex != -1)
+ {
+ host = bindAddress.substring(0, colonIndex);
+ port = Integer.parseInt(bindAddress.substring(colonIndex + 1));
+ }
+ else
+ host = bindAddress;
+ }
- System.out.println("Console URL: " + host);
- String response = HTTP.get("http://"+host +"/jbpm-console", null, true); // no auth
+ URL url = new URL("http", host, port, "/jbpm-console");
+ System.out.println("Console URL: " + url);
+
+ List<String> response = doGet(url);
+ assertEquals(HttpURLConnection.HTTP_OK, Integer.parseInt(response.get(0)));
}
+ /**
+ * Gets the resource pointed by the given URL.
+ * @param url a pointer to a resource
+ * @return response data in the following order:
+ * <
+ * <li>Code</li>
+ * <li>Message</li>
+ * <li>Body</li>
+ * @throws IOException
+ */
+ static List<String> doGet(URL url) throws IOException
+ {
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ try
+ {
+ List<String> response = new ArrayList<String>();
+ response.add(Integer.toString(connection.getResponseCode()));
+ response.add(connection.getResponseMessage());
+
+ BufferedReader connReader = new BufferedReader(new InputStreamReader(connection
+ .getInputStream()));
+ try
+ {
+ for (String line; (line = connReader.readLine()) != null;)
+ response.add(line);
+ }
+ finally
+ {
+ connReader.close();
+ }
+ return response;
+ }
+ finally
+ {
+ connection.disconnect();
+ }
+ }
}
Deleted: jbpm3/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/console/HTTP.java
===================================================================
--- jbpm3/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/console/HTTP.java 2009-04-06 22:22:55 UTC (rev 4460)
+++ jbpm3/trunk/modules/enterprise/src/test/java/org/jbpm/enterprise/console/HTTP.java 2009-04-06 22:49:42 UTC (rev 4461)
@@ -1,214 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.enterprise.console;
-
-import java.io.*;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.UUID;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class HTTP
-{
- public static String post(String urlString, InputStream inputStream, String[] credentials)
- throws Exception
- {
-
- HttpURLConnection conn = null;
- BufferedReader br = null;
- DataOutputStream dos = null;
- DataInputStream inStream = null;
-
- InputStream is = null;
- OutputStream os = null;
- boolean ret = false;
- String StrMessage = "";
-
-
- String lineEnd = "\r\n";
- String twoHyphens = "--";
- String boundary = "*****";
-
-
- int bytesRead, bytesAvailable, bufferSize;
-
- byte[] buffer;
-
- int maxBufferSize = 1*1024*1024;
-
- String responseFromServer = "";
-
- try
- {
- //------------------ CLIENT REQUEST
-
- // open a URL connection to the Servlet
-
- URL url = new URL(urlString);
-
-
- // Open a HTTP connection to the URL
-
- conn = (HttpURLConnection) url.openConnection();
-
- if(credentials!=null)
- applyCredentials(credentials, conn);
-
- // Allow Inputs
- conn.setDoInput(true);
-
- // Allow Outputs
- conn.setDoOutput(true);
-
- // Don't use a cached copy.
- conn.setUseCaches(false);
-
- // Use a post method.
- conn.setRequestMethod("POST");
-
- conn.setRequestProperty("Connection", "Keep-Alive");
-
- conn.setRequestProperty("Content-Type", "multipart/form-data;boundary="+boundary);
-
- dos = new DataOutputStream( conn.getOutputStream() );
-
- dos.writeBytes(twoHyphens + boundary + lineEnd);
- dos.writeBytes("Content-Disposition: form-data; name=\"upload\";"
- + " filename=\"" + UUID.randomUUID().toString() +"\"" + lineEnd);
- dos.writeBytes(lineEnd);
-
- // create a buffer of maximum size
- bytesAvailable = inputStream.available();
- bufferSize = Math.min(bytesAvailable, maxBufferSize);
- buffer = new byte[bufferSize];
-
- // read file and write it into form...
- bytesRead = inputStream.read(buffer, 0, bufferSize);
-
- while (bytesRead > 0)
- {
- dos.write(buffer, 0, bufferSize);
- bytesAvailable = inputStream.available();
- bufferSize = Math.min(bytesAvailable, maxBufferSize);
- bytesRead = inputStream.read(buffer, 0, bufferSize);
- }
-
- // send multipart form data necesssary after file data...
-
- dos.writeBytes(lineEnd);
- dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
-
- // close streams
-
- inputStream.close();
- dos.flush();
- dos.close();
-
- }
- catch (MalformedURLException ex)
- {
- throw ex;
- }
-
- catch (IOException ioe)
- {
- throw ioe;
- }
-
-
- //------------------ read the SERVER RESPONSE
-
- StringBuffer sb = new StringBuffer();
-
- try
- {
- inStream = new DataInputStream ( conn.getInputStream() );
- String str;
- while (( str = inStream.readLine()) != null)
- {
- sb.append(str).append("");
- }
- inStream.close();
-
- }
- catch (IOException ioex)
- {
- System.out.println("From (ServerResponse): "+ioex);
-
- }
-
-
- return sb.toString();
-
- }
-
- private static void applyCredentials(String[] credentials, HttpURLConnection conn)
- {
- String userPassword = credentials[0]+":"+credentials[1];
- String encoding = new String(Base64Coder.encode (userPassword.getBytes()));
- conn.setRequestProperty ("Authorization", "Basic " + encoding);
- }
-
- public static String get(String urlString, String[] credentials, boolean throwServerError)
- {
- StringBuffer sb = new StringBuffer();
- try
- {
- URL url = new URL(urlString);
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- if(credentials!=null)
- applyCredentials(credentials, conn);
-
-
- if(throwServerError && conn.getResponseCode()!=200)
- {
- throw new RuntimeException("Server response " + conn.getResponseCode());
- }
-
- BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
- String str;
-
-
- while ((str = in.readLine()) != null)
- {
- sb.append(str);
- }
-
- in.close();
- }
- catch (MalformedURLException e)
- {
- throw new RuntimeException(e);
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
-
- return sb.toString();
- }
-}
-
-
17 years
JBoss JBPM SVN: r4460 - in jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email: server and 1 other directory.
by do-not-reply@jboss.org
Author: bradsdavis
Date: 2009-04-06 18:22:55 -0400 (Mon, 06 Apr 2009)
New Revision: 4460
Modified:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/server/SmtpServer.java
Log:
Updated the script mail producer comments.
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java 2009-04-06 15:18:40 UTC (rev 4459)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java 2009-04-06 22:22:55 UTC (rev 4460)
@@ -19,7 +19,8 @@
throws Exception {
ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
- //TODO: Need to pass in execution rather than environment?
+
+ //Here, you just need to populate the body of the message if it is a simple text email.
this.body = (String)scriptManager.evaluateScript(script, exe, language);
return super.produce(exe, mailContext);
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/server/SmtpServer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/server/SmtpServer.java 2009-04-06 15:18:40 UTC (rev 4459)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/server/SmtpServer.java 2009-04-06 22:22:55 UTC (rev 4460)
@@ -19,4 +19,8 @@
{
return Session.getDefaultInstance(properties, null);
}
+
+ public void setProperties(Properties properties) {
+ this.properties = properties;
+ }
}
17 years
JBoss JBPM SVN: r4459 - in jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer: impl and 1 other directory.
by do-not-reply@jboss.org
Author: bradsdavis
Date: 2009-04-06 11:18:40 -0400 (Mon, 06 Apr 2009)
New Revision: 4459
Modified:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailProducer.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java
Log:
Changed the Environment to Execution
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailProducer.java 2009-04-06 14:36:41 UTC (rev 4458)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailProducer.java 2009-04-06 15:18:40 UTC (rev 4459)
@@ -3,8 +3,8 @@
import java.util.Collection;
import org.apache.commons.mail.Email;
-import org.jbpm.env.Environment;
+import org.jbpm.Execution;
public interface MailProducer {
- public Collection<Email> produce(final Environment env, final MailContext mailContext) throws Exception;
+ public Collection<Email> produce(final Execution exe, final MailContext mailContext) throws Exception;
}
\ No newline at end of file
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java 2009-04-06 14:36:41 UTC (rev 4458)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java 2009-04-06 15:18:40 UTC (rev 4459)
@@ -3,6 +3,7 @@
import java.util.Collection;
import org.apache.commons.mail.Email;
+import org.jbpm.Execution;
import org.jbpm.env.Environment;
import org.jbpm.pvm.internal.email.producer.MailContext;
import org.jbpm.pvm.internal.script.ScriptManager;
@@ -14,13 +15,13 @@
protected String language;
@Override
- public Collection<Email> produce(Environment env, MailContext mailContext)
+ public Collection<Email> produce(final Execution exe, final MailContext mailContext)
throws Exception {
ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
//TODO: Need to pass in execution rather than environment?
- this.body = (String)scriptManager.evaluateScript(script, null, language);
+ this.body = (String)scriptManager.evaluateScript(script, exe, language);
- return super.produce(env, mailContext);
+ return super.produce(exe, mailContext);
}
}
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java 2009-04-06 14:36:41 UTC (rev 4458)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java 2009-04-06 15:18:40 UTC (rev 4459)
@@ -8,6 +8,7 @@
import org.apache.commons.mail.Email;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
+import org.jbpm.Execution;
import org.jbpm.env.Environment;
import org.jbpm.identity.Group;
import org.jbpm.identity.User;
@@ -20,7 +21,7 @@
protected String body;
protected String subject;
- public Collection<Email> produce(final Environment env, final MailContext mailContext) throws Exception {
+ public Collection<Email> produce(final Execution exe, final MailContext mailContext) throws Exception {
//Create a simple email with the body set.
Email email = new SimpleEmail();
17 years
JBoss JBPM SVN: r4458 - jbpm4/trunk/modules/distro/src/main/resources/config-tool/jboss/datasource.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-06 10:36:41 -0400 (Mon, 06 Apr 2009)
New Revision: 4458
Modified:
jbpm4/trunk/modules/distro/src/main/resources/config-tool/jboss/datasource/jbpm-oracle-ds.xml
Log:
Try <track-connection-by-tx/> in oracle-ds.xml
Modified: jbpm4/trunk/modules/distro/src/main/resources/config-tool/jboss/datasource/jbpm-oracle-ds.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/resources/config-tool/jboss/datasource/jbpm-oracle-ds.xml 2009-04-06 14:18:47 UTC (rev 4457)
+++ jbpm4/trunk/modules/distro/src/main/resources/config-tool/jboss/datasource/jbpm-oracle-ds.xml 2009-04-06 14:36:41 UTC (rev 4458)
@@ -15,6 +15,7 @@
<datasources>
<xa-datasource>
<jndi-name>JbpmDS</jndi-name>
+ <track-connection-by-tx/>
<!-- uncomment to enable interleaving <interleaving/> -->
<isSameRM-override-value>false</isSameRM-override-value>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
17 years
JBoss JBPM SVN: r4457 - in jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer: impl and 1 other directory.
by do-not-reply@jboss.org
Author: bradsdavis
Date: 2009-04-06 10:18:47 -0400 (Mon, 06 Apr 2009)
New Revision: 4457
Modified:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailContext.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java
Log:
Moved content based properties to producers.
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailContext.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailContext.java 2009-04-06 14:12:18 UTC (rev 4456)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/MailContext.java 2009-04-06 14:18:47 UTC (rev 4457)
@@ -8,15 +8,12 @@
public class MailContext {
- private String producerType;
private Collection<User> actors;
private Collection<Group> groups;
private Collection<String> toAddresses;
private Collection<String> ccAddresses;
private Collection<String> bccAddresses;
- private Map<String, Object> keyValuePair;
- private String subject;
- private String body;
+
public Collection<User> getActors() {
return actors;
@@ -48,29 +45,5 @@
public void setBccAddresses(Collection<String> bccAddresses) {
this.bccAddresses = bccAddresses;
}
- public String getSubject() {
- return subject;
- }
- public void setSubject(String subject) {
- this.subject = subject;
- }
- public String getBody() {
- return body;
- }
- public void setBody(String body) {
- this.body = body;
- }
- public Map<String, Object> getKeyValuePair() {
- return keyValuePair;
- }
- public void setKeyValuePair(Map<String, Object> keyValuePair) {
- this.keyValuePair = keyValuePair;
- }
- public String getProducerType() {
- return producerType;
- }
- public void setProducerType(String producerType) {
- this.producerType = producerType;
- }
}
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java 2009-04-06 14:12:18 UTC (rev 4456)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java 2009-04-06 14:18:47 UTC (rev 4457)
@@ -9,19 +9,18 @@
public class ScriptMailProducer extends SimpleMailProducer {
+
+ protected String script;
+ protected String language;
+
@Override
public Collection<Email> produce(Environment env, MailContext mailContext)
throws Exception {
- String script = (String)mailContext.getKeyValuePair().get("script");
- String language = (String)mailContext.getKeyValuePair().get("language");
-
ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
//TODO: Need to pass in execution rather than environment?
- String body = (String)scriptManager.evaluateScript(script, null, language);
+ this.body = (String)scriptManager.evaluateScript(script, null, language);
- mailContext.setBody(body);
-
return super.produce(env, mailContext);
}
}
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java 2009-04-06 14:12:18 UTC (rev 4456)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/SimpleMailProducer.java 2009-04-06 14:18:47 UTC (rev 4457)
@@ -17,6 +17,9 @@
public class SimpleMailProducer implements MailProducer {
+ protected String body;
+ protected String subject;
+
public Collection<Email> produce(final Environment env, final MailContext mailContext) throws Exception {
//Create a simple email with the body set.
Email email = new SimpleEmail();
@@ -25,8 +28,8 @@
populateAddresses(mailContext, email);
//Set subject and message.
- email.setSubject(mailContext.getSubject());
- email.setMsg(mailContext.getBody());
+ email.setSubject(subject);
+ email.setMsg(body);
Collection<Email> emails = new HashSet<Email>();
emails.add(email);
17 years
JBoss JBPM SVN: r4456 - jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl.
by do-not-reply@jboss.org
Author: bradsdavis
Date: 2009-04-06 10:12:18 -0400 (Mon, 06 Apr 2009)
New Revision: 4456
Modified:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java
Log:
Added setting of body based on outcome of script.
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java 2009-04-06 14:10:53 UTC (rev 4455)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java 2009-04-06 14:12:18 UTC (rev 4456)
@@ -18,8 +18,9 @@
ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
//TODO: Need to pass in execution rather than environment?
- Object body = scriptManager.evaluateScript(script, null, language);
+ String body = (String)scriptManager.evaluateScript(script, null, language);
+ mailContext.setBody(body);
return super.produce(env, mailContext);
}
17 years
JBoss JBPM SVN: r4455 - jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl.
by do-not-reply@jboss.org
Author: bradsdavis
Date: 2009-04-06 10:10:53 -0400 (Mon, 06 Apr 2009)
New Revision: 4455
Added:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java
Removed:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/JuelMailProducer.java
Log:
Updated to generalize the producer.
Deleted: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/JuelMailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/JuelMailProducer.java 2009-04-06 14:10:23 UTC (rev 4454)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/JuelMailProducer.java 2009-04-06 14:10:53 UTC (rev 4455)
@@ -1,26 +0,0 @@
-package org.jbpm.pvm.internal.email.producer.impl;
-
-import java.util.Collection;
-
-import org.apache.commons.mail.Email;
-import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.email.producer.MailContext;
-import org.jbpm.pvm.internal.script.ScriptManager;
-
-
-public class JuelMailProducer extends SimpleMailProducer {
- @Override
- public Collection<Email> produce(Environment env, MailContext mailContext)
- throws Exception {
-
- String script = (String)mailContext.getKeyValuePair().get("script");
- String language = (String)mailContext.getKeyValuePair().get("language");
-
- ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
- //TODO: Need to pass in execution rather than environment?
- Object body = scriptManager.evaluateScript(script, null, language);
-
-
- return super.produce(env, mailContext);
- }
-}
Copied: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java (from rev 4454, jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/JuelMailProducer.java)
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java (rev 0)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java 2009-04-06 14:10:53 UTC (rev 4455)
@@ -0,0 +1,26 @@
+package org.jbpm.pvm.internal.email.producer.impl;
+
+import java.util.Collection;
+
+import org.apache.commons.mail.Email;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.email.producer.MailContext;
+import org.jbpm.pvm.internal.script.ScriptManager;
+
+
+public class ScriptMailProducer extends SimpleMailProducer {
+ @Override
+ public Collection<Email> produce(Environment env, MailContext mailContext)
+ throws Exception {
+
+ String script = (String)mailContext.getKeyValuePair().get("script");
+ String language = (String)mailContext.getKeyValuePair().get("language");
+
+ ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
+ //TODO: Need to pass in execution rather than environment?
+ Object body = scriptManager.evaluateScript(script, null, language);
+
+
+ return super.produce(env, mailContext);
+ }
+}
17 years