Package org.apache.catalina.mbeans

## Class MBeanFactory

- java.lang.Object
- - org.apache.catalina.mbeans.MBeanFactory

    public class MBeanFactory
    extends java.lang.Object

Author:
  Amy Roh

### Field Summary

Fields
`protected static StringManager` `sm`

### Constructor Summary

Constructors
`MBeanFactory()`

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`java.lang.String` `createAjpConnector​(java.lang.String parent, java.lang.String address, int port)` Create a new AjpConnector
`java.lang.String` `createDataSourceRealm​(java.lang.String parent, java.lang.String dataSourceName, java.lang.String roleNameCol, java.lang.String userCredCol, java.lang.String userNameCol, java.lang.String userRoleTable, java.lang.String userTable)` Create a new DataSource Realm.
`java.lang.String` `createHttpConnector​(java.lang.String parent, java.lang.String address, int port)` Create a new HttpConnector
`java.lang.String` `createHttpsConnector​(java.lang.String parent, java.lang.String address, int port)` Create a new HttpsConnector
`java.lang.String` `createJDBCRealm​(java.lang.String parent, java.lang.String driverName, java.lang.String connectionName, java.lang.String connectionPassword, java.lang.String connectionURL)` Deprecated. This method will be removed in Tomcat 10.
`java.lang.String` `createJNDIRealm​(java.lang.String parent)` Create a new JNDI Realm.
`java.lang.String` `createMemoryRealm​(java.lang.String parent)` Create a new Memory Realm.
`java.lang.String` `createStandardContext​(java.lang.String parent, java.lang.String path, java.lang.String docBase)` Create a new StandardContext.
`java.lang.String` `createStandardContext​(java.lang.String parent, java.lang.String path, java.lang.String docBase, boolean xmlValidation, boolean xmlNamespaceAware)` Create a new StandardContext.
`java.lang.String` `createStandardHost​(java.lang.String parent, java.lang.String name, java.lang.String appBase, boolean autoDeploy, boolean deployOnStartup, boolean deployXML, boolean unpackWARs)` Create a new StandardHost.
`java.lang.String` `createStandardManager​(java.lang.String parent)` Create a new StandardManager.
`java.lang.String` `createStandardServiceEngine​(java.lang.String domain, java.lang.String defaultHost, java.lang.String baseDir)` Creates a new StandardService and StandardEngine.
`java.lang.String` `createUserDatabaseRealm​(java.lang.String parent, java.lang.String resourceName)` Create a new UserDatabaseRealm.
`java.lang.String` `createValve​(java.lang.String className, java.lang.String parent)` Create a new Valve and associate it with a `Container`.
`java.lang.String` `createWebappLoader​(java.lang.String parent)` Create a new Web Application Loader.
`void` `removeConnector​(java.lang.String name)` Remove an existing Connector.
`void` `removeContext​(java.lang.String contextName)` Remove an existing Context.
`void` `removeHost​(java.lang.String name)` Remove an existing Host.
`void` `removeLoader​(java.lang.String name)` Remove an existing Loader.
`void` `removeManager​(java.lang.String name)` Remove an existing Manager.
`void` `removeRealm​(java.lang.String name)` Remove an existing Realm.
`void` `removeService​(java.lang.String name)` Remove an existing Service.
`void` `removeValve​(java.lang.String name)` Remove an existing Valve.
`void` `setContainer​(java.lang.Object container)` Set the container that this factory was created for.

### Methods inherited from class java.lang.Object

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

### Field Detail

#### sm

    protected static final StringManager sm

### Constructor Detail

#### MBeanFactory

    public MBeanFactory()

### Method Detail

#### setContainer

    public void setContainer​(java.lang.Object container)

Set the container that this factory was created for.

Parameters:
  `container` - The associated container

#### createAjpConnector

    public java.lang.String createAjpConnector​(java.lang.String parent,
                                               java.lang.String address,
                                               int port)
                                        throws java.lang.Exception

Create a new AjpConnector

Parameters:
  `parent` - MBean Name of the associated parent component
  `address` - The IP address on which to bind
  `port` - TCP port number to listen on
Returns:
  the object name of the created connector
Throws:
  `java.lang.Exception` - if an MBean cannot be created or registered

#### createDataSourceRealm

    public java.lang.String createDataSourceRealm​(java.lang.String parent,
                                                  java.lang.String dataSourceName,
                                                  java.lang.String roleNameCol,
                                                  java.lang.String userCredCol,
                                                  java.lang.String userNameCol,
                                                  java.lang.String userRoleTable,
                                                  java.lang.String userTable)
                                           throws java.lang.Exception

Create a new DataSource Realm.

Parameters:
  `parent` - MBean Name of the associated parent component
  `dataSourceName` - the datasource name
  `roleNameCol` - the column name for the role names
  `userCredCol` - the column name for the user credentials
  `userNameCol` - the column name for the user names
  `userRoleTable` - the table name for the roles table
  `userTable` - the table name for the users
Returns:
  the object name of the created realm
Throws:
  `java.lang.Exception` - if an MBean cannot be created or registered

#### createHttpConnector

    public java.lang.String createHttpConnector​(java.lang.String parent,
                                                java.lang.String address,
                                                int port)
                                         throws java.lang.Exception

Create a new HttpConnector

Parameters:
  `parent` - MBean Name of the associated parent component
  `address` - The IP address on which to bind
  `port` - TCP port number to listen on
Returns:
  the object name of the created connector
Throws:
  `java.lang.Exception` - if an MBean cannot be created or registered

#### createHttpsConnector

    public java.lang.String createHttpsConnector​(java.lang.String parent,
                                                 java.lang.String address,
                                                 int port)
                                          throws java.lang.Exception

Create a new HttpsConnector

Parameters:
  `parent` - MBean Name of the associated parent component
  `address` - The IP address on which to bind
  `port` - TCP port number to listen on
Returns:
  the object name of the created connector
Throws:
  `java.lang.Exception` - if an MBean cannot be created or registered

#### createJDBCRealm

    @Deprecated
    public java.lang.String createJDBCRealm​(java.lang.String parent,
                                            java.lang.String driverName,
                                            java.lang.String connectionName,
                                            java.lang.String connectionPassword,
                                            java.lang.String connectionURL)
                                     throws java.lang.Exception

Deprecated.
This method will be removed in Tomcat 10. Use a DataSourceRealm instead.
Create a new JDBC Realm.

Parameters:
  `parent` - MBean Name of the associated parent component
  `driverName` - JDBC driver name
  `connectionName` - the user name for the connection
  `connectionPassword` - the password for the connection
  `connectionURL` - the connection URL to the database
Returns:
  the object name of the created realm
Throws:
  `java.lang.Exception` - if an MBean cannot be created or registered

#### createJNDIRealm

    public java.lang.String createJNDIRealm​(java.lang.String parent)
                                     throws java.lang.Exception

Create a new JNDI Realm.

Parameters:
  `parent` - MBean Name of the associated parent component
Returns:
  the object name of the created realm
Throws:
  `java.lang.Exception` - if an MBean cannot be created or registered

#### createMemoryRealm

    public java.lang.String createMemoryRealm​(java.lang.String parent)
                                       throws java.lang.Exception

Create a new Memory Realm.

Parameters:
  `parent` - MBean Name of the associated parent component
Returns:
  the object name of the created realm
Throws:
  `java.lang.Exception` - if an MBean cannot be created or registered

#### createStandardContext

    public java.lang.String createStandardContext​(java.lang.String parent,
                                                  java.lang.String path,
                                                  java.lang.String docBase)
                                           throws java.lang.Exception

Create a new StandardContext.

Parameters:
  `parent` - MBean Name of the associated parent component
  `path` - The context path for this Context
  `docBase` - Document base directory (or WAR) for this Context
Returns:
  the object name of the created context
Throws:
  `java.lang.Exception` - if an MBean cannot be created or registered

#### createStandardContext

    public java.lang.String createStandardContext​(java.lang.String parent,
                                                  java.lang.String path,
                                                  java.lang.String docBase,
                                                  boolean xmlValidation,
                                                  boolean xmlNamespaceAware)
                                           throws java.lang.Exception

Create a new StandardContext.

Parameters:
  `parent` - MBean Name of the associated parent component
  `path` - The context path for this Context
  `docBase` - Document base directory (or WAR) for this Context
  `xmlValidation` - if XML descriptors should be validated
  `xmlNamespaceAware` - if the XML processor should namespace aware
Returns:
  the object name of the created context
Throws:
  `java.lang.Exception` - if an MBean cannot be created or registered

#### createStandardHost

    public java.lang.String createStandardHost​(java.lang.String parent,
                                               java.lang.String name,
                                               java.lang.String appBase,
                                               boolean autoDeploy,
                                               boolean deployOnStartup,
                                               boolean deployXML,
                                               boolean unpackWARs)
                                        throws java.lang.Exception

Create a new StandardHost.

Parameters:
  `parent` - MBean Name of the associated parent component
  `name` - Unique name of this Host
  `appBase` - Application base directory name
  `autoDeploy` - Should we auto deploy?
  `deployOnStartup` - Deploy on server startup?
  `deployXML` - Should we deploy Context XML config files property?
  `unpackWARs` - Should we unpack WARs when auto deploying?
Returns:
  the object name of the created host
Throws:
  `java.lang.Exception` - if an MBean cannot be created or registered

#### createStandardServiceEngine

    public java.lang.String createStandardServiceEngine​(java.lang.String domain,
                                                        java.lang.String defaultHost,
                                                        java.lang.String baseDir)
                                                 throws java.lang.Exception

Creates a new StandardService and StandardEngine.

Parameters:
  `domain` - Domain name for the container instance
  `defaultHost` - Name of the default host to be used in the Engine
  `baseDir` - Base directory value for Engine
Returns:
  the object name of the created service
Throws:
  `java.lang.Exception` - if an MBean cannot be created or registered

#### createStandardManager

    public java.lang.String createStandardManager​(java.lang.String parent)
                                           throws java.lang.Exception

Create a new StandardManager.

Parameters:
  `parent` - MBean Name of the associated parent component
Returns:
  the object name of the created manager
Throws:
  `java.lang.Exception` - if an MBean cannot be created or registered

#### createUserDatabaseRealm

    public java.lang.String createUserDatabaseRealm​(java.lang.String parent,
                                                    java.lang.String resourceName)
                                             throws java.lang.Exception

Create a new UserDatabaseRealm.

Parameters:
  `parent` - MBean Name of the associated parent component
  `resourceName` - Global JNDI resource name of the associated UserDatabase
Returns:
  the object name of the created realm
Throws:
  `java.lang.Exception` - if an MBean cannot be created or registered

#### createValve

    public java.lang.String createValve​(java.lang.String className,
                                        java.lang.String parent)
                                 throws java.lang.Exception

Create a new Valve and associate it with a `Container`.

Parameters:
  `className` - The fully qualified class name of the `Valve` to create
  `parent` - The MBean name of the associated parent `Container`.
Returns:
  The MBean name of the `Valve` that was created or `null` if the `Valve` does not implement `JmxEnabled`.
Throws:
  `java.lang.Exception` - if an MBean cannot be created or registered

#### createWebappLoader

    public java.lang.String createWebappLoader​(java.lang.String parent)
                                        throws java.lang.Exception

Create a new Web Application Loader.

Parameters:
  `parent` - MBean Name of the associated parent component
Returns:
  the object name of the created loader
Throws:
  `java.lang.Exception` - if an MBean cannot be created or registered

#### removeConnector

    public void removeConnector​(java.lang.String name)
                         throws java.lang.Exception

Remove an existing Connector.

Parameters:
  `name` - MBean Name of the component to remove
Throws:
  `java.lang.Exception` - if a component cannot be removed

#### removeContext

    public void removeContext​(java.lang.String contextName)
                       throws java.lang.Exception

Remove an existing Context.

Parameters:
  `contextName` - MBean Name of the component to remove
Throws:
  `java.lang.Exception` - if a component cannot be removed

#### removeHost

    public void removeHost​(java.lang.String name)
                    throws java.lang.Exception

Remove an existing Host.

Parameters:
  `name` - MBean Name of the component to remove
Throws:
  `java.lang.Exception` - if a component cannot be removed

#### removeLoader

    public void removeLoader​(java.lang.String name)
                      throws java.lang.Exception

Remove an existing Loader.

Parameters:
  `name` - MBean Name of the component to remove
Throws:
  `java.lang.Exception` - if a component cannot be removed

#### removeManager

    public void removeManager​(java.lang.String name)
                       throws java.lang.Exception

Remove an existing Manager.

Parameters:
  `name` - MBean Name of the component to remove
Throws:
  `java.lang.Exception` - if a component cannot be removed

#### removeRealm

    public void removeRealm​(java.lang.String name)
                     throws java.lang.Exception

Remove an existing Realm.

Parameters:
  `name` - MBean Name of the component to remove
Throws:
  `java.lang.Exception` - if a component cannot be removed

#### removeService

    public void removeService​(java.lang.String name)
                       throws java.lang.Exception

Remove an existing Service.

Parameters:
  `name` - MBean Name of the component to remove
Throws:
  `java.lang.Exception` - if a component cannot be removed

#### removeValve

    public void removeValve​(java.lang.String name)
                     throws java.lang.Exception

Remove an existing Valve.

Parameters:
  `name` - MBean Name of the component to remove
Throws:
  `java.lang.Exception` - if a component cannot be removed