Thread: [Ejtools-cvs] CVS: applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/jms
Brought to you by:
letiemble
From: Laurent E. <let...@us...> - 2002-05-15 20:44:54
|
Update of /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/jms In directory usw-pr-cvs1:/tmp/cvs-serv6185/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/jms Modified Files: BytesMessageProxy.java ConnectionFactoryProxy.java ConnectionService.java MapMessageProxy.java MessageProxy.java ObjectMessageProxy.java QueueProxy.java StreamMessageProxy.java TextMessageProxy.java TopicProxy.java Log Message: Add JavaDocs tags for BeanInfo generation by XDoclet Index: BytesMessageProxy.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/jms/BytesMessageProxy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BytesMessageProxy.java 12 May 2002 19:55:27 -0000 1.1 --- BytesMessageProxy.java 15 May 2002 20:44:51 -0000 1.2 *************** *** 1,37 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package net.sourceforge.ejtools.jndibrowser.model.jms; ! ! import java.awt.Component; ! import javax.jms.JMSException; ! import javax.jms.Message; ! import javax.jms.TextMessage; ! ! import org.apache.log4j.Category; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class BytesMessageProxy extends MessageProxy ! { ! /** ! * Constructor for the MessageProxy object ! * ! * @param name Description of Parameter ! * @param message Description of Parameter ! */ ! public BytesMessageProxy(String name, Message message) ! { ! super(name, message); ! } ! } ! --- 1,57 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package net.sourceforge.ejtools.jndibrowser.model.jms; ! ! import java.awt.Component; ! import javax.jms.JMSException; ! import javax.jms.Message; ! import javax.jms.TextMessage; ! ! import org.apache.log4j.Category; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @beaninfo:class displayName="JMS Bytes Message" shortDescription="JMS ! * Bytes Message" ! * @beaninfo:icons color16="toolbarButtonGraphics/development/jms/BytesMessage16.gif" ! * @beaninfo:property name="correlationId" class="java.lang.String" ! * displayName="Correlation Id" shortDescription="Correlation Id" ! * @beaninfo:property name="deliveryMode" class="int" displayName="Delivery ! * Mode" shortDescription="Delivery Mode" ! * propertyeditor="net.sourceforge.ejtools.jndibrowser.model.jms.DeliveryModeEditor" ! * @beaninfo:property name="expiration" class="long" displayName="Expiration" ! * shortDescription="Expiration" propertyeditor="net.sourceforge.ejtools.awt.editors.DateTimeEditor" ! * @beaninfo:property name="messageId" class="java.lang.String" ! * displayName="Message Id" shortDescription="Message Id" ! * @beaninfo:property name="priority" class="int" displayName="Priority" ! * shortDescription="Priority" ! * @beaninfo:property name="redelivered" class="boolean" displayName="Is ! * redelivered" shortDescription="Is redelivered" ! * @beaninfo:property name="timestamp" class="java.util.Date" ! * displayName="TimeStamp" shortDescription="TimeStamp" ! * propertyeditor="net.sourceforge.ejtools.awt.editors.DateTimeEditor" ! * @beaninfo:property name="type" class="java.lang.String" displayName="Type" ! * shortDescription="Type" ! */ ! public class BytesMessageProxy extends MessageProxy ! { ! /** ! * Constructor for the MessageProxy object ! * ! * @param message Description of Parameter ! */ ! public BytesMessageProxy(Message message) ! { ! super(message); ! } ! } ! Index: ConnectionFactoryProxy.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/jms/ConnectionFactoryProxy.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ConnectionFactoryProxy.java 5 May 2002 20:20:25 -0000 1.4 --- ConnectionFactoryProxy.java 15 May 2002 20:44:51 -0000 1.5 *************** *** 18,21 **** --- 18,22 ---- import net.sourceforge.ejtools.jndibrowser.model.JNDIEntry; + import org.apache.log4j.Category; *************** *** 23,32 **** * Description of the Class * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo Add log4j logs ! * @todo Review the exception raised */ public class ConnectionFactoryProxy extends JNDIEntry --- 24,46 ---- * Description of the Class * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo Add log4j logs ! * @todo Review the exception raised ! * @beaninfo:class displayName="Connection Factory" ! * shortDescription="Connection Factory" ! * @beaninfo:icons color16="/toolbarButtonGraphics/development/Server16.gif" ! * @beaninfo:property name="name" class="java.lang.String" displayName="Name" ! * shortDescription="Name of the Connection Factory" ! * @beaninfo:property name="className" class="java.lang.String" ! * displayName="Class" shortDescription="Class of the Connection Factory" ! * @beaninfo:property name="queueConnectionFactory" class="boolean" ! * displayName="Can Create QueueConnection" shortDescription="JNDI context ! * factory" ! * @beaninfo:property name="topicConnectionFactory" class="boolean" ! * displayName="Can Create QueueConnection" shortDescription="JNDI context ! * factory" */ public class ConnectionFactoryProxy extends JNDIEntry *************** *** 42,45 **** --- 56,61 ---- /** Description of the Field */ protected TopicConnectionFactory topicConnectionFactory = null; + /** Description of the Field */ + private static Category logger = Category.getInstance(ConnectionFactoryProxy.class); *************** *** 127,132 **** catch (Exception e) { ! System.out.println("Error during release of service ConnectionService (" + e.getMessage() + ")"); ! e.printStackTrace(); } } --- 143,147 ---- catch (Exception e) { ! logger.error("Error during release of service ConnectionService (" + e.getMessage() + ")"); } } *************** *** 156,161 **** catch (Exception e) { ! System.out.println("Error during utilisation of service ConnectionService (" + e.getMessage() + ")"); ! e.printStackTrace(); } } --- 171,175 ---- catch (Exception e) { ! logger.error("Error during utilisation of service ConnectionService (" + e.getMessage() + ")"); } } Index: ConnectionService.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/jms/ConnectionService.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ConnectionService.java 5 May 2002 20:20:25 -0000 1.4 --- ConnectionService.java 15 May 2002 20:44:51 -0000 1.5 *************** *** 40,43 **** --- 40,51 ---- */ public TopicConnectionFactory getDefaultTopicConnectionFactory(); + + + /** + * Description of the Method + * + * @param type Description of the Parameter + */ + public void selectFactory(String type); } Index: MapMessageProxy.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/jms/MapMessageProxy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MapMessageProxy.java 12 May 2002 19:55:28 -0000 1.1 --- MapMessageProxy.java 15 May 2002 20:44:51 -0000 1.2 *************** *** 1,37 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package net.sourceforge.ejtools.jndibrowser.model.jms; ! ! import java.awt.Component; ! import javax.jms.JMSException; ! import javax.jms.Message; ! import javax.jms.TextMessage; ! ! import org.apache.log4j.Category; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class MapMessageProxy extends MessageProxy ! { ! /** ! * Constructor for the MessageProxy object ! * ! * @param name Description of Parameter ! * @param message Description of Parameter ! */ ! public MapMessageProxy(String name, Message message) ! { ! super(name, message); ! } ! } ! --- 1,57 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package net.sourceforge.ejtools.jndibrowser.model.jms; ! ! import java.awt.Component; ! import javax.jms.JMSException; ! import javax.jms.Message; ! import javax.jms.TextMessage; ! ! import org.apache.log4j.Category; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @beaninfo:class displayName="JMS Map Message" shortDescription="JMS Map ! * Message" ! * @beaninfo:icons color16="toolbarButtonGraphics/development/jms/MapMessage16.gif" ! * @beaninfo:property name="correlationId" class="java.lang.String" ! * displayName="Correlation Id" shortDescription="Correlation Id" ! * @beaninfo:property name="deliveryMode" class="int" displayName="Delivery ! * Mode" shortDescription="Delivery Mode" ! * propertyeditor="net.sourceforge.ejtools.jndibrowser.model.jms.DeliveryModeEditor" ! * @beaninfo:property name="expiration" class="long" displayName="Expiration" ! * shortDescription="Expiration" propertyeditor="net.sourceforge.ejtools.awt.editors.DateTimeEditor" ! * @beaninfo:property name="messageId" class="java.lang.String" ! * displayName="Message Id" shortDescription="Message Id" ! * @beaninfo:property name="priority" class="int" displayName="Priority" ! * shortDescription="Priority" ! * @beaninfo:property name="redelivered" class="boolean" displayName="Is ! * redelivered" shortDescription="Is redelivered" ! * @beaninfo:property name="timestamp" class="java.util.Date" ! * displayName="TimeStamp" shortDescription="TimeStamp" ! * propertyeditor="net.sourceforge.ejtools.awt.editors.DateTimeEditor" ! * @beaninfo:property name="type" class="java.lang.String" displayName="Type" ! * shortDescription="Type" ! */ ! public class MapMessageProxy extends MessageProxy ! { ! /** ! * Constructor for the MessageProxy object ! * ! * @param message Description of Parameter ! */ ! public MapMessageProxy(Message message) ! { ! super(message); ! } ! } ! Index: MessageProxy.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/jms/MessageProxy.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MessageProxy.java 12 May 2002 20:10:39 -0000 1.5 --- MessageProxy.java 15 May 2002 20:44:51 -0000 1.6 *************** *** 9,13 **** --- 9,15 ---- import java.lang.reflect.Constructor; import java.util.Date; + import java.util.Enumeration; import java.util.Hashtable; + import java.util.ResourceBundle; import javax.jms.BytesMessage; *************** *** 22,34 **** import net.sourceforge.ejtools.jndibrowser.model.JNDIEntry; /** * Description of the Class * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Exceptions to detail ! * @todo Javadoc to complete ! * @todo Add log4j logs */ public class MessageProxy extends JNDIEntry --- 24,58 ---- import net.sourceforge.ejtools.jndibrowser.model.JNDIEntry; + import org.apache.log4j.Category; + /** * Description of the Class * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Exceptions to detail ! * @todo Javadoc to complete ! * @todo Add log4j logs ! * @beaninfo:class displayName="JMS Message" shortDescription="JMS Message" ! * @beaninfo:icons color16="toolbarButtonGraphics/development/jms/Message16.gif" ! * @beaninfo:property name="correlationId" class="java.lang.String" ! * displayName="Correlation Id" shortDescription="Correlation Id" ! * @beaninfo:property name="deliveryMode" class="int" displayName="Delivery ! * Mode" shortDescription="Delivery Mode" ! * propertyeditor="net.sourceforge.ejtools.jndibrowser.model.jms.DeliveryModeEditor" ! * @beaninfo:property name="expiration" class="long" displayName="Expiration" ! * shortDescription="Expiration" propertyeditor="net.sourceforge.ejtools.awt.editors.DateTimeEditor" ! * @beaninfo:property name="messageId" class="java.lang.String" ! * displayName="Message Id" shortDescription="Message Id" ! * @beaninfo:property name="priority" class="int" displayName="Priority" ! * shortDescription="Priority" ! * @beaninfo:property name="redelivered" class="boolean" displayName="Is ! * redelivered" shortDescription="Is redelivered" ! * @beaninfo:property name="timestamp" class="java.util.Date" ! * displayName="TimeStamp" shortDescription="TimeStamp" ! * propertyeditor="net.sourceforge.ejtools.awt.editors.DateTimeEditor" ! * @beaninfo:property name="type" class="java.lang.String" displayName="Type" ! * shortDescription="Type" */ public class MessageProxy extends JNDIEntry *************** *** 37,41 **** --- 61,69 ---- protected Message message = null; /** Description of the Field */ + private static Category logger = Category.getInstance(MessageProxy.class); + /** Description of the Field */ private static Hashtable proxies = new Hashtable(); + /** Bundle for I18N */ + private final static ResourceBundle res = ResourceBundle.getBundle("ApplicationResources"); *************** *** 43,53 **** * Constructor for the MessageProxy object * - * @param name Description of Parameter * @param message Description of Parameter */ ! public MessageProxy(String name, Message message) { - this.name = name; this.message = message; } --- 71,90 ---- * Constructor for the MessageProxy object * * @param message Description of Parameter + * @todo I18N to complete */ ! public MessageProxy(Message message) { this.message = message; + this.name = res.getString("tree.message.name"); + + try + { + this.name = this.name + " " + getTimestamp().getTime(); + } + catch (Exception e) + { + // Ignore it + } } *************** *** 176,203 **** * Description of the Method * - * @param name Description of Parameter * @param message Description of Parameter * @return Description of the Returned Value */ ! public static MessageProxy createMessageProxy(String name, Message message) { ! Class clazz = (Class) proxies.get(message.getClass()); try { ! Constructor constructor = clazz.getConstructor(new Class[]{java.lang.String.class, javax.jms.Message.class}); ! MessageProxy proxy = (MessageProxy) constructor.newInstance(new Object[]{name, message}); return proxy; } catch (Exception e) { } ! return new MessageProxy(name, message); } ! /** Load the list of proxies to create */ static { - proxies.put(javax.jms.Message.class, MessageProxy.class); proxies.put(javax.jms.BytesMessage.class, BytesMessageProxy.class); proxies.put(javax.jms.MapMessage.class, MapMessageProxy.class); --- 213,256 ---- * Description of the Method * * @param message Description of Parameter * @return Description of the Returned Value */ ! public static MessageProxy createMessageProxy(Message message) { ! logger.debug("Message " + message); ! ! Class clazz = null; ! Enumeration enum = proxies.keys(); ! while ((enum.hasMoreElements()) && (clazz == null)) ! { ! Class i = (Class) enum.nextElement(); ! if (i.isAssignableFrom(message.getClass())) ! { ! clazz = (Class) proxies.get(i); ! } ! } ! ! if (clazz == null) ! { ! clazz = javax.jms.Message.class; ! } try { ! Constructor constructor = clazz.getConstructor(new Class[]{javax.jms.Message.class}); ! MessageProxy proxy = (MessageProxy) constructor.newInstance(new Object[]{message}); return proxy; } catch (Exception e) { + // Ignore it } ! ! return new MessageProxy(message); } ! /** Load the list of proxies to create */ static { proxies.put(javax.jms.BytesMessage.class, BytesMessageProxy.class); proxies.put(javax.jms.MapMessage.class, MapMessageProxy.class); Index: ObjectMessageProxy.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/jms/ObjectMessageProxy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ObjectMessageProxy.java 12 May 2002 19:55:28 -0000 1.1 --- ObjectMessageProxy.java 15 May 2002 20:44:51 -0000 1.2 *************** *** 1,37 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package net.sourceforge.ejtools.jndibrowser.model.jms; ! ! import java.awt.Component; ! import javax.jms.JMSException; ! import javax.jms.Message; ! import javax.jms.TextMessage; ! ! import org.apache.log4j.Category; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class ObjectMessageProxy extends MessageProxy ! { ! /** ! * Constructor for the MessageProxy object ! * ! * @param name Description of Parameter ! * @param message Description of Parameter ! */ ! public ObjectMessageProxy(String name, Message message) ! { ! super(name, message); ! } ! } ! --- 1,57 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package net.sourceforge.ejtools.jndibrowser.model.jms; ! ! import java.awt.Component; ! import javax.jms.JMSException; ! import javax.jms.Message; ! import javax.jms.TextMessage; ! ! import org.apache.log4j.Category; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @beaninfo:class displayName="JMS Object Message" shortDescription="JMS ! * Object Message" ! * @beaninfo:icons color16="toolbarButtonGraphics/development/jms/ObjectMessage16.gif" ! * @beaninfo:property name="correlationId" class="java.lang.String" ! * displayName="Correlation Id" shortDescription="Correlation Id" ! * @beaninfo:property name="deliveryMode" class="int" displayName="Delivery ! * Mode" shortDescription="Delivery Mode" ! * propertyeditor="net.sourceforge.ejtools.jndibrowser.model.jms.DeliveryModeEditor" ! * @beaninfo:property name="expiration" class="long" displayName="Expiration" ! * shortDescription="Expiration" propertyeditor="net.sourceforge.ejtools.awt.editors.DateTimeEditor" ! * @beaninfo:property name="messageId" class="java.lang.String" ! * displayName="Message Id" shortDescription="Message Id" ! * @beaninfo:property name="priority" class="int" displayName="Priority" ! * shortDescription="Priority" ! * @beaninfo:property name="redelivered" class="boolean" displayName="Is ! * redelivered" shortDescription="Is redelivered" ! * @beaninfo:property name="timestamp" class="java.util.Date" ! * displayName="TimeStamp" shortDescription="TimeStamp" ! * propertyeditor="net.sourceforge.ejtools.awt.editors.DateTimeEditor" ! * @beaninfo:property name="type" class="java.lang.String" displayName="Type" ! * shortDescription="Type" ! */ ! public class ObjectMessageProxy extends MessageProxy ! { ! /** ! * Constructor for the MessageProxy object ! * ! * @param message Description of Parameter ! */ ! public ObjectMessageProxy(Message message) ! { ! super(message); ! } ! } ! Index: QueueProxy.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/jms/QueueProxy.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** QueueProxy.java 12 May 2002 19:55:28 -0000 1.4 --- QueueProxy.java 15 May 2002 20:44:51 -0000 1.5 *************** *** 26,29 **** --- 26,31 ---- import net.sourceforge.ejtools.jndibrowser.model.JNDIEntry; + import net.sourceforge.ejtools.util.Sort; + import org.apache.log4j.Category; *************** *** 46,49 **** --- 48,53 ---- /** Description of the Field */ private Queue queue = null; + /** Description of the Field */ + private static Category logger = Category.getInstance(QueueProxy.class); *************** *** 67,71 **** public void browse() { ! // Clean the Queue Iterator iterator = iterator(); while (iterator.hasNext()) --- 71,75 ---- public void browse() { ! logger.debug("Cleaning the Queue..."); Iterator iterator = iterator(); while (iterator.hasNext()) *************** *** 87,100 **** count = 0; - Enumeration enum = queueBrowser.getEnumeration(); ! System.out.println("Enumeration " + enum); while (enum.hasMoreElements()) { message = (Message) enum.nextElement(); ! MessageProxy newMessage = MessageProxy.createMessageProxy("Message " + count, message); count++; - System.out.println("Count is " + count); add(newMessage); --- 91,102 ---- count = 0; Enumeration enum = queueBrowser.getEnumeration(); ! while (enum.hasMoreElements()) { message = (Message) enum.nextElement(); ! MessageProxy newMessage = MessageProxy.createMessageProxy(message); count++; add(newMessage); *************** *** 108,112 **** catch (Exception e) { ! System.out.println("Exception occurred: " + e.toString()); } finally --- 110,114 ---- catch (Exception e) { ! logger.warn("Exception occurred: " + e.toString()); } finally *************** *** 120,123 **** --- 122,126 ---- catch (JMSException e) { + // Ignore it } } *************** *** 148,152 **** catch (JMSException e) { ! System.out.println("Exception occurred: " + e.toString()); } finally --- 151,155 ---- catch (JMSException e) { ! logger.warn("Exception occurred: " + e.toString()); } finally *************** *** 163,166 **** --- 166,170 ---- } } + // Browse the content this.browse(); *************** *** 195,199 **** catch (JMSException e) { ! System.out.println("Exception occurred: " + e.toString()); } finally --- 199,203 ---- catch (JMSException e) { ! logger.warn("Exception occurred: " + e.toString()); } finally *************** *** 210,213 **** --- 214,218 ---- } } + // Browse the content this.browse(); *************** *** 228,231 **** --- 233,247 ---- /** + * Return the message of this queue as an iterator + * + * @return The sorted iterator by name + */ + public Iterator iterator() + { + return Sort.sortByName(super.iterator()); + } + + + /** * Description of the Method * *************** *** 258,262 **** catch (JMSException e) { ! System.out.println("No Connection: " + e.toString()); } } --- 274,278 ---- catch (JMSException e) { ! logger.warn("No Connection: " + e.toString()); } } *************** *** 284,288 **** catch (Exception e) { ! System.out.println("No Factory: " + e.toString()); } --- 300,304 ---- catch (Exception e) { ! logger.warn("No Factory: " + e.toString()); } Index: StreamMessageProxy.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/jms/StreamMessageProxy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StreamMessageProxy.java 12 May 2002 19:55:28 -0000 1.1 --- StreamMessageProxy.java 15 May 2002 20:44:51 -0000 1.2 *************** *** 1,37 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package net.sourceforge.ejtools.jndibrowser.model.jms; ! ! import java.awt.Component; ! import javax.jms.JMSException; ! import javax.jms.Message; ! import javax.jms.TextMessage; ! ! import org.apache.log4j.Category; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class StreamMessageProxy extends MessageProxy ! { ! /** ! * Constructor for the MessageProxy object ! * ! * @param name Description of Parameter ! * @param message Description of Parameter ! */ ! public StreamMessageProxy(String name, Message message) ! { ! super(name, message); ! } ! } ! --- 1,57 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package net.sourceforge.ejtools.jndibrowser.model.jms; ! ! import java.awt.Component; ! import javax.jms.JMSException; ! import javax.jms.Message; ! import javax.jms.TextMessage; ! ! import org.apache.log4j.Category; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @beaninfo:class displayName="JMS Stream Message" shortDescription="JMS ! * Stream Message" ! * @beaninfo:icons color16="toolbarButtonGraphics/development/jms/StreamMessage16.gif" ! * @beaninfo:property name="correlationId" class="java.lang.String" ! * displayName="Correlation Id" shortDescription="Correlation Id" ! * @beaninfo:property name="deliveryMode" class="int" displayName="Delivery ! * Mode" shortDescription="Delivery Mode" ! * propertyeditor="net.sourceforge.ejtools.jndibrowser.model.jms.DeliveryModeEditor" ! * @beaninfo:property name="expiration" class="long" displayName="Expiration" ! * shortDescription="Expiration" propertyeditor="net.sourceforge.ejtools.awt.editors.DateTimeEditor" ! * @beaninfo:property name="messageId" class="java.lang.String" ! * displayName="Message Id" shortDescription="Message Id" ! * @beaninfo:property name="priority" class="int" displayName="Priority" ! * shortDescription="Priority" ! * @beaninfo:property name="redelivered" class="boolean" displayName="Is ! * redelivered" shortDescription="Is redelivered" ! * @beaninfo:property name="timestamp" class="java.util.Date" ! * displayName="TimeStamp" shortDescription="TimeStamp" ! * propertyeditor="net.sourceforge.ejtools.awt.editors.DateTimeEditor" ! * @beaninfo:property name="type" class="java.lang.String" displayName="Type" ! * shortDescription="Type" ! */ ! public class StreamMessageProxy extends MessageProxy ! { ! /** ! * Constructor for the MessageProxy object ! * ! * @param message Description of Parameter ! */ ! public StreamMessageProxy(Message message) ! { ! super(message); ! } ! } ! Index: TextMessageProxy.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/jms/TextMessageProxy.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TextMessageProxy.java 12 May 2002 19:55:28 -0000 1.4 --- TextMessageProxy.java 15 May 2002 20:44:51 -0000 1.5 *************** *** 17,24 **** * Description of the Class * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete */ public class TextMessageProxy extends MessageProxy --- 17,48 ---- * Description of the Class * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @beaninfo:class displayName="JMS Text Message" shortDescription="JMS ! * Text Message" ! * @beaninfo:icons color16="toolbarButtonGraphics/development/jms/TextMessage16.gif" ! * @beaninfo:property name="correlationId" class="java.lang.String" ! * displayName="Correlation Id" shortDescription="Correlation Id" ! * @beaninfo:property name="deliveryMode" class="int" displayName="Delivery ! * Mode" shortDescription="Delivery Mode" ! * propertyeditor="net.sourceforge.ejtools.jndibrowser.model.jms.DeliveryModeEditor" ! * @beaninfo:property name="expiration" class="long" displayName="Expiration" ! * shortDescription="Expiration" propertyeditor="net.sourceforge.ejtools.awt.editors.DateTimeEditor" ! * @beaninfo:property name="messageId" class="java.lang.String" ! * displayName="Message Id" shortDescription="Message Id" ! * @beaninfo:property name="priority" class="int" displayName="Priority" ! * shortDescription="Priority" ! * @beaninfo:property name="redelivered" class="boolean" displayName="Is ! * redelivered" shortDescription="Is redelivered" ! * @beaninfo:property name="timestamp" class="java.util.Date" ! * displayName="TimeStamp" shortDescription="TimeStamp" ! * propertyeditor="net.sourceforge.ejtools.awt.editors.DateTimeEditor" ! * @beaninfo:property name="type" class="java.lang.String" displayName="Type" ! * shortDescription="Type" ! * @beaninfo:property name="text" class="java.lang.String" displayName="Text" ! * shortDescription="Text of the message" ! * propertyeditor="com.dreambean.awt.editors.TextEditor" */ public class TextMessageProxy extends MessageProxy *************** *** 27,36 **** * Constructor for the MessageProxy object * - * @param name Description of Parameter * @param message Description of Parameter */ ! public TextMessageProxy(String name, Message message) { ! super(name, message); } --- 51,59 ---- * Constructor for the MessageProxy object * * @param message Description of Parameter */ ! public TextMessageProxy(Message message) { ! super(message); } Index: TopicProxy.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/model/jms/TopicProxy.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TopicProxy.java 12 May 2002 19:55:28 -0000 1.4 --- TopicProxy.java 15 May 2002 20:44:51 -0000 1.5 *************** *** 7,10 **** --- 7,11 ---- package net.sourceforge.ejtools.jndibrowser.model.jms; + import java.beans.beancontext.BeanContextServices; import javax.jms.JMSException; import javax.jms.Message; *************** *** 22,25 **** --- 23,27 ---- import net.sourceforge.ejtools.jndibrowser.model.JNDIEntry; + import org.apache.log4j.Category; *************** *** 37,40 **** --- 39,44 ---- /** Description of the Field */ private Topic topic = null; + /** Description of the Field */ + private static Category logger = Category.getInstance(QueueProxy.class); *************** *** 58,109 **** public void createTextMessage(String text) { ! Context jndiContext = null; ! TopicConnectionFactory topicConnectionFactory = null; ! TopicConnection topicConnection = null; ! TopicSession topicSession = null; ! TopicPublisher topicPublisher = null; ! TextMessage message = null; ! ! // TO MODIFY ! try { ! jndiContext = new InitialContext(); ! topicConnectionFactory = (TopicConnectionFactory) jndiContext.lookup("ConnectionFactory"); } ! catch (NamingException e) { ! System.out.println("JNDI lookup failed: " + e.toString()); } - // TO MODIFY ! try ! { ! topicConnection = topicConnectionFactory.createTopicConnection(); ! topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); ! topicPublisher = topicSession.createPublisher(topic); - message = topicSession.createTextMessage(); - message.setText(text); - topicPublisher.publish(message); ! topicSession.close(); ! } ! catch (JMSException e) { ! System.out.println("Exception occurred: " + e.toString()); } ! finally { ! if (topicConnection != null) ! { ! try ! { ! topicConnection.close(); ! } ! catch (JMSException e) ! { ! } ! } } } } --- 62,148 ---- public void createTextMessage(String text) { ! // Get a connection on the default factory ! TopicConnection topicConnection = getTopicConnection(); ! if (topicConnection != null) { ! try ! { ! TextMessage message = null; ! ! TopicSession topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); ! TopicPublisher topicPublisher = topicSession.createPublisher(topic); ! ! message = topicSession.createTextMessage(); ! message.setText(text); ! topicPublisher.publish(message); ! ! topicSession.close(); ! } ! catch (JMSException e) ! { ! logger.warn("Exception occurred: " + e.toString()); ! } ! finally ! { ! if (topicConnection != null) ! { ! try ! { ! topicConnection.close(); ! } ! catch (JMSException e) ! { ! } ! } ! } } ! } ! ! ! /** ! * @return The value ! * @todo Add Log4j log ! */ ! protected TopicConnection getTopicConnection() ! { ! TopicConnection topicConnection = null; ! TopicConnectionFactory topicConnectionFactory = getTopicConnectionFactory(); ! ! if (topicConnectionFactory != null) { ! try ! { ! topicConnection = topicConnectionFactory.createTopicConnection(); ! } ! catch (JMSException e) ! { ! logger.warn("No Connection: " + e.toString()); ! } } ! return topicConnection; ! } ! /** ! * @return The value ! * @todo Add Log4j log ! */ ! protected TopicConnectionFactory getTopicConnectionFactory() ! { ! TopicConnectionFactory topicConnectionFactory = null; ! ! try { ! BeanContextServices context = (BeanContextServices) getBeanContext(); ! ConnectionService service = (ConnectionService) context.getService(this, this, ConnectionService.class, this, this); ! topicConnectionFactory = service.getDefaultTopicConnectionFactory(); } ! catch (Exception e) { ! logger.warn("No Factory: " + e.toString()); } + + return topicConnectionFactory; } } |