Top Fields Constructors Methods
org.apache.catalina.mbeans

public Class MBeanFactory

extends Object
Class Inheritance
Imports
java.io.File, java.net.InetAddress, javax.management.MBeanServer, .ObjectName, org.apache.catalina.Container, .Context, .Engine, .Host, .JmxEnabled, .Realm, .Server, .Service, .Valve, org.apache.catalina.connector.Connector, org.apache.catalina.core.StandardContext, .StandardEngine, .StandardHost, .StandardService, org.apache.catalina.loader.WebappLoader, org.apache.catalina.realm.DataSourceRealm, .JNDIRealm, .MemoryRealm, .UserDatabaseRealm, org.apache.catalina.session.StandardManager, org.apache.catalina.startup.ContextConfig, .HostConfig, org.apache.juli.logging.Log, .LogFactory, org.apache.tomcat.util.res.StringManager

Author
Amy Roh

Field Summary

Modifier and TypeField and Description
private Object
container

The container (Server/Service) for which this factory was created.

private static final Log
private static final MBeanServer
mserver

The MBeanServer for this application.

protected static final StringManager

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private String
addRealmToParent(String parent, Realm realm)

public String

Returns:

the object name of the created connector
createAjpConnector
(String
MBean Name of the associated parent component
parent
,
String
The IP address on which to bind
address
,
int
TCP port number to listen on
port
)

Create a new AjpConnector

private String
createConnector(String
MBean Name of the associated parent component
parent
,
String
The IP address on which to bind
address
,
int
TCP port number to listen on
port
,
boolean
Create a AJP/1.3 Connector
isAjp
,
boolean
Create a secure Connector
isSSL
)

Create a new Connector

public String

Returns:

the object name of the created realm
createDataSourceRealm
(String
MBean Name of the associated parent component
parent
,
String
the datasource name
dataSourceName
,
String
the column name for the role names
roleNameCol
,
String
the column name for the user credentials
userCredCol
,
String
the column name for the user names
userNameCol
,
String
the table name for the roles table
userRoleTable
,
String
the table name for the users
userTable
)

Create a new DataSource Realm.

public String

Returns:

the object name of the created connector
createHttpConnector
(String
MBean Name of the associated parent component
parent
,
String
The IP address on which to bind
address
,
int
TCP port number to listen on
port
)

Create a new HttpConnector

public String

Returns:

the object name of the created connector
createHttpsConnector
(String
MBean Name of the associated parent component
parent
,
String
The IP address on which to bind
address
,
int
TCP port number to listen on
port
)

Create a new HttpsConnector

public String

Returns:

the object name of the created realm
createJNDIRealm
(String
MBean Name of the associated parent component
parent
)

Create a new JNDI Realm.

public String

Returns:

the object name of the created realm
createMemoryRealm
(String
MBean Name of the associated parent component
parent
)

Create a new Memory Realm.

public String

Returns:

the object name of the created context
createStandardContext
(String
MBean Name of the associated parent component
parent
,
String
The context path for this Context
path
,
String
Document base directory (or WAR) for this Context
docBase
)

Create a new StandardContext.

public String

Returns:

the object name of the created context
createStandardContext
(String
MBean Name of the associated parent component
parent
,
String
The context path for this Context
path
,
String
Document base directory (or WAR) for this Context
docBase
,
boolean
if XML descriptors should be validated
xmlValidation
,
boolean
if the XML processor should namespace aware
xmlNamespaceAware
)

Create a new StandardContext.

public String

Returns:

the object name of the created host
createStandardHost
(String
MBean Name of the associated parent component
parent
,
String
Unique name of this Host
name
,
String
Application base directory name
appBase
,
boolean
Should we auto deploy?
autoDeploy
,
boolean
Deploy on server startup?
deployOnStartup
,
boolean
Should we deploy Context XML config files property?
deployXML
,
boolean
Should we unpack WARs when auto deploying?
unpackWARs
)

Create a new StandardHost.

public String

Returns:

the object name of the created manager
createStandardManager
(String
MBean Name of the associated parent component
parent
)

Create a new StandardManager.

public String

Returns:

the object name of the created service
createStandardServiceEngine
(String
Domain name for the container instance
domain
,
String
Name of the default host to be used in the Engine
defaultHost
,
String
Base directory value for Engine
baseDir
)

Creates a new StandardService and StandardEngine.

public String

Returns:

the object name of the created realm
createUserDatabaseRealm
(String
MBean Name of the associated parent component
parent
,
String
Global JNDI resource name of the associated UserDatabase
resourceName
)

Create a new UserDatabaseRealm.

public String

Returns:

The MBean name of the Valve that was created or null if the Valve does not implement JmxEnabled.
createValve
(String
The fully qualified class name of the Valve to create
className
,
String
The MBean name of the associated parent Container.
parent
)

Create a new Valve and associate it with a Container.

public String

Returns:

the object name of the created loader
createWebappLoader
(String
MBean Name of the associated parent component
parent
)

Create a new Web Application Loader.

private Container
getParentContainerFromChild(ObjectName oname)

Get Parent ContainerBase to add its child component from child component's ObjectName as a String

private Container
getParentContainerFromParent(ObjectName pname)

Get Parent Container to add its child component from parent's ObjectName

private String

Returns:

empty string if t==null || t.equals("/")
getPathStr
(String
path string
t
)

Little convenience method to remove redundant code when retrieving the path string

private Service
public void
removeConnector(String
MBean Name of the component to remove
name
)

Remove an existing Connector.

public void
removeContext(String
MBean Name of the component to remove
contextName
)

Remove an existing Context.

public void
removeHost(String
MBean Name of the component to remove
name
)

Remove an existing Host.

public void
removeLoader(String
MBean Name of the component to remove
name
)

Remove an existing Loader.

public void
removeManager(String
MBean Name of the component to remove
name
)

Remove an existing Manager.

public void
removeRealm(String
MBean Name of the component to remove
name
)

Remove an existing Realm.

public void
removeService(String
MBean Name of the component to remove
name
)

Remove an existing Service.

public void
removeValve(String
MBean Name of the component to remove
name
)

Remove an existing Valve.

public void
setContainer(Object
The associated container
container
)

Set the container that this factory was created for.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

containerback to summary
private Object container

The container (Server/Service) for which this factory was created.

logback to summary
private static final Log log
mserverback to summary
private static final MBeanServer mserver

The MBeanServer for this application.

smback to summary
protected static final StringManager sm

Constructor Detail

MBeanFactoryback to summary
public MBeanFactory()

Method Detail

addRealmToParentback to summary
private String addRealmToParent(String parent, Realm realm) throws Exception
createAjpConnectorback to summary
public String createAjpConnector(String parent, String address, int port) throws Exception

Create a new AjpConnector

Parameters
parent:String

MBean Name of the associated parent component

address:String

The IP address on which to bind

port:int

TCP port number to listen on

Returns:String

the object name of the created connector

Exceptions
Exception:
if an MBean cannot be created or registered
createConnectorback to summary
private String createConnector(String parent, String address, int port, boolean isAjp, boolean isSSL) throws Exception

Create a new Connector

Parameters
parent:String

MBean Name of the associated parent component

address:String

The IP address on which to bind

port:int

TCP port number to listen on

isAjp:boolean

Create a AJP/1.3 Connector

isSSL:boolean

Create a secure Connector

Exceptions
Exception:
if an MBean cannot be created or registered
createDataSourceRealmback to summary
public String createDataSourceRealm(String parent, String dataSourceName, String roleNameCol, String userCredCol, String userNameCol, String userRoleTable, String userTable) throws Exception

Create a new DataSource Realm.

Parameters
parent:String

MBean Name of the associated parent component

dataSourceName:String

the datasource name

roleNameCol:String

the column name for the role names

userCredCol:String

the column name for the user credentials

userNameCol:String

the column name for the user names

userRoleTable:String

the table name for the roles table

userTable:String

the table name for the users

Returns:String

the object name of the created realm

Exceptions
Exception:
if an MBean cannot be created or registered
createHttpConnectorback to summary
public String createHttpConnector(String parent, String address, int port) throws Exception

Create a new HttpConnector

Parameters
parent:String

MBean Name of the associated parent component

address:String

The IP address on which to bind

port:int

TCP port number to listen on

Returns:String

the object name of the created connector

Exceptions
Exception:
if an MBean cannot be created or registered
createHttpsConnectorback to summary
public String createHttpsConnector(String parent, String address, int port) throws Exception

Create a new HttpsConnector

Parameters
parent:String

MBean Name of the associated parent component

address:String

The IP address on which to bind

port:int

TCP port number to listen on

Returns:String

the object name of the created connector

Exceptions
Exception:
if an MBean cannot be created or registered
createJNDIRealmback to summary
public String createJNDIRealm(String parent) throws Exception

Create a new JNDI Realm.

Parameters
parent:String

MBean Name of the associated parent component

Returns:String

the object name of the created realm

Exceptions
Exception:
if an MBean cannot be created or registered
createMemoryRealmback to summary
public String createMemoryRealm(String parent) throws Exception

Create a new Memory Realm.

Parameters
parent:String

MBean Name of the associated parent component

Returns:String

the object name of the created realm

Exceptions
Exception:
if an MBean cannot be created or registered
createStandardContextback to summary
public String createStandardContext(String parent, String path, String docBase) throws Exception

Create a new StandardContext.

Parameters
parent:String

MBean Name of the associated parent component

path:String

The context path for this Context

docBase:String

Document base directory (or WAR) for this Context

Returns:String

the object name of the created context

Exceptions
Exception:
if an MBean cannot be created or registered
createStandardContextback to summary
public String createStandardContext(String parent, String path, String docBase, boolean xmlValidation, boolean xmlNamespaceAware) throws Exception

Create a new StandardContext.

Parameters
parent:String

MBean Name of the associated parent component

path:String

The context path for this Context

docBase:String

Document base directory (or WAR) for this Context

xmlValidation:boolean

if XML descriptors should be validated

xmlNamespaceAware:boolean

if the XML processor should namespace aware

Returns:String

the object name of the created context

Exceptions
Exception:
if an MBean cannot be created or registered
createStandardHostback to summary
public String createStandardHost(String parent, String name, String appBase, boolean autoDeploy, boolean deployOnStartup, boolean deployXML, boolean unpackWARs) throws Exception

Create a new StandardHost.

Parameters
parent:String

MBean Name of the associated parent component

name:String

Unique name of this Host

appBase:String

Application base directory name

autoDeploy:boolean

Should we auto deploy?

deployOnStartup:boolean

Deploy on server startup?

deployXML:boolean

Should we deploy Context XML config files property?

unpackWARs:boolean

Should we unpack WARs when auto deploying?

Returns:String

the object name of the created host

Exceptions
Exception:
if an MBean cannot be created or registered
createStandardManagerback to summary
public String createStandardManager(String parent) throws Exception

Create a new StandardManager.

Parameters
parent:String

MBean Name of the associated parent component

Returns:String

the object name of the created manager

Exceptions
Exception:
if an MBean cannot be created or registered
createStandardServiceEngineback to summary
public String createStandardServiceEngine(String domain, String defaultHost, String baseDir) throws Exception

Creates a new StandardService and StandardEngine.

Parameters
domain:String

Domain name for the container instance

defaultHost:String

Name of the default host to be used in the Engine

baseDir:String

Base directory value for Engine

Returns:String

the object name of the created service

Exceptions
Exception:
if an MBean cannot be created or registered
createUserDatabaseRealmback to summary
public String createUserDatabaseRealm(String parent, String resourceName) throws Exception

Create a new UserDatabaseRealm.

Parameters
parent:String

MBean Name of the associated parent component

resourceName:String

Global JNDI resource name of the associated UserDatabase

Returns:String

the object name of the created realm

Exceptions
Exception:
if an MBean cannot be created or registered
createValveback to summary
public String createValve(String className, String parent) throws Exception

Create a new Valve and associate it with a Container.

Parameters
className:String

The fully qualified class name of the Valve to create

parent:String

The MBean name of the associated parent Container.

Returns:String

The MBean name of the Valve that was created or null if the Valve does not implement JmxEnabled.

Exceptions
Exception:
if an MBean cannot be created or registered
createWebappLoaderback to summary
public String createWebappLoader(String parent) throws Exception

Create a new Web Application Loader.

Parameters
parent:String

MBean Name of the associated parent component

Returns:String

the object name of the created loader

Exceptions
Exception:
if an MBean cannot be created or registered
getParentContainerFromChildback to summary
private Container getParentContainerFromChild(ObjectName oname) throws Exception

Get Parent ContainerBase to add its child component from child component's ObjectName as a String

getParentContainerFromParentback to summary
private Container getParentContainerFromParent(ObjectName pname) throws Exception

Get Parent Container to add its child component from parent's ObjectName

getPathStrback to summary
private String getPathStr(String t)

Little convenience method to remove redundant code when retrieving the path string

Parameters
t:String

path string

Returns:String

empty string if t==null || t.equals("/")

getServiceback to summary
private Service getService(ObjectName oname) throws Exception
removeConnectorback to summary
public void removeConnector(String name) throws Exception

Remove an existing Connector.

Parameters
name:String

MBean Name of the component to remove

Exceptions
Exception:
if a component cannot be removed
removeContextback to summary
public void removeContext(String contextName) throws Exception

Remove an existing Context.

Parameters
contextName:String

MBean Name of the component to remove

Exceptions
Exception:
if a component cannot be removed
removeHostback to summary
public void removeHost(String name) throws Exception

Remove an existing Host.

Parameters
name:String

MBean Name of the component to remove

Exceptions
Exception:
if a component cannot be removed
removeLoaderback to summary
public void removeLoader(String name) throws Exception

Remove an existing Loader.

Parameters
name:String

MBean Name of the component to remove

Exceptions
Exception:
if a component cannot be removed
removeManagerback to summary
public void removeManager(String name) throws Exception

Remove an existing Manager.

Parameters
name:String

MBean Name of the component to remove

Exceptions
Exception:
if a component cannot be removed
removeRealmback to summary
public void removeRealm(String name) throws Exception

Remove an existing Realm.

Parameters
name:String

MBean Name of the component to remove

Exceptions
Exception:
if a component cannot be removed
removeServiceback to summary
public void removeService(String name) throws Exception

Remove an existing Service.

Parameters
name:String

MBean Name of the component to remove

Exceptions
Exception:
if a component cannot be removed
removeValveback to summary
public void removeValve(String name) throws Exception

Remove an existing Valve.

Parameters
name:String

MBean Name of the component to remove

Exceptions
Exception:
if a component cannot be removed
setContainerback to summary
public void setContainer(Object container)

Set the container that this factory was created for.

Parameters
container:Object

The associated container