/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** 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:
* <dl>
* <dt>TYPE[.LOCALNAME].PROPERTY_NAME=VALUE
* <dd>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 )
*
* <dt>NAME=VALUE
* <dd>Define global properties to be used in ${} substitutions
*
* <dt>class.COMPONENT_TYPE=JAVA_CLASS_NAME
* <dd>Adds a new 'type' of component. We predefine all known types.
* </dl>
*
* 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
*/
@SuppressWarnings({"StringContatenationInLoop"})
{
boolean modified=false;
boolean started=false;
boolean saveProperties=false;
public JkMain()
{
}
private void initHTTPSUrls() {
try {
// 11657: if only ajp is used, https: redirects need to work ( at least for 1.3+)
return; // already set
} else {
}
}
}
// -------------------- Setting --------------------
/** Load a .properties file into and set the values
* into jk2 configuration.
*/
propFile=p;
if( started ) {
}
}
return propFile;
}
public void setSaveProperties( boolean b ) {
}
*/
if( "jkHome".equals( n ) ) {
setJkHome( v );
}
if( "propertiesFile".equals( n ) ) {
setPropertiesFile( v );
}
if( started ) {
processProperty( n, v );
}
}
/**
* Retrieve a property.
*/
}
}
return result;
}
/**
* Set the <code>channelClassName</code> that will used to connect to
* httpd.
*/
}
}
/**
* Set the <code>workerClassName</code> that will handle the request.
* ( sort of 'pivot' in axis :-)
*/
}
}
/** 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.
*/
getWorkerEnv().setJkHome(s);
}
return getWorkerEnv().getJkHome();
}
out =s;
}
return out;
}
err =s;
}
return err;
}
// -------------------- Initialization --------------------
{
}
}
// XXX use IntrospectionUtil to find myself
guessHome();
}
}
}
}
"container",
"channelSocket"};
/*
static String defaultHandlers[]= { "apr",
"shm",
"request",
"container",
"channelSocket",
"channelJni",
"channelUnix"};
*/
public void stop()
{
try {
} catch( IOException ex) {
}
}
}
started=false;
}
{
// 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
// backward compat
}
// Load additional component declarations
if (w == null) {
}
}
// Process properties - and add aditional handlers.
try {
} catch( IOException ex) {
} else {
}
}
}
}
started=true;
" config=" + propFile);
}
// -------------------- Usefull methods --------------------
}
return wEnv;
}
}
/* A bit of magic to support workers.properties without giving
*/
}
/*
* Set a handler property
*/
if( started ) {
}
}
/** The time it took to initialize jk ( ms)
*/
public long getInitTime() {
return initTime;
}
/** The time it took to start jk ( ms )
*/
public long getStartTime() {
return startTime;
}
// -------------------- Main --------------------
long initTime;
long startTime;
try {
return;
}
}
}
// -------------------- Private methods --------------------
private boolean checkPropertiesFile() {
return false;
}
if(!propsF.isAbsolute()) {
return false;
}
}
}
private void loadPropertiesFile() {
if(!checkPropertiesFile()) {
return;
}
try {
} catch(IOException ex ){
}
}
public void saveProperties() {
if( !saveProperties) return;
return;
}
// Temp - to check if it works
try {
} catch(IOException ex ){
}
}
// translate top-level keys ( from coyote or generic ) into component keys
static {
}
private void preProcessProperties() {
while( keys.hasMoreElements() ) {
v.addElement(key);
}
}
while( keys.hasMoreElements() ) {
}
}
private void processProperties() {
while( keys.hasMoreElements() ) {
}
}
// ignore
if( dot > 0 ) {
} else {
}
} else {
return;
}
return;
}
}
return;
}
{
return null;
}
try {
return null;
}
try {
} catch (Exception e) {
}
}
return handler;
}
private void processModules() {
int plen=6;
while( keys.hasMoreElements() ) {
if( ! k.startsWith( "class." ) )
continue;
}
}
while( st.hasMoreTokens() ) {
}
}
return res;
}
// guessing home
private void guessHome() {
return;
"tomcat-jk2.jar", CNAME );
}
}
return oname;
}
return domain;
}
return name;
}
}
}
public void postDeregister() {
}
}
}
}
}
}
}
}