[Ejtools-cvs] applications/jndi.browser/src/main/org/ejtools/jndi/browser/model/service ConnectionMe
Brought to you by:
letiemble
Update of /cvsroot/ejtools/applications/jndi.browser/src/main/org/ejtools/jndi/browser/model/service In directory sc8-pr-cvs1:/tmp/cvs-serv17169/jndi.browser/src/main/org/ejtools/jndi/browser/model/service Modified Files: ConnectionMetaData.java JMSConnectionService.java JMSConnectionServiceProvider.java Log Message: Address Todo #755528 Address Todo #800902 Index: ConnectionMetaData.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/org/ejtools/jndi/browser/model/service/ConnectionMetaData.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ConnectionMetaData.java 24 Feb 2003 22:32:17 -0000 1.2 --- ConnectionMetaData.java 27 Nov 2003 01:30:29 -0000 1.3 *************** *** 1,91 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.model.service; ! ! import org.ejtools.util.service.ProfileMetaData; ! ! /** ! * @author letiembl ! * @created 14 novembre 2002 ! * @version $Revision$ ! */ ! public class ConnectionMetaData implements ProfileMetaData ! { ! /** Description of the Field */ ! protected String[] keys = new String[]{ ! ConnectionMetaData.FACTORY, ! ConnectionMetaData.PACKAGES, ! ConnectionMetaData.URL, ! ConnectionMetaData.CONTEXT, ! ConnectionMetaData.PRINCIPAL, ! ConnectionMetaData.CREDENTIALS ! }; ! /** Description of the Field */ ! public final static String CONTEXT = "context"; ! /** Description of the Field */ ! public final static String CREDENTIALS = "credentials"; ! /** Description of the Field */ ! public final static String FACTORY = "factory"; ! /** Description of the Field */ ! public final static String PACKAGES = "packages"; ! /** Description of the Field */ ! public final static String PRINCIPAL = "principal"; ! /** Description of the Field */ ! public final static String URL = "url"; ! ! ! /** Constructor for ConnectionMetaData. */ ! public ConnectionMetaData() ! { ! super(); ! } ! ! ! /** ! * Gets the fileName attribute of the ConnectionMetaData object ! * ! * @return The fileName value ! */ ! public String getFileName() ! { ! return "/jndi.connection.properties"; ! } ! ! ! /** ! * Gets the key attribute of the ConnectionMetaData object ! * ! * @param index Description of the Parameter ! * @return The key value ! */ ! public String getKey(int index) ! { ! return this.keys[index]; ! } ! ! ! /** ! * Gets the keys attribute of the ConnectionMetaData object ! * ! * @return The keys value ! */ ! public String[] getKeys() ! { ! return this.keys; ! } ! ! ! /** ! * Gets the prefix attribute of the ConnectionMetaData object ! * ! * @return The prefix value ! */ ! public String getPrefix() ! { ! return "connection"; ! } ! } --- 1,91 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.model.service; ! ! import org.ejtools.util.service.ProfileMetaData; ! ! /** ! * @author letiembl ! * @created 14 novembre 2002 ! * @version $Revision$ ! */ ! public class ConnectionMetaData implements ProfileMetaData ! { ! /** Description of the Field */ ! protected String[] keys = new String[]{ ! ConnectionMetaData.FACTORY, ! ConnectionMetaData.PACKAGES, ! ConnectionMetaData.URL, ! ConnectionMetaData.CONTEXT, ! ConnectionMetaData.PRINCIPAL, ! ConnectionMetaData.CREDENTIALS ! }; ! /** Description of the Field */ ! public final static String CONTEXT = "context"; ! /** Description of the Field */ ! public final static String CREDENTIALS = "credentials"; ! /** Description of the Field */ ! public final static String FACTORY = "factory"; ! /** Description of the Field */ ! public final static String PACKAGES = "packages"; ! /** Description of the Field */ ! public final static String PRINCIPAL = "principal"; ! /** Description of the Field */ ! public final static String URL = "url"; ! ! ! /** Constructor for ConnectionMetaData. */ ! public ConnectionMetaData() ! { ! super(); ! } ! ! ! /** ! * Gets the fileName attribute of the ConnectionMetaData object ! * ! * @return The fileName value ! */ ! public String getFileName() ! { ! return "/jndi.connection.properties"; ! } ! ! ! /** ! * Gets the key attribute of the ConnectionMetaData object ! * ! * @param index Description of the Parameter ! * @return The key value ! */ ! public String getKey(int index) ! { ! return this.keys[index]; ! } ! ! ! /** ! * Gets the keys attribute of the ConnectionMetaData object ! * ! * @return The keys value ! */ ! public String[] getKeys() ! { ! return this.keys; ! } ! ! ! /** ! * Gets the prefix attribute of the ConnectionMetaData object ! * ! * @return The prefix value ! */ ! public String getPrefix() ! { ! return "connection"; ! } ! } Index: JMSConnectionService.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/org/ejtools/jndi/browser/model/service/JMSConnectionService.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JMSConnectionService.java 10 Feb 2003 21:18:15 -0000 1.1 --- JMSConnectionService.java 27 Nov 2003 01:30:29 -0000 1.2 *************** *** 1,51 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.model.service; ! ! import javax.jms.QueueConnectionFactory; ! import javax.jms.TopicConnectionFactory; ! ! /** ! * Description of the Interface ! * ! * @author letiemble ! * @created 3 avril 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface JMSConnectionService ! { ! /** Description of the Field */ ! public final static String QUEUE_CONNECTION_FACTORY = "QUEUE"; ! /** Description of the Field */ ! public final static String TOPIC_CONNECTION_FACTORY = "TOPIC"; ! ! ! /** ! * Getter for the defaultQueueConnectionFactory attribute ! * ! * @return The value of defaultQueueConnectionFactory attribute ! */ ! public QueueConnectionFactory getDefaultQueueConnectionFactory(); ! ! ! /** ! * Getter for the defaultConnectionFactory attribute ! * ! * @return The value of defaultConnectionFactory attribute ! */ ! public TopicConnectionFactory getDefaultTopicConnectionFactory(); ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! */ ! public void selectFactory(String type); ! } ! --- 1,51 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.model.service; ! ! import javax.jms.QueueConnectionFactory; ! import javax.jms.TopicConnectionFactory; ! ! /** ! * Description of the Interface ! * ! * @author letiemble ! * @created 3 avril 2002 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface JMSConnectionService ! { ! /** Description of the Field */ ! public final static String QUEUE_CONNECTION_FACTORY = "QUEUE"; ! /** Description of the Field */ ! public final static String TOPIC_CONNECTION_FACTORY = "TOPIC"; ! ! ! /** ! * Getter for the defaultQueueConnectionFactory attribute ! * ! * @return The value of defaultQueueConnectionFactory attribute ! */ ! public QueueConnectionFactory getDefaultQueueConnectionFactory(); ! ! ! /** ! * Getter for the defaultConnectionFactory attribute ! * ! * @return The value of defaultConnectionFactory attribute ! */ ! public TopicConnectionFactory getDefaultTopicConnectionFactory(); ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! */ ! public void selectFactory(String type); ! } ! Index: JMSConnectionServiceProvider.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/org/ejtools/jndi/browser/model/service/JMSConnectionServiceProvider.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JMSConnectionServiceProvider.java 3 Mar 2003 20:34:47 -0000 1.4 --- JMSConnectionServiceProvider.java 27 Nov 2003 01:30:29 -0000 1.5 *************** *** 1,253 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.model.service; ! ! import java.beans.beancontext.BeanContextServices; ! import java.util.Iterator; ! import java.util.ResourceBundle; ! import java.util.Vector; ! ! import javax.jms.QueueConnectionFactory; ! import javax.jms.TopicConnectionFactory; ! import javax.swing.JOptionPane; ! ! import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider; ! import org.ejtools.jndi.browser.model.jms.ConnectionFactoryProxy; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo Add log4j logs ! * @todo int argument for selectFactory ! */ ! public class JMSConnectionServiceProvider extends CustomBeanContextServiceProvider implements JMSConnectionService ! { ! /** Description of the Field */ ! protected int defaultQueueConnectionFactory = 0; ! /** Description of the Field */ ! protected int defaultTopicConnectionFactory = 0; ! /** Description of the Field */ ! protected Vector queueConnectionFactories = new Vector(); ! /** Description of the Field */ ! protected Vector topicConnectionFactories = new Vector(); ! /** Bundle for I18N */ ! private static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.jndi.browser.Resources"); ! ! ! /** ! * Getter for the currentServiceSelectors attribute ! * ! * @param bcs Description of Parameter ! * @param serviceClass Description of Parameter ! * @return The value ! */ ! public Iterator getCurrentServiceSelectors(BeanContextServices bcs, java.lang.Class serviceClass) ! { ! return (new Vector()).iterator(); ! } ! ! ! /** ! * Getter for the defaultQueueConnectionFactory attribute ! * ! * @return The value of defaultQueueConnectionFactory attribute ! */ ! public QueueConnectionFactory getDefaultQueueConnectionFactory() ! { ! if (queueConnectionFactories.size() == 0) ! { ! JOptionPane.showMessageDialog(null, ! resources.getString("text.information.noDefaultFactory.queue"), ! resources.getString("title.information.defaultFactory.queue"), ! JOptionPane.INFORMATION_MESSAGE); ! } ! else ! { ! ConnectionFactoryProxy proxy = (ConnectionFactoryProxy) queueConnectionFactories.elementAt(defaultQueueConnectionFactory); ! return proxy.getQueueConnectionFactory(); ! } ! return null; ! } ! ! ! /** ! * Getter for the defaultTopicConnectionFactory attribute ! * ! * @return The value of defaultTopicConnectionFactory attribute ! */ ! public TopicConnectionFactory getDefaultTopicConnectionFactory() ! { ! if (topicConnectionFactories.size() == 0) ! { ! JOptionPane.showMessageDialog(null, ! resources.getString("text.information.noDefaultFactory.topic"), ! resources.getString("title.information.defaultFactory.topic"), ! JOptionPane.INFORMATION_MESSAGE); ! } ! else ! { ! ConnectionFactoryProxy proxy = (ConnectionFactoryProxy) topicConnectionFactories.elementAt(defaultTopicConnectionFactory); ! return proxy.getTopicConnectionFactory(); ! } ! return null; ! } ! ! ! /** ! * Getter for the service attribute ! * ! * @param bcs Description of Parameter ! * @param requestor Description of Parameter ! * @param serviceClass Description of Parameter ! * @param serviceSelector Description of Parameter ! * @return The value ! */ ! public Object getService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Class serviceClass, java.lang.Object serviceSelector) ! { ! if (requestor instanceof ConnectionFactoryProxy) ! { ! ConnectionFactoryProxy proxy = (ConnectionFactoryProxy) requestor; ! if (proxy.isQueueConnectionFactory()) ! { ! queueConnectionFactories.add(proxy); ! } ! if (proxy.isTopicConnectionFactory()) ! { ! topicConnectionFactories.add(proxy); ! } ! } ! return this; ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcs Description of Parameter ! * @param requestor Description of Parameter ! * @param service Description of Parameter ! */ ! public void releaseService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Object service) ! { ! if (requestor instanceof ConnectionFactoryProxy) ! { ! ConnectionFactoryProxy proxy = (ConnectionFactoryProxy) requestor; ! if (proxy.isQueueConnectionFactory()) ! { ! queueConnectionFactories.remove(proxy); ! if ((this.defaultQueueConnectionFactory >= queueConnectionFactories.size()) ! && (this.defaultQueueConnectionFactory > 0)) ! { ! this.defaultQueueConnectionFactory = queueConnectionFactories.size() - 1; ! } ! } ! if (proxy.isTopicConnectionFactory()) ! { ! topicConnectionFactories.remove(proxy); ! if ((this.defaultTopicConnectionFactory >= topicConnectionFactories.size()) ! && (this.defaultTopicConnectionFactory > 0)) ! { ! this.defaultTopicConnectionFactory = topicConnectionFactories.size() - 1; ! } ! } ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! */ ! public void selectFactory(String type) ! { ! if (JMSConnectionService.QUEUE_CONNECTION_FACTORY.equals(type)) ! { ! selectQueueConnectionFactory(); ! } ! if (JMSConnectionService.TOPIC_CONNECTION_FACTORY.equals(type)) ! { ! selectTopicConnectionFactory(); ! } ! } ! ! ! /** Description of the Method */ ! public void selectQueueConnectionFactory() ! { ! if (queueConnectionFactories.size() > 0) ! { ! Object selectedValue = JOptionPane.showInputDialog(null, ! resources.getString("text.question.defaultFactory.queue"), ! resources.getString("title.question.defaultFactory.queue"), ! JOptionPane.QUESTION_MESSAGE, ! null, ! queueConnectionFactories.toArray(), ! queueConnectionFactories.elementAt(defaultQueueConnectionFactory)); ! if (selectedValue != null) ! { ! defaultQueueConnectionFactory = queueConnectionFactories.indexOf(selectedValue); ! } ! else ! { ! return; ! } ! } ! else ! { ! JOptionPane.showMessageDialog(null, ! resources.getString("text.information.noDefaultFactory.queue"), ! resources.getString("title.information.defaultFactory.queue"), ! JOptionPane.INFORMATION_MESSAGE); ! } ! } ! ! ! /** Description of the Method */ ! public void selectTopicConnectionFactory() ! { ! if (topicConnectionFactories.size() > 0) ! { ! Object selectedValue = JOptionPane.showInputDialog(null, ! resources.getString("text.question.defaultFactory.topic"), ! resources.getString("title.question.defaultFactory.topic"), ! JOptionPane.QUESTION_MESSAGE, ! null, ! topicConnectionFactories.toArray(), ! topicConnectionFactories.elementAt(defaultTopicConnectionFactory)); ! if (selectedValue != null) ! { ! defaultTopicConnectionFactory = topicConnectionFactories.indexOf(selectedValue); ! } ! else ! { ! return; ! } ! } ! else ! { ! JOptionPane.showMessageDialog(null, ! resources.getString("text.information.noDefaultFactory.topic"), ! resources.getString("title.information.defaultFactory.topic"), ! JOptionPane.INFORMATION_MESSAGE); ! } ! } ! ! ! /** ! * @return The serviceClass value ! */ ! protected Class[] getServiceClass() ! { ! return new Class[]{JMSConnectionService.class}; ! } ! } ! --- 1,253 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jndi.browser.model.service; ! ! import java.beans.beancontext.BeanContextServices; ! import java.util.Iterator; ! import java.util.ResourceBundle; ! import java.util.Vector; ! ! import javax.jms.QueueConnectionFactory; ! import javax.jms.TopicConnectionFactory; ! import javax.swing.JOptionPane; ! ! import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider; ! import org.ejtools.jndi.browser.model.jms.ConnectionFactoryProxy; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo Add log4j logs ! * @todo int argument for selectFactory ! */ ! public class JMSConnectionServiceProvider extends CustomBeanContextServiceProvider implements JMSConnectionService ! { ! /** Description of the Field */ ! protected int defaultQueueConnectionFactory = 0; ! /** Description of the Field */ ! protected int defaultTopicConnectionFactory = 0; ! /** Description of the Field */ ! protected Vector queueConnectionFactories = new Vector(); ! /** Description of the Field */ ! protected Vector topicConnectionFactories = new Vector(); ! /** Bundle for I18N */ ! private static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.jndi.browser.Resources"); ! ! ! /** ! * Getter for the currentServiceSelectors attribute ! * ! * @param bcs Description of Parameter ! * @param serviceClass Description of Parameter ! * @return The value ! */ ! public Iterator getCurrentServiceSelectors(BeanContextServices bcs, java.lang.Class serviceClass) ! { ! return (new Vector()).iterator(); ! } ! ! ! /** ! * Getter for the defaultQueueConnectionFactory attribute ! * ! * @return The value of defaultQueueConnectionFactory attribute ! */ ! public QueueConnectionFactory getDefaultQueueConnectionFactory() ! { ! if (queueConnectionFactories.size() == 0) ! { ! JOptionPane.showMessageDialog(null, ! resources.getString("text.information.noDefaultFactory.queue"), ! resources.getString("title.information.defaultFactory.queue"), ! JOptionPane.INFORMATION_MESSAGE); ! } ! else ! { ! ConnectionFactoryProxy proxy = (ConnectionFactoryProxy) queueConnectionFactories.elementAt(defaultQueueConnectionFactory); ! return proxy.getQueueConnectionFactory(); ! } ! return null; ! } ! ! ! /** ! * Getter for the defaultTopicConnectionFactory attribute ! * ! * @return The value of defaultTopicConnectionFactory attribute ! */ ! public TopicConnectionFactory getDefaultTopicConnectionFactory() ! { ! if (topicConnectionFactories.size() == 0) ! { ! JOptionPane.showMessageDialog(null, ! resources.getString("text.information.noDefaultFactory.topic"), ! resources.getString("title.information.defaultFactory.topic"), ! JOptionPane.INFORMATION_MESSAGE); ! } ! else ! { ! ConnectionFactoryProxy proxy = (ConnectionFactoryProxy) topicConnectionFactories.elementAt(defaultTopicConnectionFactory); ! return proxy.getTopicConnectionFactory(); ! } ! return null; ! } ! ! ! /** ! * Getter for the service attribute ! * ! * @param bcs Description of Parameter ! * @param requestor Description of Parameter ! * @param serviceClass Description of Parameter ! * @param serviceSelector Description of Parameter ! * @return The value ! */ ! public Object getService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Class serviceClass, java.lang.Object serviceSelector) ! { ! if (requestor instanceof ConnectionFactoryProxy) ! { ! ConnectionFactoryProxy proxy = (ConnectionFactoryProxy) requestor; ! if (proxy.isQueueConnectionFactory()) ! { ! queueConnectionFactories.add(proxy); ! } ! if (proxy.isTopicConnectionFactory()) ! { ! topicConnectionFactories.add(proxy); ! } ! } ! return this; ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcs Description of Parameter ! * @param requestor Description of Parameter ! * @param service Description of Parameter ! */ ! public void releaseService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Object service) ! { ! if (requestor instanceof ConnectionFactoryProxy) ! { ! ConnectionFactoryProxy proxy = (ConnectionFactoryProxy) requestor; ! if (proxy.isQueueConnectionFactory()) ! { ! queueConnectionFactories.remove(proxy); ! if ((this.defaultQueueConnectionFactory >= queueConnectionFactories.size()) ! && (this.defaultQueueConnectionFactory > 0)) ! { ! this.defaultQueueConnectionFactory = queueConnectionFactories.size() - 1; ! } ! } ! if (proxy.isTopicConnectionFactory()) ! { ! topicConnectionFactories.remove(proxy); ! if ((this.defaultTopicConnectionFactory >= topicConnectionFactories.size()) ! && (this.defaultTopicConnectionFactory > 0)) ! { ! this.defaultTopicConnectionFactory = topicConnectionFactories.size() - 1; ! } ! } ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param type Description of the Parameter ! */ ! public void selectFactory(String type) ! { ! if (JMSConnectionService.QUEUE_CONNECTION_FACTORY.equals(type)) ! { ! selectQueueConnectionFactory(); ! } ! if (JMSConnectionService.TOPIC_CONNECTION_FACTORY.equals(type)) ! { ! selectTopicConnectionFactory(); ! } ! } ! ! ! /** Description of the Method */ ! public void selectQueueConnectionFactory() ! { ! if (queueConnectionFactories.size() > 0) ! { ! Object selectedValue = JOptionPane.showInputDialog(null, ! resources.getString("text.question.defaultFactory.queue"), ! resources.getString("title.question.defaultFactory.queue"), ! JOptionPane.QUESTION_MESSAGE, ! null, ! queueConnectionFactories.toArray(), ! queueConnectionFactories.elementAt(defaultQueueConnectionFactory)); ! if (selectedValue != null) ! { ! defaultQueueConnectionFactory = queueConnectionFactories.indexOf(selectedValue); ! } ! else ! { ! return; ! } ! } ! else ! { ! JOptionPane.showMessageDialog(null, ! resources.getString("text.information.noDefaultFactory.queue"), ! resources.getString("title.information.defaultFactory.queue"), ! JOptionPane.INFORMATION_MESSAGE); ! } ! } ! ! ! /** Description of the Method */ ! public void selectTopicConnectionFactory() ! { ! if (topicConnectionFactories.size() > 0) ! { ! Object selectedValue = JOptionPane.showInputDialog(null, ! resources.getString("text.question.defaultFactory.topic"), ! resources.getString("title.question.defaultFactory.topic"), ! JOptionPane.QUESTION_MESSAGE, ! null, ! topicConnectionFactories.toArray(), ! topicConnectionFactories.elementAt(defaultTopicConnectionFactory)); ! if (selectedValue != null) ! { ! defaultTopicConnectionFactory = topicConnectionFactories.indexOf(selectedValue); ! } ! else ! { ! return; ! } ! } ! else ! { ! JOptionPane.showMessageDialog(null, ! resources.getString("text.information.noDefaultFactory.topic"), ! resources.getString("title.information.defaultFactory.topic"), ! JOptionPane.INFORMATION_MESSAGE); ! } ! } ! ! ! /** ! * @return The serviceClass value ! */ ! protected Class[] getServiceClass() ! { ! return new Class[]{JMSConnectionService.class}; ! } ! } ! |