| Method from org.apache.jk.server.JkMain Detail: |
public String getChannelClassName() {
return (String)props.get( "handler.channel.className");
}
|
public String getDomain() {
return domain;
}
|
public String getErr() {
return this.err;
}
|
public long getInitTime() {
return initTime;
}
The time it took to initialize jk ( ms) |
public String getJkHome() {
return getWorkerEnv().getJkHome();
}
|
public static JkMain getJkMain() {
return jkMain;
}
|
public ObjectName getObjectName() {
return oname;
}
|
public String getOut() {
return this.out;
}
|
public String getPropertiesFile() {
return propFile;
}
|
public Object getProperty(String name) {
String alias = (String)replacements.get(name);
Object result = null;
if(alias != null) {
result = props.get(alias);
}
if(result == null) {
result = props.get(name);
}
return result;
}
|
public long getStartTime() {
return startTime;
}
The time it took to start jk ( ms ) |
public String getWorkerClassName() {
return (String)props.get( "handler.container.className");
}
|
public WorkerEnv getWorkerEnv() {
if( wEnv==null ) {
wEnv=new WorkerEnv();
}
return wEnv;
}
|
public void init() throws IOException {
long t1=System.currentTimeMillis();
if(null != out) {
PrintStream outS=new PrintStream(new FileOutputStream(out));
System.setOut(outS);
}
if(null != err) {
PrintStream errS=new PrintStream(new FileOutputStream(err));
System.setErr(errS);
}
String home=getWorkerEnv().getJkHome();
if( home==null ) {
// XXX use IntrospectionUtil to find myself
this.guessHome();
}
home=getWorkerEnv().getJkHome();
if( home==null ) {
log.info( "Can't find home, jk2.properties not loaded");
}
if(log.isDebugEnabled())
log.debug("Starting Jk2, base dir= " + home );
loadPropertiesFile();
String initHTTPS = (String)props.get("class.initHTTPS");
if("true".equalsIgnoreCase(initHTTPS)) {
initHTTPSUrls();
}
long t2=System.currentTimeMillis();
initTime=t2-t1;
}
|
public static void main(String[] args) {
try {
if( args.length == 1 &&
( "-?".equals(args[0]) || "-h".equals( args[0])) ) {
System.out.println("Usage: ");
System.out.println(" JkMain [args]");
System.out.println();
System.out.println(" Each bean setter corresponds to an arg ( like -debug 10 )");
System.out.println(" System properties:");
System.out.println(" jk2.home Base dir of jk2");
return;
}
jkMain=new JkMain();
IntrospectionUtils.processArgs( jkMain, args, new String[] {},
null, new Hashtable());
jkMain.init();
jkMain.start();
} catch( Exception ex ) {
log.warn("Error running",ex);
}
}
|
public void pause() throws Exception {
for( int i=0; i< wEnv.getHandlerCount(); i++ ) {
if( wEnv.getHandler(i) != null ) {
wEnv.getHandler(i).pause();
}
}
}
|
public void postDeregister() {
}
|
public void postRegister(Boolean registrationDone) {
}
|
public void preDeregister() throws Exception {
}
|
public ObjectName preRegister(MBeanServer server,
ObjectName name) throws Exception {
oname=name;
mserver=server;
domain=name.getDomain();
return name;
}
|
public void resume() throws Exception {
for( int i=0; i< wEnv.getHandlerCount(); i++ ) {
if( wEnv.getHandler(i) != null ) {
wEnv.getHandler(i).resume();
}
}
}
|
public void saveProperties() {
if( !saveProperties) return;
if(propsF == null) {
log.warn("No properties file specified. Unable to save");
return;
}
// Temp - to check if it works
File outFile= new File(propsF.getParentFile(), propsF.getName()+".save");
log.debug("Saving properties " + outFile );
try {
props.store( new FileOutputStream(outFile), "AUTOMATICALLY GENERATED" );
} catch(IOException ex ){
log.warn("Unable to save to "+outFile,ex);
}
}
|
public void setBeanProperty(Object target,
String name,
String val) {
if( val!=null )
val=IntrospectionUtils.replaceProperties( val, props, null );
if( log.isDebugEnabled())
log.debug( "setProperty " + target + " " + name + "=" + val );
IntrospectionUtils.setProperty( target, name, val );
}
|
public void setChannelClassName(String name) {
props.put( "handler.channel.className",name);
}
Set the channelClassName that will used to connect to
httpd. |
public void setErr(String s) {
this.err=s;
}
|
public void setJkHome(String s) {
getWorkerEnv().setJkHome(s);
}
Set the base dir of jk2. ( including WEB-INF if in a webapp ).
We'll try to guess it from classpath if none is set ( for
example on command line ), but if in a servlet environment
you need to use Context.getRealPath or a system property or
set it expliciltey. |
public void setOut(String s) {
this.out=s;
}
|
public void setPropertiesFile(String p) {
propFile=p;
if( started ) {
loadPropertiesFile();
}
}
Load a .properties file into and set the values
into jk2 configuration. |
public void setProperty(String n,
String v) {
if( "jkHome".equals( n ) ) {
setJkHome( v );
}
if( "propertiesFile".equals( n ) ) {
setPropertiesFile( v );
}
props.put( n, v );
if( started ) {
processProperty( n, v );
saveProperties();
}
}
Set a name/value as a jk2 property |
public void setPropertyString(String handlerN,
String name,
String val) {
if( log.isDebugEnabled() )
log.debug( "setProperty " + handlerN + " " + name + "=" + val );
Object target=getWorkerEnv().getHandler( handlerN );
setBeanProperty( target, name, val );
if( started ) {
saveProperties();
}
}
|
public void setSaveProperties(boolean b) {
saveProperties=b;
}
|
public void setWorkerClassName(String name) {
props.put( "handler.container.className",name);
}
Set the workerClassName that will handle the request.
( sort of 'pivot' in axis :-) |
public void setWorkerEnv(WorkerEnv wEnv) {
this.wEnv = wEnv;
}
|
public void start() throws IOException {
long t1=System.currentTimeMillis();
// We must have at least 3 handlers:
// channel is the 'transport'
// request is the request processor or 'global' chain
// container is the 'provider'
// Additional handlers may exist and be used internally
// or be chained to create one of the standard handlers
String handlers[]=defaultHandlers;
// backward compat
String workers=props.getProperty( "handler.list", null );
if( workers!=null ) {
handlers= split( workers, ",");
}
// Load additional component declarations
processModules();
for( int i=0; i< handlers.length; i++ ) {
String name= handlers[i];
JkHandler w=getWorkerEnv().getHandler( name );
if( w==null ) {
newHandler( name, "", name );
}
}
// Process properties - and add aditional handlers.
processProperties();
for( int i=0; i< wEnv.getHandlerCount(); i++ ) {
if( wEnv.getHandler(i) != null ) {
try {
wEnv.getHandler(i).init();
} catch( IOException ex) {
if( "apr".equals(wEnv.getHandler(i).getName() )) {
log.info( "APR not loaded, disabling jni components: " + ex.toString());
} else {
log.error( "error initializing " + wEnv.getHandler(i).getName(), ex );
}
}
}
}
started=true;
long t2=System.currentTimeMillis();
startTime=t2-t1;
this.saveProperties();
log.info("Jk running ID=" + wEnv.getLocalId() + " time=" + initTime + "/" + startTime +
" config=" + propFile);
}
|
public void stop() {
/*
static String defaultHandlers[]= { "apr",
"shm",
"request",
"container",
"channelSocket",
"channelJni",
"channelUnix"};
*/
for( int i=0; i< wEnv.getHandlerCount(); i++ ) {
if( wEnv.getHandler(i) != null ) {
try {
wEnv.getHandler(i).destroy();
} catch( IOException ex) {
log.error("Error stopping " + wEnv.getHandler(i).getName(), ex);
}
}
}
started=false;
}
|