Author: jacopoc
Date: Sat Sep 13 06:57:02 2014 New Revision: 1624700 URL: http://svn.apache.org/r1624700 Log: Removed the ClassLoaderContainer: it is no more used. Moved the portOffset field from ClassLoaderContainer to the Start/Config class. Removed: ofbiz/trunk/framework/base/src/org/ofbiz/base/container/ClassLoaderContainer.java Modified: ofbiz/trunk/framework/base/ofbiz-component.xml ofbiz/trunk/framework/base/src/org/ofbiz/base/container/NamingServiceContainer.java ofbiz/trunk/framework/catalina/build.xml ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java ofbiz/trunk/framework/service/src/org/ofbiz/service/config/model/ServiceEngine.java ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/XMLRPCClientEngine.java ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java ofbiz/trunk/framework/service/src/org/ofbiz/service/test/XmlRpcTests.java ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Config.java ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Start.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java Modified: ofbiz/trunk/framework/base/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/ofbiz-component.xml?rev=1624700&r1=1624699&r2=1624700&view=diff ============================================================================== --- ofbiz/trunk/framework/base/ofbiz-component.xml (original) +++ ofbiz/trunk/framework/base/ofbiz-component.xml Sat Sep 13 06:57:02 2014 @@ -28,9 +28,6 @@ under the License. <test-suite loader="main" location="testdef/basetests.xml"/> - <!-- load the classloader container --> - <container name="classloader-container" loaders="main,rmi,pos,install,test" class="org.ofbiz.base.container.ClassLoaderContainer"/> - <!-- load the naming (JNDI) server --> <container name="naming-container" loaders="rmi" class="org.ofbiz.base.container.NamingServiceContainer"> <property name="host" value="0.0.0.0"/> Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/container/NamingServiceContainer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/container/NamingServiceContainer.java?rev=1624700&r1=1624699&r2=1624700&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/container/NamingServiceContainer.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/container/NamingServiceContainer.java Sat Sep 13 06:57:02 2014 @@ -25,6 +25,7 @@ import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.rmi.server.UnicastRemoteObject; +import org.ofbiz.base.start.Start; import org.ofbiz.base.util.RMIExtendedSocketFactory; /** @@ -57,7 +58,7 @@ public class NamingServiceContainer impl ContainerConfig.Container.Property port = cfg.getProperty("port"); if (port.value != null) { try { - this.namingPort = Integer.parseInt(port.value) + ClassLoaderContainer.portOffset; + this.namingPort = Integer.parseInt(port.value) + Start.getInstance().getConfig().portOffset; } catch (Exception e) { throw new ContainerException("Invalid port defined in container [naming-container] configuration or as portOffset; not a valid int"); } Modified: ofbiz/trunk/framework/catalina/build.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/build.xml?rev=1624700&r1=1624699&r2=1624700&view=diff ============================================================================== --- ofbiz/trunk/framework/catalina/build.xml (original) +++ ofbiz/trunk/framework/catalina/build.xml Sat Sep 13 06:57:02 2014 @@ -35,6 +35,7 @@ under the License. <fileset dir="../base/lib/commons" includes="*.jar"/> <fileset dir="../base/lib/j2eespecs" includes="*.jar"/> <fileset dir="../base/build/lib" includes="*.jar"/> + <fileset dir="../start/build/lib" includes="*.jar"/> <fileset dir="../entity/lib" includes="*.jar"/> <fileset dir="../entity/build/lib" includes="*.jar"/> </path> Modified: ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=1624700&r1=1624699&r2=1624700&view=diff ============================================================================== --- ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java (original) +++ ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java Sat Sep 13 06:57:02 2014 @@ -71,12 +71,12 @@ import org.apache.tomcat.util.scan.Stand import org.ofbiz.base.component.ComponentConfig; import org.ofbiz.base.concurrent.ExecutionPool; -import org.ofbiz.base.container.ClassLoaderContainer; import org.ofbiz.base.container.Container; import org.ofbiz.base.container.ContainerConfig; import org.ofbiz.base.container.ContainerConfig.Container.Property; import org.ofbiz.base.container.ContainerException; import org.ofbiz.base.location.FlexibleLocation; +import org.ofbiz.base.start.Start; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.SSLUtil; import org.ofbiz.base.util.UtilValidate; @@ -477,7 +477,7 @@ public class CatalinaContainer implement // need some standard properties String protocol = ContainerConfig.getPropertyValue(connectorProp, "protocol", "HTTP/1.1"); String address = ContainerConfig.getPropertyValue(connectorProp, "address", "0.0.0.0"); - int port = ContainerConfig.getPropertyValue(connectorProp, "port", 0) + ClassLoaderContainer.portOffset; + int port = ContainerConfig.getPropertyValue(connectorProp, "port", 0) + Start.getInstance().getConfig().portOffset; boolean secure = ContainerConfig.getPropertyValue(connectorProp, "secure", false); if (protocol.toLowerCase().startsWith("ajp")) { Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/config/model/ServiceEngine.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/config/model/ServiceEngine.java?rev=1624700&r1=1624699&r2=1624700&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/config/model/ServiceEngine.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/config/model/ServiceEngine.java Sat Sep 13 06:57:02 2014 @@ -24,8 +24,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.ofbiz.base.container.ClassLoaderContainer; import org.ofbiz.base.lang.ThreadSafe; +import org.ofbiz.base.start.Start; import org.ofbiz.base.util.UtilXml; import org.ofbiz.service.config.ServiceConfigException; import org.w3c.dom.Element; @@ -91,10 +91,10 @@ public final class ServiceEngine { } for (ServiceLocation serviceLocation : serviceLocations) { String location = serviceLocation.getLocation(); - if (location.contains("localhost") && ClassLoaderContainer.portOffset != 0) { - Integer port = 1099 + ClassLoaderContainer.portOffset; + if (location.contains("localhost") && Start.getInstance().getConfig().portOffset != 0) { + Integer port = 1099 + Start.getInstance().getConfig().portOffset; location = location.replace("1099", port.toString()); - port = 8080 + ClassLoaderContainer.portOffset; + port = 8080 + Start.getInstance().getConfig().portOffset; location = location.replace("8080", port.toString()); serviceLocation.setLocation(location); } Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/XMLRPCClientEngine.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/XMLRPCClientEngine.java?rev=1624700&r1=1624699&r2=1624700&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/XMLRPCClientEngine.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/XMLRPCClientEngine.java Sat Sep 13 06:57:02 2014 @@ -28,7 +28,7 @@ import javolution.util.FastMap; import org.apache.xmlrpc.XmlRpcException; import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; import org.ofbiz.base.config.GenericConfigException; -import org.ofbiz.base.container.ClassLoaderContainer; +import org.ofbiz.base.start.Start; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; @@ -91,8 +91,8 @@ public class XMLRPCClientEngine extends String keyAlias = null; try { url = ServiceConfigUtil.getEngineParameter(engine, "url"); - if (ClassLoaderContainer.portOffset != 0) { - Integer port = 8080 + ClassLoaderContainer.portOffset; + if (Start.getInstance().getConfig().portOffset != 0) { + Integer port = 8080 + Start.getInstance().getConfig().portOffset; url = url.replace("8080", port.toString()); } login = ServiceConfigUtil.getEngineParameter(engine, "login"); Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java?rev=1624700&r1=1624699&r2=1624700&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java Sat Sep 13 06:57:02 2014 @@ -26,10 +26,10 @@ import java.rmi.server.RMIServerSocketFa import javax.naming.InitialContext; import javax.naming.NamingException; -import org.ofbiz.base.container.ClassLoaderContainer; import org.ofbiz.base.container.Container; import org.ofbiz.base.container.ContainerConfig; import org.ofbiz.base.container.ContainerException; +import org.ofbiz.base.start.Start; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.DelegatorFactory; @@ -81,9 +81,9 @@ public class RmiServiceContainer impleme String useCtx = initialCtxProp == null || initialCtxProp.value == null ? "false" : initialCtxProp.value; String host = lookupHostProp == null || lookupHostProp.value == null ? "localhost" : lookupHostProp.value; String port = lookupPortProp == null || lookupPortProp.value == null ? "1099" : lookupPortProp.value; - if (ClassLoaderContainer.portOffset != 0) { + if (Start.getInstance().getConfig().portOffset != 0) { Integer portValue = Integer.valueOf(port); - portValue += ClassLoaderContainer.portOffset; + portValue += Start.getInstance().getConfig().portOffset; port = portValue.toString(); } String keystore = ContainerConfig.getPropertyValue(cfg, "ssl-keystore", null); Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/test/XmlRpcTests.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/test/XmlRpcTests.java?rev=1624700&r1=1624699&r2=1624700&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/test/XmlRpcTests.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/test/XmlRpcTests.java Sat Sep 13 06:57:02 2014 @@ -23,7 +23,7 @@ import java.util.Locale; import java.util.Map; import org.apache.xmlrpc.client.XmlRpcClient; -import org.ofbiz.base.container.ClassLoaderContainer; +import org.ofbiz.base.start.Start; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; @@ -42,8 +42,8 @@ public class XmlRpcTests extends Abstrac public XmlRpcTests(String name) { super(name); - if (ClassLoaderContainer.portOffset != 0) { - Integer port = 8080 + ClassLoaderContainer.portOffset; + if (Start.getInstance().getConfig().portOffset != 0) { + Integer port = 8080 + Start.getInstance().getConfig().portOffset; url = url.replace("8080", port.toString()); } } Modified: ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Config.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Config.java?rev=1624700&r1=1624699&r2=1624700&view=diff ============================================================================== --- ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Config.java (original) +++ ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Config.java Sat Sep 13 06:57:02 2014 @@ -52,6 +52,7 @@ public class Config { public final boolean shutdownAfterLoad; public final String splashLogo; public final boolean useShutdownHook; + public final Integer portOffset; Config(String[] args) throws IOException { String firstArg = args.length > 0 ? args[0] : ""; @@ -203,6 +204,35 @@ public class Config { } } loaders = Collections.unmodifiableList(loadersTmp); + + // set the port offset + Integer portOffset = 0; + if (args != null) { + for (String argument : args) { + // arguments can prefix w/ a '-'. Just strip them off + if (argument.startsWith("-")) { + int subIdx = 1; + if (argument.startsWith("--")) { + subIdx = 2; + } + argument = argument.substring(subIdx); + } + // parse the arguments + if (argument.indexOf("=") != -1) { + String argumentName = argument.substring(0, argument.indexOf("=")); + String argumentVal = argument.substring(argument.indexOf("=") + 1); + if ("portoffset".equalsIgnoreCase(argumentName) && !"${portoffset}".equals(argumentVal)) { + try { + portOffset = Integer.valueOf(argumentVal); + } catch (NumberFormatException e) { + System.out.println("Error while parsing portoffset (the default value 0 will be used) = " + e); + } + } + } + } + } + this.portOffset = portOffset; + } private String getOfbizHomeProp(Properties props, String key, String def) { @@ -261,7 +291,7 @@ public class Config { return props; } - public void initClasspath(Classpath classPath) throws IOException { + void initClasspath(Classpath classPath) throws IOException { // add OFBIZ_HOME to class path classPath.addClasspath(this.ofbizHome); Modified: ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Start.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Start.java?rev=1624700&r1=1624699&r2=1624700&view=diff ============================================================================== --- ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Start.java (original) +++ ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Start.java Sat Sep 13 06:57:02 2014 @@ -376,6 +376,10 @@ public final class Start { } } + public Config getConfig() { + return this.config; + } + // ----------------------------------------------- // private class AdminPortThread extends Thread { Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java?rev=1624700&r1=1624699&r2=1624700&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java Sat Sep 13 06:57:02 2014 @@ -37,7 +37,7 @@ import javax.servlet.http.HttpSession; import javolution.util.FastMap; -import org.ofbiz.base.container.ClassLoaderContainer; +import org.ofbiz.base.start.Start; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.SSLUtil; import org.ofbiz.base.util.StringUtil; @@ -1030,12 +1030,12 @@ public class RequestHandler { String httpServer = UtilProperties.getPropertyValue("url.properties", "force.http.host"); boolean useHttps = UtilProperties.propertyValueEqualsIgnoreCase("url.properties", "port.https.enabled", "Y"); - if (ClassLoaderContainer.portOffset != 0) { + if (Start.getInstance().getConfig().portOffset != 0) { Integer httpPortValue = Integer.valueOf(httpPort); - httpPortValue += ClassLoaderContainer.portOffset; + httpPortValue += Start.getInstance().getConfig().portOffset; httpPort = httpPortValue.toString(); Integer httpsPortValue = Integer.valueOf(httpsPort); - httpsPortValue += ClassLoaderContainer.portOffset; + httpsPortValue += Start.getInstance().getConfig().portOffset; httpsPort = httpsPortValue.toString(); } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java?rev=1624700&r1=1624699&r2=1624700&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java Sat Sep 13 06:57:02 2014 @@ -20,8 +20,8 @@ package org.ofbiz.webapp.website; import javax.servlet.http.HttpServletRequest; -import org.ofbiz.base.container.ClassLoaderContainer; import org.ofbiz.base.lang.ThreadSafe; +import org.ofbiz.base.start.Start; import org.ofbiz.base.util.Assert; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilProperties; @@ -100,12 +100,12 @@ public final class WebSiteProperties { httpsHost = request.getServerName(); } - if (ClassLoaderContainer.portOffset != 0) { + if (Start.getInstance().getConfig().portOffset != 0) { Integer httpPortValue = Integer.valueOf(httpPort); - httpPortValue += ClassLoaderContainer.portOffset; + httpPortValue += Start.getInstance().getConfig().portOffset; httpPort = httpPortValue.toString(); Integer httpsPortValue = Integer.valueOf(httpsPort); - httpsPortValue += ClassLoaderContainer.portOffset; + httpsPortValue += Start.getInstance().getConfig().portOffset; httpsPort = httpsPortValue.toString(); } @@ -133,12 +133,12 @@ public final class WebSiteProperties { String httpsHost = (webSiteValue.get("httpsHost") != null) ? webSiteValue.getString("httpsHost") : defaults.getHttpsHost(); boolean enableHttps = (webSiteValue.get("enableHttps") != null) ? webSiteValue.getBoolean("enableHttps") : defaults.getEnableHttps(); - if (ClassLoaderContainer.portOffset != 0) { + if (Start.getInstance().getConfig().portOffset != 0) { Integer httpPortValue = Integer.valueOf(httpPort); - httpPortValue += ClassLoaderContainer.portOffset; + httpPortValue += Start.getInstance().getConfig().portOffset; httpPort = httpPortValue.toString(); Integer httpsPortValue = Integer.valueOf(httpsPort); - httpsPortValue += ClassLoaderContainer.portOffset; + httpsPortValue += Start.getInstance().getConfig().portOffset; httpsPort = httpsPortValue.toString(); } |
Free forum by Nabble | Edit this page |