Oracle GlassFish(tm) Server Message Queue
5.0

com.sun.messaging
Class BasicConnectionFactory

java.lang.Object
  extended by com.sun.messaging.AdministeredObject
      extended by com.sun.messaging.BasicConnectionFactory
All Implemented Interfaces:
java.io.Serializable, ConnectionFactory
Direct Known Subclasses:
ConnectionFactory

public class BasicConnectionFactory
extends AdministeredObject
implements ConnectionFactory

A BasicConnectionFactory encapsulates Sun MQ specific configuration information for Sun MQ ConnectionFactory objects and is used to create Connections with a Sun MQ Java Message Service (JMS) provider.

See Also:
javax.jms.ConnectionFactory, com.sun.messaging.ConnectionConfiguration, Serialized Form

Field Summary
 
Fields inherited from class com.sun.messaging.AdministeredObject
AO_PROPERTY_TYPE_BOOLEAN, AO_PROPERTY_TYPE_INTEGER, AO_PROPERTY_TYPE_LIST, AO_PROPERTY_TYPE_LONG, AO_PROPERTY_TYPE_PROPERTYOWNER, AO_PROPERTY_TYPE_STRING, cachedConfigurationMap, configuration, configurationLabels, configurationTypes, cr, storedVersion, VERSION
 
Constructor Summary
  BasicConnectionFactory()
          Constructs a BasicConnectionFactory with the default configuration.
protected BasicConnectionFactory(java.lang.String defaultsBase)
          Constructs a BasicConnectionFactory with the specified configuration.
 
Method Summary
 Connection createConnection()
          Creates a Connection with the default user identity.
 Connection createConnection(java.lang.String username, java.lang.String password)
          Creates a Connection with a specified user identity.
 JMSContext createContext()
          Creates a JMSContext with the default user identity and an unspecified sessionMode.
 JMSContext createContext(int sessionMode)
          Creates a JMSContext with the default user identity and the specified session mode.
 JMSContext createContext(java.lang.String userName, java.lang.String password)
          Creates a JMSContext with the specified user identity and an unspecified sessionMode.
 JMSContext createContext(java.lang.String userName, java.lang.String password, int sessionMode)
          Creates a JMSContext with the specified user identity and the specified session mode.
 java.lang.String getConnectionType()
          Returns the type of connections created by this BasicConnectionFactory.
protected static com.sun.messaging.jmq.jmsclient.ContainerType getContainerType()
           
 void setConnectionType(java.lang.String type)
          Sets the type of connections created by this BasicConnectionFactory.
 void setDefaultConfiguration()
          Sets the minimum BasicConnectionFactory configuration defaults required to connect to the Sun MQ Message Service.
 java.lang.String toString()
          Returns a pretty printed version of the provider specific information for this ConnectionFactory object.
 
Methods inherited from class com.sun.messaging.AdministeredObject
dump, enumeratePropertyNames, getConfiguration, getCurrentConfiguration, getLabelForGroup, getPropertiesForGroup, getProperty, getPropertyForListValue, getPropertyGroups, getPropertyLabel, getPropertyListOtherName, getPropertyListValues, getPropertyType, getPropertyValueForListValue, getStoredVersion, getVERSION, isPropertyDeprecated, isPropertyHidden, isReadOnly, isStoredVersionCompatible, setProperty, setReadOnly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicConnectionFactory

public BasicConnectionFactory()
Constructs a BasicConnectionFactory with the default configuration.


BasicConnectionFactory

protected BasicConnectionFactory(java.lang.String defaultsBase)
Constructs a BasicConnectionFactory with the specified configuration.

Method Detail

createConnection

public Connection createConnection()
                            throws JMSException
Creates a Connection with the default user identity. The default user identity is defined by the ConnectionFactory properties imqDefaultUsername and imqDefaultPassword

Specified by:
createConnection in interface ConnectionFactory
Returns:
a newly created Connection.
Throws:
JMSException - if a JMS error occurs.
See Also:
ConnectionConfiguration.imqDefaultUsername, ConnectionConfiguration.imqDefaultPassword

createConnection

public Connection createConnection(java.lang.String username,
                                   java.lang.String password)
                            throws JMSException
Creates a Connection with a specified user identity.

Specified by:
createConnection in interface ConnectionFactory
Parameters:
username - the caller's user name
password - the caller's password
Returns:
a newly created connection.
Throws:
JMSException - if a JMS error occurs.

createContext

public JMSContext createContext()
Description copied from interface: ConnectionFactory
Creates a JMSContext with the default user identity and an unspecified sessionMode.

A connection and session are created for use by the new JMSContext. The connection is created in stopped mode but will be automatically started when a JMSConsumer is created.

The behaviour of the session that is created depends on whether this method is called in a Java SE environment, in the Java EE application client container, or in the Java EE web or EJB container. If this method is called in the Java EE web or EJB container then the behaviour of the session also depends on whether or not there is an active JTA transaction in progress.

In a Java SE environment or in the Java EE application client container:

In a Java EE web or EJB container, when there is an active JTA transaction in progress:

In the Java EE web or EJB container, when there is no active JTA transaction in progress:

Specified by:
createContext in interface ConnectionFactory
Returns:
a newly created JMSContext
See Also:
JMSContext.AUTO_ACKNOWLEDGE, ConnectionFactory.createContext(int), ConnectionFactory.createContext(java.lang.String, java.lang.String), ConnectionFactory.createContext(java.lang.String, java.lang.String, int), JMSContext.createContext(int)

createContext

public JMSContext createContext(java.lang.String userName,
                                java.lang.String password)
Description copied from interface: ConnectionFactory
Creates a JMSContext with the specified user identity and an unspecified sessionMode.

A connection and session are created for use by the new JMSContext. The connection is created in stopped mode but will be automatically started when a JMSConsumer.

The behaviour of the session that is created depends on whether this method is called in a Java SE environment, in the Java EE application client container, or in the Java EE web or EJB container. If this method is called in the Java EE web or EJB container then the behaviour of the session also depends on whether or not there is an active JTA transaction in progress.

In a Java SE environment or in the Java EE application client container:

In a Java EE web or EJB container, when there is an active JTA transaction in progress:

In the Java EE web or EJB container, when there is no active JTA transaction in progress:

Specified by:
createContext in interface ConnectionFactory
Parameters:
userName - the caller's user name
password - the caller's password
Returns:
a newly created JMSContext
See Also:
JMSContext.AUTO_ACKNOWLEDGE, ConnectionFactory.createContext(), ConnectionFactory.createContext(int), ConnectionFactory.createContext(java.lang.String, java.lang.String, int), JMSContext.createContext(int)

createContext

public JMSContext createContext(java.lang.String userName,
                                java.lang.String password,
                                int sessionMode)
Description copied from interface: ConnectionFactory
Creates a JMSContext with the specified user identity and the specified session mode.

A connection and session are created for use by the new JMSContext. The JMSContext is created in stopped mode but will be automatically started when a JMSConsumer is created.

The effect of setting the sessionMode argument depends on whether this method is called in a Java SE environment, in the Java EE application client container, or in the Java EE web or EJB container. If this method is called in the Java EE web or EJB container then the effect of setting the sessionMode argument also depends on whether or not there is an active JTA transaction in progress.

In a Java SE environment or in the Java EE application client container:

In a Java EE web or EJB container, when there is an active JTA transaction in progress:

In the Java EE web or EJB container, when there is no active JTA transaction in progress:

Specified by:
createContext in interface ConnectionFactory
Parameters:
userName - the caller's user name
password - the caller's password
sessionMode - indicates which of four possible session modes will be used.
  • If this method is called in a Java SE environment or in the Java EE application client container, the permitted values are JMSContext.SESSION_TRANSACTED, JMSContext.CLIENT_ACKNOWLEDGE, JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE.
  • If this method is called in the Java EE web or EJB container when there is an active JTA transaction in progress then this argument is ignored.
  • If this method is called in the Java EE web or EJB container when there is no active JTA transaction in progress, the permitted values are JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE. In this case the values JMSContext.TRANSACTED and JMSContext.CLIENT_ACKNOWLEDGE are not permitted.
Returns:
a newly created JMSContext
See Also:
JMSContext.SESSION_TRANSACTED, JMSContext.CLIENT_ACKNOWLEDGE, JMSContext.AUTO_ACKNOWLEDGE, JMSContext.DUPS_OK_ACKNOWLEDGE, ConnectionFactory.createContext(), ConnectionFactory.createContext(int), ConnectionFactory.createContext(java.lang.String, java.lang.String), JMSContext.createContext(int)

createContext

public JMSContext createContext(int sessionMode)
Description copied from interface: ConnectionFactory
Creates a JMSContext with the default user identity and the specified session mode.

A connection and session are created for use by the new JMSContext. The JMSContext is created in stopped mode but will be automatically started when a JMSConsumer is created.

The effect of setting the sessionMode argument depends on whether this method is called in a Java SE environment, in the Java EE application client container, or in the Java EE web or EJB container. If this method is called in the Java EE web or EJB container then the effect of setting the sessionMode argument also depends on whether or not there is an active JTA transaction in progress.

In a Java SE environment or in the Java EE application client container:

In a Java EE web or EJB container, when there is an active JTA transaction in progress:

In the Java EE web or EJB container, when there is no active JTA transaction in progress:

Specified by:
createContext in interface ConnectionFactory
Parameters:
sessionMode - indicates which of four possible session modes will be used.
  • If this method is called in a Java SE environment or in the Java EE application client container, the permitted values are JMSContext.SESSION_TRANSACTED, JMSContext.CLIENT_ACKNOWLEDGE, JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE.
  • If this method is called in the Java EE web or EJB container when there is an active JTA transaction in progress then this argument is ignored.
  • If this method is called in the Java EE web or EJB container when there is no active JTA transaction in progress, the permitted values are JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE. In this case the values JMSContext.TRANSACTED and JMSContext.CLIENT_ACKNOWLEDGE are not permitted.
Returns:
a newly created JMSContext
See Also:
JMSContext.SESSION_TRANSACTED, JMSContext.CLIENT_ACKNOWLEDGE, JMSContext.AUTO_ACKNOWLEDGE, JMSContext.DUPS_OK_ACKNOWLEDGE, ConnectionFactory.createContext(), ConnectionFactory.createContext(java.lang.String, java.lang.String), ConnectionFactory.createContext(java.lang.String, java.lang.String, int), JMSContext.createContext(int)

getContainerType

protected static com.sun.messaging.jmq.jmsclient.ContainerType getContainerType()

setConnectionType

public final void setConnectionType(java.lang.String type)
Sets the type of connections created by this BasicConnectionFactory.

Parameters:
type - The type of connections created by this BasicConnectionFactory.

getConnectionType

public final java.lang.String getConnectionType()
Returns the type of connections created by this BasicConnectionFactory.

Returns:
The type of connections created by this BasicConnectionFactory.

toString

public java.lang.String toString()
Returns a pretty printed version of the provider specific information for this ConnectionFactory object.

Overrides:
toString in class AdministeredObject
Returns:
the pretty printed string.

setDefaultConfiguration

public void setDefaultConfiguration()
Sets the minimum BasicConnectionFactory configuration defaults required to connect to the Sun MQ Message Service.

Specified by:
setDefaultConfiguration in class AdministeredObject

Oracle GlassFish(tm) Server Message Queue
5.0

Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.