Fields Summary |
---|
private static com.sun.org.apache.commons.logging.Log | log |
private String | defaultHostHost name to use when no server host, or an unknown host,
is specified in the request. |
private static final String | infoThe descriptive information string for this implementation. |
private org.apache.catalina.Service | serviceThe Service that owns this Engine, if any. |
private String | baseDirAllow the base dir to be specified explicitely for
each engine. In time we should stop using catalina.base property -
otherwise we loose some flexibility. |
private String | mbeansFileOptional mbeans config file. This will replace the "hacks" in
jk and ServerListener. The mbeans file will support (transparent)
persistence - soon. It'll probably replace jk2.properties and could
replace server.xml. Of course - the same beans could be loaded and
managed by an external entity - like the embedding app - which
can use a different persistence mechanism. |
private List | mbeansMbeans loaded by the engine. |
private org.apache.catalina.DefaultContext | defaultContextDefaultContext config |
private String | jvmRouteIdThe JVM Route ID for this Tomcat instance. All Route ID's must be unique
across the cluster. |
Methods Summary |
---|
public void | addChild(org.apache.catalina.Container child)Add a child Container, only if the proposed child is an implementation
of Host.
if (!(child instanceof Host))
throw new IllegalArgumentException
(sm.getString("standardEngine.notHost"));
super.addChild(child);
|
public void | addDefaultContext(org.apache.catalina.DefaultContext defaultContext)Set the DefaultContext
for new web applications.
DefaultContext oldDefaultContext = this.defaultContext;
this.defaultContext = defaultContext;
support.firePropertyChange("defaultContext",
oldDefaultContext, this.defaultContext);
|
public javax.management.ObjectName | createObjectName(java.lang.String domain, javax.management.ObjectName parent)
if( log.isDebugEnabled())
log.debug("Create ObjectName " + domain + " " + parent );
return new ObjectName( domain + ":type=Engine");
|
public void | destroy()
// END CR 6368085
if( ! initialized ) return;
/* CR 6368085
initialized=false;
*/
// START CR 6368085
super.destroy();
// END CR 6368085
// if we created it, make sure it's also destroyed
((StandardService)service).destroy();
if( mbeans != null ) {
try {
Registry.getRegistry().invoke(mbeans, "destroy", false);
} catch (Exception e) {
log.error(sm.getString(
"standardEngine.unregister.mbeans.failed",
mbeansFile),
e);
}
}
//
if( mbeans != null ) {
try {
for( int i=0; i<mbeans.size() ; i++ ) {
Registry.getRegistry().unregisterComponent((ObjectName)mbeans.get(i));
}
} catch (Exception e) {
log.error(sm.getString(
"standardEngine.unregister.mbeans.failed",
mbeansFile),
e);
}
}
// force all metadata to be reloaded.
// That doesn't affect existing beans. We should make it per
// registry - and stop using the static.
Registry.getRegistry().resetMetadata();
|
public java.lang.String | getBaseDir()
if( baseDir==null ) {
baseDir=System.getProperty("catalina.base");
}
if( baseDir==null ) {
baseDir=System.getProperty("catalina.home");
}
return baseDir;
|
public org.apache.catalina.DefaultContext | getDefaultContext()Retrieve the DefaultContext for new web applications.
return (this.defaultContext);
|
public java.lang.String | getDefaultHost()Return the default host.
return (defaultHost);
|
public java.lang.String | getDomain()
if (domain!=null) {
return domain;
} else {
return getName();
}
|
public java.lang.String | getInfo()Return descriptive information about this Container implementation and
the corresponding version number, in the format
<description>/<version> .
return (info);
|
public java.lang.String | getJvmRoute()Retrieve the cluster-wide unique identifier for this Engine.
This value is only useful in a load-balancing scenario.
return jvmRouteId;
|
public java.lang.String | getMbeansFile()
return mbeansFile;
|
public javax.management.ObjectName | getParentName()
if (getService()==null) {
return null;
}
String name = getService().getName();
ObjectName serviceName=new ObjectName(domain +
":type=Service,serviceName="+name);
return serviceName;
|
public org.apache.catalina.Realm | getRealm()Provide a default in case no explicit configuration is set
// ------------------------------------------------------------- Properties
Realm configured=super.getRealm();
// If no set realm has been called - default to JAAS
// This can be overriden at engine, context and host level
if( configured==null ) {
configured=new JAASRealm();
this.setRealm( configured );
}
return configured;
|
public org.apache.catalina.Service | getService()Return the Service with which we are associated (if any).
return (this.service);
|
public void | importDefaultContext(org.apache.catalina.Context context)Import the DefaultContext config into a web application context.
if ( this.defaultContext != null )
this.defaultContext.importDefaultContext(context);
|
public void | init()
if( initialized ) return;
/* CR 6368085
initialized=true;
*/
if( oname==null ) {
// not registered in JMX yet - standalone mode
try {
if (domain==null) {
domain=getName();
}
log.debug( "Register " + domain );
oname=new ObjectName(domain + ":type=Engine");
controller=oname;
Registry.getRegistry().registerComponent(this, oname, null);
} catch( Throwable t ) {
log.info("Error registering ", t );
}
}
if( mbeansFile == null ) {
String defaultMBeansFile=getBaseDir() + "/conf/tomcat5-mbeans.xml";
File f=new File( defaultMBeansFile );
if( f.exists() ) mbeansFile=f.getAbsolutePath();
}
if( mbeansFile != null ) {
readEngineMbeans();
}
if( mbeans != null ) {
try {
Registry.getRegistry().invoke(mbeans, "init", false);
} catch (Exception e) {
log.error("Error in init() for " + mbeansFile, e);
}
}
// not needed since the following if statement does the same thing the right way
// remove later after checking
//if( service==null ) {
// try {
// ObjectName serviceName=getParentName();
// if( mserver.isRegistered( serviceName )) {
// log.info("Registering with the service ");
// try {
// mserver.invoke( serviceName, "setContainer",
// new Object[] { this },
// new String[] { "org.apache.catalina.Container" } );
// } catch( Exception ex ) {
// ex.printStackTrace();
// }
// }
// } catch( Exception ex ) {
// log.error("Error registering with service ");
// }
//}
if( service==null ) {
// for consistency...: we are probably in embeded mode
try {
service=new StandardService();
service.setContainer( this );
service.initialize();
} catch( Throwable t ) {
log.error(t);
}
}
// START CR 6368085
initialized = true;
// END CR 6368085
|
public void | installDefaultContext(org.apache.catalina.Context context)Install the StandardContext portion of the DefaultContext
configuration into current Context.
if (defaultContext != null &&
defaultContext instanceof StandardDefaultContext) {
((StandardDefaultContext)defaultContext).installDefaultContext(context);
}
|
public javax.management.ObjectName | preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
super.preRegister(server,name);
this.setName( name.getDomain());
return name;
|
private void | readEngineMbeans()
try {
MbeansSource mbeansMB=new MbeansSource();
File mbeansF=new File( mbeansFile );
mbeansMB.setSource(mbeansF);
Registry.getRegistry().registerComponent(mbeansMB,
domain + ":type=MbeansFile", null);
mbeansMB.load();
mbeansMB.init();
mbeansMB.setRegistry(Registry.getRegistry());
mbeans=mbeansMB.getMBeans();
} catch( Throwable t ) {
log.error( "Error loading " + mbeansFile, t );
}
|
public void | setBaseDir(java.lang.String baseDir)
this.baseDir = baseDir;
|
public void | setDefaultHost(java.lang.String host)Set the default host.
String oldDefaultHost = this.defaultHost;
if (host == null) {
this.defaultHost = null;
} else {
// START OF PE 4989789
//this.defaultHost = host.toLowerCase();
this.defaultHost = host;
// END OF PE 4989789
}
support.firePropertyChange("defaultHost", oldDefaultHost,
this.defaultHost);
|
public void | setDomain(java.lang.String domain)
this.domain = domain;
|
public void | setJvmRoute(java.lang.String routeId)Set the cluster-wide unique identifier for this Engine.
This value is only useful in a load-balancing scenario.
This property should not be changed once it is set.
jvmRouteId = routeId;
|
public void | setMbeansFile(java.lang.String mbeansFile)
this.mbeansFile = mbeansFile;
|
public void | setName(java.lang.String name)
if( domain != null ) {
// keep name==domain, ignore override
// we are already registered
super.setName( domain );
return;
}
// The engine name is used as domain
domain=name; // XXX should we set it in init() ? It shouldn't matter
super.setName( name );
|
public void | setParent(org.apache.catalina.Container container)Disallow any attempt to set a parent for this Container, since an
Engine is supposed to be at the top of the Container hierarchy.
throw new IllegalArgumentException
(sm.getString("standardEngine.notParent"));
|
public void | setService(org.apache.catalina.Service service)Set the Service with which we are associated (if any).
this.service = service;
|
public void | start()Start this Engine component.
if( started ) {
return;
}
if( !initialized ) {
init();
}
/* PWC 6296256
// Log our server identification information
log.info( "Starting Servlet Engine: " + ServerInfo.getServerInfo());
*/
// START PWC 6296256
if (log.isDebugEnabled()) {
log.debug("Starting Servlet Engine");
}
// END PWC 6296256
if( mbeans != null ) {
try {
Registry.getRegistry().invoke(mbeans, "start", false);
} catch (Exception e) {
log.error("Error in start() for " + mbeansFile, e);
}
}
// Standard container startup
super.start();
|
public void | stop()
super.stop();
if( mbeans != null ) {
try {
Registry.getRegistry().invoke(mbeans, "stop", false);
} catch (Exception e) {
log.error("Error in stop() for " + mbeansFile, e);
}
}
|
public java.lang.String | toString()Return a String representation of this component.
StringBuffer sb = new StringBuffer("StandardEngine[");
sb.append(getName());
sb.append("]");
return (sb.toString());
|