|
What this is
Other links
The source code
/*
* Copyright 1999-2004 The Apache Sofware 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/
package org.apache.tomcat.startup;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.Hashtable;
import org.apache.tomcat.util.IntrospectionUtils;
/**
* Simple task for enabling the admin interface. Can be used as
* an ant task or from command line.
*
* @author Costin Manolache
*/
public class EnableAdmin {
Hashtable attributes=new Hashtable();
String args[];
public EnableAdmin() {
}
//-------------------- Properties --------------------
public void setHome(String home) {
attributes.put( "home", home );
}
public void setInstall(String install) {
attributes.put( "install", install );
}
public void setArgs(String args[]) {
attributes.put("args", args);
this.args=args;
}
public void setConfig( String s ) {
attributes.put( "config" , s );
}
public void setAction(String s ) {
attributes.put("action",s);
attributes.put(s, "true" );
}
public void setSandbox( boolean b ) {
if( b ) attributes.put( "sandbox", "true" );
}
public void setStop( boolean b ) {
if( b ) attributes.put( "stop", "true" );
}
public void setEnableAdmin( boolean b ) {
if( b ) attributes.put( "enableAdmin", "true" );
}
public void setParentClassLoader( ClassLoader cl ) {
attributes.put( "parentClassLoader", cl );
}
public void setCommonClassLoader( ClassLoader cl ) {
attributes.put( "commonClassLoader", cl );
}
public void setAppsClassLoader( ClassLoader cl ) {
attributes.put( "appsClassLoader", cl );
}
public void setContainerClassLoader( ClassLoader cl ) {
attributes.put( "containerClassLoader", cl );
}
// -------------------- execute --------------------
public void execute() throws Exception
{
if( args!=null ) {
boolean ok=processArgs( args );
if ( ! ok ) {
printUsage();
return;
}
}
System.out.println("Overriding apps-admin settings ");
String home=(String)attributes.get("home");
if( home==null) home=(String)attributes.get("install");
FileWriter fw=new FileWriter( home + File.separator +
"conf" + File.separator +
"apps-admin.xml" );
PrintWriter pw=new PrintWriter( fw );
pw.println( "");
pw.println( "
|
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.