You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
(1) |
Apr
(85) |
May
(76) |
Jun
(45) |
Jul
(19) |
Aug
(90) |
Sep
(50) |
Oct
(49) |
Nov
|
Dec
(23) |
---|
From: Mike H. <he...@us...> - 2002-12-06 19:13:23
|
Update of /cvsroot/velcro/velcro/main/src/java/velcro/broadcaster In directory sc8-pr-cvs1:/tmp/cvs-serv32047/velcro/broadcaster Modified Files: MessageProcessorEntryComparator.java Log Message: Added/fixed comments and Javadocs. Index: MessageProcessorEntryComparator.java =================================================================== RCS file: /cvsroot/velcro/velcro/main/src/java/velcro/broadcaster/MessageProcessorEntryComparator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MessageProcessorEntryComparator.java 6 Dec 2002 18:37:51 -0000 1.3 --- MessageProcessorEntryComparator.java 6 Dec 2002 19:13:16 -0000 1.4 *************** *** 32,44 **** /** ! * Compares two <code>MessageProcessorEntry</code> objects based on their priority field. * ! * @author mike */ class MessageProcessorEntryComparator implements Comparator { ! /** Creates a new instance of MessageProcessorEntryComparator */ ! public MessageProcessorEntryComparator() { ! } /** --- 32,48 ---- /** ! * Compares two <code>MessageProcessorEntry</code> objects based on their ! * priority field. If the priority fields match then the EjbName field is ! * used for comparison. * ! * @author mike at users.sourceforge.net ! * @version $Revision$ */ class MessageProcessorEntryComparator implements Comparator { ! /** ! * Creates a new instance of MessageProcessorEntryComparator. ! */ ! public MessageProcessorEntryComparator() {} /** *************** *** 78,81 **** --- 82,88 ---- /* * $Log$ + * Revision 1.4 2002/12/06 19:13:16 heathm + * Added/fixed comments and Javadocs. + * * Revision 1.3 2002/12/06 18:37:51 heathm * Fixed matching priority comparator problem. |
From: Mike H. <he...@us...> - 2002-12-06 18:38:40
|
Update of /cvsroot/velcro/velcro/main/src/java/velcro/broadcaster In directory sc8-pr-cvs1:/tmp/cvs-serv16017/velcro/broadcaster Modified Files: MessageProcessorEntryComparator.java Log Message: Fixed matching priority comparator problem. Index: MessageProcessorEntryComparator.java =================================================================== RCS file: /cvsroot/velcro/velcro/main/src/java/velcro/broadcaster/MessageProcessorEntryComparator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MessageProcessorEntryComparator.java 4 Dec 2002 04:11:56 -0000 1.2 --- MessageProcessorEntryComparator.java 6 Dec 2002 18:37:51 -0000 1.3 *************** *** 68,72 **** return -1; } else if (e1.getPriority() == e2.getPriority()) { ! return 0; } else { return 1; --- 68,72 ---- return -1; } else if (e1.getPriority() == e2.getPriority()) { ! return e1.getEjbName().compareTo(e2.getEjbName()); } else { return 1; *************** *** 78,81 **** --- 78,84 ---- /* * $Log$ + * Revision 1.3 2002/12/06 18:37:51 heathm + * Fixed matching priority comparator problem. + * * Revision 1.2 2002/12/04 04:11:56 heathm * Fixed null checking. |
From: <no...@so...> - 2002-12-06 18:38:21
|
Bugs item #649067, was opened at 2002-12-05 10:13 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=404884&aid=649067&group_id=32242 Category: Messaging Group: CVS HEAD >Status: Closed >Resolution: Fixed Priority: 7 Submitted By: Mike Heath (heathm) Assigned to: Mike Heath (heathm) Summary: Message processor priority problem Initial Comment: velcro.broadcaster.MessageProcessorEntryComparator return two MessageProcessorEntry objects are equal if they have the same priority. This needs to be changed to include an additional factor (such as the ejbName) so if a second entry with an existing priority gets added to the collection it doesn't get discarded since the collection thinks they are equal. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=404884&aid=649067&group_id=32242 |
From: <no...@so...> - 2002-12-05 17:13:58
|
Bugs item #649067, was opened at 2002-12-05 10:13 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=404884&aid=649067&group_id=32242 Category: Messaging Group: CVS HEAD Status: Open Resolution: None Priority: 7 Submitted By: Mike Heath (heathm) Assigned to: Mike Heath (heathm) Summary: Message processor priority problem Initial Comment: velcro.broadcaster.MessageProcessorEntryComparator return two MessageProcessorEntry objects are equal if they have the same priority. This needs to be changed to include an additional factor (such as the ejbName) so if a second entry with an existing priority gets added to the collection it doesn't get discarded since the collection thinks they are equal. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=404884&aid=649067&group_id=32242 |
From: Mike H. <he...@us...> - 2002-12-04 04:42:32
|
Update of /cvsroot/velcro/velcro/main/src/java/velcro/broadcaster In directory sc8-pr-cvs1:/tmp/cvs-serv19667/main/src/java/velcro/broadcaster Modified Files: MessageBroadcasterEJB.java Log Message: Added remove() call for all message processor EJB's used in message broadcast. Index: MessageBroadcasterEJB.java =================================================================== RCS file: /cvsroot/velcro/velcro/main/src/java/velcro/broadcaster/MessageBroadcasterEJB.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MessageBroadcasterEJB.java 3 Dec 2002 15:07:25 -0000 1.2 --- MessageBroadcasterEJB.java 4 Dec 2002 04:42:29 -0000 1.3 *************** *** 37,40 **** --- 37,41 ---- import javax.ejb.CreateException; + import javax.ejb.RemoveException; import javax.ejb.SessionBean; import javax.ejb.SessionContext; *************** *** 131,137 **** */ public ActionMessage broadcast(ActionMessage message) { - // Ensure the processor map is empty. - processorMap.clear(); - if (log.isDebugEnabled()) { // TODO: Internationalize debug message. --- 132,135 ---- *************** *** 177,181 **** } ! // TODO: Properly empty processorMap return message; --- 175,195 ---- } ! Iterator keys = processorMap.keySet().iterator(); ! while (keys.hasNext()) { ! String key = (String)keys.next(); ! //TODO: Add support for both local and remote interfaces. ! MessageProcessorLocal processor = (MessageProcessorLocal)processorMap.get(key); ! try { ! processor.remove(); ! } catch (RemoveException re) { ! log.debug(re); ! throw new RuntimeException(re); ! } ! } ! processorMap.clear(); ! ! if (log.isTraceEnabled()) { ! log.trace("Done broadcasting message of type: " + message.getType()); ! } return message; *************** *** 192,201 **** while (i.hasNext()) { MessageProcessorEntry mpe = (MessageProcessorEntry)i.next(); ! if (log.isTraceEnabled()) { log.trace("PROCESSOR ENTRY -- Type: " + mpe.getType() + " Phase: " + mpe.getPhase() + " EJB Name: " + mpe.getEjbName()); log.trace(" Pre-process MESSAGE -- " + message); } ! String ejbName = mpe.getEjbName(); if (!processorMap.containsKey(ejbName)) { --- 206,215 ---- while (i.hasNext()) { MessageProcessorEntry mpe = (MessageProcessorEntry)i.next(); ! if (log.isTraceEnabled()) { log.trace("PROCESSOR ENTRY -- Type: " + mpe.getType() + " Phase: " + mpe.getPhase() + " EJB Name: " + mpe.getEjbName()); log.trace(" Pre-process MESSAGE -- " + message); } ! String ejbName = mpe.getEjbName(); if (!processorMap.containsKey(ejbName)) { *************** *** 212,216 **** MessageProcessorLocal processor = (MessageProcessorLocal)processorMap.get(ejbName); message = processor.processMessage(message); ! if (log.isTraceEnabled()) { log.trace(" Post-process MESSAGE -- " + message); --- 226,230 ---- MessageProcessorLocal processor = (MessageProcessorLocal)processorMap.get(ejbName); message = processor.processMessage(message); ! if (log.isTraceEnabled()) { log.trace(" Post-process MESSAGE -- " + message); *************** *** 343,346 **** --- 357,363 ---- /* * $Log$ + * Revision 1.3 2002/12/04 04:42:29 heathm + * Added remove() call for all message processor EJB's used in message broadcast. + * * Revision 1.2 2002/12/03 15:07:25 heathm * Removed JMS stuff. |
From: Mike H. <he...@us...> - 2002-12-04 04:18:27
|
Update of /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/tests In directory sc8-pr-cvs1:/tmp/cvs-serv4984/testsuite/simpletest/src/java/velcro/testsuite/simpletest/tests Modified Files: Test.java Log Message: Added man message test for performance testing. Fixed CalledAll test. Index: Test.java =================================================================== RCS file: /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/tests/Test.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Test.java 3 Dec 2002 15:14:23 -0000 1.6 --- Test.java 4 Dec 2002 04:18:23 -0000 1.7 *************** *** 56,59 **** --- 56,60 ---- public class Test extends TestCase { public static final String BROADCASTER = "VelcroBroadcasterRemote"; + public static final int MESSAGE_LOOP = 100; /** Creates a new instance of Test */ *************** *** 107,111 **** assertTrue("Set "+ Constants.DATA_ITEM + " and shouldn't have.", !msg.getData().containsKey(Constants.DATA_ITEM)); } ! public void testCalledEJB2() throws CreateException, NamingException, RemoteException, RemoveException { MessageBroadcaster broadcaster = createBroadcaster(); --- 108,112 ---- assertTrue("Set "+ Constants.DATA_ITEM + " and shouldn't have.", !msg.getData().containsKey(Constants.DATA_ITEM)); } ! public void testCalledEJB2() throws CreateException, NamingException, RemoteException, RemoveException { MessageBroadcaster broadcaster = createBroadcaster(); *************** *** 120,124 **** assertTrue("Set "+ Constants.DATA_ITEM + " and shouldn't have.", !msg.getData().containsKey(Constants.DATA_ITEM)); } ! public void testCalledAll() throws CreateException, NamingException, RemoteException, RemoveException { final int EXPECTED_NUMBER = 3; --- 121,125 ---- assertTrue("Set "+ Constants.DATA_ITEM + " and shouldn't have.", !msg.getData().containsKey(Constants.DATA_ITEM)); } ! public void testCalledAll() throws CreateException, NamingException, RemoteException, RemoveException { final int EXPECTED_NUMBER = 3; *************** *** 130,137 **** broadcaster.remove(); assertTrue("Failed to set data field " + Constants.DATA_ITEM, msg.getData().containsKey(Constants.DATA_ITEM)); ! assertTrue("Set "+ Constants.DATA_ITEM1 + " and shouldn't have.", !msg.getData().containsKey(Constants.DATA_ITEM1)); ! assertTrue("Set "+ Constants.DATA_ITEM2 + " and shouldn't have.", !msg.getData().containsKey(Constants.DATA_ITEM2)); ! Integer num = (Integer)msg.getData(Constants.DATA_ITEM); ! assertEquals(EXPECTED_NUMBER, num.intValue()); } } --- 131,152 ---- broadcaster.remove(); assertTrue("Failed to set data field " + Constants.DATA_ITEM, msg.getData().containsKey(Constants.DATA_ITEM)); ! assertTrue("Didn't set "+ Constants.DATA_ITEM1, msg.getData().containsKey(Constants.DATA_ITEM1)); ! assertTrue("Didn't set "+ Constants.DATA_ITEM2, msg.getData().containsKey(Constants.DATA_ITEM2)); ! // Integer num = (Integer)msg.getData(Constants.DATA_ITEM); ! // assertEquals(EXPECTED_NUMBER, num.intValue()); ! } ! ! /** ! * This is more of a performance check than any real functionality test. ! */ ! public void testCalledAllMany() throws CreateException, NamingException, RemoteException, RemoveException { ! MessageBroadcaster broadcaster = createBroadcaster(); ! ! for (int i = 0; i < MESSAGE_LOOP; i++) { ! ActionMessage msg = new ActionMessageBase(); ! msg.setType(Constants.TYPE_ALL); ! msg = broadcaster.broadcast(msg); ! broadcaster.remove(); ! } } } *************** *** 139,142 **** --- 154,161 ---- /* *$Log$ + *Revision 1.7 2002/12/04 04:18:23 heathm + *Added man message test for performance testing. + *Fixed CalledAll test. + * *Revision 1.6 2002/12/03 15:14:23 heathm *Fixed testCalledAll unit test. The returned message from the broadcaster was not getting assigned. |
From: Mike H. <he...@us...> - 2002-12-04 04:17:48
|
Update of /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/test1 In directory sc8-pr-cvs1:/tmp/cvs-serv4554/testsuite/simpletest/src/java/velcro/testsuite/simpletest/test1 Modified Files: EJB1.java Log Message: Added support for handling "all" message type. Index: EJB1.java =================================================================== RCS file: /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/test1/EJB1.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EJB1.java 3 Dec 2002 15:11:33 -0000 1.2 --- EJB1.java 4 Dec 2002 04:17:45 -0000 1.3 *************** *** 57,60 **** --- 57,64 ---- message.setData(Constants.DATA_ITEM1, new Boolean(true)); + if (message.getType().equals(Constants.TYPE_ALL)) { + message.setData(Constants.DATA_ITEM, new Boolean(true)); + } + message.setPhase(ActionMessage.PHASE_DONE); *************** *** 86,89 **** --- 90,96 ---- /* * $Log$ + * Revision 1.3 2002/12/04 04:17:45 heathm + * Added support for handling "all" message type. + * * Revision 1.2 2002/12/03 15:11:33 heathm * Sets message phase to done so broadcaster knows we're done processing. |
From: Mike H. <he...@us...> - 2002-12-04 04:17:04
|
Update of /cvsroot/velcro/velcro/testsuite/simpletest/dd/broadcaster/META-INF In directory sc8-pr-cvs1:/tmp/cvs-serv4049/testsuite/simpletest/dd/broadcaster/META-INF Modified Files: ejb-jar.xml Log Message: Added descriptors for "all" message type. Index: ejb-jar.xml =================================================================== RCS file: /cvsroot/velcro/velcro/testsuite/simpletest/dd/broadcaster/META-INF/ejb-jar.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ejb-jar.xml 3 Dec 2002 15:08:50 -0000 1.2 --- ejb-jar.xml 4 Dec 2002 04:17:01 -0000 1.3 *************** *** 28,32 **** <env-entry-name>defaultPriority</env-entry-name> <env-entry-type>java.lang.Integer</env-entry-type> ! <env-entry-value>45</env-entry-value> </env-entry> --- 28,32 ---- <env-entry-name>defaultPriority</env-entry-name> <env-entry-type>java.lang.Integer</env-entry-type> ! <env-entry-value>0</env-entry-value> </env-entry> *************** *** 47,57 **** <env-entry-value>controller</env-entry-value> </env-entry> - <ejb-local-ref> - <ejb-ref-name>ejb/velcro/simpletestTest1</ejb-ref-name> - <ejb-ref-type>Session</ejb-ref-type> - <local-home>velcro.broadcaster.MessageProcessorLocalHome</local-home> - <local>velcro.broadcaster.MessageProcessorLocal</local> - <ejb-link>simpletestTest1</ejb-link> - </ejb-local-ref> <!-- Test1 End --> --- 47,50 ---- *************** *** 72,75 **** --- 65,111 ---- <env-entry-value>controller</env-entry-value> </env-entry> + <!-- Test2 End --> + + <!-- All Start --> + <env-entry> + <env-entry-name>messages/all/INIT/simpletestTest1/ejbName</env-entry-name> + <env-entry-type>java.lang.String</env-entry-type> + <env-entry-value>ejb/velcro/simpletestTest1</env-entry-value> + </env-entry> + <env-entry> + <env-entry-name>messages/all/INIT/simpletestTest1/priority</env-entry-name> + <env-entry-type>java.lang.Integer</env-entry-type> + <env-entry-value>50</env-entry-value> + </env-entry> + <env-entry> + <env-entry-name>messages/all/INIT/simpletestTest1/broadcastMode</env-entry-name> + <env-entry-type>java.lang.String</env-entry-type> + <env-entry-value>controller</env-entry-value> + </env-entry> + <env-entry> + <env-entry-name>messages/all/INIT/simpletestTest2/ejbName</env-entry-name> + <env-entry-type>java.lang.String</env-entry-type> + <env-entry-value>ejb/velcro/simpletestTest2</env-entry-value> + </env-entry> + <env-entry> + <env-entry-name>messages/all/INIT/simpletestTest2/priority</env-entry-name> + <env-entry-type>java.lang.Integer</env-entry-type> + <env-entry-value>10</env-entry-value> + </env-entry> + <env-entry> + <env-entry-name>messages/all/INIT/simpletestTest2/broadcastMode</env-entry-name> + <env-entry-type>java.lang.String</env-entry-type> + <env-entry-value>controller</env-entry-value> + </env-entry> + <!-- All End --> + + <!-- Message processor references --> + <ejb-local-ref> + <ejb-ref-name>ejb/velcro/simpletestTest1</ejb-ref-name> + <ejb-ref-type>Session</ejb-ref-type> + <local-home>velcro.broadcaster.MessageProcessorLocalHome</local-home> + <local>velcro.broadcaster.MessageProcessorLocal</local> + <ejb-link>simpletestTest1</ejb-link> + </ejb-local-ref> <ejb-local-ref> <ejb-ref-name>ejb/velcro/simpletestTest2</ejb-ref-name> *************** *** 79,83 **** <ejb-link>simpletestTest2</ejb-link> </ejb-local-ref> ! <!-- Test2 End --> </session> <session> --- 115,119 ---- <ejb-link>simpletestTest2</ejb-link> </ejb-local-ref> ! <!-- End of message processor references --> </session> <session> |
From: Mike H. <he...@us...> - 2002-12-04 04:16:32
|
Update of /cvsroot/velcro/velcro/testsuite/simpletest In directory sc8-pr-cvs1:/tmp/cvs-serv3689/testsuite/simpletest Modified Files: build.xml Log Message: Touches velcro-broadcaster-ejb.jar to make sure it gets new deployment descriptor everytime. Index: build.xml =================================================================== RCS file: /cvsroot/velcro/velcro/testsuite/simpletest/build.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** build.xml 29 Oct 2002 18:44:17 -0000 1.5 --- build.xml 4 Dec 2002 04:16:29 -0000 1.6 *************** *** 91,94 **** --- 91,95 ---- <!-- Modify broadcaster jar --> <copy file="${build_dir}/lib/velcro-broadcaster-ejb.jar" todir="."/> + <touch file="velcro-broadcaster-ejb.jar" millis="0"/> <jar jarfile="velcro-broadcaster-ejb.jar"> <manifest> *************** *** 178,181 **** --- 179,185 ---- <!-- $Log$ + Revision 1.6 2002/12/04 04:16:29 heathm + Touches velcro-broadcaster-ejb.jar to make sure it gets new deployment descriptor everytime. + Revision 1.5 2002/10/29 18:44:17 heathm Added code to modify braodcaster EJB deploy descriptor. |
From: Mike H. <he...@us...> - 2002-12-04 04:14:38
|
Update of /cvsroot/velcro/velcro/main/src/java/velcro/messaging In directory sc8-pr-cvs1:/tmp/cvs-serv2451/velcro/messaging Removed Files: ReplyActionMessage.java Log Message: Deprecated. --- ReplyActionMessage.java DELETED --- |
From: Mike H. <he...@us...> - 2002-12-04 04:13:06
|
Update of /cvsroot/velcro/velcro/main/src/java/velcro/messaging In directory sc8-pr-cvs1:/tmp/cvs-serv1561/main/src/java/velcro/messaging Modified Files: ActionMessage.java Log Message: Added transaction constants for phases. Index: ActionMessage.java =================================================================== RCS file: /cvsroot/velcro/velcro/main/src/java/velcro/messaging/ActionMessage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ActionMessage.java 29 Oct 2002 18:41:37 -0000 1.2 --- ActionMessage.java 4 Dec 2002 04:13:03 -0000 1.3 *************** *** 40,51 **** public interface ActionMessage extends Serializable { /** * The default phase an <code>ActionMessage</code> object should be set to when constructed. */ public static final String PHASE_INIT = "INIT"; /** ! * The phase an <code>ActionMessage</code> object is when it is done being processed. */ ! public static final String PHASE_DONE = "DONE"; /** --- 40,66 ---- public interface ActionMessage extends Serializable { /** + * The phase an <code>ActionMessage</code> object is when it is done being processed. + */ + public static final String PHASE_DONE = "DONE"; + + /** * The default phase an <code>ActionMessage</code> object should be set to when constructed. */ public static final String PHASE_INIT = "INIT"; + + /** + * The phase a message is in right after committing the transaction. + */ + public static final String PHASE_POST_COMMIT = "POST-COMMIT"; /** ! * The phase a message is in right before committing the transaction. */ ! public static final String PHASE_PRE_COMMIT = "PRE-COMMIT"; ! ! /** ! * The phase a message is in after a transaction has been rolled back. ! */ ! public static final String PHASE_ROLLBACK = "PRE-ROLLBACK"; /** *************** *** 159,162 **** --- 174,180 ---- /* * $Log$ + * Revision 1.3 2002/12/04 04:13:03 heathm + * Added transaction constants for phases. + * * Revision 1.2 2002/10/29 18:41:37 heathm * Renamed state to phase. |
From: Mike H. <he...@us...> - 2002-12-04 04:11:59
|
Update of /cvsroot/velcro/velcro/main/src/java/velcro/broadcaster In directory sc8-pr-cvs1:/tmp/cvs-serv806/main/src/java/velcro/broadcaster Modified Files: MessageProcessorEntryComparator.java Log Message: Fixed null checking. Index: MessageProcessorEntryComparator.java =================================================================== RCS file: /cvsroot/velcro/velcro/main/src/java/velcro/broadcaster/MessageProcessorEntryComparator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MessageProcessorEntryComparator.java 3 Dec 2002 15:05:33 -0000 1.1 --- MessageProcessorEntryComparator.java 4 Dec 2002 04:11:56 -0000 1.2 *************** *** 59,67 **** MessageProcessorEntry e2 = (MessageProcessorEntry)o2; ! if (o1 == null || o2 == null) { return 0; ! } if (e1.getPriority() < e2.getPriority()) { return -1; ! } if (e1.getPriority() == e2.getPriority()) { return 0; } else { --- 59,71 ---- MessageProcessorEntry e2 = (MessageProcessorEntry)o2; ! if (e1 == e2) { return 0; ! } else if (e1 != null && e2 == null) { ! return 1; ! } else if (e1 == null && e2 != null) { return -1; ! } else if (e1.getPriority() < e2.getPriority()) { ! return -1; ! } else if (e1.getPriority() == e2.getPriority()) { return 0; } else { *************** *** 74,77 **** --- 78,84 ---- /* * $Log$ + * Revision 1.2 2002/12/04 04:11:56 heathm + * Fixed null checking. + * * Revision 1.1 2002/12/03 15:05:33 heathm * Initial add. |
From: Mike H. <he...@us...> - 2002-12-04 04:11:03
|
Update of /cvsroot/velcro/velcro/main In directory sc8-pr-cvs1:/tmp/cvs-serv32634/main Modified Files: build.xml Log Message: Added Velcro sources to velcro.jar. Index: build.xml =================================================================== RCS file: /cvsroot/velcro/velcro/main/build.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** build.xml 29 Oct 2002 18:38:49 -0000 1.16 --- build.xml 4 Dec 2002 04:11:00 -0000 1.17 *************** *** 106,109 **** --- 106,113 ---- <exclude name="**/*TEST*"/> </fileset> + <fileset dir="${sourcesDir}"> + <exclude name="**/*TEST*"/> + <exclude name="**/*.class"/> + </fileset> <fileset dir="${velcro.main.etc_dir}"> <include name="**/**" /> *************** *** 135,138 **** --- 139,145 ---- <!-- $Log$ + Revision 1.17 2002/12/04 04:11:00 heathm + Added Velcro sources to velcro.jar. + Revision 1.16 2002/10/29 18:38:49 heathm Renamed sources_dir to sourcesDir. |
From: Mike H. <he...@us...> - 2002-12-03 15:15:26
|
Update of /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/test2 In directory sc8-pr-cvs1:/tmp/cvs-serv20084/velcro/testsuite/simpletest/test2 Modified Files: EJB2.java Log Message: Set message to done so broadcaster knows we're done processing. Index: EJB2.java =================================================================== RCS file: /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/test2/EJB2.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EJB2.java 9 Sep 2002 22:13:04 -0000 1.1 --- EJB2.java 3 Dec 2002 15:15:20 -0000 1.2 *************** *** 38,41 **** --- 38,43 ---- import velcro.messaging.MessageProcessor; + import velcro.testsuite.simpletest.Constants; + /** * Tests the basic functionality of the message broadcaster. *************** *** 55,59 **** public ActionMessage processMessage(ActionMessage message) { mLogger.trace("In processMessage."); ! message.setData("TEST1", new Boolean(true)); return message; --- 57,63 ---- public ActionMessage processMessage(ActionMessage message) { mLogger.trace("In processMessage."); ! message.setData(Constants.DATA_ITEM2, new Boolean(true)); ! ! message.setPhase(ActionMessage.PHASE_DONE); return message; *************** *** 83,86 **** --- 87,93 ---- /* * $Log$ + * Revision 1.2 2002/12/03 15:15:20 heathm + * Set message to done so broadcaster knows we're done processing. + * * Revision 1.1 2002/09/09 22:13:04 heathm * Renamed from Test2EJB.java |
From: Mike H. <he...@us...> - 2002-12-03 15:14:26
|
Update of /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/tests In directory sc8-pr-cvs1:/tmp/cvs-serv19728/velcro/testsuite/simpletest/tests Modified Files: Test.java Log Message: Fixed testCalledAll unit test. The returned message from the broadcaster was not getting assigned. Index: Test.java =================================================================== RCS file: /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/tests/Test.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Test.java 3 Dec 2002 15:13:05 -0000 1.5 --- Test.java 3 Dec 2002 15:14:23 -0000 1.6 *************** *** 127,131 **** ActionMessage msg = new ActionMessageBase(); msg.setType(Constants.TYPE_ALL); ! broadcaster.broadcast(msg); broadcaster.remove(); assertTrue("Failed to set data field " + Constants.DATA_ITEM, msg.getData().containsKey(Constants.DATA_ITEM)); --- 127,131 ---- ActionMessage msg = new ActionMessageBase(); msg.setType(Constants.TYPE_ALL); ! msg = broadcaster.broadcast(msg); broadcaster.remove(); assertTrue("Failed to set data field " + Constants.DATA_ITEM, msg.getData().containsKey(Constants.DATA_ITEM)); *************** *** 139,142 **** --- 139,145 ---- /* *$Log$ + *Revision 1.6 2002/12/03 15:14:23 heathm + *Fixed testCalledAll unit test. The returned message from the broadcaster was not getting assigned. + * *Revision 1.5 2002/12/03 15:13:05 heathm *Fixed test cases so they actually work. |
From: Mike H. <he...@us...> - 2002-12-03 15:13:07
|
Update of /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/tests In directory sc8-pr-cvs1:/tmp/cvs-serv19146/velcro/testsuite/simpletest/tests Modified Files: Test.java Log Message: Fixed test cases so they actually work. Index: Test.java =================================================================== RCS file: /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/tests/Test.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Test.java 30 Oct 2002 00:26:50 -0000 1.4 --- Test.java 3 Dec 2002 15:13:05 -0000 1.5 *************** *** 95,106 **** } - public void testBroadcasterAvailable() throws CreateException, NamingException, RemoteException, RemoveException { - MessageBroadcaster broadcaster = createBroadcaster(); - - ActionMessage msg = new ActionMessageBase(); - broadcaster.broadcast(msg); - broadcaster.remove(); - } - public void testCalledEJB1() throws CreateException, NamingException, RemoteException, RemoveException { MessageBroadcaster broadcaster = createBroadcaster(); --- 95,98 ---- *************** *** 108,113 **** ActionMessage msg = new ActionMessageBase(); msg.setType(Constants.TYPE_TEST1); ! broadcaster.broadcast(msg); broadcaster.remove(); assertTrue("Failed to set data field " + Constants.DATA_ITEM1, msg.getData().containsKey(Constants.DATA_ITEM1)); assertTrue("Set "+ Constants.DATA_ITEM2 + " and shouldn't have.", !msg.getData().containsKey(Constants.DATA_ITEM2)); --- 100,106 ---- ActionMessage msg = new ActionMessageBase(); msg.setType(Constants.TYPE_TEST1); ! msg = broadcaster.broadcast(msg); broadcaster.remove(); + System.out.println(msg.toString()); assertTrue("Failed to set data field " + Constants.DATA_ITEM1, msg.getData().containsKey(Constants.DATA_ITEM1)); assertTrue("Set "+ Constants.DATA_ITEM2 + " and shouldn't have.", !msg.getData().containsKey(Constants.DATA_ITEM2)); *************** *** 120,125 **** ActionMessage msg = new ActionMessageBase(); msg.setType(Constants.TYPE_TEST2); ! broadcaster.broadcast(msg); broadcaster.remove(); assertTrue("Failed to set data field " + Constants.DATA_ITEM2, msg.getData().containsKey(Constants.DATA_ITEM2)); assertTrue("Set "+ Constants.DATA_ITEM1 + " and shouldn't have.", !msg.getData().containsKey(Constants.DATA_ITEM1)); --- 113,119 ---- ActionMessage msg = new ActionMessageBase(); msg.setType(Constants.TYPE_TEST2); ! msg = broadcaster.broadcast(msg); broadcaster.remove(); + System.out.println(msg.toString()); assertTrue("Failed to set data field " + Constants.DATA_ITEM2, msg.getData().containsKey(Constants.DATA_ITEM2)); assertTrue("Set "+ Constants.DATA_ITEM1 + " and shouldn't have.", !msg.getData().containsKey(Constants.DATA_ITEM1)); *************** *** 145,148 **** --- 139,145 ---- /* *$Log$ + *Revision 1.5 2002/12/03 15:13:05 heathm + *Fixed test cases so they actually work. + * *Revision 1.4 2002/10/30 00:26:50 heathm *Removed call to setState in messages since the default state is automatically set my the ActionMessageBase constructor. |
From: Mike H. <he...@us...> - 2002-12-03 15:11:37
|
Update of /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/test1 In directory sc8-pr-cvs1:/tmp/cvs-serv18448/velcro/testsuite/simpletest/test1 Modified Files: EJB1.java Log Message: Sets message phase to done so broadcaster knows we're done processing. Index: EJB1.java =================================================================== RCS file: /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/test1/EJB1.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EJB1.java 9 Sep 2002 22:12:47 -0000 1.1 --- EJB1.java 3 Dec 2002 15:11:33 -0000 1.2 *************** *** 38,41 **** --- 38,43 ---- import velcro.messaging.MessageProcessor; + import velcro.testsuite.simpletest.Constants; + /** * Tests the basic functionality of the message broadcaster. *************** *** 44,59 **** */ public class EJB1 implements SessionBean, MessageProcessor { ! public static final String LOG_NAME = "SIMPLE TEST 1 EJB"; ! ! protected Log mLogger; /** Creates a new instance of Test1EJB */ public EJB1() { - mLogger = LogFactory.getLog(LOG_NAME); } public ActionMessage processMessage(ActionMessage message) { ! mLogger.trace("In processMessage."); ! message.setData("TEST1", new Boolean(true)); return message; --- 46,61 ---- */ public class EJB1 implements SessionBean, MessageProcessor { ! protected Log log = LogFactory.getLog(this.getClass()); /** Creates a new instance of Test1EJB */ public EJB1() { } public ActionMessage processMessage(ActionMessage message) { ! ! log.trace("In processMessage."); ! message.setData(Constants.DATA_ITEM1, new Boolean(true)); ! ! message.setPhase(ActionMessage.PHASE_DONE); return message; *************** *** 61,81 **** public void ejbCreate() throws javax.ejb.CreateException { ! mLogger.trace("Creatinging EJB"); } public void ejbActivate() throws javax.ejb.EJBException, java.rmi.RemoteException { ! mLogger.trace("Activating."); } public void ejbPassivate() throws javax.ejb.EJBException, java.rmi.RemoteException { ! mLogger.trace("Passivating."); } public void ejbRemove() throws javax.ejb.EJBException, java.rmi.RemoteException { ! mLogger.trace("Removing."); } public void setSessionContext(SessionContext context) throws javax.ejb.EJBException, java.rmi.RemoteException { ! mLogger.trace("Setting session context."); } --- 63,83 ---- public void ejbCreate() throws javax.ejb.CreateException { ! log.trace("Creating test EJB 1"); } public void ejbActivate() throws javax.ejb.EJBException, java.rmi.RemoteException { ! log.trace("Activating."); } public void ejbPassivate() throws javax.ejb.EJBException, java.rmi.RemoteException { ! log.trace("Passivating."); } public void ejbRemove() throws javax.ejb.EJBException, java.rmi.RemoteException { ! log.trace("Removing."); } public void setSessionContext(SessionContext context) throws javax.ejb.EJBException, java.rmi.RemoteException { ! log.trace("Setting session context."); } *************** *** 84,87 **** --- 86,92 ---- /* * $Log$ + * Revision 1.2 2002/12/03 15:11:33 heathm + * Sets message phase to done so broadcaster knows we're done processing. + * * Revision 1.1 2002/09/09 22:12:47 heathm * Renamed from Test1EJB.java |
From: Mike H. <he...@us...> - 2002-12-03 15:09:57
|
Update of /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest In directory sc8-pr-cvs1:/tmp/cvs-serv17701/velcro/testsuite/simpletest Modified Files: Constants.java Log Message: Changed type constants to lower case. Index: Constants.java =================================================================== RCS file: /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/Constants.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Constants.java 30 Oct 2002 00:25:25 -0000 1.6 --- Constants.java 3 Dec 2002 15:09:54 -0000 1.7 *************** *** 35,41 **** */ public final class Constants { ! public static final String TYPE_TEST1 = "TEST1"; ! public static final String TYPE_TEST2 = "TEST2"; ! public static final String TYPE_ALL = "ALL"; public static final String DATA_ITEM1 = "DATA1"; --- 35,41 ---- */ public final class Constants { ! public static final String TYPE_TEST1 = "test1"; ! public static final String TYPE_TEST2 = "test2"; ! public static final String TYPE_ALL = "all"; public static final String DATA_ITEM1 = "DATA1"; *************** *** 46,49 **** --- 46,52 ---- /* * $Log$ + * Revision 1.7 2002/12/03 15:09:54 heathm + * Changed type constants to lower case. + * * Revision 1.6 2002/10/30 00:25:25 heathm * Removed phase constant. |
From: Mike H. <he...@us...> - 2002-12-03 15:08:53
|
Update of /cvsroot/velcro/velcro/testsuite/simpletest/dd/broadcaster/META-INF In directory sc8-pr-cvs1:/tmp/cvs-serv17268/testsuite/simpletest/dd/broadcaster/META-INF Modified Files: ejb-jar.xml Log Message: Added necesarry fields for broadcaster messaging tables. Added entries for test bean 2. Index: ejb-jar.xml =================================================================== RCS file: /cvsroot/velcro/velcro/testsuite/simpletest/dd/broadcaster/META-INF/ejb-jar.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ejb-jar.xml 29 Oct 2002 05:07:47 -0000 1.1 --- ejb-jar.xml 3 Dec 2002 15:08:50 -0000 1.2 *************** *** 23,32 **** <session-type>Stateless</session-type> <transaction-type>Bean</transaction-type> <!-- Test1 Start --> <env-entry> ! <env-entry-name>messages/test1/start/module-name</env-entry-name> <env-entry-type>java.lang.String</env-entry-type> <env-entry-value>ejb/velcro/simpletestTest1</env-entry-value> </env-entry> <ejb-local-ref> <ejb-ref-name>ejb/velcro/simpletestTest1</ejb-ref-name> --- 23,50 ---- <session-type>Stateless</session-type> <transaction-type>Bean</transaction-type> + + <!-- Default Priority --> + <env-entry> + <env-entry-name>defaultPriority</env-entry-name> + <env-entry-type>java.lang.Integer</env-entry-type> + <env-entry-value>45</env-entry-value> + </env-entry> + <!-- Test1 Start --> <env-entry> ! <env-entry-name>messages/test1/INIT/simpletestTest1/ejbName</env-entry-name> <env-entry-type>java.lang.String</env-entry-type> <env-entry-value>ejb/velcro/simpletestTest1</env-entry-value> </env-entry> + <env-entry> + <env-entry-name>messages/test1/INIT/simpletestTest1/priority</env-entry-name> + <env-entry-type>java.lang.Integer</env-entry-type> + <env-entry-value>50</env-entry-value> + </env-entry> + <env-entry> + <env-entry-name>messages/test1/INIT/simpletestTest1/broadcastMode</env-entry-name> + <env-entry-type>java.lang.String</env-entry-type> + <env-entry-value>controller</env-entry-value> + </env-entry> <ejb-local-ref> <ejb-ref-name>ejb/velcro/simpletestTest1</ejb-ref-name> *************** *** 37,40 **** --- 55,83 ---- </ejb-local-ref> <!-- Test1 End --> + + <!-- Test2 Start --> + <env-entry> + <env-entry-name>messages/test2/INIT/simpletestTest2/ejbName</env-entry-name> + <env-entry-type>java.lang.String</env-entry-type> + <env-entry-value>ejb/velcro/simpletestTest2</env-entry-value> + </env-entry> + <env-entry> + <env-entry-name>messages/test2/INIT/simpletestTest2/priority</env-entry-name> + <env-entry-type>java.lang.Integer</env-entry-type> + <env-entry-value>50</env-entry-value> + </env-entry> + <env-entry> + <env-entry-name>messages/test2/INIT/simpletestTest2/broadcastMode</env-entry-name> + <env-entry-type>java.lang.String</env-entry-type> + <env-entry-value>controller</env-entry-value> + </env-entry> + <ejb-local-ref> + <ejb-ref-name>ejb/velcro/simpletestTest2</ejb-ref-name> + <ejb-ref-type>Session</ejb-ref-type> + <local-home>velcro.broadcaster.MessageProcessorLocalHome</local-home> + <local>velcro.broadcaster.MessageProcessorLocal</local> + <ejb-link>simpletestTest2</ejb-link> + </ejb-local-ref> + <!-- Test2 End --> </session> <session> |
From: Mike H. <he...@us...> - 2002-12-03 15:07:28
|
Update of /cvsroot/velcro/velcro/main/src/java/velcro/broadcaster In directory sc8-pr-cvs1:/tmp/cvs-serv16650/velcro/broadcaster Modified Files: MessageBroadcasterEJB.java Log Message: Removed JMS stuff. Added initial message routing loops. Added message table loading. Index: MessageBroadcasterEJB.java =================================================================== RCS file: /cvsroot/velcro/velcro/main/src/java/velcro/broadcaster/MessageBroadcasterEJB.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MessageBroadcasterEJB.java 16 Oct 2002 04:47:51 -0000 1.1 --- MessageBroadcasterEJB.java 3 Dec 2002 15:07:25 -0000 1.2 *************** *** 29,40 **** package velcro.broadcaster; ! import javax.ejb.MessageDrivenBean; ! import javax.ejb.MessageDrivenContext; import javax.ejb.SessionBean; import javax.ejb.SessionContext; ! import javax.jms.JMSException; ! import javax.jms.Message; ! import javax.jms.MessageListener; ! import javax.jms.ObjectMessage; import org.apache.commons.logging.Log; --- 29,46 ---- package velcro.broadcaster; ! import java.util.Collection; ! import java.util.HashMap; ! import java.util.Iterator; ! import java.util.Map; ! import java.util.TreeMap; ! import java.util.TreeSet; ! ! import javax.ejb.CreateException; import javax.ejb.SessionBean; import javax.ejb.SessionContext; ! import javax.naming.InitialContext; ! import javax.naming.NameClassPair; ! import javax.naming.NamingEnumeration; ! import javax.naming.NamingException; import org.apache.commons.logging.Log; *************** *** 43,103 **** import velcro.messaging.ActionMessage; ! public class MessageBroadcasterEJB implements SessionBean, MessageDrivenBean, MessageListener { ! public static final String LOG_NAME = "Velcro Message Broadcaster"; ! protected SessionContext mContext; ! protected MessageDrivenContext mMsgContext; ! protected Log mLogger; public MessageBroadcasterEJB() { ! mLogger = LogFactory.getLog(LOG_NAME); } public void ejbCreate() { ! mLogger.trace("In ejbCreate"); } public void ejbRemove() { ! mLogger.trace("In ejbRemove"); } public void ejbActivate() { ! mLogger.trace("In ejbActivate"); } public void ejbPassivate() { ! mLogger.trace("In ejbPassivate"); } public void setSessionContext(SessionContext context) { ! mLogger.trace("Setting session context"); ! ! mContext = context; ! } ! ! public void setMessageDrivenContext(MessageDrivenContext context) { ! mLogger.trace("Setting message driven context"); ! ! mMsgContext = context; ! } ! ! public void onMessage(Message message) { ! mLogger.trace("Received JMS message"); ! try { ! //Extract action message object from JMS message. ! ObjectMessage om = (ObjectMessage)message; ! ActionMessage am = (ActionMessage)om.getObject(); ! ! if (mLogger.isInfoEnabled()) { ! mLogger.info("Received Action Message through JMS of type " + am.getType()); ! } ! ! // Process the message ! broadcast(am); ! } catch (JMSException e) { ! mLogger.fatal("Error extracting ActionMessage from JMS message", e); ! } } --- 49,122 ---- import velcro.messaging.ActionMessage; ! public class MessageBroadcasterEJB implements SessionBean { ! /** ! * JNDI location containing the message processor entries. ! */ ! public static final String MESSAGE_TABLE_LOCATION = "java:comp/env/messages"; ! public static final String ENV_DEFAULT_PRIORITY = "java:comp/env/defaultPriority"; ! public static final String JNDI_LOCATION_PROCESSOR_EJBS = "java:comp/env"; ! public static final int STATIC_DEFAULT_PRIORITY = 50; ! public static final int STATIC_DEFAULT_LOOP_COUNT = 100; ! public static final String PROCESSOR_ENTRY_EJB_NAME = "ejbName"; ! public static final String PROCESSOR_ENTRY_PRIORITY = "priority"; ! public static final String PROCESSOR_ENTRY_BROADCAST_MODE = "broadcastMode"; ! public static final String BROADCAST_MODE_BROADCAST = "broadcast"; ! public static final String BROADCAST_MODE_CONTROLLER = "controller"; ! ! protected Log log = LogFactory.getLog(this.getClass()); ! ! protected int DEFAULT_PRIORITY; ! ! protected SessionContext context; ! ! protected Map processors = new TreeMap(); ! ! /** ! * Used to store all the session bean instances so Statefull session beans ! * can be used with velcro. ! */ ! private Map processorMap; public MessageBroadcasterEJB() { ! processorMap = new HashMap(); } public void ejbCreate() { ! log.trace("In ejbCreate"); ! ! try { ! InitialContext ic = new InitialContext(); ! Integer dp = (Integer)ic.lookup(ENV_DEFAULT_PRIORITY); ! DEFAULT_PRIORITY = dp.intValue(); ! } catch (NamingException ne) { ! log.debug("'" + ENV_DEFAULT_PRIORITY + "' not found."); ! DEFAULT_PRIORITY = STATIC_DEFAULT_PRIORITY; ! } ! ! if (log.isDebugEnabled()) { ! log.debug("Default priority set to: " + DEFAULT_PRIORITY); ! } ! ! updateMessageEntryTable(); } public void ejbRemove() { ! log.trace("In ejbRemove"); } public void ejbActivate() { ! log.trace("In ejbActivate"); } public void ejbPassivate() { ! log.trace("In ejbPassivate"); } public void setSessionContext(SessionContext context) { ! log.trace("Setting session context"); ! this.context = context; } *************** *** 112,123 **** */ public ActionMessage broadcast(ActionMessage message) { ! if (mLogger.isInfoEnabled()) { ! mLogger.info("Processing message of type " + message.getType()); } ! return message; } public void queue(ActionMessage message) { } --- 131,340 ---- */ public ActionMessage broadcast(ActionMessage message) { ! // Ensure the processor map is empty. ! processorMap.clear(); ! ! if (log.isDebugEnabled()) { ! // TODO: Internationalize debug message. ! log.debug("Broadcasting message of type " + message.getType()); } ! ! int loopCount = 0; ! while (!message.getPhase().equals(ActionMessage.PHASE_DONE)) { ! if (loopCount > STATIC_DEFAULT_LOOP_COUNT) { ! // TODO: Internationalize these strings. ! log.debug("Infinite loop check triggered."); ! throw new RuntimeException("Max loop count exceded"); ! } ! loopCount++; ! String type = message.getType(); ! String phase = null; ! if (!processors.containsKey(type)) { ! // TODO: Create an exception for this (and internationalize it) ! log.debug("No registered processors for type: '" + message.getType() + "'"); ! throw new RuntimeException("No registered processors for type: '" + message.getType() + "'"); ! } ! Map processorPhases = (Map)processors.get(type); ! phase = message.getPhase(); ! if (!processorPhases.containsKey(phase)) { ! // TODO: Create custom exception for this. ! log.debug("There are no processors registered for phase: '" + message.getPhase() + "'"); ! throw new RuntimeException("There are no processors registered for phase: '" + message.getPhase() + "'"); ! } ! BroadcastModeContainer modes = (BroadcastModeContainer)processorPhases.get(phase); ! ! Collection controllers = modes.getControllers(); ! Collection broadcasters = modes.getBroadcasters(); ! if (controllers.isEmpty()) { ! // TODO: Internationalize this. ! log.warn("There are no controller processors for message: " + message); ! } ! ! log.trace("Iterating through broadcasters."); ! message = iterateProcessors(broadcasters, message); ! log.trace("Iterating through controllers."); ! message = iterateProcessors(controllers, message); ! ! } ! ! // TODO: Properly empty processorMap ! return message; } public void queue(ActionMessage message) { + log.trace("Queuing message"); + } + + protected ActionMessage iterateProcessors(Collection processors, ActionMessage message) { + try { + InitialContext ic = new InitialContext(); + Iterator i = processors.iterator(); + while (i.hasNext()) { + MessageProcessorEntry mpe = (MessageProcessorEntry)i.next(); + + if (log.isTraceEnabled()) { + log.trace("PROCESSOR ENTRY -- Type: " + mpe.getType() + " Phase: " + mpe.getPhase() + " EJB Name: " + mpe.getEjbName()); + log.trace(" Pre-process MESSAGE -- " + message); + } + + String ejbName = mpe.getEjbName(); + if (!processorMap.containsKey(ejbName)) { + //TODO: Add checking for remote or local interface. + String jndiName = JNDI_LOCATION_PROCESSOR_EJBS + "/" + ejbName; + if (log.isTraceEnabled()) { + log.trace("Looking up message processor at: " + jndiName); + } + MessageProcessorLocalHome processorHome = (MessageProcessorLocalHome)ic.lookup(jndiName); + MessageProcessorLocal processor = processorHome.create(); + processorMap.put(ejbName, processor); + } + //TODO: Add checking for remote or local interface. + MessageProcessorLocal processor = (MessageProcessorLocal)processorMap.get(ejbName); + message = processor.processMessage(message); + + if (log.isTraceEnabled()) { + log.trace(" Post-process MESSAGE -- " + message); + } + } + + return message; + } catch (NamingException ne) { + // TODO: Create custom exception for this and internationlize. + log.debug(ne); + throw new RuntimeException("Naming error", ne); + } catch (CreateException ce) { + // TODO: Internationalize this message + log.debug(ce); + throw new RuntimeException("Could not create message processor EJB", ce); + } + } + + protected void updateMessageEntryTable() { + try { + log.trace("Updating message entry table"); + InitialContext ic = new InitialContext(); + + // Loop through all types + NamingEnumeration types = ic.list(MESSAGE_TABLE_LOCATION); + while(types.hasMore()) { + NameClassPair typePair = (NameClassPair)types.next(); + String type = typePair.getName(); + + if (log.isTraceEnabled()) { + log.trace("Looking up phases with message type '" + type + "'"); + } + + String phasesLocation = MESSAGE_TABLE_LOCATION + "/" + type; + + if (log.isTraceEnabled()) { + log.trace("Looking up phases from " + phasesLocation); + } + + // Loop through all the phases for the current type + NamingEnumeration phases = ic.list(phasesLocation); + while(phases.hasMore()) { + NameClassPair phasePair = (NameClassPair)phases.next(); + String phase = phasePair.getName(); + + if (log.isTraceEnabled()) { + log.trace("Looking up message processors for type: '" + type + "' and phase: '" + phase + "'"); + } + + String processorLocation = phasesLocation + "/" + phase; + if (log.isTraceEnabled()) { + log.trace("Looking up processor parameters from " + processorLocation); + } + + NamingEnumeration processorNames = ic.list(processorLocation); + while(processorNames.hasMore()) { + NameClassPair processorNamePair = (NameClassPair)processorNames.next(); + String processorName = processorNamePair.getName(); + + String processorEntriesLocation = processorLocation + "/" + processorName; + + String ejbName; + int priority; + + // Lookup ejbName + ejbName = (String)ic.lookup(processorEntriesLocation + "/" + PROCESSOR_ENTRY_EJB_NAME); + if (log.isTraceEnabled()) { + log.trace("Looking up processor params for: '" + ejbName + "'"); + } + + // Lookup priority + try { + // Try block here is for looking up the priority. If thepriority isn't + // found (throws an exception) uses the default. + Integer p = (Integer)ic.lookup(processorEntriesLocation + "/" + PROCESSOR_ENTRY_PRIORITY); + priority = p.intValue(); + } catch (NamingException ne) { + // TODO: Internationalize this string. + log.debug("Priority not set, using default."); + priority = DEFAULT_PRIORITY; + } + + MessageProcessorEntry mpe = new MessageProcessorEntry(type, phase, ejbName, priority); + + // Check if the type is already in processors map. + if (!processors.containsKey(type)) { + // Add phases map. + processors.put(type, new TreeMap()); + } + Map phasesMap = (Map)processors.get(type); + if (!phasesMap.containsKey(phase)) { + Collection broadcasters = new TreeSet(new MessageProcessorEntryComparator()); + Collection controllers = new TreeSet(new MessageProcessorEntryComparator()); + BroadcastModeContainer bmc = new BroadcastModeContainer(broadcasters, controllers); + phasesMap.put(phase, bmc); + } + BroadcastModeContainer processorsList = (BroadcastModeContainer)phasesMap.get(phase); + + // Check to see this processor is to be handled as a controller or a broadcaster. + try { + String broadcastMode = (String)ic.lookup(processorEntriesLocation + "/" + PROCESSOR_ENTRY_BROADCAST_MODE); + if (broadcastMode.compareToIgnoreCase(BROADCAST_MODE_CONTROLLER) == 0) { + processorsList.getControllers().add(mpe); + } else { + // Defaults to broadcaster. + + // Make sure the following code matches the adding for a broadcaster in the + // catch block below. + processorsList.getBroadcasters().add(mpe); + } + } catch (NamingException ne) { + // TODO: Internationalize this string. + log.debug("Broadcast mode not set, defaulting to broadcast."); + + // Make sure the following code matches the adding for a broadcaster in the above + // try block. + processorsList.getBroadcasters().add(mpe); + } + } // Processor names loop + }// Phases loop + } // Types loop + } catch (NamingException e) { + log.error(e); + throw new RuntimeException(e); + } } *************** *** 126,129 **** --- 343,351 ---- /* * $Log$ + * Revision 1.2 2002/12/03 15:07:25 heathm + * Removed JMS stuff. + * Added initial message routing loops. + * Added message table loading. + * * Revision 1.1 2002/10/16 04:47:51 heathm * Moved source tree from /main/src to /main/src/java. |
From: Mike H. <he...@us...> - 2002-12-03 15:05:36
|
Update of /cvsroot/velcro/velcro/main/src/java/velcro/broadcaster In directory sc8-pr-cvs1:/tmp/cvs-serv15813/velcro/broadcaster Added Files: MessageProcessorEntryComparator.java Log Message: Initial add. --- NEW FILE: MessageProcessorEntryComparator.java --- /* * MessageProcessorEntryComparator.java * * This file is part of Velcro. * * Velcro is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Velcro 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 General Public License for more details. * You should have received a copy of the GNU General Public License * along with Velcro; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Copyright 2002, Mike Heath * * Created on November 27, 2002, 8:44 PM * Created by Mike Heath (heathm at users.sourceforge.net) * $Author: heathm $ * $Date: 2002/12/03 15:05:33 $ * $Revision: 1.1 $ */ package velcro.broadcaster; import java.util.Comparator; /** * Compares two <code>MessageProcessorEntry</code> objects based on their priority field. * * @author mike */ class MessageProcessorEntryComparator implements Comparator { /** Creates a new instance of MessageProcessorEntryComparator */ public MessageProcessorEntryComparator() { } /** * Compares two MessageProcessEntries to determine which has the higher * priority. * * @param o1 the first object to be compared. * @param o2 the second object to be compared. * @return a negative integer, zero, or a positive integer as the * first argument is less than, equal to, or greater than the * second. * @throws ClassCastException if the arguments' types prevent them from * being compared by this Comparator. * */ public int compare(Object o1, Object o2) { MessageProcessorEntry e1 = (MessageProcessorEntry)o1; MessageProcessorEntry e2 = (MessageProcessorEntry)o2; if (o1 == null || o2 == null) { return 0; } if (e1.getPriority() < e2.getPriority()) { return -1; } if (e1.getPriority() == e2.getPriority()) { return 0; } else { return 1; } } } /* * $Log: MessageProcessorEntryComparator.java,v $ * Revision 1.1 2002/12/03 15:05:33 heathm * Initial add. * */ |
From: Mike H. <he...@us...> - 2002-12-03 15:03:20
|
Update of /cvsroot/velcro/velcro/main/src/java/velcro/broadcaster In directory sc8-pr-cvs1:/tmp/cvs-serv14753/velcro/broadcaster Added Files: MessageProcessorEntry.java Log Message: Initial add. --- NEW FILE: MessageProcessorEntry.java --- /* * MessageProcessorEntry.java * * This file is part of Velcro. * * Velcro is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Velcro 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 General Public License for more details. * You should have received a copy of the GNU General Public License * along with Velcro; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Copyright 2002, Mike Heath * * Created on November 19, 2002, 9:16 PM * Created by Mike Heath (heathm at users.sourceforge.net) * $Author: heathm $ * $Date: 2002/12/03 15:03:17 $ * $Revision: 1.1 $ */ package velcro.broadcaster; /** * Holds a message processor entry as retreived from the EJB environment * entries. * * @author Mike Heath (mike at users.sourceforgen.net) */ class MessageProcessorEntry { private String type; private String phase; private String ejbName; private int priority; /** * Creates a new instance of MessageProcessorEntry */ public MessageProcessorEntry(String type, String phase, String ejbName, int priority) { setType(type); setPhase(phase); setEjbName(ejbName); setPriority(priority); } /** * Returns the JNDI EJB reference name for the current entry. * * @return EJB reference name */ public java.lang.String getEjbName() { return ejbName; } /** * Sets the JNDI EJB reference name for the current entry. * * @param ejbName EJB reference name */ public void setEjbName(String ejbName) { this.ejbName = ejbName; } /** * Returns the priority in which entry is invoked. * * @return The priority */ public int getPriority() { return priority; } /** * Sets the priority in which entry is invoked. * * @param priority The priority. * */ public void setPriority(int priority) { this.priority = priority; } /** * Returns the type of the message this processor handles. * * @return The message type. */ public String getType() { return type; } /** * Sets the type of the message this processor handles. * * @param type The message type. */ public void setType(String type) { this.type = type; } /** * Returns the phase of the message this processor handles. * * @return The message phase. */ public String getPhase() { return phase; } /** * Sets the phase of the message this processor handles. * * @param phase The message phase. */ public void setPhase(java.lang.String phase) { this.phase = phase; } } /* * $Log: MessageProcessorEntry.java,v $ * Revision 1.1 2002/12/03 15:03:17 heathm * Initial add. * */ |
From: Mike H. <he...@us...> - 2002-12-03 15:01:38
|
Update of /cvsroot/velcro/velcro/main/src/java/velcro/broadcaster In directory sc8-pr-cvs1:/tmp/cvs-serv13994/velcro/broadcaster Added Files: BroadcastModeContainer.java Log Message: Initial add. --- NEW FILE: BroadcastModeContainer.java --- /* * BroadcastModesContainer.java * * This file is part of Velcro. * * Velcro is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Velcro 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 General Public License for more details. * You should have received a copy of the GNU General Public License * along with Velcro; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Copyright 2002, Mike Heath * * Created on November 27, 2002, 8:34 PM * Created by Mike Heath (heathm at users.sourceforge.net) * $Author: heathm $ * $Date: 2002/12/03 15:01:35 $ * $Revision: 1.1 $ */ package velcro.broadcaster; import java.util.Collection; /** * Holds two collections for handling controller lists and broadcast lists. * *<p>This is probably a dumb name and should be changed in the future. * * @author Mike Heath <mike (at) users.sourceforge.net> */ class BroadcastModeContainer { private Collection broadcasters; private Collection controllers; /** Creates a new instance of BroadcastModesContainer */ public BroadcastModeContainer(Collection broadcasters, Collection controllers) { setBroadcasters(broadcasters); setControllers(controllers); } /** * Getter for property broadcasters. * * @return Value of property broadcasters. */ public java.util.Collection getBroadcasters() { return broadcasters; } /** * Setter for property broadcasters. * * @param broadcasters New value of property broadcasters. */ public void setBroadcasters(java.util.Collection broadcasters) { this.broadcasters = broadcasters; } /** * Getter for property controllers. * * @return Value of property controllers. */ public java.util.Collection getControllers() { return controllers; } /** * Setter for property controllers. * * @param controllers New value of property controllers. */ public void setControllers(java.util.Collection controllers) { this.controllers = controllers; } } /* * $Log: BroadcastModeContainer.java,v $ * Revision 1.1 2002/12/03 15:01:35 heathm * Initial add. * */ |
From: Mike H. <he...@us...> - 2002-10-30 00:26:53
|
Update of /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/tests In directory usw-pr-cvs1:/tmp/cvs-serv26430 Modified Files: Test.java Log Message: Removed call to setState in messages since the default state is automatically set my the ActionMessageBase constructor. Index: Test.java =================================================================== RCS file: /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/tests/Test.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Test.java 14 Sep 2002 18:51:26 -0000 1.3 --- Test.java 30 Oct 2002 00:26:50 -0000 1.4 *************** *** 108,112 **** ActionMessage msg = new ActionMessageBase(); msg.setType(Constants.TYPE_TEST1); - msg.setState(Constants.STATE); broadcaster.broadcast(msg); broadcaster.remove(); --- 108,111 ---- *************** *** 121,125 **** ActionMessage msg = new ActionMessageBase(); msg.setType(Constants.TYPE_TEST2); - msg.setState(Constants.STATE); broadcaster.broadcast(msg); broadcaster.remove(); --- 120,123 ---- *************** *** 135,139 **** ActionMessage msg = new ActionMessageBase(); msg.setType(Constants.TYPE_ALL); - msg.setState(Constants.STATE); broadcaster.broadcast(msg); broadcaster.remove(); --- 133,136 ---- *************** *** 148,151 **** --- 145,151 ---- /* *$Log$ + *Revision 1.4 2002/10/30 00:26:50 heathm + *Removed call to setState in messages since the default state is automatically set my the ActionMessageBase constructor. + * *Revision 1.3 2002/09/14 18:51:26 heathm *Set the state on all messages. |
From: Mike H. <he...@us...> - 2002-10-30 00:25:27
|
Update of /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest In directory usw-pr-cvs1:/tmp/cvs-serv25858 Modified Files: Constants.java Log Message: Removed phase constant. Index: Constants.java =================================================================== RCS file: /cvsroot/velcro/velcro/testsuite/simpletest/src/java/velcro/testsuite/simpletest/Constants.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Constants.java 29 Oct 2002 18:45:09 -0000 1.5 --- Constants.java 30 Oct 2002 00:25:25 -0000 1.6 *************** *** 39,44 **** public static final String TYPE_ALL = "ALL"; - public static final String PHASE = "START"; - public static final String DATA_ITEM1 = "DATA1"; public static final String DATA_ITEM2 = "DATA2"; --- 39,42 ---- *************** *** 48,51 **** --- 46,52 ---- /* * $Log$ + * Revision 1.6 2002/10/30 00:25:25 heathm + * Removed phase constant. + * * Revision 1.5 2002/10/29 18:45:09 heathm * Renamed STATE to PHASE. |