You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2012/03/17 06:35:45 UTC

svn commit: r1301866 - in /ofbiz/trunk/framework: ./ base/config/ minilang/src/org/ofbiz/minilang/ service/config/ service/src/org/ofbiz/service/ webslinger/

Author: jacopoc
Date: Sat Mar 17 05:35:45 2012
New Revision: 1301866

URL: http://svn.apache.org/viewvc?rev=1301866&view=rev
Log:
Removed the Webslinger component and all the framework dependencies on it; the reasons for this
* no active committer was maintaining the webslinger component
* the component was experimental and not really used by OFBiz
* the component was really big (lot of jars etc...) and we are trying to slim down the OFBiz framework and keep only the essential/useful features
* this fixes a security issue reported to the OFBiz PMC

The only Webslinger feature used by the OFBiz framework was the "service debug mode" (enabled by default with the property servicedispatcher.servicedebugmode): I have considered to keep it but it was impossible because it relied on Webslinger legacy code (in the org.webslinger.invoker.* package) that was never contributed as a source file to the OFBiz project; I have tried to review the source file from an external Webslinger repo but I couldn't find them; the only site about Webslinger I could find is this:
http://www.webslinger.org/Downloads
but the svn resources mentioned there are broken. The fact that the OFBiz frameework was dependent (for a feature useful only in development mode) on an external project that doesn't publish its source code (at least in an easy to find location) convinced me that it was better to clean up the dependency completely; on the bright side OFBiz should now use less memory.


Removed:
    ofbiz/trunk/framework/base/config/webslinger-invoker.properties
    ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericInvoker.java
    ofbiz/trunk/framework/webslinger/
Modified:
    ofbiz/trunk/framework/base/config/both-containers.xml
    ofbiz/trunk/framework/base/config/ofbiz-containers.xml
    ofbiz/trunk/framework/build.xml
    ofbiz/trunk/framework/component-load.xml
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java
    ofbiz/trunk/framework/service/config/service.properties
    ofbiz/trunk/framework/service/config/serviceengine.xml
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java

Modified: ofbiz/trunk/framework/base/config/both-containers.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/config/both-containers.xml?rev=1301866&r1=1301865&r2=1301866&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/config/both-containers.xml (original)
+++ ofbiz/trunk/framework/base/config/both-containers.xml Sat Mar 17 05:35:45 2012
@@ -26,9 +26,6 @@ under the License.
     <!-- load the cached classloader container (always second) -->
     <container name="classloader-container" class="org.ofbiz.base.container.ClassLoaderContainer"/>
 
-    <container name="commons-vfs-container" class="org.ofbiz.commons.vfs.CommonsVfsContainer"/>
-    <container name="webslinger-container" class="org.ofbiz.webslinger.WebslingerContainer"/>
-
     <!-- load JNDI/JOTM; this is no longer needed, leaving this in for now just in case someone wants to drop in JOTM from the specialized directory
     <container name="jotm-container" class="org.ofbiz.jotm.container.JotmContainer">
         <property name="jndi-config" value="iiop.properties"/>
@@ -93,9 +90,6 @@ under the License.
     -->
 
     <!-- load catalina (tomcat) and all web applications -->
-    <!-- TODO: switch to webslinger, for per-site logging
-    <container name="catalina-container" class="org.ofbiz.webslinger.WebslingerCatalinaContainer">
-    -->
     <container name="catalina-container" class="org.ofbiz.catalina.container.CatalinaContainer">
         <!-- static configuration for tomcat -->
         <property name="delegator-name" value="default"/>

Modified: ofbiz/trunk/framework/base/config/ofbiz-containers.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/config/ofbiz-containers.xml?rev=1301866&r1=1301865&r2=1301866&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/config/ofbiz-containers.xml (original)
+++ ofbiz/trunk/framework/base/config/ofbiz-containers.xml Sat Mar 17 05:35:45 2012
@@ -26,9 +26,6 @@ under the License.
     <!-- load the cached classloader container (always second) -->
     <container name="classloader-container" class="org.ofbiz.base.container.ClassLoaderContainer"/>
 
-    <container name="commons-vfs-container" class="org.ofbiz.commons.vfs.CommonsVfsContainer"/>
-    <container name="webslinger-container" class="org.ofbiz.webslinger.WebslingerContainer"/>
-
     <!-- load JNDI/JOTM; this is no longer needed, leaving this in for now just in case someone wants to drop in JOTM from the specialized directory
     <container name="jotm-container" class="org.ofbiz.jotm.container.JotmContainer">
         <property name="jndi-config" value="iiop.properties"/>
@@ -98,9 +95,6 @@ under the License.
     </container>
 
     <!-- load catalina (tomcat) and all web applications -->
-    <!-- TODO: switch to webslinger, for per-site logging
-    <container name="catalina-container" class="org.ofbiz.webslinger.WebslingerCatalinaContainer">
-    -->
     <container name="catalina-container" class="org.ofbiz.catalina.container.CatalinaContainer">
         <!-- static configuration for tomcat -->
         <property name="delegator-name" value="default"/>

Modified: ofbiz/trunk/framework/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/build.xml?rev=1301866&r1=1301865&r2=1301866&view=diff
==============================================================================
--- ofbiz/trunk/framework/build.xml (original)
+++ ofbiz/trunk/framework/build.xml Sat Mar 17 05:35:45 2012
@@ -26,7 +26,6 @@ under the License.
                entity/build.xml,geronimo/build.xml,
                catalina/build.xml,jetty/build.xml,
                security/build.xml,service/build.xml,jcr/build.xml,entityext/build.xml,
-               webslinger/build.xml,
                bi/build.xml,minilang/build.xml,
                webapp/build.xml,guiapp/build.xml,widget/build.xml,
                common/build.xml,datafile/build.xml,birt/build.xml,

Modified: ofbiz/trunk/framework/component-load.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/component-load.xml?rev=1301866&r1=1301865&r2=1301866&view=diff
==============================================================================
--- ofbiz/trunk/framework/component-load.xml (original)
+++ ofbiz/trunk/framework/component-load.xml Sat Mar 17 05:35:45 2012
@@ -41,7 +41,6 @@ under the License.
     <load-component component-location="appserver"/>
     <load-component component-location="testtools"/>
     <load-component component-location="webtools"/>
-    <load-component component-location="webslinger"/>
     <load-component component-location="images"/>
     <load-component component-location="example"/>
     <load-component component-location="exampleext"/>

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java?rev=1301866&r1=1301865&r2=1301866&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java Sat Mar 17 05:35:45 2012
@@ -83,8 +83,6 @@ import org.ofbiz.service.ModelService;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-import org.webslinger.invoker.Wrap;
-
 /**
  * SimpleMethod Mini Language Core Object
  */
@@ -895,15 +893,6 @@ public class SimpleMethod {
                     Debug.logWarning("Operation element \"" + nodeName + "\" no recognized", module);
                 }
                 if (methodOp == null) continue;
-                if (UtilProperties.propertyValueEquals("webslinger-invoker.properties", "wrap-calls", "true")) {
-                    Wrap<MethodOperation> wrap = new Wrap<MethodOperation>().fileName(simpleMethod.getLocationAndName()).wrappedClass(methodOp.getClass());
-                    wrap.wrap(methodOperationExecMethod);
-                    Object startLine = curOperElem.getUserData("startLine");
-                    if (startLine != null) {
-                        wrap.lineNumber(((Integer) startLine).intValue());
-                    }
-                    methodOp = wrap.newInstance(new Class<?>[] {Element.class, SimpleMethod.class}, new Object[] {curOperElem, simpleMethod});
-                }
                 methodOperations.add(methodOp);
                 DeprecatedOperation depOp = methodOp.getClass().getAnnotation(DeprecatedOperation.class);
                 if (depOp != null) Debug.logInfo("The " + nodeName + " operation has been deprecated in favor of the " + depOp.value() + " operation; found use of this in [" + simpleMethod.getShortDescription() + "]: " + methodOp.rawString(), module);

Modified: ofbiz/trunk/framework/service/config/service.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/config/service.properties?rev=1301866&r1=1301865&r2=1301866&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/config/service.properties (original)
+++ ofbiz/trunk/framework/service/config/service.properties Sat Mar 17 05:35:45 2012
@@ -17,8 +17,6 @@
 # under the License.
 ###############################################################################
 
-# If set to true then service definitions are wrapped with their filename and line number, for easier debugging; if enabled, JVM PermGen memory settings may need to be increased
-servicedispatcher.servicedebugmode=true
 # flag to automatically export all services: same of setting export="true" for all service definitions
 remotedispatcher.exportall=false
 # complete answer from SOAP WSDL or only brief message "Problem processing the service" for security reason

Modified: ofbiz/trunk/framework/service/config/serviceengine.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/config/serviceengine.xml?rev=1301866&r1=1301865&r2=1301866&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/config/serviceengine.xml (original)
+++ ofbiz/trunk/framework/service/config/serviceengine.xml Sat Mar 17 05:35:45 2012
@@ -62,7 +62,6 @@ under the License.
         <engine name="soap" class="org.ofbiz.service.engine.SOAPClientEngine"/>
         <engine name="ofbiz-workflow" class="org.ofbiz.workflow.WorkflowEngine"/>
         <engine name="workflow" class="org.ofbiz.shark.service.SharkServiceEngine"/>
-        <engine name="webslinger-server" class="org.ofbiz.webslinger.WebslingerServerEngine"/>
         <engine name="xml-rpc-local" class="org.ofbiz.service.engine.XMLRPCClientEngine">
             <parameter name="url" value="http://localhost:8080/webtools/control/xmlrpc"/>
             <parameter name="login" value="admin"/>

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java?rev=1301866&r1=1301865&r2=1301866&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java Sat Mar 17 05:35:45 2012
@@ -202,8 +202,6 @@ public class ModelService extends Abstra
     /** Flag to say if we have pulled in our addition parameters from our implemented service(s) */
     protected boolean inheritedParameters = false;
 
-    public GenericInvoker invoker;
-
     public ModelService() {}
 
     public ModelService(ModelService model) {
@@ -229,9 +227,6 @@ public class ModelService extends Abstra
         this.overrideParameters = model.overrideParameters;
         this.inheritedParameters = model.inheritedParameters();
         this.internalGroup = model.internalGroup;
-        if (model.invoker != null) {
-            this.invoker = model.invoker.copy(this);
-        }
 
         List<ModelParam> modelParamList = model.getModelParamList();
         for (ModelParam param: modelParamList) {

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java?rev=1301866&r1=1301865&r2=1301866&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java Sat Mar 17 05:35:45 2012
@@ -54,8 +54,6 @@ import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
-import org.webslinger.invoker.Wrap;
-
 import freemarker.template.utility.StringUtil;
 
 /**
@@ -65,7 +63,6 @@ import freemarker.template.utility.Strin
 public class ModelServiceReader implements Serializable {
 
     public static final String module = ModelServiceReader.class.getName();
-    protected static boolean serviceDebugMode = true;
 
     /** is either from a URL or from a ResourceLoader (through the ResourceHandler) */
     protected boolean isFromURL;
@@ -94,7 +91,6 @@ public class ModelServiceReader implemen
         this.readerURL = readerURL;
         this.handler = handler;
         this.dctx = dctx;
-        serviceDebugMode = "true".equals(UtilProperties.getPropertyValue("service", "servicedispatcher.servicedebugmode", "true"));
     }
 
     private Map<String, ModelService> getModelServices() {
@@ -204,21 +200,6 @@ public class ModelServiceReader implemen
         ModelService service = new ModelService();
 
         service.name = UtilXml.checkEmpty(serviceElement.getAttribute("name")).intern();
-        if (serviceDebugMode) {
-            Wrap<GenericInvoker> wrap = new Wrap<GenericInvoker>().fileName(resourceLocation + '#' + service.name).wrappedClass(GenericInvokerImpl.class);
-            for (Method method: GenericInvokerImpl.class.getDeclaredMethods()) {
-                if (method.getName().startsWith("run")) {
-                    wrap.wrap(method);
-                } else if (method.getName().startsWith("send")) {
-                    wrap.wrap(method);
-                }
-            }
-            Object startLine = serviceElement.getUserData("startLine");
-            if (startLine != null) {
-                wrap.lineNumber(((Integer) startLine).intValue());
-            }
-            service.invoker = wrap.newInstance(new Class<?>[] {ModelService.class}, new Object[] {service});
-        }
         service.definitionLocation = resourceLocation;
         service.engineName = UtilXml.checkEmpty(serviceElement.getAttribute("engine")).intern();
         service.location = UtilXml.checkEmpty(serviceElement.getAttribute("location")).intern();
@@ -749,54 +730,4 @@ public class ModelServiceReader implemen
 
         return document;
     }
-
-    public static class GenericInvokerImpl implements GenericInvoker {
-        private final ModelService modelService;
-
-        public GenericInvokerImpl(ModelService modelService) {
-            this.modelService = modelService;
-        }
-
-        public Map<String, Object> runSync(String localName, GenericEngine engine, Map<String, Object> context) throws GenericServiceException {
-            return engine.runSync(localName, modelService, context);
-        }
-
-        public void runSyncIgnore(String localName, GenericEngine engine, Map<String, Object> context) throws GenericServiceException {
-            engine.runSyncIgnore(localName, modelService, context);
-        }
-
-        public void runAsync(String localName, GenericEngine engine, Map<String, Object> context, GenericRequester requester, boolean persist) throws GenericServiceException {
-            if (requester != null) {
-                engine.runAsync(localName, modelService, context, requester, persist);
-            } else {
-                engine.runAsync(localName, modelService, context, persist);
-            }
-        }
-
-        public void sendCallbacks(GenericEngine engine, Map<String, Object> context, Map<String, Object> result, Throwable t, int mode) throws GenericServiceException {
-            if (t != null) {
-                engine.sendCallbacks(modelService, context, t, mode);
-            } else if (result != null) {
-                engine.sendCallbacks(modelService, context, result, mode);
-            } else {
-                engine.sendCallbacks(modelService, context, mode);
-            }
-        }
-
-        public GenericInvokerImpl copy(ModelService modelService) {
-            try {
-                try {
-                    return getClass().getConstructor(ModelService.class).newInstance(modelService);
-                } catch (InvocationTargetException e) {
-                    throw e.getCause();
-                }
-            } catch (RuntimeException e) {
-                throw e;
-            } catch (Error e) {
-                throw e;
-            } catch (Throwable e) {
-                throw (InternalError) new InternalError(e.getMessage()).initCause(e);
-            }
-        }
-    }
 }

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java?rev=1301866&r1=1301865&r2=1301866&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java Sat Mar 17 05:35:45 2012
@@ -74,7 +74,6 @@ public class ServiceDispatcher {
     protected static boolean enableJM = true;
     protected static boolean enableJMS = true;
     protected static boolean enableSvcs = true;
-    protected static boolean serviceDebugMode = true;
 
     protected Delegator delegator = null;
     protected GenericEngineFactory factory = null;
@@ -123,7 +122,6 @@ public class ServiceDispatcher {
         if (enableSvcs) {
             this.runStartupServices();
         }
-        serviceDebugMode = "true".equals(UtilProperties.getPropertyValue("service", "servicedispatcher.servicedebugmode", "true"));
     }
 
     protected ServiceDispatcher(Delegator delegator) {
@@ -395,13 +393,8 @@ public class ServiceDispatcher {
                     // ===== invoke the service =====
                     if (!isError && !isFailure) {
                         Map<String, Object> invokeResult = null;
-                        if (serviceDebugMode) {
-                            invokeResult = modelService.invoker.runSync(localName, engine, context);
-                            modelService.invoker.sendCallbacks(engine, context, invokeResult, null, GenericEngine.SYNC_MODE);
-                        } else {
-                            invokeResult = engine.runSync(localName, modelService, context);
-                            engine.sendCallbacks(modelService, context, invokeResult, GenericEngine.SYNC_MODE);
-                        }
+                        invokeResult = engine.runSync(localName, modelService, context);
+                        engine.sendCallbacks(modelService, context, invokeResult, GenericEngine.SYNC_MODE);
                         if (invokeResult != null) {
                             result.putAll(invokeResult);
                         } else {
@@ -515,11 +508,7 @@ public class ServiceDispatcher {
                     UtilTimer.closeTimer(localName + " / " + modelService.name, "Sync service failed...", module);
                 }
                 String errMsg = "Service [" + modelService.name + "] threw an unexpected exception/error";
-                if (serviceDebugMode) {
-                    modelService.invoker.sendCallbacks(engine, context, null, t, GenericEngine.SYNC_MODE);
-                } else {
-                    engine.sendCallbacks(modelService, context, t, GenericEngine.SYNC_MODE);
-                }
+                engine.sendCallbacks(modelService, context, t, GenericEngine.SYNC_MODE);
                 try {
                     TransactionUtil.rollback(beganTrans, errMsg, t);
                 } catch (GenericTransactionException te) {
@@ -715,17 +704,12 @@ public class ServiceDispatcher {
 
                 // run the service
                 if (!isError && !isFailure) {
-                    if (serviceDebugMode) {
-                        service.invoker.runAsync(localName, engine, context, requester, persist);
-                        service.invoker.sendCallbacks(engine, context, null, null, GenericEngine.ASYNC_MODE);
+                    if (requester != null) {
+                        engine.runAsync(localName, service, context, requester, persist);
                     } else {
-                        if (requester != null) {
-                            engine.runAsync(localName, service, context, requester, persist);
-                        } else {
-                            engine.runAsync(localName, service, context, persist);
-                        }
-                        engine.sendCallbacks(service, context, GenericEngine.ASYNC_MODE);
+                        engine.runAsync(localName, service, context, persist);
                     }
+                    engine.sendCallbacks(service, context, GenericEngine.ASYNC_MODE);
                 }
 
                 if (Debug.timingOn()) {
@@ -738,11 +722,7 @@ public class ServiceDispatcher {
                 }
                 String errMsg = "Service [" + service.name + "] threw an unexpected exception/error";
                 Debug.logError(t, errMsg, module);
-                if (serviceDebugMode) {
-                    service.invoker.sendCallbacks(engine, context, null, t, GenericEngine.ASYNC_MODE);
-                } else {
-                    engine.sendCallbacks(service, context, t, GenericEngine.ASYNC_MODE);
-                }
+                engine.sendCallbacks(service, context, t, GenericEngine.ASYNC_MODE);
                 try {
                     TransactionUtil.rollback(beganTrans, errMsg, t);
                 } catch (GenericTransactionException te) {