com.sun.grizzly.http.jk.server
Class JkMain

java.lang.Object
  extended by com.sun.grizzly.http.jk.server.JkMain
All Implemented Interfaces:
MBeanRegistration

public class JkMain
extends Object
implements MBeanRegistration

Main class used to startup and configure jk. It manages the conf/jk2.properties file and is the target of JMX proxy. It implements a policy of save-on-change - whenever a property is changed at runtime the jk2.properties file will be overriden. You can edit the config file when tomcat is stoped ( or if you don't use JMX or other admin tools ). The format of jk2.properties:

TYPE[.LOCALNAME].PROPERTY_NAME=VALUE
Set a property on the associated component. TYPE will be used to find the class name and instantiate the component. LOCALNAME allows multiple instances. In JMX mode, TYPE and LOCALNAME will form the JMX name ( eventually combined with a 'jk2' component )
NAME=VALUE
Define global properties to be used in ${} substitutions
class.COMPONENT_TYPE=JAVA_CLASS_NAME
Adds a new 'type' of component. We predefine all known types.
Instances are created the first time a component name is found. In addition, 'handler.list' property will override the list of 'default' components that are loaded automatically. Note that the properties file is just one (simplistic) way to configure jk. We hope to see configs based on registry, LDAP, db, etc. ( XML is not necesarily better )

Author:
Costin Manolache

Field Summary
protected  String domain
           
protected  MBeanServer mserver
           
protected  ObjectName oname
           
 
Constructor Summary
JkMain()
           
 
Method Summary
 String getChannelClassName()
           
 String getDomain()
           
 String getErr()
           
 long getInitTime()
          The time it took to initialize jk ( ms)
 String getJkHome()
           
static JkMain getJkMain()
           
 ObjectName getObjectName()
           
 String getOut()
           
 String getPropertiesFile()
           
 Object getProperty(String name)
          Retrieve a property.
 long getStartTime()
          The time it took to start jk ( ms )
 String getWorkerClassName()
           
 WorkerEnv getWorkerEnv()
           
 void init()
           
static void main(String[] args)
           
 void pause()
           
 void postDeregister()
           
 void postRegister(Boolean registrationDone)
           
 void preDeregister()
           
 ObjectName preRegister(MBeanServer server, ObjectName name)
           
 void resume()
           
 void saveProperties()
           
 void setBeanProperty(Object target, String name, String val)
           
 void setChannelClassName(String name)
          Set the channelClassName that will used to connect to httpd.
 void setErr(String s)
           
 void setJkHome(String s)
          Set the base dir of jk2.
 void setOut(String s)
           
 void setPropertiesFile(String p)
          Load a .properties file into and set the values into jk2 configuration.
 void setProperty(String n, String v)
          Set a name/value as a jk2 property
 void setPropertyString(String handlerN, String name, String val)
           
 void setSaveProperties(boolean b)
           
 void setWorkerClassName(String name)
          Set the workerClassName that will handle the request.
 void setWorkerEnv(WorkerEnv wEnv)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

domain

protected String domain

oname

protected ObjectName oname

mserver

protected MBeanServer mserver
Constructor Detail

JkMain

public JkMain()
Method Detail

getJkMain

public static JkMain getJkMain()

setPropertiesFile

public void setPropertiesFile(String p)
Load a .properties file into and set the values into jk2 configuration.


getPropertiesFile

public String getPropertiesFile()

setSaveProperties

public void setSaveProperties(boolean b)

setProperty

public void setProperty(String n,
                        String v)
Set a name/value as a jk2 property


getProperty

public Object getProperty(String name)
Retrieve a property.


setChannelClassName

public void setChannelClassName(String name)
Set the channelClassName that will used to connect to httpd.


getChannelClassName

public String getChannelClassName()

setWorkerClassName

public void setWorkerClassName(String name)
Set the workerClassName that will handle the request. ( sort of 'pivot' in axis :-)


getWorkerClassName

public String getWorkerClassName()

setJkHome

public void setJkHome(String 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.


getJkHome

public String getJkHome()

setOut

public void setOut(String s)

getOut

public String getOut()

setErr

public void setErr(String s)

getErr

public String getErr()

init

public void init()
          throws IOException
Throws:
IOException

stop

public void stop()

start

public void start()
           throws IOException
Throws:
IOException

getWorkerEnv

public WorkerEnv getWorkerEnv()

setWorkerEnv

public void setWorkerEnv(WorkerEnv wEnv)

setBeanProperty

public void setBeanProperty(Object target,
                            String name,
                            String val)

setPropertyString

public void setPropertyString(String handlerN,
                              String name,
                              String val)

getInitTime

public long getInitTime()
The time it took to initialize jk ( ms)


getStartTime

public long getStartTime()
The time it took to start jk ( ms )


main

public static void main(String[] args)

saveProperties

public void saveProperties()

getObjectName

public ObjectName getObjectName()

getDomain

public String getDomain()

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws Exception
Specified by:
preRegister in interface MBeanRegistration
Throws:
Exception

postRegister

public void postRegister(Boolean registrationDone)
Specified by:
postRegister in interface MBeanRegistration

preDeregister

public void preDeregister()
                   throws Exception
Specified by:
preDeregister in interface MBeanRegistration
Throws:
Exception

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface MBeanRegistration

pause

public void pause()
           throws Exception
Throws:
Exception

resume

public void resume()
            throws Exception
Throws:
Exception


Copyright © 2012 Oracle Corporation. All Rights Reserved.