# Class BasicConnectionFactory

java.lang.Object
com.sun.messaging.AdministeredObject
com.sun.messaging.BasicConnectionFactory

All Implemented Interfaces:
  `jakarta.jms.ConnectionFactory, Serializable`

Direct Known Subclasses:
  `ConnectionFactory`

public class BasicConnectionFactory extends AdministeredObject implements jakarta.jms.ConnectionFactory
A `BasicConnectionFactory` encapsulates OpenMQ specific configuration information for OpenMQ `ConnectionFactory` objects and is used to create Connections with a OpenMQ Jakarta Messaging provider.

See Also:
  - `jakarta.jms.ConnectionFactory`
  - `com.sun.messaging.ConnectionConfiguration`
  - Serialized Form

- ## Field Summary

  ### Fields inherited from class 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, VERSION`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  ``
  `BasicConnectionFactory()`
  Constructs a BasicConnectionFactory with the default configuration.
  `protected`
  `BasicConnectionFactory(String defaultsBase)`
  Constructs a BasicConnectionFactory with the specified configuration.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `jakarta.jms.Connection`
  `createConnection()`
  Creates a Connection with the default user identity.
  `jakarta.jms.Connection`
  `createConnection(String username, String password)`
  Creates a Connection with a specified user identity.
  `jakarta.jms.JMSContext`
  `createContext()`
  `jakarta.jms.JMSContext`
  `createContext(int sessionMode)`
  `jakarta.jms.JMSContext`
  `createContext(String userName, String password)`
  `jakarta.jms.JMSContext`
  `createContext(String userName, String password, int sessionMode)`
  `final String`
  `getConnectionType()`
  Returns the type of connections created by this `BasicConnectionFactory`.
  `protected static com.sun.messaging.jmq.jmsclient.ContainerType`
  `getContainerType()`
  `final void`
  `setConnectionType(String type)`
  Sets the type of connections created by this `BasicConnectionFactory`.
  `void`
  `setDefaultConfiguration()`
  Sets the minimum `BasicConnectionFactory` configuration defaults required to connect to the OpenMQ Service.
  `String`
  `toString()`
  Returns a pretty printed version of the provider specific information for this ConnectionFactory object.

  ### Methods inherited from class AdministeredObject

  `dump, enumeratePropertyNames, getConfiguration, getCurrentConfiguration, getLabelForGroup, getPropertiesForGroup, getProperty, getPropertyForListValue, getPropertyGroups, getPropertyLabel, getPropertyListOtherName, getPropertyListValues, getPropertyType, getPropertyValueForListValue, getStoredVersion, getVERSION, isPropertyDeprecated, isPropertyHidden, isReadOnly, isStoredVersionCompatible, setProperties, setProperty, setReadOnly, setStoredVersion`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### BasicConnectionFactory

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

  - ### BasicConnectionFactory

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

- ## Method Details

  - ### createConnection

    public jakarta.jms.Connection createConnection() throws jakarta.jms.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 `jakarta.jms.ConnectionFactory`
    Returns:
      a newly created Connection.
    Throws:
      `jakarta.jms.JMSException` - if a JMS error occurs.
    See Also:
      - `ConnectionConfiguration.imqDefaultUsername`
      - `ConnectionConfiguration.imqDefaultPassword`

  - ### createConnection

    public jakarta.jms.Connection createConnection(String username, String password) throws jakarta.jms.JMSException
    Creates a Connection with a specified user identity.
    Specified by:
      `createConnection` in interface `jakarta.jms.ConnectionFactory`
    Parameters:
      `username` - the caller's user name
      `password` - the caller's password
    Returns:
      a newly created connection.
    Throws:
      `jakarta.jms.JMSException` - if a JMS error occurs.

  - ### createContext

    public jakarta.jms.JMSContext createContext()
    Specified by:
      `createContext` in interface `jakarta.jms.ConnectionFactory`

  - ### createContext

    public jakarta.jms.JMSContext createContext(String userName, String password)
    Specified by:
      `createContext` in interface `jakarta.jms.ConnectionFactory`

  - ### createContext

    public jakarta.jms.JMSContext createContext(String userName, String password, int sessionMode)
    Specified by:
      `createContext` in interface `jakarta.jms.ConnectionFactory`

  - ### createContext

    public jakarta.jms.JMSContext createContext(int sessionMode)
    Specified by:
      `createContext` in interface `jakarta.jms.ConnectionFactory`

  - ### getContainerType

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

  - ### setConnectionType

    public final void setConnectionType(String type)
    Sets the type of connections created by this `BasicConnectionFactory`.
    Parameters:
      `type` - The type of connections created by this `BasicConnectionFactory`.

  - ### getConnectionType

    public final String getConnectionType()
    Returns the type of connections created by this `BasicConnectionFactory`.
    Returns:
      The type of connections created by this `BasicConnectionFactory`.

  - ### toString

    public 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 OpenMQ Service.
    Specified by:
      `setDefaultConfiguration` in class `AdministeredObject`