[jboss-svn-commits] JBL Code SVN: r8940 - in labs/jbossesb/trunk/product/core: rosetta/src/org/jboss/soa/esb/couriers and 5 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Jan 20 11:20:44 EST 2007
Author: mark.little at jboss.com
Date: 2007-01-20 11:20:44 -0500 (Sat, 20 Jan 2007)
New Revision: 8940
Added:
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationException.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/EncryptionFailedException.java
Modified:
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockNotificationTarget.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/CourierUtil.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/persist/SqlDbTable.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationList.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationTarget.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyConsole.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyFiles.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyQueues.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifySqlTable.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyTopics.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyUtil.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/DefaultEncryptionFactory.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/Encryption.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStore.java
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget1.java
Log:
Method signature changes for finer granularity exceptions.
Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockNotificationTarget.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockNotificationTarget.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/util/MockNotificationTarget.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -8,61 +8,74 @@
import junit.framework.TestCase;
import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.notification.NotificationException;
import org.jboss.soa.esb.notification.NotificationTarget;
/**
- * Mock NotificationTarget Implementation.
- * <p/>
- * Configured by giving the target output list a 'name'. Notifications are statically accessed via the static
- * {@link #getTargetList(String)} method, supplying the target list name.
- * <p/>
+ * Mock NotificationTarget Implementation. <p/> Configured by giving the target
+ * output list a 'name'. Notifications are statically accessed via the static
+ * {@link #getTargetList(String)} method, supplying the target list name. <p/>
* Sample config:
+ *
* <pre>
- * <NotificationList type="OK">
- * <target class="org.jboss.soa.esb.util.MockNotificationTarget" <b>name="ok-target"</b> />
- * </NotificationList>
+ * <NotificationList type="OK">
+ * <target class="org.jboss.soa.esb.util.MockNotificationTarget" <b>name="ok-target"</b> />
+ * </NotificationList>
* </pre>
+ *
* @author tfennelly
*/
-public class MockNotificationTarget extends NotificationTarget {
+public class MockNotificationTarget extends NotificationTarget
+{
private static Hashtable<String, List<Serializable>> targetLists = new Hashtable<String, List<Serializable>>();
+
private List<Serializable> targetList;
-
- public MockNotificationTarget(ConfigTree config) {
+
+ public MockNotificationTarget (ConfigTree config)
+ {
super(config);
-
+
String name = config.getAttribute("name");
-
- if(name == null || name.trim().equals("")) {
- TestCase.fail("Mock NotificationTarget configured incorrectly. Must specify a 'name' attribute on the NotificationList/target element.");
+
+ if (name == null || name.trim().equals(""))
+ {
+ TestCase
+ .fail("Mock NotificationTarget configured incorrectly. Must specify a 'name' attribute on the NotificationList/target element.");
}
-
+
targetList = getTargetList(name);
}
-
- public static List<Serializable> getTargetList(String name) {
- synchronized (targetLists) {
+
+ public static List<Serializable> getTargetList (String name)
+ {
+ synchronized (targetLists)
+ {
List<Serializable> notificationList = targetLists.get(name);
-
+
// Never return a null list.
- if(notificationList == null) {
+ if (notificationList == null)
+ {
notificationList = new ArrayList<Serializable>();
targetLists.put(name, notificationList);
}
-
+
return notificationList;
}
}
-
- public static void clearNotifications() {
- synchronized (targetLists) {
+
+ public static void clearNotifications ()
+ {
+ synchronized (targetLists)
+ {
targetLists.clear();
}
}
@Override
- public void sendNotification(Serializable notificationObject) throws Exception {
+ public void sendNotification (Serializable notificationObject)
+ throws NotificationException
+ {
targetList.add(notificationObject);
}
}
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/CourierUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/CourierUtil.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/couriers/CourierUtil.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -44,6 +44,7 @@
import org.apache.log4j.Logger;
import org.jboss.internal.soa.esb.couriers.DeliverOnlyCourier;
import org.jboss.internal.soa.esb.couriers.PickUpOnlyCourier;
+import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.addressing.MalformedEPRException;
import org.jboss.soa.esb.addressing.eprs.FTPEpr;
@@ -61,7 +62,7 @@
private CourierUtil() {}
public static List<KeyValuePair> propertiesFromSelector(String selector)
- throws Exception
+ throws ConfigurationException
{
// No problem if selector is null - everything in queue will be returned
List<KeyValuePair> oRet = new ArrayList<KeyValuePair>();
@@ -72,7 +73,7 @@
String[] sa = sCurr.split("=");
if (sa.length != 2 || sa[1].charAt(0) != '\''
|| sa[1].charAt(-1 + sa[1].length()) != '\'')
- throw new Exception("Illegal message selector syntax <"
+ throw new ConfigurationException("Illegal message selector syntax <"
+ selector + ">");
KeyValuePair oNew = new KeyValuePair(sa[0], sa[1].substring(0,
-1 + sa[1].length()).substring(1));
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/persist/SqlDbTable.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/persist/SqlDbTable.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/helpers/persist/SqlDbTable.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -26,7 +26,10 @@
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
-public abstract class SqlDbTable {
+import org.jboss.soa.esb.ConfigurationException;
+
+public abstract class SqlDbTable
+{
protected String m_sTableName;
protected SqlField[] m_oaFields;
@@ -35,15 +38,18 @@
private JdbcCleanConn m_oConn;
- public JdbcCleanConn getConn() {
+ public JdbcCleanConn getConn ()
+ {
return m_oConn;
}
- public final String getTableName() {
+ public final String getTableName ()
+ {
return m_sTableName;
}
- public final SqlField[] getAllFields() {
+ public final SqlField[] getAllFields ()
+ {
return m_oaFields;
}
@@ -51,36 +57,37 @@
protected String m_sSelectSql;
- public SqlDbTable(JdbcCleanConn p_oC, String p_sTblNm) throws Exception {
+ public SqlDbTable (JdbcCleanConn p_oC, String p_sTblNm) throws SQLException, ConfigurationException
+ {
m_oConn = p_oC;
m_sTableName = p_sTblNm;
initFields();
} // ________________________________
- public abstract int setInsValues(PreparedStatement p_PS, Object bobj)
- throws Exception;
+ public abstract int setInsValues (PreparedStatement p_PS, Object bobj)
+ throws SQLException;
- public abstract Object getFromRS(ResultSet p_oRS) throws Exception;
+ public abstract Object getFromRS (ResultSet p_oRS) throws SQLException;
- protected abstract String getSelectFields();
+ protected abstract String getSelectFields ();
- public String getFldName(int p_i) {
- return (null == m_oaFields) ? null : (p_i < 0) ? null
- : (p_i >= m_oaFields.length) ? null : m_oaFields[p_i]
- .getFieldName();
+ public String getFldName (int p_i)
+ {
+ return (null == m_oaFields) ? null : (p_i < 0) ? null : (p_i >= m_oaFields.length) ? null : m_oaFields[p_i]
+ .getFieldName();
} // ________________________________
- public String getSelectStatement() {
- if (m_sSelectSql != null)
- return m_sSelectSql;
+ public String getSelectStatement ()
+ {
+ if (m_sSelectSql != null) return m_sSelectSql;
StringBuffer sb = new StringBuffer("select ").append(getSelectFields());
m_sSelectSql = sb.append(" from ").append(getTableName()).toString();
return m_sSelectSql;
} // ________________________________
- public String getInsertStatement() {
- if (m_sInsertSql != null)
- return m_sInsertSql;
+ public String getInsertStatement ()
+ {
+ if (m_sInsertSql != null) return m_sInsertSql;
StringBuffer sb = new StringBuffer(256);
sb.append("insert into ").append(getTableName());
@@ -93,9 +100,9 @@
return (m_sInsertSql = sb.toString());
} // ________________________________
- public String getUpdateStatement() {
- if (m_sUpdateSql != null)
- return m_sUpdateSql;
+ public String getUpdateStatement ()
+ {
+ if (m_sUpdateSql != null) return m_sUpdateSql;
StringBuffer sb = new StringBuffer(256);
sb.append("update ").append(getTableName()).append(" set ");
@@ -104,11 +111,12 @@
int iVal = 0;
int iWh = 0;
- for (int i = 0; i < m_oaFields.length; i++) {
+ for (int i = 0; i < m_oaFields.length; i++)
+ {
SqlField oCurr = m_oaFields[i];
- if (oCurr.isPrimaryKey())
- ((iWh++ < 1) ? sbWhere : sbWhere.append(" and ")).append(
- oCurr.getFieldName()).append(" = ?");
+ if (oCurr.isPrimaryKey()) ((iWh++ < 1) ? sbWhere : sbWhere
+ .append(" and ")).append(oCurr.getFieldName()).append(
+ " = ?");
else
((iVal++ < 1) ? sb : sb.append(",")).append(
oCurr.getFieldName()).append(" = ?");
@@ -118,18 +126,18 @@
return (m_sUpdateSql = sb.toString());
} // ________________________________
- public String getDeleteStatement() {
- if (m_sDeleteSql != null)
- return m_sDeleteSql;
+ public String getDeleteStatement ()
+ {
+ if (m_sDeleteSql != null) return m_sDeleteSql;
StringBuffer sb = new StringBuffer(256);
sb.append("delete from ").append(getTableName()).append(" where ");
int iWh = 0;
- for (int i = 0; i < m_oaFields.length; i++) {
+ for (int i = 0; i < m_oaFields.length; i++)
+ {
SqlField oCurr = m_oaFields[i];
- if (!oCurr.isPrimaryKey())
- continue;
+ if (!oCurr.isPrimaryKey()) continue;
((iWh++ < 1) ? sb : sb.append(" and "))
.append(oCurr.getFieldName()).append(" = ?");
}
@@ -137,44 +145,58 @@
return (m_sDeleteSql = sb.toString());
} // ________________________________
- public void setObject(PreparedStatement p_PS, int p_iFld, Object p_sFldVal)
- throws SQLException {
- if (null != p_sFldVal)
- if (p_sFldVal instanceof String) {
- String sTr = ((String) p_sFldVal).trim();
- p_sFldVal = (sTr.length() > 0) ? sTr : null;
- }
+ public void setObject (PreparedStatement p_PS, int p_iFld, Object p_sFldVal)
+ throws SQLException
+ {
+ if (null != p_sFldVal) if (p_sFldVal instanceof String)
+ {
+ String sTr = ((String) p_sFldVal).trim();
+ p_sFldVal = (sTr.length() > 0) ? sTr : null;
+ }
;
int iSqlIdx = 1 + p_iFld;
- if (null == p_sFldVal)
- p_PS.setNull(iSqlIdx, m_oaFields[p_iFld].getSqlType());
+ if (null == p_sFldVal) p_PS.setNull(iSqlIdx, m_oaFields[p_iFld]
+ .getSqlType());
else
p_PS.setObject(iSqlIdx, p_sFldVal);
} // ________________________________
- public void setLong(PreparedStatement p_PS, int p_iFld, long p_lVal)
- throws SQLException {
+ public void setLong (PreparedStatement p_PS, int p_iFld, long p_lVal)
+ throws SQLException
+ {
p_PS.setLong(1 + p_iFld, p_lVal);
} // ________________________________
- public void setInt(PreparedStatement p_PS, int p_iFld, int p_iVal)
- throws SQLException {
+ public void setInt (PreparedStatement p_PS, int p_iFld, int p_iVal)
+ throws SQLException
+ {
p_PS.setInt(1 + p_iFld, p_iVal);
} // ________________________________
- private void initFields() throws Exception {
+ private void initFields () throws SQLException, ConfigurationException
+ {
PreparedStatement PS = m_oConn.prepareStatement(getSelectStatement());
ResultSetMetaData MD = m_oConn.execQueryWait(PS, 3).getMetaData();
m_oaFields = new SqlField[MD.getColumnCount()];
- for (int i1 = 0; i1 < m_oaFields.length; i1++) {
- int iCol = 1 + i1;
- String sFN = MD.getColumnName(iCol);
- Class oCL = Class.forName(MD.getColumnClassName(iCol));
- int iTP = MD.getColumnType(iCol);
- int iSZ = MD.getColumnDisplaySize(iCol);
- m_oaFields[i1] = new SqlField(sFN, oCL, iTP, iSZ, false);
+
+ try
+ {
+ for (int i1 = 0; i1 < m_oaFields.length; i1++)
+ {
+ int iCol = 1 + i1;
+ String sFN = MD.getColumnName(iCol);
+ Class oCL = Class.forName(MD.getColumnClassName(iCol));
+ int iTP = MD.getColumnType(iCol);
+ int iSZ = MD.getColumnDisplaySize(iCol);
+ m_oaFields[i1] = new SqlField(sFN, oCL, iTP, iSZ, false);
+ }
}
+ catch (ClassNotFoundException ex)
+ {
+ throw new ConfigurationException(ex);
+ }
+
PS.close();
} // ________________________________
} // ____________________________________________________________________________
Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationException.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationException.java (rev 0)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationException.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.jboss.soa.esb.notification;
+
+/**
+ * Configuration Exception.
+ *
+ * @author mark.little at jboss.com
+ * @since Version 4.0
+ */
+
+public class NotificationException extends Exception
+{
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct an exception instance.
+ *
+ * @param message
+ * Exception message.
+ */
+ public NotificationException (String message)
+ {
+ super(message);
+ }
+
+ /**
+ * Construct an exception instance.
+ *
+ * @param message
+ * Exception message.
+ * @param cause
+ * Exception cause.
+ */
+ public NotificationException (String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ /**
+ * Construct an exception instance.
+ *
+ * @param cause
+ * Exception cause.
+ */
+ public NotificationException (Throwable cause)
+ {
+ super(cause);
+ }
+}
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationList.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationList.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationList.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -25,18 +25,18 @@
import java.io.Serializable;
import org.apache.log4j.Logger;
+import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.ConfigTree;
/**
- * Holds lists of NotificationTarget objects so that the
- * NotificationHandler EJB behaviour can be controlled at runtime by
- * client applications
+ * Holds lists of NotificationTarget objects so that the NotificationHandler EJB
+ * behaviour can be controlled at runtime by client applications
* <p>
* Description: Objects of this class will hold a list of objects that extend
* the NotificationTarget base class. It's main purpose is to allow Rosetta
* users to configure lists of recipients of specific events, and request the
- * NotificationHandler EJB to take care of triggering the events to each
- * object specified as a child "target" element
+ * NotificationHandler EJB to take care of triggering the events to each object
+ * specified as a child "target" element
* </p>
* <p>
* Author: Heuristica - Buenos Aires - Argentina
@@ -44,7 +44,8 @@
*
* @version 1.0
*/
-public class NotificationList extends ConfigTree {
+public class NotificationList extends ConfigTree
+{
/**
*
*/
@@ -61,6 +62,7 @@
public static final String CHILD_TGT = "target";
private String m_sType;
+
protected static Logger _logger = Logger.getLogger(NotificationList.class);
/**
@@ -71,21 +73,21 @@
* needed to instantiate this object, including child elements
* named "target" that represent each individual
* NotificationTarget object
- * @throws Exception -
- * the getMessage() of the Exception explains the problem
*/
- public NotificationList(ConfigTree p_oP){
+ public NotificationList (ConfigTree p_oP)
+ {
super(p_oP);
m_sType = p_oP.getAttribute(TYPE);
- if (null != m_sType)
- m_sType = m_sType.toLowerCase();
+ if (null != m_sType) m_sType = m_sType.toLowerCase();
} // __________________________________
- private NotificationTarget[] getTargets() throws Exception {
+ private NotificationTarget[] getTargets () throws ConfigurationException
+ {
ConfigTree[] oaTgts = super.getChildren(CHILD_TGT);
NotificationTarget[] oaRet = new NotificationTarget[oaTgts.length];
-
- for (int i1 = 0; i1 < oaRet.length; i1++) {
+
+ for (int i1 = 0; i1 < oaRet.length; i1++)
+ {
oaRet[i1] = NotificationTarget.fromParams(oaTgts[i1]);
}
@@ -99,15 +101,24 @@
*
* @param p_o
* Object - The event to notify to all targets
- * @throws Exception -
+ * @throws NotificationException -
* use Exception.getMessage() at runtime
*/
- public void sendNotification(Serializable p_o) throws Exception {
- NotificationTarget[] oaTgt = getTargets();
-
- for (int i1 = 0; i1 < oaTgt.length; i1++) {
- oaTgt[i1].sendNotification(p_o);
+ public void sendNotification (Serializable p_o) throws NotificationException
+ {
+ try
+ {
+ NotificationTarget[] oaTgt = getTargets();
+
+ for (int i1 = 0; i1 < oaTgt.length; i1++)
+ {
+ oaTgt[i1].sendNotification(p_o);
+ }
}
+ catch (ConfigurationException ex)
+ {
+ throw new NotificationException(ex);
+ }
} // __________________________________
/**
@@ -120,7 +131,8 @@
* argument</li>
* @see ConfigTree#getAttr(String)
*/
- public boolean isOK() {
+ public boolean isOK ()
+ {
return (null == m_sType) ? true : m_sType.startsWith("ok");
}
@@ -134,28 +146,31 @@
* argument</li>
* @see ConfigTree#getAttr(String)
*/
- public boolean isErr() {
+ public boolean isErr ()
+ {
return (null == m_sType) ? true : m_sType.startsWith("err");
}
- public static void notifyAll(ConfigTree[]list, Serializable content)
+ public static void notifyAll (ConfigTree[] list, Serializable content)
{
for (ConfigTree tree : list)
{
ConfigTree[] targets = tree.getChildren(NotificationList.CHILD_TGT);
- for (ConfigTree curr :targets)
+ for (ConfigTree curr : targets)
{
- try
+ try
{
- NotificationTarget target = NotificationTarget.fromParams(curr);
+ NotificationTarget target = NotificationTarget
+ .fromParams(curr);
target.sendNotification(content);
}
- catch(Exception e)
+ catch (Exception e)
{
- _logger.error("Can't instantiate target "+curr.toString(),e);
+ _logger.error(
+ "Can't instantiate target " + curr.toString(), e);
}
}
}
- } //________________________________
+ } // ________________________________
} // ____________________________________________________________________________
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationTarget.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationTarget.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotificationTarget.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -1,107 +1,153 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.jboss.soa.esb.notification;
import java.lang.reflect.Constructor;
+import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.ConfigTree;
+
/**
* Abstract class to define expected behaviour of all NotificationTargets and
* provide some common functionality to all of them
- * <p>Description: </p>
- * <p>Heuristica - Buenos Aires - Argentina</p>
+ * <p>
+ * Description:
+ * </p>
+ * <p>
+ * Heuristica - Buenos Aires - Argentina
+ * </p>
+ *
* @version 1.0
*/
public abstract class NotificationTarget
{
- /**
- * Derived classes must implement this method to do what has to be done to
- * trigger that specific type of notification event
- * @param p_o Object - The toString() method of this object will be the actual
- * notification content
- * @throws Exception - invoke Exception.getMessage() at runtime for this object
- * @see ConfigTree
- */
- public abstract void sendNotification(java.io.Serializable p_o) throws Exception;
+ /**
+ * Derived classes must implement this method to do what has to be done to
+ * trigger that specific type of notification event
+ *
+ * @param p_o
+ * Object - The toString() method of this object will be the
+ * actual notification content
+ * @throws NotificationException -
+ * invoke Exception.getMessage() at runtime for this object
+ * @see ConfigTree
+ */
+ public abstract void sendNotification (java.io.Serializable p_o)
+ throws NotificationException;
- private static final String NOTIF_PFX = NotificationTarget.class.getPackage().getName();
+ private static final String NOTIF_PFX = NotificationTarget.class
+ .getPackage().getName();
- public static final String PRM_NOTIF_CLASS = "class";
+ public static final String PRM_NOTIF_CLASS = "class";
- /**
- * Common object to hold details of object's information - Each derived class
- * will hold it's own needs
- */
- protected ConfigTree m_oParms;
- /**
- * Instantiate an empty NotificationTarget object
- */
- protected NotificationTarget() {}
- /**
- * Instantiate a NotificationTarget object with the information contained
- * in <arg 1>
- * @param p_oP ConfigTree - Holds details to instantiate this object
- */
- protected NotificationTarget (ConfigTree p_oP)
- { m_oParms = p_oP;
- } //__________________________________
+ /**
+ * Common object to hold details of object's information - Each derived
+ * class will hold it's own needs
+ */
+ protected ConfigTree m_oParms;
- /**
- * A typical Factory.getInstance() method
- * @param p_oP ConfigTree - Contents of this argument will determine the
- * type (derived class) of NotificationTarget returned
- * @throws Exception - Arg 1 does not contain a valid structure for currently
- * implemented NotificationTarget subclasses - invoke Exception.getMessage() at
- * runtime for details
- * @return NotificationTarget - An object that instantiates the NotificationTarget
- * abstract class
- */
- public static NotificationTarget fromParams (ConfigTree p_oP) throws Exception
- { String sClass = p_oP.getAttribute(PRM_NOTIF_CLASS);
- if (null==sClass) throw new Exception("Missing '"+PRM_NOTIF_CLASS
- +"' attribute in parameters");
- Class oCls = null;
- try { oCls = Class.forName(NOTIF_PFX+"."+sClass); }
- catch (Exception e)
- { try { oCls = Class.forName(sClass); }
- catch (Exception e1) {/* oCls will be null */}
- }
- if (null==oCls)
- throw new Exception("Invalid class <"+sClass+">, or missing library");
+ /**
+ * Instantiate an empty NotificationTarget object
+ */
+ protected NotificationTarget ()
+ {
+ }
- Constructor oCons = null;
- try { oCons = oCls.getConstructor(new Class[] {ConfigTree.class}); }
- catch (Exception e) {}
- if (null==oCons)
- throw new Exception("No valid constructor "+sClass+"(ConfigTree)");
+ /**
+ * Instantiate a NotificationTarget object with the information contained in
+ * <arg 1>
+ *
+ * @param p_oP
+ * ConfigTree - Holds details to instantiate this object
+ */
+ protected NotificationTarget (ConfigTree p_oP)
+ {
+ m_oParms = p_oP;
+ } // __________________________________
- Object oRet = null;
- try { oRet = oCons.newInstance(new Object[] {p_oP}); }
- catch (Exception e) { e.printStackTrace();}
- if (null==oRet || (! (oRet instanceof NotificationTarget)))
- throw new Exception(sClass+" does not extend NotificationTarget");
+ /**
+ * A typical Factory.getInstance() method
+ *
+ * @param p_oP
+ * ConfigTree - Contents of this argument will determine the type
+ * (derived class) of NotificationTarget returned
+ * @throws ConfigurationException -
+ * Arg 1 does not contain a valid structure for currently
+ * implemented NotificationTarget subclasses - invoke
+ * Exception.getMessage() at runtime for details
+ * @return NotificationTarget - An object that instantiates the
+ * NotificationTarget abstract class
+ */
+ public static NotificationTarget fromParams (ConfigTree p_oP)
+ throws ConfigurationException
+ {
+ String sClass = p_oP.getAttribute(PRM_NOTIF_CLASS);
+ if (null == sClass)
+ throw new IllegalArgumentException(
+ "Missing '" + PRM_NOTIF_CLASS + "' attribute in parameters");
+ Class oCls = null;
+ try
+ {
+ oCls = Class.forName(NOTIF_PFX + "." + sClass);
+ }
+ catch (Exception e)
+ {
+ try
+ {
+ oCls = Class.forName(sClass);
+ }
+ catch (Exception e1)
+ {/* oCls will be null */
+ }
+ }
+ if (null == oCls)
+ throw new ConfigurationException(
+ "Invalid class <" + sClass + ">, or missing library");
- return (NotificationTarget) oRet;
- } //__________________________________
-} //____________________________________________________________________________
+ Constructor oCons = null;
+ try
+ {
+ oCons = oCls.getConstructor(new Class[] { ConfigTree.class });
+ }
+ catch (Exception e)
+ {
+ }
+ if (null == oCons)
+ throw new ConfigurationException(
+ "No valid constructor " + sClass + "(ConfigTree)");
+
+ Object oRet = null;
+ try
+ {
+ oRet = oCons.newInstance(new Object[] { p_oP });
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ if (null == oRet || (!(oRet instanceof NotificationTarget)))
+ throw new ConfigurationException(sClass + " does not extend NotificationTarget");
+
+ return (NotificationTarget) oRet;
+ } // __________________________________
+} // ____________________________________________________________________________
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyConsole.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyConsole.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyConsole.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -14,7 +14,7 @@
}
@Override
- public void sendNotification(Serializable content) throws Exception
+ public void sendNotification(Serializable content) throws NotificationException
{
System.out.println
("ConsoleNotifier "+Util.getStamp()+"<"+content+">");
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -28,6 +28,7 @@
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
+import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.Email;
import org.jboss.soa.esb.util.Util;
@@ -43,71 +44,93 @@
*
* @version 1.0
*/
-public class NotifyEmail extends NotificationTarget {
+public class NotifyEmail extends NotificationTarget
+{
/**
* Instantiate a NotifyEmail object using the information contained in
* <arg 1>
*
* @param p_oP
* ConfigTree - See attributes and structure needed for the
- * Email() constructor - The MESSAGE attribute will
- * be filled in at sendNotification(Serializable) time
- * @throws Exception
+ * Email() constructor - The MESSAGE attribute will be filled in
+ * at sendNotification(Serializable) time
+ * @throws ConfigurationException
* @see NotifyEmail#sendNotification(Serializable)
*/
- public NotifyEmail(ConfigTree p_oP) throws Exception {
+ public NotifyEmail (ConfigTree p_oP) throws ConfigurationException
+ {
super(p_oP);
- String sAtt = (String) m_oParms.getAttribute(Email.FROM);
- if (null != sAtt)
- InternetAddress.parse(sAtt);
-
- InternetAddress.parse(m_oParms.getAttribute(Email.SENDTO));
-
- sAtt = (String) m_oParms.getAttribute(Email.COPYTO);
- if (null != sAtt)
- InternetAddress.parse(sAtt);
+ try
+ {
+ String sAtt = (String) m_oParms.getAttribute(Email.FROM);
+
+ if (null != sAtt)
+ InternetAddress.parse(sAtt);
+
+ InternetAddress.parse(m_oParms.getAttribute(Email.SENDTO));
+
+ sAtt = (String) m_oParms.getAttribute(Email.COPYTO);
+ if (null != sAtt)
+ InternetAddress.parse(sAtt);
+ }
+ catch (AddressException ex)
+ {
+ throw new ConfigurationException(ex);
+ }
} // __________________________________
/**
- * Send an Email using Email() using p_o.toString() to fill in the
- * message text
+ * Send an Email using Email() using p_o.toString() to fill in the message
+ * text
*
* @param p_o
* Object - This object's toString() method will supply contents
* of mail message
*/
- public void sendNotification(Serializable p_o) {
- try {
+ public void sendNotification (Serializable p_o) throws NotificationException
+ {
+ try
+ {
ConfigTree oP = m_oParms.cloneObj();
String sMsg = oP.getAttribute(Email.MESSAGE);
- sMsg = ((null == sMsg) ? p_o.toString() : sMsg + "\n") + p_o.toString();
+ sMsg = ((null == sMsg) ? p_o.toString() : sMsg + "\n") + p_o
+ .toString();
oP.setAttribute(Email.MESSAGE, sMsg);
sendEmailNotification(oP);
- } catch (Exception e) {
- Util.getDefaultLogger(this.getClass()).error("Send Mail Failed",
- e);
- e.printStackTrace();
}
+ catch (AddressException e)
+ {
+ Util.getDefaultLogger(this.getClass()).error("Send Mail Failed", e);
+
+ throw new NotificationException(e);
+ }
+ catch (MessagingException ex)
+ {
+ throw new NotificationException(ex);
+ }
} // __________________________________
/**
- * Send an email notification based on the supplied parameters.
- * <p/>
- * This method allows overriding for test purposes.
- * @param messageParams Message parameters.
+ * Send an email notification based on the supplied parameters. <p/> This
+ * method allows overriding for test purposes.
+ *
+ * @param messageParams
+ * Message parameters.
*/
- protected void sendEmailNotification(ConfigTree messageParams) throws AddressException, MessagingException {
-
+ protected void sendEmailNotification (ConfigTree messageParams)
+ throws AddressException, MessagingException
+ {
+
Email esbMail = new Email();
- esbMail.setSendTo(messageParams.getAttribute(Email.SENDTO));
- esbMail.setFrom(messageParams.getAttribute(Email.FROM));
- esbMail.setCopyTo(messageParams.getAttribute(Email.COPYTO));
- esbMail.setSubject(messageParams.getAttribute(Email.SUBJECT));
+ esbMail.setSendTo(messageParams.getAttribute(Email.SENDTO));
+ esbMail.setFrom(messageParams.getAttribute(Email.FROM));
+ esbMail.setCopyTo(messageParams.getAttribute(Email.COPYTO));
+ esbMail.setSubject(messageParams.getAttribute(Email.SUBJECT));
- esbMail.setAttachments(messageParams.getTextChildren(Email.ATTACH));
- esbMail.setMessage(messageParams.getAttribute(Email.MESSAGE));
-
+ esbMail.setAttachments(messageParams.getTextChildren(Email.ATTACH));
+ esbMail.setMessage(messageParams.getAttribute(Email.MESSAGE));
+
esbMail.sendMessage();
}
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyFiles.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyFiles.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyFiles.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -45,7 +45,8 @@
*
* @version 1.0
*/
-public class NotifyFiles extends NotificationTarget {
+public class NotifyFiles extends NotificationTarget
+{
/**
* Mnemonic for the child element name that hold the files to write ("file")
*/
@@ -76,9 +77,9 @@
* ConfigTree - Should contain a nonempty set of child elements
* with elementName="file". Each child element must have a "URI"
* attribute and optionally a "append" element
- * @throws Exception
*/
- public NotifyFiles(ConfigTree p_oP) throws Exception {
+ public NotifyFiles (ConfigTree p_oP)
+ {
super(p_oP);
setFiles(p_oP.getChildren(CHILD_FILE));
@@ -91,36 +92,46 @@
* @param p_oaP
* ConfigTree[] - Each entry must have a "URI" attribute, and can
* have an optional "append" attribute
- * @throws Exception -
- * invoke Exception.getMessage() at runtime for details
* @see ConfigTree#getAttr(String)
*/
- protected void setFiles(ConfigTree[] p_oaP) throws Exception {
+ protected void setFiles (ConfigTree[] p_oaP)
+ {
m_oaOutF = new NotificationFile[p_oaP.length];
-
- for (int i = 0; i < p_oaP.length; i++) {
+
+ for (int i = 0; i < p_oaP.length; i++)
+ {
String fileURI = p_oaP[i].getAttribute(ATT_URI);
String append = p_oaP[i].getAttribute(ATT_APPEND);
-
- if (null == fileURI) {
- throw new IllegalArgumentException("Bad File Notification Configuration: Missing file URI attribute.");
+
+ if (null == fileURI)
+ {
+ throw new IllegalArgumentException(
+ "Bad File Notification Configuration: Missing file URI attribute.");
}
-
- try {
- m_oaOutF[i] = new NotificationFile(new URI(fileURI), Boolean.valueOf(append));
- } catch(Exception e) {
- m_oaOutF[i] = new NotificationFile(fileURI, Boolean.valueOf(append));
- }
-
+
+ try
+ {
+ m_oaOutF[i] = new NotificationFile(new URI(fileURI), Boolean
+ .valueOf(append));
+ }
+ catch (Exception e)
+ {
+ m_oaOutF[i] = new NotificationFile(fileURI, Boolean
+ .valueOf(append));
+ }
+
// Make sure the parent folder exists...
- File parent = m_oaOutF[i].getAbsoluteFile().getParentFile();
- if(null==parent || !parent.exists()) {
- throw new IllegalArgumentException("Bad File Notification Configuration: Parent folder for file [" + m_oaOutF[i].getAbsolutePath() + "] doesn't exist.");
+ File parent = m_oaOutF[i].getAbsoluteFile().getParentFile();
+ if (null == parent || !parent.exists())
+ {
+ throw new IllegalArgumentException(
+ "Bad File Notification Configuration: Parent folder for file [" + m_oaOutF[i]
+ .getAbsolutePath() + "] doesn't exist.");
}
}
} // __________________________________
- /**
+ /**
* Writes the result of p_o into each one of the File objects contained in
* the m_oaOutF array
*
@@ -130,69 +141,97 @@
* @see NotifyFiles#setFiles(ConfigTree[])
* @see NotifyFiles#m_oaOutF
*/
- public void sendNotification(Serializable p_o) {
+ public void sendNotification (Serializable p_o) throws NotificationException
+ {
FileOutputStream fileOutStream = null;
- for (NotificationFile notificationFile : m_oaOutF) {
- try {
- fileOutStream = new FileOutputStream(notificationFile, notificationFile.append);
- if (p_o instanceof String) {
+
+ for (NotificationFile notificationFile : m_oaOutF)
+ {
+ try
+ {
+ fileOutStream = new FileOutputStream(notificationFile,
+ notificationFile.append);
+ if (p_o instanceof String)
+ {
stringNotification(fileOutStream, (String) p_o);
- } else {
+ }
+ else
+ {
objectNotification(fileOutStream, p_o);
}
- } catch (Exception e) { /* We do nothing here for the time being */
- } finally {
- try {
+ }
+ catch (Exception e)
+ { /* We do nothing here for the time being */
+ }
+ finally
+ {
+ try
+ {
fileOutStream.close();
- } catch (Exception eCl) {/*
- * Unable to Close - What could we
- * do
- */
}
+ catch (Exception eCl)
+ {
+ /*
+ * Unable to Close - What could we do
+ */
+ }
}
}
} // __________________________________
- private void stringNotification(FileOutputStream p_oF, String p_s) {
- try {
+ private void stringNotification (FileOutputStream p_oF, String p_s)
+ {
+ try
+ {
p_oF.write(p_s.getBytes());
- if (!p_s.endsWith("\n"))
+
+ if (!p_s.endsWith("\n"))
p_oF.write("\n".getBytes());
- } catch (Exception e) { /* We do nothing here for the time being */
}
+ catch (Exception e)
+ { /* We do nothing here for the time being */
+ }
} // __________________________________
- private void objectNotification(FileOutputStream p_oF, Object p_o) {
- try {
+ private void objectNotification (FileOutputStream p_oF, Object p_o)
+ {
+ try
+ {
ObjectOutputStream OS = new ObjectOutputStream(p_oF);
OS.writeObject(p_o);
- } catch (Exception e) { /* We do nothing here for the time being */
}
+ catch (Exception e)
+ {
+ /* We do nothing here for the time being */
+ }
} // __________________________________
/**
- * Notification File.
- * <p/>
- * Simply adds the "append" property to the file.
+ * Notification File. <p/> Simply adds the "append" property to the file.
+ *
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
- private class NotificationFile extends File {
+ private class NotificationFile extends File
+ {
private static final long serialVersionUID = 1L;
+
private boolean append = false;
- private NotificationFile(URI fileURI, boolean append) {
+ private NotificationFile (URI fileURI, boolean append)
+ {
super(fileURI);
this.append = append;
}
- /**
- * @param file
- * @param append2
- */
- public NotificationFile(String file, boolean append) {
- super(file);
- this.append = append;
- }
+ /**
+ * @param file
+ * @param append2
+ */
+ public NotificationFile (String file, boolean append)
+ {
+ super(file);
+ this.append = append;
+ }
}
} // ____________________________________________________________________________
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -27,12 +27,15 @@
import java.util.Properties;
import javax.jms.Connection;
+import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.ConfigTree;
/**
@@ -48,7 +51,8 @@
*
* @version 1.0
*/
-public abstract class NotifyJMS extends NotificationTarget {
+public abstract class NotifyJMS extends NotificationTarget
+{
/**
* Abstract method - All classes that extend NotifyJMS must implement it
* according to their own javax.jms.Destination needs (Queue/Topic)
@@ -56,7 +60,7 @@
* @param p_oMsg
* Message
*/
- protected abstract void sendToAll(Message p_oMsg);
+ protected abstract void sendToAll (Message p_oMsg);
/**
* Element name mnemonic to search for child elements in the ConfigTree at
@@ -118,24 +122,31 @@
* Will contain a variable number of "messageProp" child elements
* that will be added to messages sent to
* </p>
- * @throws Exception
+ * @throws ConfigurationException
*/
- protected NotifyJMS(ConfigTree p_oP) throws Exception {
+ protected NotifyJMS (ConfigTree p_oP) throws ConfigurationException
+ {
super(p_oP);
ConfigTree[] oaMsgP = p_oP.getChildren(CHILD_MSG_PROP);
- for (int i1 = 0; i1 < oaMsgP.length; i1++) {
+ for (int i1 = 0; i1 < oaMsgP.length; i1++)
+ {
String sKey = oaMsgP[i1].getAttribute(ATT_PROP_NAME);
- if (null == sKey)
- continue;
+ if (null == sKey) continue;
String sVal = oaMsgP[i1].getAttribute(ATT_PROP_VALUE);
- if (null == sVal)
- continue;
+ if (null == sVal) continue;
m_oProps.setProperty(sKey.trim(), sVal);
}
- m_oCtx = new InitialContext();
+ try
+ {
+ m_oCtx = new InitialContext();
+ }
+ catch (NamingException ex)
+ {
+ throw new ConfigurationException(ex);
+ }
} // __________________________________
@@ -144,17 +155,22 @@
* developers should always call this method before unreferencing this
* object
*/
- public void release() {
- if (null != m_oSess)
- try {
- m_oSess.close();
- } catch (Exception e1) {
- }
- if (null != m_oConn)
- try {
- m_oConn.close();
- } catch (Exception e2) {
- }
+ public void release ()
+ {
+ if (null != m_oSess) try
+ {
+ m_oSess.close();
+ }
+ catch (Exception e1)
+ {
+ }
+ if (null != m_oConn) try
+ {
+ m_oConn.close();
+ }
+ catch (Exception e2)
+ {
+ }
} // __________________________________
/**
@@ -166,21 +182,33 @@
* supply contents of JMS message
* @see NotifyJMS#CHILD_MSG_PROP
*/
- public void sendNotification(Serializable p_o) throws Exception {
- Message oMsg = null;
-
- if (p_o instanceof String) {
- oMsg = m_oSess.createTextMessage(p_o.toString());
- } else {
- oMsg = m_oSess.createObjectMessage((Serializable) p_o);
+ public void sendNotification (Serializable p_o) throws NotificationException
+ {
+ try
+ {
+ Message oMsg = null;
+
+ if (p_o instanceof String)
+ {
+ oMsg = m_oSess.createTextMessage(p_o.toString());
+ }
+ else
+ {
+ oMsg = m_oSess.createObjectMessage((Serializable) p_o);
+ }
+
+ for (Iterator II = m_oProps.keySet().iterator(); II.hasNext();)
+ {
+ String sKey = (String) II.next();
+ String sVal = m_oProps.getProperty(sKey);
+ oMsg.setStringProperty(sKey, sVal);
+ }
+ sendToAll(oMsg);
}
-
- for (Iterator II = m_oProps.keySet().iterator(); II.hasNext();) {
- String sKey = (String) II.next();
- String sVal = m_oProps.getProperty(sKey);
- oMsg.setStringProperty(sKey, sVal);
+ catch (JMSException ex)
+ {
+ throw new NotificationException(ex);
}
- sendToAll(oMsg);
} // __________________________________
} // ____________________________________________________________________________
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyQueues.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyQueues.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyQueues.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -22,6 +22,7 @@
package org.jboss.soa.esb.notification;
+import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageProducer;
import javax.jms.Queue;
@@ -31,6 +32,7 @@
import javax.jms.QueueSession;
import javax.naming.NamingException;
+import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.ConfigTree;
;
@@ -46,11 +48,13 @@
*
* @version 1.0
*/
-public class NotifyQueues extends NotifyJMS {
+public class NotifyQueues extends NotifyJMS
+{
/**
* Connection Factory JNDI name.
*/
public static final String CONNECTION_FACTORY = "ConnectionFactory";
+
/**
* Element name mnemonic to search for child elements in the ConfigTree at
* constructor time, that will hold a "jndiName" attribute specifying the
@@ -60,50 +64,68 @@
*/
public static final String CHILD_QUEUE = "queue";
- public NotifyQueues(ConfigTree p_oP) throws Exception {
+ public NotifyQueues (ConfigTree p_oP) throws ConfigurationException, JMSException
+ {
super(p_oP);
setQueues(p_oP.getChildren(CHILD_QUEUE));
} // __________________________________
- protected void setQueues(ConfigTree[] p_oaP) throws Exception {
- QueueConnectionFactory qcf = lookupQueueConnectionFactory();
- QueueConnection oQconn = qcf.createQueueConnection();
- QueueSession oQsess = oQconn.createQueueSession(false,
- QueueSession.AUTO_ACKNOWLEDGE);
-
- m_oaMssProd = new MessageProducer[p_oaP.length];
- for (int i1 = 0; i1 < p_oaP.length; i1++) {
- String sAtt = p_oaP[i1].getAttribute(ATT_DEST_NAME);
- if (null == sAtt)
- throw new Exception("Missing queue jndiName");
- Queue oQ = (Queue) m_oCtx.lookup(sAtt);
- m_oaMssProd[i1] = oQsess.createSender(oQ);
+ protected void setQueues (ConfigTree[] p_oaP) throws ConfigurationException, JMSException
+ {
+ try
+ {
+ QueueConnectionFactory qcf = lookupQueueConnectionFactory();
+ QueueConnection oQconn = qcf.createQueueConnection();
+ QueueSession oQsess = oQconn.createQueueSession(false,
+ QueueSession.AUTO_ACKNOWLEDGE);
+
+ m_oaMssProd = new MessageProducer[p_oaP.length];
+ for (int i1 = 0; i1 < p_oaP.length; i1++)
+ {
+ String sAtt = p_oaP[i1].getAttribute(ATT_DEST_NAME);
+ if (null == sAtt)
+ throw new ConfigurationException("Missing queue jndiName");
+ Queue oQ = (Queue) m_oCtx.lookup(sAtt);
+ m_oaMssProd[i1] = oQsess.createSender(oQ);
+ }
+
+ m_oConn = oQconn;
+ m_oSess = oQsess;
+ // m_oConn.start(); Only for incoming messages ???
}
-
- m_oConn = oQconn;
- m_oSess = oQsess;
- // m_oConn.start(); Only for incoming messages ???
+ catch (NamingException ex)
+ {
+ throw new ConfigurationException(ex);
+ }
} // __________________________________
/**
- * Get the {@link QueueConnectionFactory} to be used for this instance.
- * <p/>
+ * Get the {@link QueueConnectionFactory} to be used for this instance. <p/>
* Can be overridden for testing.
+ *
* @return The QueueConnectionFactory fro the JNDI context.
* @throws NamingException
*/
- protected QueueConnectionFactory lookupQueueConnectionFactory() throws NamingException {
- // REVIEW: The connection factory name is hardcoded and is the same as that of the topic connection factory.
+ protected QueueConnectionFactory lookupQueueConnectionFactory ()
+ throws NamingException
+ {
+ // REVIEW: The connection factory name is hardcoded and is the same as
+ // that of the topic connection factory.
return (QueueConnectionFactory) m_oCtx.lookup(CONNECTION_FACTORY);
}
- protected void sendToAll(Message p_oMsg) {
- for (int i1 = 0; i1 < m_oaMssProd.length; i1++) {
+ protected void sendToAll (Message p_oMsg)
+ {
+ for (int i1 = 0; i1 < m_oaMssProd.length; i1++)
+ {
QueueSender oCurr = (QueueSender) m_oaMssProd[i1];
- try {
+ try
+ {
oCurr.send(p_oMsg);
- } catch (Exception e) {
}
+ catch (Exception e)
+ {
+ }
}
} // __________________________________
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifySqlTable.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifySqlTable.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifySqlTable.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -25,11 +25,13 @@
import java.sql.PreparedStatement;
import java.util.Properties;
+import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.persist.JdbcCleanConn;
import org.jboss.soa.esb.helpers.persist.SimpleDataSource;
-public class NotifySqlTable extends NotificationTarget {
+public class NotifySqlTable extends NotificationTarget
+{
public static final String CHILD_COLUMN = "column";
public static final String ATT_TABLE = "table";
@@ -44,7 +46,8 @@
protected Properties m_oCols;
- public NotifySqlTable(ConfigTree p_oP) throws Exception {
+ public NotifySqlTable (ConfigTree p_oP) throws ConfigurationException
+ {
super(p_oP);
m_sDriver = getAttr(SimpleDataSource.DRIVER);
m_sURL = getAttr(SimpleDataSource.URL);
@@ -55,67 +58,87 @@
m_oCols = new Properties();
ConfigTree[] oaP = p_oP.getChildren(CHILD_COLUMN);
- for (int i1 = 0; i1 < oaP.length; i1++) {
+ for (int i1 = 0; i1 < oaP.length; i1++)
+ {
ConfigTree oCurr = oaP[i1];
String sCol = oCurr.getAttribute(ATT_NAME);
- if (null == sCol) {
+ if (null == sCol)
+ {
continue;
}
sCol = sCol.trim();
- if (sCol.length() < 1) {
+ if (sCol.length() < 1)
+ {
continue;
}
String sVal = oCurr.getAttribute(ATT_VALUE);
- if (null == sVal) {
+ if (null == sVal)
+ {
sVal = "";
}
m_oCols.setProperty(sCol, sVal);
}
} // __________________________________
- private String getAttr(String p_sAtt) throws Exception {
+ private String getAttr (String p_sAtt) throws ConfigurationException
+ {
String sRet = m_oParms.getAttribute(p_sAtt);
- if (null == sRet) {
- throw new Exception("Missing " + p_sAtt + " attribute");
+ if (null == sRet)
+ {
+ throw new ConfigurationException("Missing " + p_sAtt + " attribute");
}
sRet = sRet.trim();
- if (p_sAtt.equals(SimpleDataSource.PASSWORD)) {
+ if (p_sAtt.equals(SimpleDataSource.PASSWORD))
+ {
return sRet;
}
- if (sRet.length() < 1) {
- throw new Exception("Empty " + p_sAtt + " attribute");
+ if (sRet.length() < 1)
+ {
+ throw new ConfigurationException("Empty " + p_sAtt + " attribute");
}
return sRet;
} // __________________________________
- public String getInsertStmt() {
+ public String getInsertStmt ()
+ {
String[] saCols = new String[m_oCols.size()];
m_oCols.keySet().toArray(saCols);
- StringBuffer sbCol = new StringBuffer("insert into ").append(m_sTable).append(" ");
+ StringBuffer sbCol = new StringBuffer("insert into ").append(m_sTable)
+ .append(" ");
StringBuffer sbPrm = new StringBuffer(" values ");
- for (int i1 = 0; i1 < saCols.length; i1++) {
+ for (int i1 = 0; i1 < saCols.length; i1++)
+ {
String sIn = (i1 == 0) ? "(" : ",";
String sCurrCol = saCols[i1];
sbCol.append(sIn).append("\"").append(sCurrCol).append("\"");
- sbPrm.append(sIn).append("'").append(m_oCols.getProperty(sCurrCol)).append("'");
- // REVIEW: Does the value being inserted not need to be escaped e.g. what if it has a quote in its value??
+ sbPrm.append(sIn).append("'").append(m_oCols.getProperty(sCurrCol))
+ .append("'");
+ // REVIEW: Does the value being inserted not need to be escaped e.g.
+ // what if it has a quote in its value??
}
return sbCol.append(")").append(sbPrm).append(")").toString();
} // __________________________________
- public void sendNotification(java.io.Serializable p_o) {
+ public void sendNotification (java.io.Serializable p_o) throws NotificationException
+ {
m_oCols.setProperty(m_sDataCol, p_o.toString());
JdbcCleanConn oConn = null;
- try {
- oConn = new JdbcCleanConn(new SimpleDataSource(m_sDriver, m_sURL, m_sUser, m_sPwd));
+ try
+ {
+ oConn = new JdbcCleanConn(new SimpleDataSource(m_sDriver, m_sURL,
+ m_sUser, m_sPwd));
PreparedStatement PS = oConn.prepareStatement(getInsertStmt());
oConn.execUpdWait(PS, 3);
oConn.commit();
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.err);
- } finally {
- if (null != oConn) {
+ } finally
+ {
+ if (null != oConn)
+ {
oConn.release();
}
}
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyTopics.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyTopics.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyTopics.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -22,6 +22,7 @@
package org.jboss.soa.esb.notification;
+import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageProducer;
import javax.jms.Topic;
@@ -29,35 +30,60 @@
import javax.jms.TopicConnectionFactory;
import javax.jms.TopicPublisher;
import javax.jms.TopicSession;
+import javax.naming.NamingException;
+import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.ConfigTree;
-public class NotifyTopics extends NotifyJMS {
+public class NotifyTopics extends NotifyJMS
+{
public static final String CONNECTION_FACTORY = "ConnectionFactory";
+
public static final String CHILD_TOPIC = "topic";
- public NotifyTopics(ConfigTree p_oP) throws Exception {
+ public NotifyTopics (ConfigTree p_oP) throws ConfigurationException, JMSException
+ {
super(p_oP);
setTopics(p_oP.getChildren(CHILD_TOPIC));
} // __________________________________
- protected void setTopics(ConfigTree[] p_oaP) throws Exception {
- // REVIEW: The connection factory name is hardcoded and is the same as that of the queue connection factory.
- TopicConnectionFactory qcf = (TopicConnectionFactory) m_oCtx.lookup(CONNECTION_FACTORY);
+ protected void setTopics (ConfigTree[] p_oaP) throws ConfigurationException, JMSException
+ {
+ // REVIEW: The connection factory name is hardcoded and is the same as
+ // that of the queue connection factory.
+ TopicConnectionFactory qcf = null;
+
+ try
+ {
+ qcf = (TopicConnectionFactory) m_oCtx.lookup(CONNECTION_FACTORY);
+ }
+ catch (NamingException ex)
+ {
+ throw new ConfigurationException(ex);
+ }
+
TopicConnection oTconn = qcf.createTopicConnection();
TopicSession oTsess = oTconn.createTopicSession(false,
TopicSession.AUTO_ACKNOWLEDGE);
m_oaMssProd = new MessageProducer[p_oaP.length];
- for (int i1 = 0; i1 < p_oaP.length; i1++) {
- String sAtt = p_oaP[i1].getAttribute(ATT_DEST_NAME);
- if (null == sAtt)
- throw new Exception("Missing topic jndiName");
- Topic oT = (Topic) m_oCtx.lookup(sAtt);
- m_oaMssProd[i1] = oTsess.createPublisher(oT);
+
+ try
+ {
+ for (int i1 = 0; i1 < p_oaP.length; i1++)
+ {
+ String sAtt = p_oaP[i1].getAttribute(ATT_DEST_NAME);
+ if (null == sAtt) throw new ConfigurationException("Missing topic jndiName");
+ Topic oT = (Topic) m_oCtx.lookup(sAtt);
+ m_oaMssProd[i1] = oTsess.createPublisher(oT);
+ }
}
+ catch (NamingException ex)
+ {
+ throw new ConfigurationException(ex);
+ }
m_oConn = oTconn;
m_oSess = oTsess;
@@ -65,13 +91,19 @@
} // __________________________________
- protected void sendToAll(Message p_oMsg) {
- for (int i1 = 0; i1 < m_oaMssProd.length; i1++) {
+ protected void sendToAll (Message p_oMsg)
+ {
+ for (int i1 = 0; i1 < m_oaMssProd.length; i1++)
+ {
TopicPublisher oCurr = (TopicPublisher) m_oaMssProd[i1];
- try {
+
+ try
+ {
oCurr.publish(p_oMsg);
- } catch (Exception e) {
}
+ catch (Exception e)
+ {
+ }
}
} // __________________________________
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyUtil.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/notification/NotifyUtil.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -31,32 +31,40 @@
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.services.NotificationManager;
-public class NotifyUtil {
+public class NotifyUtil
+{
- public static void notifyOK(NotificationManager p_oNH,
- ConfigTree p_oParent, Serializable p_o, Map p_oCtx) {
- try {
+ public static void notifyOK (NotificationManager p_oNH,
+ ConfigTree p_oParent, Serializable p_o, Map p_oCtx)
+ {
+ try
+ {
ConfigTree[] oaP = p_oParent.getChildren(NotificationList.ELEMENT);
- for (int i1 = 0; i1 < oaP.length; i1++) {
+ for (int i1 = 0; i1 < oaP.length; i1++)
+ {
NotificationList oCurr = new NotificationList(oaP[i1]);
- if (!oCurr.isOK())
- continue;
+ if (!oCurr.isOK()) continue;
ConfigTree oCpy = oaP[i1].cloneObj();
MacroExpander.replaceMacros(oCpy, p_oCtx);
p_oNH.sendNotifications(oCpy, p_o);
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
} // __________________________________
- public static void notifyError(NotificationManager p_oNH,
- ConfigTree p_oParent, Object p_o, Map p_oCtx, Exception p_e) {
+ public static void notifyError (NotificationManager p_oNH,
+ ConfigTree p_oParent, Object p_o, Map p_oCtx, Exception p_e)
+ {
ByteArrayOutputStream oBO = new ByteArrayOutputStream();
PrintStream oPS = new PrintStream(oBO);
- try {
+ try
+ {
oPS.println(p_o.toString());
- if (null != p_e) {
+ if (null != p_e)
+ {
p_e.printStackTrace(oPS);
}
oPS.close();
@@ -64,22 +72,29 @@
String sMsg = oBO.toString();
ConfigTree[] oaP = p_oParent.getChildren(NotificationList.ELEMENT);
// if (oaP.length<1) // Uncomment this line to send only to the list
-
- // REVIEW: What's going on here? What's the difference between sending an
- // error notification and sending a regular notification apart from there being an
- // error message? What's the difference between how the InotificationHandler
+
+ // REVIEW: What's going on here? What's the difference between
+ // sending an
+ // error notification and sending a regular notification apart from
+ // there being an
+ // error message? What's the difference between how the
+ // InotificationHandler
// interface is used on the notifyOK and notifyError methods?
-
+
p_oNH.sendNotifications(sMsg);
- for (int i1 = 0; i1 < oaP.length; i1++) {
+ for (int i1 = 0; i1 < oaP.length; i1++)
+ {
NotificationList oCurr = new NotificationList(oaP[i1]);
- if (!oCurr.isErr()) {
+ if (!oCurr.isErr())
+ {
continue;
}
MacroExpander.replaceMacros(oaP[i1], p_oCtx);
p_oNH.sendNotifications(oaP[i1], sMsg);
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
} // __________________________________
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/DefaultEncryptionFactory.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/DefaultEncryptionFactory.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/DefaultEncryptionFactory.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -48,13 +48,13 @@
// catch (Exception e) { e.printStackTrace(); }
// }
public byte [] encrypt (byte [] p_ba, Object p_oParms)
- throws Exception
+ throws EncryptionFailedException
{
return p_ba;
} //__________________________________
public byte [] decrypt (byte [] p_ba, Object p_oParms)
- throws Exception
+ throws EncryptionFailedException
{
return p_ba;
} //__________________________________
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/Encryption.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/Encryption.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/Encryption.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -23,6 +23,6 @@
public interface Encryption
{
- public byte [] encrypt (byte [] p_ba, Object p_oParms) throws Exception;
- public byte [] decrypt (byte [] p_ba, Object p_oParms) throws Exception;
+ public byte [] encrypt (byte [] p_ba, Object p_oParms) throws EncryptionFailedException;
+ public byte [] decrypt (byte [] p_ba, Object p_oParms) throws EncryptionFailedException;
}
Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/EncryptionFailedException.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/EncryptionFailedException.java (rev 0)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/EncryptionFailedException.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.jboss.soa.esb.services;
+
+/**
+ * Configuration Exception.
+ *
+ * @author mark.little at jboss.com
+ * @since Version 4.0
+ */
+
+public class EncryptionFailedException extends Exception
+{
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct an exception instance.
+ *
+ * @param message
+ * Exception message.
+ */
+ public EncryptionFailedException (String message)
+ {
+ super(message);
+ }
+
+ /**
+ * Construct an exception instance.
+ *
+ * @param message
+ * Exception message.
+ * @param cause
+ * Exception cause.
+ */
+ public EncryptionFailedException (String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ /**
+ * Construct an exception instance.
+ *
+ * @param cause
+ * Exception cause.
+ */
+ public EncryptionFailedException (Throwable cause)
+ {
+ super(cause);
+ }
+}
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStore.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStore.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/services/persistence/MessageStore.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -25,11 +25,11 @@
import org.jboss.soa.esb.message.Message;
+public interface MessageStore
+{
+ public URI addMessage (Message message);
-public interface MessageStore {
-
- public URI addMessage(Message message);
- public Message getMessage(URI uid) throws Exception;
+ public Message getMessage (URI uid) throws Exception;
}
Modified: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget1.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget1.java 2007-01-20 13:24:24 UTC (rev 8939)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget1.java 2007-01-20 16:20:44 UTC (rev 8940)
@@ -1,24 +1,27 @@
package org.jboss.soa.esb.notification;
-
import java.io.Serializable;
import java.util.List;
import org.jboss.soa.esb.helpers.ConfigTree;
-public class TestNotificationTarget1 extends NotificationTarget {
+public class TestNotificationTarget1 extends NotificationTarget
+{
private ConfigTree config;
-
+
public static List<String> messageList;
-
- public TestNotificationTarget1(ConfigTree targetConf) {
+
+ public TestNotificationTarget1 (ConfigTree targetConf)
+ {
super(targetConf);
config = targetConf;
}
@Override
- public void sendNotification(Serializable obj) throws Exception {
+ public void sendNotification (Serializable obj)
+ throws NotificationException
+ {
messageList.add(config.getAttribute("message") + "-" + obj);
}
}
More information about the jboss-svn-commits
mailing list