User: user57
Date: 01/07/20 19:12:04
Modified: src/main/org/jboss/jms/ra JmsSessionFactoryImpl.java
Log:
o reformat
Revision Changes Path
1.3 +185 -163 jboss/src/main/org/jboss/jms/ra/JmsSessionFactoryImpl.java
Index: JmsSessionFactoryImpl.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/jms/ra/JmsSessionFactoryImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JmsSessionFactoryImpl.java 2001/06/18 20:01:26 1.2
+++ JmsSessionFactoryImpl.java 2001/07/21 02:12:04 1.3
@@ -27,8 +27,6 @@
import javax.resource.spi.ConnectionManager;
import javax.resource.spi.ConnectionRequestInfo;
-
-
import javax.jms.JMSException;
import javax.jms.ConnectionConsumer;
import javax.jms.ServerSessionPool;
@@ -40,173 +38,197 @@
import javax.jms.ConnectionMetaData;
import org.jboss.jms.ra.client.JmsSessionFactory;
+
/**
* JmsSessionFactoryImpl.java
*
+ * <p>Created: Thu Mar 29 15:36:51 2001
*
- * Created: Thu Mar 29 15:36:51 2001
- *
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Antman</a>.
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
-
-public class JmsSessionFactoryImpl implements JmsSessionFactory,Serializable,
Referenceable {
- private static final String ISE = "This method is not applicatable in JMS
resource adapter";
-
- private Reference reference;
-
- // Used from JmsConnectionFactory
- private String userName = null;
- private String password = null;
- private Boolean isTopic = null;
-
- /**
- * JmsRa own factory
- */
- private ManagedConnectionFactory mcf;
-
- /**
- * Hook to the appserver
- */
- private ConnectionManager cm;
-
-
- public JmsSessionFactoryImpl(ManagedConnectionFactory mcf,
- ConnectionManager cm)
- {
- this.mcf = mcf;
- this.cm = cm;
- if (cm == null) {
- // This is standalone usage, no appserver
- this.cm = new JmsConnectionManager();
- } else {
- this.cm = cm;
- }
-
- }
-
- public void setReference(Reference reference) {
- this.reference = reference;
- }
-
- public Reference getReference() {
- return reference;
- }
-
- // --- API for JmsConnectionFactoryImpl
- public void setUserName(String name)
- {
- userName = name;
- }
-
- public void setPassword(String password)
- {
- this.password = password;
- }
-
- public void isTopic(Boolean isTopic) {
- this.isTopic = isTopic;
- }
- //---- QueueConnection ---
- public QueueSession createQueueSession(boolean transacted,
- int acknowledgeMode)
- throws JMSException
- {
- try {
- if(isTopic != null && isTopic == Boolean.TRUE)
- throw new IllegalStateException("Cant get a queue session from a topic
connection");
-
- JmsConnectionRequestInfo info =
- new JmsConnectionRequestInfo(transacted,acknowledgeMode,false);
- info.setUserName(userName);
- info.setPassword(password);
+public class JmsSessionFactoryImpl
+ implements JmsSessionFactory, Serializable, Referenceable
+{
+ private static final String ISE =
+ "This method is not applicatable in JMS resource adapter";
+
+ private Reference reference;
+
+ // Used from JmsConnectionFactory
+ private String userName; // = null;
+ private String password; // = null;
+ private Boolean isTopic; // = null;
+
+ /** JmsRa own factory */
+ private ManagedConnectionFactory mcf;
+
+ /** Hook to the appserver */
+ private ConnectionManager cm;
+
+ public JmsSessionFactoryImpl(final ManagedConnectionFactory mcf,
+ final ConnectionManager cm)
+ {
+ this.mcf = mcf;
+ this.cm = cm;
+
+ if (cm == null) {
+ // This is standalone usage, no appserver
+ this.cm = new JmsConnectionManager();
+ }
+ else {
+ this.cm = cm;
+ }
+ }
+
+ public void setReference(final Reference reference) {
+ this.reference = reference;
+ }
+
+ public Reference getReference() {
+ return reference;
+ }
+
+ // --- API for JmsConnectionFactoryImpl
+
+ public void setUserName(final String name)
+ {
+ userName = name;
+ }
+
+ public void setPassword(final String password)
+ {
+ this.password = password;
+ }
+
+ public void isTopic(final Boolean isTopic) {
+ this.isTopic = isTopic;
+ }
+
+ //---- QueueConnection ---
+
+ public QueueSession createQueueSession(final boolean transacted,
+ final int acknowledgeMode)
+ throws JMSException
+ {
+ try {
+ if (isTopic != null && isTopic == Boolean.TRUE) {
+ throw new IllegalStateException
+ ("Cant get a queue session from a topic connection");
+ }
- return (QueueSession) cm.allocateConnection(
- mcf,
- info
- );
- }catch(ResourceException ex) {
- JMSException je = new JMSException("Could not create a session: " + ex);
- je.setLinkedException(ex);
- throw je;
- }
- }
-
- public ConnectionConsumer createConnectionConsumer(Queue queue,
- String messageSelector,
- ServerSessionPool sessionPool,
- int maxMessages)
- throws JMSException
- {
- throw new IllegalStateException(ISE);
- }
-
-
- //--- TopicConnection ---
-
- public TopicSession createTopicSession(boolean transacted,
- int acknowledgeMode)
- throws JMSException
- {
- try {
- if(isTopic != null && isTopic == Boolean.FALSE)
- throw new IllegalStateException("Cant get a topic session from a
session connection");
-
- JmsConnectionRequestInfo info =
- new JmsConnectionRequestInfo(transacted,acknowledgeMode,true);
- info.setUserName(userName);
- info.setPassword(password);
+ JmsConnectionRequestInfo info =
+ new JmsConnectionRequestInfo(transacted, acknowledgeMode, false);
+ info.setUserName(userName);
+ info.setPassword(password);
- return (TopicSession) cm.allocateConnection(mcf,
- info
- );
+ return (QueueSession)cm.allocateConnection(mcf, info);
+ }
+ catch (ResourceException e) {
+ e.printStackTrace();
+ JMSException je =
+ new JMSException("Could not create a session: " + e);
+ je.setLinkedException(e);
+ throw je;
+ }
+ }
+
+ public ConnectionConsumer
+ createConnectionConsumer(Queue queue,
+ String messageSelector,
+ ServerSessionPool sessionPool,
+ int maxMessages)
+ throws JMSException
+ {
+ throw new IllegalStateException(ISE);
+ }
+
+ //--- TopicConnection ---
+
+ public TopicSession createTopicSession(final boolean transacted,
+ final int acknowledgeMode)
+ throws JMSException
+ {
+ try {
+ if (isTopic != null && isTopic == Boolean.FALSE) {
+ throw new IllegalStateException
+ ("Cant get a topic session from a session connection");
+ }
+
+ JmsConnectionRequestInfo info =
+ new JmsConnectionRequestInfo(transacted, acknowledgeMode, true);
+
+ info.setUserName(userName);
+ info.setPassword(password);
- }catch(ResourceException ex) {
-
- JMSException je = new JMSException("Could not create a session: " + ex);
- je.setLinkedException(ex);
- throw je;
- }
- }
-
- public ConnectionConsumer createConnectionConsumer(Topic topic,
- String messageSelector,
- ServerSessionPool sessionPool,
- int maxMessages)
- throws JMSException
- {
- throw new IllegalStateException(ISE);
- }
-
- public ConnectionConsumer createDurableConnectionConsumer(Topic topic,
- String subscriptionName,
- String messageSelector,
- ServerSessionPool sessionPool,
- int maxMessages)
- throws JMSException
- {
- throw new IllegalStateException(ISE);
- }
- //--- Al the Connection methods
- public String getClientID() throws JMSException {throw new
IllegalStateException(ISE);}
-
- public void setClientID(String cID) throws JMSException {throw new
IllegalStateException(ISE);}
-
- public ConnectionMetaData getMetaData() throws JMSException {throw new
IllegalStateException(ISE);}
-
- public ExceptionListener getExceptionListener() throws JMSException {throw new
IllegalStateException(ISE);}
-
- public void setExceptionListener(ExceptionListener listener) throws
JMSException {throw new IllegalStateException(ISE);}
-
- public void start() throws JMSException {throw new IllegalStateException(ISE);}
-
- public void stop() throws JMSException {throw new IllegalStateException(ISE);}
-
- public synchronized void close() throws JMSException {throw new
IllegalStateException(ISE);}
-} // JmsSessionFactoryImpl
-
-
-
-
-
-
+ return (TopicSession)cm.allocateConnection(mcf, info);
+ }
+ catch (ResourceException e) {
+ JMSException je = new JMSException
+ ("Could not create a session: " + e);
+ je.setLinkedException(e);
+ throw je;
+ }
+ }
+
+ public ConnectionConsumer
+ createConnectionConsumer(Topic topic,
+ String messageSelector,
+ ServerSessionPool sessionPool,
+ int maxMessages)
+ throws JMSException
+ {
+ throw new IllegalStateException(ISE);
+ }
+
+ public ConnectionConsumer
+ createDurableConnectionConsumer(Topic topic,
+ String subscriptionName,
+ String messageSelector,
+ ServerSessionPool sessionPool,
+ int maxMessages)
+ throws JMSException
+ {
+ throw new IllegalStateException(ISE);
+ }
+
+ //--- Al the Connection methods
+
+ public String getClientID() throws JMSException {
+ throw new IllegalStateException(ISE);
+ }
+
+ public void setClientID(String cID) throws JMSException {
+ throw new IllegalStateException(ISE);
+ }
+
+ public ConnectionMetaData getMetaData() throws JMSException {
+ throw new IllegalStateException(ISE);
+ }
+
+ public ExceptionListener getExceptionListener() throws JMSException {
+ throw new IllegalStateException(ISE);
+ }
+
+ public void setExceptionListener(ExceptionListener listener)
+ throws JMSException
+ {
+ throw new IllegalStateException(ISE);
+ }
+
+ public void start() throws JMSException {
+ throw new IllegalStateException(ISE);
+ }
+
+ public void stop() throws JMSException {
+ throw new IllegalStateException(ISE);
+ }
+
+ //
+ // Why is this synchronized ?
+ //
+
+ public synchronized void close() throws JMSException {
+ throw new IllegalStateException(ISE);
+ }
+}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development