/*
* 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.
*/
/**
* Load the HTTP or RMI adapters for MX4J and JMXRI.
*
* Add "mx.enabled=true" in jk2.properties to enable it.
* with mx.httpPort, mx.httpHost, mxjrmpPort and mx.jrmpPort.
* <p />
* If you run into an error message like
* "SystemId Unknown; Line #12; Column #81; Cannot add attribute name after
* child nodes or before an element is produced. Attribute will be ignored."
* after setting mx.enabled to true, you probably need a newer version
* of Xalan. See the RELEASE-NOTES document section on XML Parsers for
* more information.
*
*/
{
private boolean enabled=false;
private boolean log4jEnabled=true;
private boolean useXSLTProcessor = true;
public JkMX() {
}
/* -------------------- Public methods -------------------- */
/** Enable the MX4J adapters (new way)
*/
public void setEnabled(boolean b) {
enabled=b;
}
public boolean getEnabled() {
return enabled;
}
/** Enable the Log4j MBean)
*/
public void setLog4jEnabled(boolean b) {
log4jEnabled=b;
}
public boolean getLog4jEnabled() {
return log4jEnabled;
}
/** Enable the MX4J adapters (old way, compatible)
*/
public void setPort(int i) {
enabled=(i != -1);
}
public int getPort() {
}
/** Enable the MX4J HTTP internal adapter
*/
public void setHttpPort( int i ) {
httpport=i;
}
public int getHttpPort() {
return httpport;
}
}
return httphost;
}
}
return authmode;
}
}
return authuser;
}
}
return authpassword;
}
/** Enable the MX4J JRMP internal adapter
*/
public void setJrmpPort( int i ) {
jrmpport=i;
}
public int getJrmpPort() {
return jrmpport;
}
}
return jrmphost;
}
public boolean getUseXSLTProcessor() {
return useXSLTProcessor;
}
}
/** Initialize the worker. After this call the worker will be
* ready to accept new requests.
*/
boolean httpAdapterLoaded = false;
boolean jrmpAdapterLoaded = false;
try {
"Http:name=HttpAdaptor");
new Object[] {
if(useXSLTProcessor) {
"Http:name=XSLTProcessor");
}
// starts the server
httpAdapterLoaded = true;
} catch( Throwable t ) {
}
}
if ((httpport != -1) && (!httpAdapterLoaded) && classExists("mx4j.tools.adaptor.http.HttpAdaptor")) {
try {
"Http:name=HttpAdaptor");
new Object[] {
if(useXSLTProcessor) {
"Http:name=XSLTProcessor");
}
// starts the server
httpAdapterLoaded = true;
} catch( Throwable t ) {
}
}
try {
"Naming:name=rmiregistry");
// Create the JRMP adaptor
"Adaptor:protocol=jrmp");
new Object[] {
"com.sun.jndi.rmi.registry.RegistryContextFactory"},
new Object[] {
jrpmurl},
// Registers the JRMP adaptor in JNDI and starts it
jrmpAdapterLoaded = true;
}
}
if ((httpport != -1) && (! httpAdapterLoaded) && classExists("com.sun.jdmk.comm.HtmlAdaptorServer")) {
try {
"Adaptor:name=html,port=" + httpport);
httpAdapterLoaded = true;
} catch( Throwable t ) {
}
}
if ((!httpAdapterLoaded) && (!jrmpAdapterLoaded))
}
public void destroy() {
try {
if( httpServerName!=null ) {
}
if( jrmpServerName!=null ) {
}
} catch( Throwable t ) {
}
}
try {
mserver = getMBeanServer();
if( enabled ) {
loadAdapter();
}
if( log4jEnabled) {
try {
registerObject("org.apache.log4j.jmx.HierarchyDynamicMBean" ,
"log4j:hierarchy=default");
} catch( Throwable t ) {
}
}
} catch( Throwable t ) {
}
}
}
} else {
}
return (server);
}
try {
return true;
} catch(Throwable e) {
return false;
}
}
throws Exception {
Object o = c.newInstance();
return objN;
}
}