Complete refactoring of the core runtime
parent
88a8fc164b
commit
28b2f67a34
|
@ -22,7 +22,7 @@
|
|||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Main-Class>net.openesb.standalone.bootstrap.StandaloneBoostrapper</Main-Class>
|
||||
<Main-Class>net.openesb.standalone.startup.Bootstrap</Main-Class>
|
||||
<Class-Path>jbi.jar jbi-ext.jar jta-1_1-classes.zip</Class-Path>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
|
|
|
@ -1,390 +0,0 @@
|
|||
/*
|
||||
* BEGIN_HEADER - DO NOT EDIT
|
||||
*
|
||||
* The contents of this file are subject to the terms
|
||||
* of the Common Development and Distribution License
|
||||
* (the "License"). You may not use this file except
|
||||
* in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at
|
||||
* https://open-esb.dev.java.net/public/CDDLv1.0.html.
|
||||
* See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL
|
||||
* HEADER in each file and include the License file at
|
||||
* https://open-esb.dev.java.net/public/CDDLv1.0.html.
|
||||
* If applicable add the following below this CDDL HEADER,
|
||||
* with the fields enclosed by brackets "[]" replaced with
|
||||
* your own identifying information: Portions Copyright
|
||||
* [year] [name of copyright owner]
|
||||
*/
|
||||
|
||||
/*
|
||||
* @(#)JSEJBIBootstrap.java
|
||||
* Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* END_HEADER - DO NOT EDIT
|
||||
*/
|
||||
package net.openesb.standalone.bootstrap;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.remote.JMXConnector;
|
||||
import javax.management.remote.JMXConnectorFactory;
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
|
||||
public class StandaloneBoostrapper
|
||||
implements Runnable
|
||||
{
|
||||
/** JSR208 interfaces. */
|
||||
private static final String JBI_JAR_NAME = "jbi.jar";
|
||||
|
||||
/** JBI runtime interfaces exposed to components. */
|
||||
private static final String JBI_EXT_JAR_NAME = "jbi-ext.jar";
|
||||
|
||||
/** Name of the top-level class of the JBI runtime framework. */
|
||||
private static final String JBI_FRAMEWORK_CLASS_NAME =
|
||||
"net.openesb.standalone.framework.StandaloneContainer";
|
||||
|
||||
/** Runtime life cycle commands. */
|
||||
private static final String START = "start";
|
||||
private static final String STOP = "stop";
|
||||
|
||||
/** Environment property used to override install root location. */
|
||||
private static final String INSTALL_ROOT = "install.root";
|
||||
/** Environment property used for instance name. */
|
||||
public static final String INSTANCE_NAME = "instance.name";
|
||||
/** Environment property used for JMX connector port setting. */
|
||||
//private static final String CONNECTOR_PORT = "connector.port";
|
||||
/** Default connector port. */
|
||||
//private static final String DEFAULT_CONNECTOR_PORT = "8699";
|
||||
/** Default instance name. */
|
||||
private static final String DEFAULT_INSTANCE_NAME = "server";
|
||||
|
||||
|
||||
/** List of jars that should not be included in the runtime classloader. */
|
||||
private List<String> mBlacklistJars = new ArrayList<String>();
|
||||
|
||||
/** ClassLoader used for JBI runtime classes. These classes are not
|
||||
* part of the component classloader hierarchy.
|
||||
*/
|
||||
private ClassLoader mFrameworkClassLoader;
|
||||
|
||||
/** ClassLoader for clases in lib/ext that become part of the component
|
||||
* classloader hierarchy.
|
||||
*/
|
||||
private ClassLoader mExtensionClassLoader;
|
||||
|
||||
/** JBI installation directory. */
|
||||
private File mJbiInstallDir;
|
||||
|
||||
/** JBI Framework implementation */
|
||||
private Object mJbiFramework;
|
||||
|
||||
/** Environment properties */
|
||||
private Properties mEnvironment;
|
||||
|
||||
private Logger mLog =
|
||||
Logger.getLogger(this.getClass().getPackage().getName());
|
||||
|
||||
/** Runs the JBI framework in stand-alone mode under Java SE. System
|
||||
* properties defined at the command-line with '-D' are passed into the
|
||||
* framework as environment properties.
|
||||
* @param args not used at this time
|
||||
* @throws Exception framework failed to initialize
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
StandaloneBoostrapper jbiBootstrap = new StandaloneBoostrapper(System.getProperties());
|
||||
|
||||
try
|
||||
{
|
||||
jbiBootstrap.createJBIFramework();
|
||||
|
||||
// Are we starting or stopping? Default to start.
|
||||
if (args != null && args.length > 0 && STOP.equalsIgnoreCase(args[0]))
|
||||
{
|
||||
jbiBootstrap.unloadJBIFramework();
|
||||
}
|
||||
else
|
||||
{
|
||||
jbiBootstrap.loadJBIFramework();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/** Create a new JSEJBIBootstrap instance with the specified environment.
|
||||
* @param env environment properties
|
||||
*/
|
||||
public StandaloneBoostrapper(Properties env)
|
||||
{
|
||||
mEnvironment = env;
|
||||
|
||||
// setup blacklist jars
|
||||
mBlacklistJars.add(JBI_JAR_NAME);
|
||||
mBlacklistJars.add(JBI_EXT_JAR_NAME);
|
||||
|
||||
// If connector port is not specified, set a 'smart' value
|
||||
//if (mEnvironment.getProperty(CONNECTOR_PORT) == null)
|
||||
//{
|
||||
// mEnvironment.setProperty(CONNECTOR_PORT, DEFAULT_CONNECTOR_PORT);
|
||||
//}
|
||||
|
||||
// If install root is not set, default to current working directory
|
||||
String installPath = mEnvironment.getProperty(INSTALL_ROOT);
|
||||
if (installPath == null)
|
||||
{
|
||||
File installDir = new File(System.getProperty("user.dir"));
|
||||
// account for javaw launch from a double-click on the jar
|
||||
if (installDir.getName().equals("lib"))
|
||||
{
|
||||
installDir = installDir.getParentFile();
|
||||
}
|
||||
|
||||
installPath = installDir.getAbsolutePath();
|
||||
}
|
||||
|
||||
mJbiInstallDir = new File(installPath);
|
||||
|
||||
// quick sanity check on the install root
|
||||
if (!mJbiInstallDir.isDirectory() ||
|
||||
!new File(mJbiInstallDir, "lib/jbi_rt.jar").exists())
|
||||
{
|
||||
throw new RuntimeException("Invalid JBI install root: " +
|
||||
mJbiInstallDir.getAbsolutePath());
|
||||
}
|
||||
|
||||
// pass this information along to the core framework
|
||||
mEnvironment.setProperty(INSTALL_ROOT, mJbiInstallDir.getAbsolutePath());
|
||||
}
|
||||
|
||||
/** Shutdown hook to allow the JBI framework to exit gracefully in the
|
||||
* event of an abrupt shutdown (e.g. ^C).
|
||||
*/
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Using System.out because the loggers appear to be gone at this point
|
||||
System.out.println("Unloading JBI framework in response to VM termination.");
|
||||
invoke(mJbiFramework, "unload");
|
||||
System.out.println("JBI framework shutdown complete.");
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
mLog.log(Level.SEVERE, "Failed to unload JBI framework: {0}", t.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/** Loads the JBI framework using the Java SE platform wrapper. If the
|
||||
* framework loads successfully, this method adds a shutdown hook to
|
||||
* allow for civilized clean-up when the VM terminates.
|
||||
*/
|
||||
void loadJBIFramework()
|
||||
{
|
||||
try
|
||||
{
|
||||
invoke(mJbiFramework, "load");
|
||||
|
||||
//Add a shutdown hook to call unload when the VM exits
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(this));
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
mLog.log(Level.SEVERE, "Failed to load JBI framework: {0}", t.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/** Unloads the JBI framework using the Java SE platform wrapper. This is
|
||||
* always a remote call, since the framework has (presumably) been loaded
|
||||
* previously by another process.
|
||||
*/
|
||||
void unloadJBIFramework()
|
||||
{
|
||||
String errMsg = null;
|
||||
JMXServiceURL serviceURL;
|
||||
//int jmxConnectorPort;
|
||||
|
||||
try
|
||||
{
|
||||
// Which port is the connector server running on?
|
||||
//jmxConnectorPort = Integer.parseInt(mEnvironment.getProperty(
|
||||
// CONNECTOR_PORT, DEFAULT_CONNECTOR_PORT));
|
||||
|
||||
serviceURL = (JMXServiceURL)invoke(mJbiFramework, "getServiceURL");
|
||||
|
||||
JMXConnector jmxConn = JMXConnectorFactory.connect(serviceURL);
|
||||
MBeanServerConnection mbsConn = jmxConn.getMBeanServerConnection();
|
||||
ObjectName fwMBeanName = new ObjectName("net.open-esb.standalone",
|
||||
"instance", mEnvironment.getProperty(INSTANCE_NAME, DEFAULT_INSTANCE_NAME));
|
||||
mbsConn.invoke(fwMBeanName, "unload", new Object[0], new String[0]);
|
||||
|
||||
}
|
||||
catch (NumberFormatException nfEx)
|
||||
{
|
||||
mLog.log(Level.SEVERE, "Invalid JMX connector port value. {0}", nfEx.getMessage());
|
||||
}
|
||||
catch (javax.management.MBeanException mbEx)
|
||||
{
|
||||
errMsg = mbEx.getTargetException().toString();
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
errMsg = t.toString();
|
||||
}
|
||||
|
||||
if (errMsg != null)
|
||||
{
|
||||
mLog.log(Level.SEVERE, "Failed to unload JBI framework: {0}", errMsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
mLog.log(Level.INFO, "JBI framework has been unloaded.");
|
||||
}
|
||||
}
|
||||
|
||||
/** Creates the JBI framework using the appropriate classloading structure.
|
||||
*/
|
||||
private void createJBIFramework()
|
||||
throws Exception
|
||||
{
|
||||
Class fwClass;
|
||||
Constructor fwCtor;
|
||||
|
||||
try
|
||||
{
|
||||
createExtensionClassLoader();
|
||||
createFrameworkClassLoader();
|
||||
|
||||
// Set the thread context classloader to the extension classloader
|
||||
Thread.currentThread().setContextClassLoader(mFrameworkClassLoader);
|
||||
|
||||
fwClass = mFrameworkClassLoader.loadClass(JBI_FRAMEWORK_CLASS_NAME);
|
||||
fwCtor = fwClass.getDeclaredConstructor(Properties.class);
|
||||
mJbiFramework = fwCtor.newInstance(mEnvironment);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
throw new Exception("Failed to create JBI framework: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/** Creates a separate runtime classloader to avoid namespace pollution
|
||||
* between the component classloading hierarchy and the JBI implementation.
|
||||
* At present, this method is greedy and includes any file in the lib/
|
||||
* directory in the runtime classpath.
|
||||
*/
|
||||
private void createFrameworkClassLoader()
|
||||
{
|
||||
ArrayList<URL> cpList = new ArrayList<URL>();
|
||||
URL[] cpURLs = new URL[0];
|
||||
File libDir = new File(mJbiInstallDir, "lib");
|
||||
|
||||
// Everything in the lib directory goes into the classpath
|
||||
for (File lib : libDir.listFiles())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (mBlacklistJars.contains(lib.getName()))
|
||||
{
|
||||
// skip blacklisted jars
|
||||
continue;
|
||||
}
|
||||
|
||||
mLog.log(Level.FINEST, "Framework classloader : loading library {0}", lib.getName());
|
||||
cpList.add(lib.toURI().toURL());
|
||||
}
|
||||
catch (java.net.MalformedURLException urlEx)
|
||||
{
|
||||
mLog.log(Level.WARNING, "Bad library URL: {0}", urlEx.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
cpURLs = cpList.toArray(cpURLs);
|
||||
mFrameworkClassLoader = new URLClassLoader(
|
||||
cpURLs, mExtensionClassLoader);
|
||||
}
|
||||
|
||||
/** Creates a separate extension classloader for the component classloading
|
||||
* chain. All jars added in the lib/ext directory are automatically added
|
||||
* to this classloader's classpath.
|
||||
*/
|
||||
private void createExtensionClassLoader()
|
||||
{
|
||||
ArrayList<URL> cpList = new ArrayList<URL>();
|
||||
URL[] cpURLs = new URL[0];
|
||||
File libDir = new File(mJbiInstallDir, "lib/ext");
|
||||
|
||||
if (libDir.exists() || libDir.isDirectory())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Add the top-level ext directory
|
||||
cpList.add(libDir.toURI().toURL());
|
||||
|
||||
// Everything in the lib/ext directory goes into the classpath
|
||||
for (File lib : libDir.listFiles())
|
||||
{
|
||||
mLog.log(Level.FINEST, "Extension classloader : loading library {0}", lib.getName());
|
||||
cpList.add(lib.toURI().toURL());
|
||||
}
|
||||
}
|
||||
catch (java.net.MalformedURLException urlEx)
|
||||
{
|
||||
mLog.log(Level.WARNING, "Bad library URL: {0}", urlEx.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
cpURLs = cpList.toArray(cpURLs);
|
||||
mExtensionClassLoader = new URLClassLoader(
|
||||
cpURLs, getClass().getClassLoader());
|
||||
}
|
||||
|
||||
/** Utility method to invoke a method using reflection. This is kind of
|
||||
* a sloppy implementation, since we don't account for overloaded methods.
|
||||
* @param obj contains the method to be invoked
|
||||
* @param method name of the method to be invoked
|
||||
* @param params parameters, if any
|
||||
* @return returned object, if any
|
||||
*/
|
||||
private Object invoke(Object obj, String method, Object... params)
|
||||
throws Throwable
|
||||
{
|
||||
Object result = null;
|
||||
|
||||
try
|
||||
{
|
||||
for (Method m : obj.getClass().getDeclaredMethods())
|
||||
{
|
||||
if (m.getName().equals(method))
|
||||
{
|
||||
result = m.invoke(obj, params);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (java.lang.reflect.InvocationTargetException itEx)
|
||||
{
|
||||
throw itEx.getTargetException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,8 +5,17 @@ package net.openesb.standalone.logger;
|
|||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public class OpenESBLogManager extends java.util.logging.LogManager {
|
||||
public class LogManager extends java.util.logging.LogManager {
|
||||
|
||||
@Override
|
||||
public void reset() throws SecurityException {
|
||||
//FIX when called from a runtime shutdown hook
|
||||
}
|
||||
|
||||
public void reset0() throws SecurityException {
|
||||
super.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProperty(String name) {
|
||||
String result = super.getProperty(name);
|
|
@ -0,0 +1,270 @@
|
|||
package net.openesb.standalone.startup;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.remote.JMXConnector;
|
||||
import javax.management.remote.JMXConnectorFactory;
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public class Bootstrap {
|
||||
|
||||
/**
|
||||
* JSR208 interfaces.
|
||||
*/
|
||||
private static final String JBI_JAR_NAME = "jbi.jar";
|
||||
/**
|
||||
* JBI runtime interfaces exposed to components.
|
||||
*/
|
||||
private static final String JBI_EXT_JAR_NAME = "jbi-ext.jar";
|
||||
/**
|
||||
* List of jars that should not be included in the runtime classloader.
|
||||
*/
|
||||
private List<String> mBlacklistJars = new ArrayList<String>();
|
||||
|
||||
{
|
||||
mBlacklistJars.add(JBI_JAR_NAME);
|
||||
mBlacklistJars.add(JBI_EXT_JAR_NAME);
|
||||
}
|
||||
/**
|
||||
* ClassLoader used for JBI runtime classes. These classes are not part of
|
||||
* the component classloader hierarchy.
|
||||
*/
|
||||
private ClassLoader mFrameworkClassLoader;
|
||||
/**
|
||||
* ClassLoader for clases in lib/ext that become part of the component
|
||||
* classloader hierarchy.
|
||||
*/
|
||||
private ClassLoader mExtensionClassLoader;
|
||||
private final static Logger mLog =
|
||||
Logger.getLogger(Bootstrap.class.getName());
|
||||
/**
|
||||
* Daemon reference
|
||||
*/
|
||||
private Object openesbDaemon = null;
|
||||
/**
|
||||
* Daemon object used by main.
|
||||
*/
|
||||
private static Bootstrap daemon = null;
|
||||
private static final String OPENESB_HOME_PROP = "openesb.home";
|
||||
|
||||
public void init() throws Exception {
|
||||
// Set OpenESB path
|
||||
setOpenesbHome();
|
||||
|
||||
initClassLoaders();
|
||||
|
||||
// Set the thread context classloader to the framework classloader
|
||||
Thread.currentThread().setContextClassLoader(mFrameworkClassLoader);
|
||||
|
||||
Class<?> fwClass = mFrameworkClassLoader.loadClass(
|
||||
"net.openesb.standalone.startup.Container");
|
||||
Object startupInstance = fwClass.newInstance();
|
||||
|
||||
openesbDaemon = startupInstance;
|
||||
}
|
||||
|
||||
private void initClassLoaders() {
|
||||
createExtensionClassLoader();
|
||||
createFrameworkClassLoader();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the
|
||||
* <code>openesb.home</code> System property to the current working
|
||||
* directory if it has not been set.
|
||||
*/
|
||||
private void setOpenesbHome() {
|
||||
String installPath = System.getProperty(OPENESB_HOME_PROP);
|
||||
if (installPath == null) {
|
||||
File installDir = new File(System.getProperty("user.dir"));
|
||||
// account for javaw launch from a double-click on the jar
|
||||
if (installDir.getName().equals("lib")) {
|
||||
installDir = installDir.getParentFile();
|
||||
}
|
||||
|
||||
installPath = installDir.getAbsolutePath();
|
||||
}
|
||||
|
||||
File openesbHomeDir = new File(installPath);
|
||||
|
||||
// quick sanity check on the install root
|
||||
if (!openesbHomeDir.isDirectory()
|
||||
|| !new File(openesbHomeDir, "lib/jbi_rt.jar").exists()) {
|
||||
throw new RuntimeException("Invalid JBI install root: "
|
||||
+ openesbHomeDir.getAbsolutePath());
|
||||
}
|
||||
|
||||
// pass this information along to the core framework
|
||||
System.setProperty(OPENESB_HOME_PROP,
|
||||
openesbHomeDir.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the OpenESB Standalone daemon.
|
||||
*/
|
||||
public void start() throws Exception {
|
||||
if (openesbDaemon == null) {
|
||||
init();
|
||||
}
|
||||
|
||||
Method method = openesbDaemon.getClass().getMethod("start", (Class[]) null);
|
||||
method.invoke(openesbDaemon, (Object[]) null);
|
||||
}
|
||||
public static final String DEFAULT_INSTANCE_NAME = "server";
|
||||
public static final int DEFAULT_INSTANCE_PORT = 8699;
|
||||
public static final String DEFAULT_SERVICE_URL = "service:jmx:rmi:///jndi/rmi://localhost:%s/jmxrmi";
|
||||
|
||||
/**
|
||||
* Stop the OpenESB Standalone daemon.
|
||||
*/
|
||||
public void stop(String[] arguments)
|
||||
throws Exception {
|
||||
|
||||
String errMsg = null;
|
||||
try {
|
||||
Map env = new HashMap();
|
||||
String[] creds = {"admin", "admin"};
|
||||
env.put(JMXConnector.CREDENTIALS, creds);
|
||||
|
||||
JMXServiceURL serviceURL = new JMXServiceURL(
|
||||
String.format(DEFAULT_SERVICE_URL, DEFAULT_INSTANCE_PORT));
|
||||
|
||||
JMXConnector jmxConn = JMXConnectorFactory.connect(serviceURL, env);
|
||||
MBeanServerConnection mbsConn = jmxConn.getMBeanServerConnection();
|
||||
ObjectName fwMBeanName = new ObjectName("net.open-esb.standalone",
|
||||
"instance", DEFAULT_INSTANCE_NAME);
|
||||
mbsConn.invoke(fwMBeanName, "stop", new Object[0], new String[0]);
|
||||
|
||||
} catch (NumberFormatException nfEx) {
|
||||
mLog.log(Level.SEVERE, "Invalid JMX connector port value. {0}", nfEx.getMessage());
|
||||
} catch (javax.management.MBeanException mbEx) {
|
||||
errMsg = mbEx.getTargetException().toString();
|
||||
} catch (Throwable t) {
|
||||
errMsg = t.toString();
|
||||
}
|
||||
|
||||
if (errMsg != null) {
|
||||
mLog.log(Level.SEVERE, "Failed to unload JBI framework: {0}", errMsg);
|
||||
} else {
|
||||
mLog.log(Level.INFO, "JBI framework has been unloaded.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Main method, used for testing only.
|
||||
*
|
||||
* @param args Command line arguments to be processed
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
|
||||
if (daemon == null) {
|
||||
// Don't set daemon until init() has completed
|
||||
Bootstrap bootstrap = new Bootstrap();
|
||||
/*
|
||||
try {
|
||||
bootstrap.init();
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
return;
|
||||
}*/
|
||||
daemon = bootstrap;
|
||||
}
|
||||
|
||||
try {
|
||||
String command = "start";
|
||||
if (args.length > 0) {
|
||||
command = args[args.length - 1];
|
||||
}
|
||||
|
||||
if (command.equals("start")) {
|
||||
daemon.start();
|
||||
} else if (command.equals("stop")) {
|
||||
daemon.stop(args);
|
||||
} else {
|
||||
mLog.log(Level.WARNING,
|
||||
"Bootstrap: command \"{0}\" does not exist.", command);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a separate runtime classloader to avoid namespace pollution
|
||||
* between the component classloading hierarchy and the JBI implementation.
|
||||
* At present, this method is greedy and includes any file in the lib/
|
||||
* directory in the runtime classpath.
|
||||
*/
|
||||
private void createFrameworkClassLoader() {
|
||||
ArrayList<URL> cpList = new ArrayList<URL>();
|
||||
URL[] cpURLs = new URL[0];
|
||||
File libDir = new File(
|
||||
System.getProperty(OPENESB_HOME_PROP), "lib");
|
||||
|
||||
// Everything in the lib directory goes into the classpath
|
||||
for (File lib : libDir.listFiles()) {
|
||||
try {
|
||||
if (mBlacklistJars.contains(lib.getName())) {
|
||||
// skip blacklisted jars
|
||||
continue;
|
||||
}
|
||||
|
||||
mLog.log(Level.FINEST, "Framework classloader : loading library {0}", lib.getName());
|
||||
cpList.add(lib.toURI().toURL());
|
||||
} catch (java.net.MalformedURLException urlEx) {
|
||||
mLog.log(Level.WARNING, "Bad library URL: {0}", urlEx.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
cpURLs = cpList.toArray(cpURLs);
|
||||
mFrameworkClassLoader = new URLClassLoader(
|
||||
cpURLs, mExtensionClassLoader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a separate extension classloader for the component classloading
|
||||
* chain. All jars added in the lib/ext directory are automatically added to
|
||||
* this classloader's classpath.
|
||||
*/
|
||||
private void createExtensionClassLoader() {
|
||||
ArrayList<URL> cpList = new ArrayList<URL>();
|
||||
URL[] cpURLs = new URL[0];
|
||||
File libDir = new File(
|
||||
System.getProperty(OPENESB_HOME_PROP), "lib/ext");
|
||||
|
||||
if (libDir.exists() || libDir.isDirectory()) {
|
||||
try {
|
||||
// Add the top-level ext directory
|
||||
cpList.add(libDir.toURI().toURL());
|
||||
|
||||
// Everything in the lib/ext directory goes into the classpath
|
||||
for (File lib : libDir.listFiles()) {
|
||||
mLog.log(Level.FINEST, "Extension classloader : loading library {0}", lib.getName());
|
||||
cpList.add(lib.toURI().toURL());
|
||||
}
|
||||
} catch (java.net.MalformedURLException urlEx) {
|
||||
mLog.log(Level.WARNING, "Bad library URL: {0}", urlEx.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
cpURLs = cpList.toArray(cpURLs);
|
||||
mExtensionClassLoader = new URLClassLoader(
|
||||
cpURLs, getClass().getClassLoader());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package net.openesb.standalone;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public final class Constants {
|
||||
|
||||
public static final String OPENESB_HOME_PROP = "openesb.home";
|
||||
|
||||
public static final String DEFAULT_INSTANCE_NAME = "server";
|
||||
|
||||
public static final int DEFAULT_INSTANCE_PORT = 8699;
|
||||
|
||||
public static final String DEFAULT_SERVICE_URL = "service:jmx:rmi:///jndi/rmi://localhost:%s/jmxrmi";
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package net.openesb.standalone;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public interface Lifecycle {
|
||||
|
||||
void start() throws LifecycleException;
|
||||
|
||||
void stop() throws LifecycleException;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package net.openesb.standalone;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public class LifecycleException extends RuntimeException {
|
||||
|
||||
public LifecycleException() {
|
||||
}
|
||||
|
||||
public LifecycleException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public LifecycleException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
|
@ -1,14 +1,9 @@
|
|||
package net.openesb.standalone;
|
||||
package net.openesb.standalone.core;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Scopes;
|
||||
import com.google.inject.name.Names;
|
||||
import com.sun.jbi.platform.PlatformContext;
|
||||
import java.util.Properties;
|
||||
import javax.transaction.TransactionManager;
|
||||
import net.openesb.security.SecurityProvider;
|
||||
import net.openesb.standalone.framework.StandaloneContainer;
|
||||
import net.openesb.standalone.framework.StandalonePlatformContext;
|
||||
import net.openesb.standalone.jmx.auth.login.JMXAuthenticator;
|
||||
import net.openesb.standalone.jta.TransactionManagerProvider;
|
||||
import net.openesb.standalone.security.SecurityProviderImpl;
|
||||
|
@ -20,22 +15,13 @@ import net.openesb.standalone.settings.yaml.YamlSettingsProvider;
|
|||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public class StandaloneModule extends AbstractModule {
|
||||
public class CoreModule extends AbstractModule {
|
||||
|
||||
private static final String DEFAULT_INSTALL_ROOT = System.getProperty("user.dir");
|
||||
private static final String INSTALL_ROOT = "install.root";
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(Properties.class).toInstance(StandaloneContainer.systemEnv);
|
||||
String installRoot = StandaloneContainer.systemEnv.getProperty(INSTALL_ROOT, DEFAULT_INSTALL_ROOT);
|
||||
bindConstant().annotatedWith(Names.named(INSTALL_ROOT)).to(installRoot);
|
||||
|
||||
bind(PlatformContext.class).to(StandalonePlatformContext.class).asEagerSingleton();
|
||||
bind(Settings.class).toProvider(YamlSettingsProvider.class).asEagerSingleton();
|
||||
bind(TransactionManager.class).toProvider(TransactionManagerProvider.class).in(Scopes.SINGLETON);
|
||||
bind(SecurityProvider.class).to(SecurityProviderImpl.class).asEagerSingleton();
|
||||
bind(javax.management.remote.JMXAuthenticator.class).to(JMXAuthenticator.class).in(Scopes.SINGLETON);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.openesb.standalone.framework;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public class FrameworkModule extends AbstractModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(com.sun.jbi.platform.PlatformContext.class)
|
||||
.to(net.openesb.standalone.framework.PlatformContext.class)
|
||||
.asEagerSingleton();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package net.openesb.standalone.framework;
|
||||
|
||||
import com.sun.jbi.platform.PlatformContext;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.inject.Inject;
|
||||
import javax.jbi.JBIException;
|
||||
|
||||
import net.openesb.standalone.Lifecycle;
|
||||
import net.openesb.standalone.LifecycleException;
|
||||
import net.openesb.standalone.settings.Settings;
|
||||
|
||||
/**
|
||||
* OpenESB Framework wrapper for OpenESB Standalone platform.
|
||||
* <br>
|
||||
* A FrameworkService instance cannot be loaded multiple times in the same VM.
|
||||
* If multiple instances of the framework are required in a VM, instantiate
|
||||
* multiple instances of JSEJBIFramework and load each one independently. There
|
||||
* is no limit on the number of uniquely named JSEJBIFramework instances in the
|
||||
* same VM. A specific JSEJBIFramework instance can be loaded and unloaded
|
||||
* multiple times in a VM.
|
||||
*
|
||||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public class FrameworkService
|
||||
extends com.sun.jbi.framework.JBIFramework
|
||||
implements Lifecycle {
|
||||
|
||||
private boolean mLoaded;
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(FrameworkService.class.getPackage().getName());
|
||||
@Inject
|
||||
private PlatformContext platformContext;
|
||||
@Inject
|
||||
private Settings settings;
|
||||
|
||||
/**
|
||||
* Creates a new instance of the OpenESB framework.
|
||||
*/
|
||||
public FrameworkService() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if (mLoaded) {
|
||||
throw new LifecycleException("OpenESB Standalone runtime already loaded!");
|
||||
}
|
||||
|
||||
// For stand-alone JBI, JBI_HOME = platform install root
|
||||
System.setProperty("com.sun.jbi.home",
|
||||
platformContext.getInstallRoot());
|
||||
|
||||
// --------------------------------------------
|
||||
// TODO: removing this part asap
|
||||
System.setProperty("http.port",
|
||||
settings.get("http.port", "4848"));
|
||||
System.setProperty("http.enabled",
|
||||
settings.get("http.enabled", "true"));
|
||||
// --------------------------------------------
|
||||
|
||||
try {
|
||||
init(platformContext, System.getProperties());
|
||||
startup(platformContext.getNamingContext(), "");
|
||||
prepare();
|
||||
ready(true);
|
||||
|
||||
// JBI framework has been loaded
|
||||
mLoaded = true;
|
||||
} catch (JBIException jbie) {
|
||||
LOG.log(Level.SEVERE, "Unable to start properly OpenESB Core", jbie);
|
||||
throw new LifecycleException("Unable to start properly OpenESB Core", jbie);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
if (!mLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
shutdown();
|
||||
terminate();
|
||||
|
||||
mLoaded = false;
|
||||
} catch (JBIException jbie) {
|
||||
LOG.log(Level.SEVERE, "Unable to stop properly OpenESB Core", jbie);
|
||||
throw new LifecycleException("Unable to stop properly OpenESB Core", jbie);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,14 +10,14 @@ import java.util.HashSet;
|
|||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.MBeanServer;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.transaction.TransactionManager;
|
||||
import net.openesb.security.SecurityProvider;
|
||||
import net.openesb.standalone.jmx.MBServerConnectorFactory;
|
||||
import net.openesb.standalone.Constants;
|
||||
import net.openesb.standalone.jmx.JMXService;
|
||||
import net.openesb.standalone.settings.Settings;
|
||||
|
||||
/**
|
||||
|
@ -26,22 +26,23 @@ import net.openesb.standalone.settings.Settings;
|
|||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public class StandalonePlatformContext implements com.sun.jbi.platform.PlatformContext {
|
||||
public class PlatformContext implements com.sun.jbi.platform.PlatformContext {
|
||||
|
||||
private static final String DEFAULT_INSTANCE_NAME = "server";
|
||||
private static final String INSTANCE_NAME = "instance.name";
|
||||
|
||||
private final String mInstanceName;
|
||||
|
||||
@Inject private MBServerConnectorFactory jmxConnector;
|
||||
@Inject private JMXService jmxConnector;
|
||||
@Inject private SecurityProvider securityProvider;
|
||||
@Inject private TransactionManager transactionManager;
|
||||
@Inject private InitialContext namingContext;
|
||||
@Inject @Named("install.root") private String mInstallRoot;
|
||||
private String mInstallRoot = System.getProperty(
|
||||
Constants.OPENESB_HOME_PROP);
|
||||
|
||||
@Inject
|
||||
public StandalonePlatformContext(Settings settings) {
|
||||
mInstanceName = settings.get(INSTANCE_NAME, DEFAULT_INSTANCE_NAME);
|
||||
public PlatformContext(Settings settings) {
|
||||
mInstanceName = settings.get(INSTANCE_NAME,
|
||||
Constants.DEFAULT_INSTANCE_NAME);
|
||||
}
|
||||
|
||||
/**
|
|
@ -1,152 +0,0 @@
|
|||
package net.openesb.standalone.framework;
|
||||
|
||||
import com.sun.jbi.platform.PlatformContext;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.ObjectName;
|
||||
import net.openesb.standalone.LocalStringKeys;
|
||||
import net.openesb.standalone.inject.Injector;
|
||||
import net.openesb.standalone.jmx.MBServerConnectorFactory;
|
||||
import net.openesb.standalone.settings.Settings;
|
||||
import net.openesb.standalone.utils.I18NBundle;
|
||||
|
||||
/**
|
||||
* JBI framework wrapper for OpenESB Standalone platform.
|
||||
* <br>
|
||||
* A JSEJBIFramework instance cannot be loaded multiple times in the same VM. If
|
||||
* multiple instances of the framework are required in a VM, instantiate
|
||||
* multiple instances of JSEJBIFramework and load each one independently. There
|
||||
* is no limit on the number of uniquely named JSEJBIFramework instances in the
|
||||
* same VM. A specific JSEJBIFramework instance can be loaded and unloaded
|
||||
* multiple times in a VM.
|
||||
*
|
||||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public class StandaloneContainer
|
||||
extends com.sun.jbi.framework.JBIFramework
|
||||
implements StandaloneContainerMBean {
|
||||
|
||||
private boolean mLoaded;
|
||||
public static Properties systemEnv;
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(StandaloneContainer.class.getPackage().getName());
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new instance of the JBI framework.
|
||||
*/
|
||||
public StandaloneContainer(Properties environment) {
|
||||
super();
|
||||
systemEnv = environment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the JBI framework with the specified environment. When this method
|
||||
* retuns, all public interfaces and system services have completely
|
||||
* initialized. If a connector port is specified in the environment
|
||||
* properties, a remote JMX connector server is created.
|
||||
*
|
||||
* @throws Exception failed to load JBI framework
|
||||
*/
|
||||
@Override
|
||||
public synchronized void load()
|
||||
throws Exception {
|
||||
if (mLoaded) {
|
||||
throw new IllegalStateException("OpenESB runtime already loaded!");
|
||||
}
|
||||
|
||||
PlatformContext mPlatformContext = Injector.getInstance().getInjector().getInstance(PlatformContext.class);
|
||||
|
||||
// Register a management MBean for this framework instance
|
||||
ObjectName fwMBeanName = new ObjectName("net.open-esb.standalone",
|
||||
"instance", mPlatformContext.getInstanceName());
|
||||
MBeanServer mbs = mPlatformContext.getMBeanServer();
|
||||
if (mbs.isRegistered(fwMBeanName)) {
|
||||
if (mbs.getAttribute(fwMBeanName, "Loaded").equals(Boolean.TRUE)) {
|
||||
// Framework already loaded from a separate thread/process
|
||||
throw new IllegalStateException("JBI framework instance "
|
||||
+ mPlatformContext.getInstanceName() + " has already been loaded");
|
||||
} else {
|
||||
// MBean should not be registered - try to clean up
|
||||
mbs.unregisterMBean(fwMBeanName);
|
||||
}
|
||||
}
|
||||
mbs.registerMBean(this, fwMBeanName);
|
||||
|
||||
MBServerConnectorFactory connectorFactory =
|
||||
Injector.getInstance().getInjector().getInstance(MBServerConnectorFactory.class);
|
||||
connectorFactory.createConnector();
|
||||
|
||||
// For stand-alone JBI, JBI_HOME = platform install root
|
||||
systemEnv.setProperty("com.sun.jbi.home",
|
||||
mPlatformContext.getInstallRoot());
|
||||
|
||||
// --------------------------------------------
|
||||
// TODO: removing this part asap
|
||||
Settings settings = Injector.getInstance().getInjector().getInstance(Settings.class);
|
||||
|
||||
System.setProperty("http.port",
|
||||
settings.get("http.port", "4848"));
|
||||
System.setProperty("http.enabled",
|
||||
settings.get("http.enabled", "true"));
|
||||
// --------------------------------------------
|
||||
|
||||
init(mPlatformContext, systemEnv);
|
||||
startup(mPlatformContext.getNamingContext(), "");
|
||||
prepare();
|
||||
ready(true);
|
||||
|
||||
// JBI framework has been loaded
|
||||
mLoaded = true;
|
||||
}
|
||||
|
||||
public String getServiceUrl() {
|
||||
MBServerConnectorFactory connectorFactory =
|
||||
Injector.getInstance().getInjector().getInstance(MBServerConnectorFactory.class);
|
||||
return connectorFactory.getServiceUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries the state of the JBI Framework.
|
||||
*
|
||||
* @return true if the JBI framework is loaded, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isLoaded() {
|
||||
return mLoaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unloads the JBI framework. When this method retuns, all public
|
||||
* interfaces, system services, and JMX connector (if configured) have been
|
||||
* destroyed.
|
||||
*
|
||||
* @throws javax.jbi.JBIException failed to unload JBI framework
|
||||
*/
|
||||
@Override
|
||||
public void unload()
|
||||
throws Exception {
|
||||
if (!mLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
shutdown();
|
||||
terminate();
|
||||
|
||||
try {
|
||||
MBServerConnectorFactory connectorFactory =
|
||||
Injector.getInstance().getInjector().getInstance(MBServerConnectorFactory.class);
|
||||
connectorFactory.destroy();
|
||||
} catch (Exception ex) {
|
||||
LOG.log(Level.SEVERE, I18NBundle.getBundle().getMessage(
|
||||
LocalStringKeys.CONTAINER_SHUTDOWN_ERROR), ex);
|
||||
}
|
||||
|
||||
mLoaded = false;
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package net.openesb.standalone.framework;
|
||||
|
||||
/**
|
||||
* Management interface for OpenESB Standalone Container.
|
||||
*
|
||||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public interface StandaloneContainerMBean
|
||||
{
|
||||
/** Queries the state of the JBI Framework.
|
||||
* @return true if the JBI framework is loaded, false otherwise.
|
||||
*/
|
||||
boolean isLoaded();
|
||||
|
||||
/** Load the JBI framework with the specified environment. When this method
|
||||
* retuns, all public interfaces and system services have completely
|
||||
* initialized. If a connector port is specified in the environment
|
||||
* properties, a remote JMX connector server is created.
|
||||
* @throws Exception failed to load JBI framework
|
||||
*/
|
||||
void load() throws Exception;
|
||||
|
||||
/** Unloads the JBI framework. When this method retuns, all
|
||||
* public interfaces, system services, and JMX connector (if configured)
|
||||
* have been destroyed.
|
||||
* @throws javax.jbi.JBIException failed to unload JBI framework
|
||||
*/
|
||||
void unload() throws Exception;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package net.openesb.standalone.inject;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import net.openesb.standalone.StandaloneModule;
|
||||
import net.openesb.standalone.naming.NamingModule;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public class Injector {
|
||||
|
||||
private static Injector instance;
|
||||
private com.google.inject.Injector injector;
|
||||
|
||||
private Injector() {
|
||||
injector = Guice.createInjector(
|
||||
new StandaloneModule(),
|
||||
new NamingModule());
|
||||
}
|
||||
|
||||
public static Injector getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new Injector();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public com.google.inject.Injector getInjector() {
|
||||
return this.injector;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package net.openesb.standalone.inject;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Module;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ModulesBuilder implements Iterable<Module> {
|
||||
|
||||
private final List<Module> modules = new ArrayList<Module>();
|
||||
|
||||
public ModulesBuilder add(Module... modules) {
|
||||
for (Module module : modules) {
|
||||
add(module);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModulesBuilder add(Module module) {
|
||||
modules.add(module);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Module> iterator() {
|
||||
return modules.iterator();
|
||||
}
|
||||
|
||||
public com.google.inject.Injector createInjector() {
|
||||
com.google.inject.Injector injector = Guice.createInjector(modules);
|
||||
return injector;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package net.openesb.standalone.jmx;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.rmi.registry.LocateRegistry;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
|
@ -11,6 +12,9 @@ import javax.management.remote.JMXAuthenticator;
|
|||
import javax.management.remote.JMXConnectorServer;
|
||||
import javax.management.remote.JMXConnectorServerFactory;
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
import net.openesb.standalone.Constants;
|
||||
import net.openesb.standalone.Lifecycle;
|
||||
import net.openesb.standalone.LifecycleException;
|
||||
import net.openesb.standalone.LocalStringKeys;
|
||||
import net.openesb.standalone.settings.Settings;
|
||||
import net.openesb.standalone.utils.I18NBundle;
|
||||
|
@ -20,11 +24,9 @@ import net.openesb.standalone.utils.I18NBundle;
|
|||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public class MBServerConnectorFactory {
|
||||
public class JMXService implements Lifecycle {
|
||||
|
||||
private static final String DEFAULT_SERVICE_URL = "service:jmx:rmi:///jndi/rmi://localhost:%s/jmxrmi";
|
||||
private static final Logger LOG = Logger.getLogger(MBServerConnectorFactory.class.getName());
|
||||
private static final int DEFAULT_CONNECTOR_PORT = 8699;
|
||||
private static final Logger LOG = Logger.getLogger(JMXService.class.getName());
|
||||
private static final String CONNECTOR_PORT = "instance.port";
|
||||
@Inject
|
||||
private Settings settings;
|
||||
|
@ -36,6 +38,103 @@ public class MBServerConnectorFactory {
|
|||
private String serviceUrl;
|
||||
private JMXConnectorServer connectorServer;
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if (server == null) {
|
||||
server = MBeanServerHolder.INSTANCE;
|
||||
}
|
||||
|
||||
serviceUrl = String.format(Constants.DEFAULT_SERVICE_URL, getPort());
|
||||
JMXServiceURL url = null;
|
||||
|
||||
try {
|
||||
// Create the JMX service URL.
|
||||
url = new JMXServiceURL(serviceUrl);
|
||||
} catch (MalformedURLException murle) {
|
||||
throw new LifecycleException("Unable to create JMX connector", murle);
|
||||
}
|
||||
|
||||
// if the URL is localhost, start up an Registry
|
||||
if (serviceUrl.indexOf("localhost") > -1
|
||||
&& url.getProtocol().compareToIgnoreCase("rmi") == 0) {
|
||||
try {
|
||||
int registryPort = getURLLocalHostPort(serviceUrl);
|
||||
try {
|
||||
LocateRegistry.createRegistry(registryPort);
|
||||
} catch (Exception ex) {
|
||||
// the registry may had been created
|
||||
LocateRegistry.getRegistry(registryPort);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.log(Level.SEVERE, I18NBundle.getBundle().getMessage(
|
||||
LocalStringKeys.CONNECTOR_CREATE_REGISTRY_FAILURE), ex);
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String, Object> environment = new HashMap<String, Object>();
|
||||
environment.put(JMXConnectorServer.AUTHENTICATOR, authenticator);
|
||||
environment.put("com.sun.management.jmxremote.authenticate", Boolean.TRUE.toString());
|
||||
|
||||
try {
|
||||
// Create the connector server now.
|
||||
connectorServer =
|
||||
JMXConnectorServerFactory.newJMXConnectorServer(url, environment, server);
|
||||
} catch (IOException ioe) {
|
||||
throw new LifecycleException("Unable to create JMX connector", ioe);
|
||||
}
|
||||
|
||||
if (threaded) {
|
||||
// Start the connector server asynchronously (in a separate thread).
|
||||
Thread connectorThread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
connectorServer.start();
|
||||
} catch (IOException ex) {
|
||||
LOG.log(Level.SEVERE, I18NBundle.getBundle().getMessage(
|
||||
LocalStringKeys.CONNECTOR_START_CONNECTOR_FAILURE, serviceUrl), ex);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
connectorThread.setName("JMX Connector Thread [" + connectorServer.getAddress() + "]");
|
||||
connectorThread.setDaemon(daemon);
|
||||
connectorThread.start();
|
||||
} else {
|
||||
try {
|
||||
// Start the connector server in the same thread.
|
||||
connectorServer.start();
|
||||
} catch (IOException ioe) {
|
||||
throw new LifecycleException("Unable to start JMX connector", ioe);
|
||||
}
|
||||
}
|
||||
|
||||
if (LOG.isLoggable(Level.INFO)) {
|
||||
LOG.log(Level.INFO, I18NBundle.getBundle().getMessage(
|
||||
LocalStringKeys.CONNECTOR_START_CONNECTOR_STARTED,
|
||||
connectorServer.getAddress()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
if (connectorServer != null) {
|
||||
try {
|
||||
connectorServer.stop();
|
||||
if (LOG.isLoggable(Level.INFO)) {
|
||||
LOG.log(Level.INFO, I18NBundle.getBundle().getMessage(
|
||||
LocalStringKeys.CONNECTOR_SERVER_CONNECTOR_STOPPED));
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
LOG.log(Level.SEVERE, I18NBundle.getBundle().getMessage(
|
||||
LocalStringKeys.CONTAINER_SHUTDOWN_ERROR), ioe);
|
||||
throw new LifecycleException(
|
||||
I18NBundle.getBundle().getMessage(
|
||||
LocalStringKeys.CONTAINER_SHUTDOWN_ERROR), ioe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class MBeanServerHolder {
|
||||
|
||||
private static final MBeanServer INSTANCE =
|
||||
|
@ -70,94 +169,20 @@ public class MBServerConnectorFactory {
|
|||
return -1;
|
||||
}
|
||||
|
||||
public void createConnector() throws IOException {
|
||||
if (server == null) {
|
||||
server = MBeanServerHolder.INSTANCE;
|
||||
}
|
||||
|
||||
serviceUrl = String.format(DEFAULT_SERVICE_URL, getPort());
|
||||
|
||||
// Create the JMX service URL.
|
||||
JMXServiceURL url = new JMXServiceURL(serviceUrl);
|
||||
|
||||
// if the URL is localhost, start up an Registry
|
||||
if (serviceUrl.indexOf("localhost") > -1
|
||||
&& url.getProtocol().compareToIgnoreCase("rmi") == 0) {
|
||||
try {
|
||||
int registryPort = getURLLocalHostPort(serviceUrl);
|
||||
try {
|
||||
LocateRegistry.createRegistry(registryPort);
|
||||
} catch (Exception ex) {
|
||||
// the registry may had been created
|
||||
LocateRegistry.getRegistry(registryPort);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.log(Level.SEVERE, I18NBundle.getBundle().getMessage(
|
||||
LocalStringKeys.CONNECTOR_CREATE_REGISTRY_FAILURE), ex);
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String, Object> environment = new HashMap<String, Object>();
|
||||
environment.put(JMXConnectorServer.AUTHENTICATOR, authenticator);
|
||||
environment.put("com.sun.management.jmxremote.authenticate", Boolean.TRUE.toString());
|
||||
|
||||
// Create the connector server now.
|
||||
connectorServer =
|
||||
JMXConnectorServerFactory.newJMXConnectorServer(url, environment, server);
|
||||
|
||||
if (threaded) {
|
||||
// Start the connector server asynchronously (in a separate thread).
|
||||
Thread connectorThread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
connectorServer.start();
|
||||
} catch (IOException ex) {
|
||||
LOG.log(Level.SEVERE, I18NBundle.getBundle().getMessage(
|
||||
LocalStringKeys.CONNECTOR_START_CONNECTOR_FAILURE, serviceUrl), ex);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
connectorThread.setName("JMX Connector Thread [" + connectorServer.getAddress() + "]");
|
||||
connectorThread.setDaemon(daemon);
|
||||
connectorThread.start();
|
||||
} else {
|
||||
// Start the connector server in the same thread.
|
||||
connectorServer.start();
|
||||
}
|
||||
|
||||
if (LOG.isLoggable(Level.INFO)) {
|
||||
LOG.log(Level.INFO, I18NBundle.getBundle().getMessage(
|
||||
LocalStringKeys.CONNECTOR_START_CONNECTOR_STARTED,
|
||||
connectorServer.getAddress()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void destroy() throws IOException {
|
||||
if (connectorServer != null) {
|
||||
connectorServer.stop();
|
||||
if (LOG.isLoggable(Level.INFO)) {
|
||||
LOG.log(Level.INFO, I18NBundle.getBundle().getMessage(
|
||||
LocalStringKeys.CONNECTOR_SERVER_CONNECTOR_STOPPED,
|
||||
connectorServer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MBeanServer getMBeanServer() {
|
||||
return MBeanServerHolder.INSTANCE;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
try {
|
||||
return settings.getAsInt(CONNECTOR_PORT, DEFAULT_CONNECTOR_PORT);
|
||||
return settings.getAsInt(CONNECTOR_PORT,
|
||||
Constants.DEFAULT_INSTANCE_PORT);
|
||||
} catch (NumberFormatException nfEx) {
|
||||
LOG.log(Level.SEVERE, I18NBundle.getBundle().getMessage(
|
||||
LocalStringKeys.CONNECTOR_SERVER_INVALID_PORT, DEFAULT_CONNECTOR_PORT), nfEx);
|
||||
LocalStringKeys.CONNECTOR_SERVER_INVALID_PORT,
|
||||
Constants.DEFAULT_INSTANCE_PORT), nfEx);
|
||||
|
||||
return DEFAULT_CONNECTOR_PORT;
|
||||
return Constants.DEFAULT_INSTANCE_PORT;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,7 +25,7 @@ public class ContextProvider implements Provider<InitialContext> {
|
|||
private static final Logger LOG =
|
||||
Logger.getLogger(ContextProvider.class.getPackage().getName());
|
||||
|
||||
private static final String DEFAULT_CONTEXT_XML = "${install.root}/config/context.xml";
|
||||
private static final String DEFAULT_CONTEXT_XML = "${openesb.home}/config/context.xml";
|
||||
private static final String CONTEXT_PATH = "jndi.context";
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package net.openesb.standalone.node;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public interface Node {
|
||||
|
||||
/**
|
||||
* Start the node. If the node is already started, this method is no-op.
|
||||
*/
|
||||
void start();
|
||||
|
||||
/**
|
||||
* Stops the node. If the node is already stopped, this method is no-op.
|
||||
*/
|
||||
void stop();
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package net.openesb.standalone.node;
|
||||
|
||||
import net.openesb.standalone.node.internal.InstanceNode;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public final class NodeBuilder {
|
||||
|
||||
/**
|
||||
* A convenient factory method to create a {@link NodeBuilder}.
|
||||
*/
|
||||
public static NodeBuilder nodeBuilder() {
|
||||
return new NodeBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the node without starting it.
|
||||
*/
|
||||
public Node build() {
|
||||
return new InstanceNode();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package net.openesb.standalone.node.internal;
|
||||
|
||||
import com.google.inject.Injector;
|
||||
import com.sun.jbi.platform.PlatformContext;
|
||||
import java.util.logging.Logger;
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.StandardMBean;
|
||||
import net.openesb.standalone.core.CoreModule;
|
||||
import net.openesb.standalone.framework.FrameworkModule;
|
||||
import net.openesb.standalone.framework.FrameworkService;
|
||||
import net.openesb.standalone.inject.ModulesBuilder;
|
||||
import net.openesb.standalone.jmx.JMXService;
|
||||
import net.openesb.standalone.naming.NamingModule;
|
||||
import net.openesb.standalone.node.Node;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public class InstanceNode implements Node {
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(InstanceNode.class.getPackage().getName());
|
||||
|
||||
private final Injector injector;
|
||||
|
||||
private JMXService jmxService;
|
||||
private FrameworkService frameworkService;
|
||||
|
||||
public InstanceNode () {
|
||||
LOG.info("Initializing new instance...");
|
||||
|
||||
ModulesBuilder modules = new ModulesBuilder();
|
||||
|
||||
modules.add(new CoreModule());
|
||||
modules.add(new FrameworkModule());
|
||||
modules.add(new NamingModule());
|
||||
modules.add(new NodeModule(this));
|
||||
|
||||
injector = modules.createInjector();
|
||||
|
||||
LOG.info("Instance initialized");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
LOG.info("Instance is starting ...");
|
||||
|
||||
jmxService = injector.getInstance(JMXService.class);
|
||||
jmxService.start();
|
||||
|
||||
frameworkService = injector.getInstance(FrameworkService.class);
|
||||
frameworkService.start();
|
||||
|
||||
PlatformContext platformContext = injector.getInstance(PlatformContext.class);
|
||||
|
||||
try {
|
||||
// Register a management MBean for this framework instance
|
||||
ObjectName fwMBeanName = new ObjectName("net.open-esb.standalone",
|
||||
"instance", platformContext.getInstanceName());
|
||||
MBeanServer mbs = platformContext.getMBeanServer();
|
||||
if (mbs.isRegistered(fwMBeanName)) {
|
||||
if (mbs.getAttribute(fwMBeanName, "Loaded").equals(Boolean.TRUE)) {
|
||||
// Framework already loaded from a separate thread/process
|
||||
throw new IllegalStateException("JBI framework instance "
|
||||
+ platformContext.getInstanceName() + " has already been loaded");
|
||||
} else {
|
||||
// MBean should not be registered - try to clean up
|
||||
mbs.unregisterMBean(fwMBeanName);
|
||||
}
|
||||
}
|
||||
|
||||
final StandardMBean mbean = new StandardMBean(this, Node.class);
|
||||
mbs.registerMBean(mbean, fwMBeanName);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
LOG.info("Instance started");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
LOG.info("Instance is stopping ...");
|
||||
|
||||
frameworkService.stop();
|
||||
jmxService.stop();
|
||||
|
||||
LOG.info("Instance stopped");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package net.openesb.standalone.node.internal;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import net.openesb.standalone.node.Node;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public class NodeModule extends AbstractModule {
|
||||
|
||||
private final Node node;
|
||||
|
||||
public NodeModule(Node node) {
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(Node.class).toInstance(node);
|
||||
}
|
||||
}
|
|
@ -6,11 +6,9 @@ import java.io.FileInputStream;
|
|||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import net.openesb.standalone.Constants;
|
||||
import net.openesb.standalone.LocalStringKeys;
|
||||
import net.openesb.standalone.settings.ImmutableSettings;
|
||||
import net.openesb.standalone.settings.Settings;
|
||||
|
@ -31,15 +29,13 @@ public class YamlSettingsProvider implements Provider<Settings> {
|
|||
private static final Logger LOG =
|
||||
Logger.getLogger(YamlSettingsProvider.class.getPackage().getName());
|
||||
private static final String CONFIG_FILE = "openesb.config";
|
||||
@Inject
|
||||
@Named("install.root")
|
||||
private String mInstallRoot;
|
||||
@Inject
|
||||
private Properties environment;
|
||||
|
||||
private final String mInstallRoot = System.getProperty(
|
||||
Constants.OPENESB_HOME_PROP);
|
||||
|
||||
@Override
|
||||
public Settings get() {
|
||||
String configFile = environment.getProperty(CONFIG_FILE);
|
||||
String configFile = System.getProperty(CONFIG_FILE);
|
||||
|
||||
if (configFile == null) {
|
||||
configFile = mInstallRoot + File.separatorChar + "config/openesb.yaml";
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
package net.openesb.standalone.startup;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.LogManager;
|
||||
import net.openesb.standalone.Lifecycle;
|
||||
import net.openesb.standalone.node.Node;
|
||||
import net.openesb.standalone.node.NodeBuilder;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public class Container implements Lifecycle {
|
||||
|
||||
private final Node node;
|
||||
private Thread shutdownHook;
|
||||
|
||||
public Container() {
|
||||
NodeBuilder nodeBuilder = NodeBuilder.nodeBuilder();
|
||||
node = nodeBuilder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
node.start();
|
||||
|
||||
System.out.println("CONTAINER STARTED");
|
||||
// Register shutdown hook
|
||||
shutdownHook = new ContainerShutdownHook();
|
||||
Runtime.getRuntime().addShutdownHook(shutdownHook);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop an existing server instance.
|
||||
*/
|
||||
@Override
|
||||
public void stop() {
|
||||
node.stop();
|
||||
|
||||
// This is a fix when shutdown an instance by using a shutdown hook.
|
||||
try {
|
||||
invoke(LogManager.getLogManager(), "reset0");
|
||||
} catch (Throwable t) {
|
||||
}
|
||||
|
||||
System.out.println("CONTAINER STOPPED");
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to invoke a method using reflection. This is kind of a
|
||||
* sloppy implementation, since we don't account for overloaded methods.
|
||||
*
|
||||
* @param obj contains the method to be invoked
|
||||
* @param method name of the method to be invoked
|
||||
* @param params parameters, if any
|
||||
* @return returned object, if any
|
||||
*/
|
||||
private Object invoke(Object obj, String method, Object... params)
|
||||
throws Throwable {
|
||||
Object result = null;
|
||||
|
||||
try {
|
||||
for (Method m : obj.getClass().getDeclaredMethods()) {
|
||||
if (m.getName().equals(method)) {
|
||||
result = m.invoke(obj, params);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (java.lang.reflect.InvocationTargetException itEx) {
|
||||
throw itEx.getTargetException();
|
||||
}
|
||||
}
|
||||
|
||||
private class ContainerShutdownHook extends Thread {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (node != null) {
|
||||
Container.this.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,9 +13,9 @@ CONTAINER_SHUTDOWN_ERROR = OESE-1000: Error during framework shutdown: {0}.
|
|||
#
|
||||
CONNECTOR_CREATE_REGISTRY_FAILURE = OESE-1100: Create RMI registry failure.
|
||||
CONNECTOR_START_CONNECTOR_FAILURE = OESE-1101: Start connector failure: {0}.
|
||||
CONNECTOR_START_CONNECTOR_STARTED = OESE-1102: JMX connector server started: {0}
|
||||
CONNECTOR_START_CONNECTOR_STARTED = OESE-1102: JMX connector server started at: {0}
|
||||
CONNECTOR_SERVER_INVALID_PORT = OESE-1103: Invalid JMX Connector port. Use the default one {0}.
|
||||
CONNECTOR_SERVER_CONNECTOR_STOPPED = OESE-1104: JMX connector server stopped: {0}.
|
||||
CONNECTOR_SERVER_CONNECTOR_STOPPED = OESE-1104: JMX connector server stopped.
|
||||
|
||||
#
|
||||
# ============================================================================
|
||||
|
|
|
@ -69,7 +69,7 @@ for /r %%x in (%BOOSTRAP_PATTERN%) do (SET filename=%%x)
|
|||
if %filename%=="" Goto notfind
|
||||
|
||||
:: Start OpenESB in a new Dos window
|
||||
START "OpenESB SE" %JAVA_HOME%\bin\java -Djava.util.logging.config.file=%OPENESB_HOME%/config/logger.properties -Djava.util.logging.manager=net.openesb.standalone.logger.OpenESBLogManager -Djavax.net.ssl.keyStore=%OPENESB_HOME%/keystore.jks -Djavax.net.ssl.trustStore=%OPENESB_HOME%/cacerts.jks -Djavax.net.ssl.keyStorePassword=changeit -Djmx.invoke.getters=true -Dinstall.root=%OPENESB_HOME% -jar %filename%
|
||||
START "OpenESB SE" %JAVA_HOME%\bin\java -Djava.util.logging.config.file=%OPENESB_HOME%/config/logger.properties -Djava.util.logging.manager=net.openesb.standalone.logger.LogManager -Djavax.net.ssl.keyStore=%OPENESB_HOME%/keystore.jks -Djavax.net.ssl.trustStore=%OPENESB_HOME%/cacerts.jks -Djavax.net.ssl.keyStorePassword=changeit -Djmx.invoke.getters=true -Dopenesb.home=%OPENESB_HOME% -jar %filename%
|
||||
|
||||
echo.
|
||||
echo.
|
||||
|
|
|
@ -102,7 +102,7 @@ echo ""
|
|||
-Djava.util.logging.config.file=$OPENESB_HOME/config/logger.properties \
|
||||
-Djava.util.logging.manager=net.openesb.standalone.logger.OpenESBLogManager \
|
||||
-Djmx.invoke.getters=true \
|
||||
-Dinstall.root=$OPENESB_HOME \
|
||||
-Dopenesb.home=$OPENESB_HOME \
|
||||
-jar "$OPENESB_BOOT_CLASSPATH" \
|
||||
"$@"
|
||||
OPENESB_STATUS=$?
|
|
@ -39,7 +39,7 @@ java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
|
|||
net.openesb.standalone.logger.FileHandler.level=INFO
|
||||
|
||||
# Naming style for the output file:
|
||||
net.openesb.standalone.logger.FileHandler.directory=${install.root}/logs
|
||||
net.openesb.standalone.logger.FileHandler.directory=${openesb.home}/logs
|
||||
|
||||
# Encoding
|
||||
net.openesb.standalone.logger.FileHandler.encoding=UTF-8
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
##################################### JNDI ########################################
|
||||
# Specify the context file to used for JNDI
|
||||
# jndi.context: ${install.root}/config/context.xml
|
||||
# jndi.context: ${openesb.home}/config/context.xml
|
||||
|
||||
################################### Security ######################################
|
||||
# Set the security realms which have to be used for management purpose or components
|
||||
|
@ -29,4 +29,4 @@ realm:
|
|||
# The realm "admin" is the realm used for management (JMX / Rest API)
|
||||
admin:
|
||||
type: properties
|
||||
file: ${install.root}/config/mgmt-users.properties
|
||||
file: ${openesb.home}/config/mgmt-users.properties
|
Loading…
Reference in New Issue