CVE-2012-1621: 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.



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1301866 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacopo Cappellato
2012-03-17 05:35:45 +00:00
parent 30729104a5
commit dc4edc748e
101 changed files with 8 additions and 2090 deletions
@@ -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"/>
@@ -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"/>
@@ -1,24 +0,0 @@
###############################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
###############################################################################
# If true, then various dynamically loaded items will have a custom
# class compiled, that includes more helpful identification. This
# can include some of the following: file location, line number,
# and/or other unique identification.
wrap-calls=false
-1
View File
@@ -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,
-1
View File
@@ -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"/>
@@ -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);
@@ -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
@@ -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"/>
@@ -1,77 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.ofbiz.service;
import java.util.Map;
import org.ofbiz.service.engine.GenericEngine;
import org.webslinger.invoker.Invoker;
/**
* Generic Invoker Interface
*/
public interface GenericInvoker extends Invoker {
/**
* Run the service synchronously and return the result.
*
* @param localName Name of the LocalDispatcher.
* @param engine GenericEngine object.
* @param context Map of name, value pairs composing the context.
* @return Map of name, value pairs composing the result.
* @throws GenericServiceException
*/
public Map<String, Object> runSync(String localName, GenericEngine engine, Map<String, Object> context) throws GenericServiceException;
/**
* Run the service synchronously and IGNORE the result.
*
* @param localName Name of the LocalDispatcher.
* @param engine GenericEngine object.
* @param context Map of name, value pairs composing the context.
* @throws GenericServiceException
*/
public void runSyncIgnore(String localName, GenericEngine engine, Map<String, Object> context) throws GenericServiceException;
/**
* Run the service asynchronously, passing an instance of GenericRequester that will receive the result.
*
* @param localName Name of the LocalDispatcher.
* @param engine GenericEngine object.
* @param context Map of name, value pairs composing the context.
* @param requester Object implementing GenericRequester interface which will receive the result.
* @param persist True for store/run; False for run.
* @throws GenericServiceException
*/
public void runAsync(String localName, GenericEngine engine, Map<String, Object> context, GenericRequester requester, boolean persist)
throws GenericServiceException;
/**
* Send the service callbacks
* @param engine GenericEngine object
* @param context Map of name, value pairs composing the context
* @param result Object to return to callback (Throwable or Map)
* @param mode Service mode (sync or async)
* @throws GenericServiceException
*/
public void sendCallbacks(GenericEngine engine, Map<String, Object> context, Map<String, Object> result, Throwable t, int mode) throws GenericServiceException;
public GenericInvoker copy(ModelService modelService);
}
@@ -202,8 +202,6 @@ public class ModelService extends AbstractMap<String, Object> implements Seriali
/** 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 AbstractMap<String, Object> implements Seriali
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) {
@@ -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.StringUtil;
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 implements Serializable {
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 implements Serializable {
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 implements Serializable {
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);
}
}
}
}
@@ -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) {
-47
View File
@@ -1,47 +0,0 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project name="OFBiz - Webslinger" default="jar" basedir=".">
<import file="../../common.xml"/>
<!-- ================================================================== -->
<!-- Initialization of all property settings -->
<!-- ================================================================== -->
<property name="desc" value="Webslinger Component"/>
<property name="name" value="ofbiz-webslinger"/>
<property name="ofbiz.home.dir" value="../.."/>
<path id="local.class.path">
<fileset dir="lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/entity/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/entity/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/base/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/base/lib/j2eespecs" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/base/lib/commons" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/base/lib/scripting" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/base/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/security/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/service/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/catalina/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/catalina/lib" includes="*.jar"/>
<pathelement location="${ofbiz.home.dir}/framework/catalina/build/classes"/>
</path>
</project>
@@ -1,17 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
moduleBase=ofbiz-component://webslinger/modules
@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<entity-engine-xml>
<WebslingerServer webslingerServerId="WEBSLINGER" delegatorName="default" dispatcherName="webslinger" serverName="webslinger" target="ofbiz-component://webslinger/websites/webslinger"/>
<WebslingerHostMapping hostName="*" contextPath="/webslinger" webslingerServerId="WEBSLINGER"/>
<WebslingerHostSuffix hostSuffixId="PREVIEW" hostSuffix=".preview"/>
<WebslingerHostSuffix hostSuffixId="LOCALHOST" hostSuffix=".localhost"/>
</entity-engine-xml>
@@ -1,140 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd">
<entity entity-name="WebslingerServer"
package-name="org.ofbiz.webslinger"
title="Webslinger Server">
<field name="webslingerServerId" type="id-ne"></field>
<field name="delegatorName" type="name"></field>
<field name="dispatcherName" type="name"></field>
<field name="serverName" type="name"></field>
<field name="webSiteId" type="id"></field>
<field name="target" type="name"></field>
<field name="loadAtStart" type="indicator"></field>
<prim-key field="webslingerServerId"/>
<relation type="one" fk-name="WSS_WS" rel-entity-name="WebSite">
<key-map field-name="webSiteId"/>
</relation>
</entity>
<entity entity-name="WebslingerServerBase"
package-name="org.ofbiz.webslinger"
title="Webslinger Server">
<field name="webslingerServerId" type="id-ne"></field>
<field name="baseName" type="name"></field>
<field name="seqNum" type="numeric"></field>
<prim-key field="webslingerServerId"/>
<prim-key field="baseName"/>
<relation type="one" fk-name="WSB_WS" rel-entity-name="WebslingerServer">
<key-map field-name="webslingerServerId"/>
</relation>
</entity>
<entity entity-name="WebslingerHostMapping"
package-name="org.ofbiz.webslinger"
title="Webslinger Server">
<field name="hostName" type="name"></field>
<field name="contextPath" type="value"></field>
<field name="webslingerServerId" type="id-ne"></field>
<prim-key field="hostName"/>
<prim-key field="contextPath"/>
<relation type="one" fk-name="WHM_WS" rel-entity-name="WebslingerServer">
<key-map field-name="webslingerServerId"/>
</relation>
</entity>
<entity entity-name="WebslingerHostSuffix"
package-name="org.ofbiz.webslinger"
title="Webslinger Server">
<field name="hostSuffixId" type="id-ne"></field>
<field name="hostSuffix" type="name"></field>
<prim-key field="hostSuffixId"/>
</entity>
<view-entity entity-name="WebslingerLayout"
package-name="org.ofbiz.webslinger"
title="WebslingerServer and WebslingerHostMapping View Entity">
<member-entity entity-alias="WS" entity-name="WebslingerServer"/>
<member-entity entity-alias="WHM" entity-name="WebslingerHostMapping"/>
<alias-all entity-alias="WS"/>
<alias-all entity-alias="WHM">
<exclude field="webslingerServerId"/>
</alias-all>
<view-link entity-alias="WS" rel-entity-alias="WHM">
<key-map field-name="webslingerServerId"/>
</view-link>
<relation type="one" rel-entity-name="WebslingerServer">
<key-map field-name="webslingerServerId"/>
</relation>
<relation type="many" rel-entity-name="WebslingerServerBase">
<key-map field-name="webslingerServerId"/>
</relation>
<relation type="one" rel-entity-name="WebslingerHostMapping">
<key-map field-name="hostName"/>
<key-map field-name="contextPath"/>
</relation>
</view-entity>
<!--
<entity entity-name="WebslingerModule"
package-name="org.ofbiz.webslinger"
title="Webslinger Module">
<field name="moduleId" type="id-ne"></field>
<field name="target" type="name"></field>
<prim-key field="moduleId"/>
</entity>
<entity entity-name="WebslingerServerModule"
package-name="org.ofbiz.webslinger"
title="Webslinger Server">
<field name="webslingerServerId" type="id-ne"></field>
<field name="moduleId" type="id-ne"></field>
<prim-key field="webslingerServerId"/>
<prim-key field="moduleId"/>
<relation type="one" fk-name="WSM_WM" rel-entity-name="WebslingerModule">
<key-map field-name="moduleId"/>
</relation>
<relation type="one" fk-name="WSM_WW" rel-entity-name="WebslingerServer">
<key-map field-name="webslingerServerId"/>
</relation>
</entity>
<view-entity entity-name="WebslingerServerModuleLayout"
package-name="org.ofbiz.webslinger"
title="WebslingerModule and WebslingerServerModule View Entity">
<member-entity entity-alias="WM" entity-name="WebslingerModule"/>
<member-entity entity-alias="WSM" entity-name="WebslingerServerModule"/>
<alias-all entity-alias="WM"/>
<alias-all entity-alias="WSM">
<exclude field="moduleId"/>
</alias-all>
<view-link entity-alias="WM" rel-entity-alias="WSM">
<key-map field-name="moduleId"/>
</view-link>
<relation type="one" rel-entity-name="WebslingerModule">
<key-map field-name="moduleId"/>
</relation>
<relation type="one" rel-entity-name="WebslingerServerModule">
<key-map field-name="webslingerServerId"/>
<key-map field-name="moduleId"/>
</relation>
</view-entity>
-->
</entitymodel>
Binary file not shown.
@@ -1,18 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
application/x-ofbiz-condition ofbiz-condition
application/x-ofbiz-screen ofbiz-screen
@@ -1 +0,0 @@
java.lang.String:/WEB-INF/Events/System/Ofbiz/FilterOfbizConditionData
@@ -1 +0,0 @@
java.lang.String:ofbiz-screen
@@ -1,44 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
import org.ofbiz.entity.condition.EntityCondition
import org.ofbiz.entity.condition.EntityOperator
def buildCondition
def getValue = { item ->
if (item instanceof Map) return buildCondition(item)
return item
}
buildCondition = { item ->
switch (item.name) {
case "EntityConditionList":
def conditions = []
for (conditionDef in item.list) {
conditions.add(buildCondition(conditionDef))
}
return EntityCondition.makeCondition(conditions, EntityOperator.lookup(item.operator))
case "EntityExpr":
return EntityCondition.makeCondition(getValue(item.left), EntityOperator.lookup(item.operator), getValue(item.right))
case "Include":
return webslinger.event(item.path)
default:
throw new InternalError(item.toString())
}
}
return buildCondition(webslinger.payload)
@@ -1,59 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
import org.ofbiz.base.util.StringUtil
import org.ofbiz.base.util.UtilXml
import org.ofbiz.base.util.collections.MapStack
import org.ofbiz.base.util.template.FreeMarkerWorker
import org.ofbiz.widget.screen.ScreenFactory
import org.ofbiz.widget.screen.ScreenRenderer
import org.ofbiz.widget.html.HtmlFormRenderer
import org.ofbiz.widget.html.HtmlScreenRenderer
import org.webslinger.commons.vfs.VFSUtil
import org.webslinger.container.FileInfo
switch (webslinger.command) {
case 'init':
return new HtmlScreenRenderer()
case 'get-creator':
return [
createValue: { fi, name ->
def file = fi.file
def singleScreenText = VFSUtil.getString(file)
def screenName = fi.servletFile.name.path
def fullDocumentText = '<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd"><screen name="' + screenName + '">' + singleScreenText + '</screen></screens>'
def doc = UtilXml.readXmlDocument(fullDocumentText)
def screens = ScreenFactory.readScreenDocument(doc, "webslinger://$webslinger.webslingerServletContext.id")
if (screens.size() != 1) throw new IllegalArgumentException('wrong size')
return screens.values().iterator().next()
}
] as FileInfo.Creator
}
def target = webslinger.payload
def modelScreen = target.pathContext.info.getCachedItem(null)
def screenRenderer = webslinger.initObject
//response.contentType = 'text/html'
def targetContext = MapStack.create(target.context)
def screens = new ScreenRenderer(response.writer, targetContext, screenRenderer);
screens.populateContextForRequest(request, response, webslinger.webslingerServletContext)
FreeMarkerWorker.getSiteParameters(request, targetContext)
targetContext.formStringRenderer = new HtmlFormRenderer(request, response)
targetContext.simpleEncoder = StringUtil.htmlEncoder
modelScreen.renderScreenString(response.writer, targetContext, screenRenderer)
return null
@@ -1 +0,0 @@
java.lang.String:true
-34
View File
@@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ofbiz-component name="webslinger"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
<resource-loader name="main" type="component"/>
<classpath type="dir" location="config"/>
<classpath type="jar" location="lib/*"/>
<classpath type="jar" location="build/lib/*"/>
<entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
<entity-resource type="data" reader-name="seed" loader="main" location="data/WebslingerSeedData.xml"/>
<webapp name="webslinger" title="Webslinger" server="default-server" location="webapp/webslinger"
base-permission="OFBTOOLS,WEBSLINGER" mount-point="/webslinger"/>
</ofbiz-component>
@@ -1,27 +0,0 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<providers>
<provider class-name="org.ofbiz.commons.vfs.ofbiz.OfbizHomeProvider">
<scheme name="ofbiz-home"/>
</provider>
<provider class-name="org.ofbiz.commons.vfs.ofbiz.OfbizComponentProvider">
<scheme name="ofbiz-component"/>
</provider>
</providers>
@@ -1,66 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.ofbiz.commons.vfs;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import org.apache.commons.vfs.FileObject;
import org.apache.commons.vfs.FileSystemException;
import org.apache.commons.vfs.FileSystemManager;
import org.apache.commons.vfs.impl.StandardFileSystemManager;
import org.ofbiz.base.container.Container;
import org.ofbiz.base.container.ContainerException;
import org.ofbiz.base.util.UtilMisc;
import org.webslinger.commons.vfs.VFSUtil;
public class CommonsVfsContainer implements Container {
private static StandardFileSystemManager sfsm;
public void init(String[] args, String configFile) throws ContainerException {
}
public boolean start() throws ContainerException {
try {
StandardFileSystemManager sfsm = VFSUtil.createStandardFileSystemManager();
FileObject currentDir = sfsm.resolveFile(new File(".").toURI().toURL().toString());
sfsm.setBaseFile(currentDir);
CommonsVfsContainer.sfsm = sfsm;
} catch (FileSystemException e) {
throw UtilMisc.initCause(new ContainerException("Initializing StandardFileSystemManager"), e);
} catch (MalformedURLException e) {
throw UtilMisc.initCause(new ContainerException("Initializing StandardFileSystemManager"), e);
}
return true;
}
public void stop() throws ContainerException {
sfsm.close();
sfsm = null;
}
public static FileObject resolveFile(String uri) throws IOException {
return sfsm.resolveFile(uri);
}
public static FileSystemManager getFileSystemManager() {
return sfsm;
}
}
@@ -1,58 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.ofbiz.commons.vfs.ofbiz;
import java.net.URL;
import java.util.Collection;
import org.apache.commons.vfs.FileObject;
import org.apache.commons.vfs.FileSystemException;
import org.apache.commons.vfs.FileSystemOptions;
import org.apache.commons.vfs.provider.AbstractFileProvider;
import org.apache.commons.vfs.provider.local.DefaultLocalFileProvider;
import org.ofbiz.base.location.FlexibleLocation;
import org.ofbiz.base.util.UtilMisc;
import org.webslinger.commons.vfs.VFSUtil;
public class OfbizComponentProvider extends AbstractFileProvider {
public Collection<?> getCapabilities() {
return DefaultLocalFileProvider.capabilities;
}
public FileObject findFile(FileObject base, String name, FileSystemOptions properties) throws FileSystemException {
try {
//name = name.replaceAll("^ofbiz-component://", "");
int nameLength = name.length();
int componentNameStart = 16;
while (componentNameStart < nameLength && name.charAt(componentNameStart) == '/') componentNameStart++;
if (componentNameStart == nameLength) throw new IllegalArgumentException("Invalid name(" + name + ")");
int componentNameEnd = componentNameStart;
while (componentNameEnd < nameLength && name.charAt(componentNameEnd) != '/') componentNameEnd++;
if (componentNameEnd == nameLength) throw new IllegalArgumentException("Invalid name(" + name + ")");
int restStart = componentNameEnd;
while (restStart < nameLength && name.charAt(restStart) == '/') restStart++;
if (restStart == nameLength) throw new IllegalArgumentException("Invalid name(" + name + ")");
String componentName = name.substring(componentNameStart, componentNameEnd);
URL location = FlexibleLocation.resolveLocation("component://" + componentName + "/.");
FileObject ofbizBase = getContext().resolveFile(location.toString(), properties);
return VFSUtil.toFileObject(ofbizBase.getFileSystem().getFileSystemManager(), ofbizBase.resolveFile(name.substring(restStart)).getURL().toString(), properties);
} catch (Exception e) {
throw UtilMisc.initCause(new FileSystemException(e.getMessage(), null, e), e);
}
}
}
@@ -1,50 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.ofbiz.commons.vfs.ofbiz;
import java.net.URL;
import java.util.Collection;
import org.apache.commons.vfs.FileObject;
import org.apache.commons.vfs.FileSystemException;
import org.apache.commons.vfs.FileSystemOptions;
import org.apache.commons.vfs.provider.AbstractFileProvider;
import org.apache.commons.vfs.provider.local.DefaultLocalFileProvider;
import org.ofbiz.base.location.FlexibleLocation;
import org.ofbiz.base.util.UtilMisc;
import org.webslinger.commons.vfs.VFSUtil;
public class OfbizHomeProvider extends AbstractFileProvider {
public Collection<?> getCapabilities() {
return DefaultLocalFileProvider.capabilities;
}
public FileObject findFile(FileObject base, String name, FileSystemOptions properties) throws FileSystemException {
//new Exception("findFile(" + base + ", " + name + ")").printStackTrace();
try {
URL location = FlexibleLocation.resolveLocation("ofbizhome://.");
FileObject ofbizBase = getContext().resolveFile(location.toString(), properties);
return VFSUtil.toFileObject(ofbizBase.getFileSystem().getFileSystemManager(), ofbizBase.resolveFile(name.substring(13)).getURL().toString(), properties);
} catch (Exception e) {
throw UtilMisc.initCause(new FileSystemException(e.getMessage(), null, e), e);
}
}
}
@@ -1,73 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.ofbiz.webslinger;
import java.util.Iterator;
import java.util.Locale;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import org.ofbiz.base.util.GeneralException;
import org.ofbiz.base.util.ObjectType;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.model.ModelEntity;
import org.ofbiz.entity.model.ModelField;
import org.ofbiz.entity.model.ModelFieldType;
public class EntityHttpUtil {
public static GenericValue makeValidValue(String entityName, ServletRequest request) throws GeneralException {
return makeValidValue(entityName, false, request);
}
public static GenericValue makeValidValue(String entityName, boolean includePks, ServletRequest request) throws GeneralException {
if (request instanceof HttpServletRequest) return makeValidValue(entityName, includePks, (HttpServletRequest) request);
throw new IllegalArgumentException("Not an HttpServletRequest");
}
public static GenericValue makeValidValue(String entityName, HttpServletRequest request) throws GeneralException {
return makeValidValue(entityName, false, request);
}
public static GenericValue makeValidValue(String entityName, boolean includePks, HttpServletRequest request) throws GeneralException {
Delegator delegator = (Delegator) request.getAttribute("delegator");
GenericValue value = delegator.makeValue(entityName);
ModelEntity model = value.getModelEntity();
Iterator<ModelField> it = includePks ? model.getFieldsIterator() : model.getNopksIterator();
Locale locale = UtilHttp.getLocale(request);
while (it.hasNext()) {
ModelField field = it.next();
String fieldName = field.getName();
String parameterValue = request.getParameter(fieldName);
Object fieldValue;
if (parameterValue == null) {
fieldValue = null;
} else {
ModelFieldType fieldType = delegator.getEntityFieldType(model, field.getType());
String wantedType = fieldType.getJavaType();
fieldValue = ObjectType.simpleTypeConvert(parameterValue, wantedType, null, locale, true);
}
value.put(fieldName, fieldValue);
}
return value;
}
}
@@ -1,37 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.ofbiz.webslinger;
import org.ofbiz.entity.transaction.TransactionUtil;
import java.util.concurrent.Callable;
public class EntityTransactionUtil {
/** @deprecated use TransactionUtil.doNewTransaction */
@Deprecated
public static <V> V doNewTransaction(String ifErrorMessage, Callable<V> callable) throws Throwable {
return TransactionUtil.doNewTransaction(ifErrorMessage, callable);
}
/** @deprecated use TransactionUtil.doNewTransaction */
@Deprecated
public static <V> V doTransaction(String ifErrorMessage, Callable<V> callable) throws Throwable {
return TransactionUtil.doTransaction(ifErrorMessage, callable);
}
}
@@ -1,118 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.ofbiz.webslinger;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericPK;
import org.ofbiz.entity.GenericValue;
import org.webslinger.cache.ConcurrentCache;
import org.webslinger.concurrent.ExecutionPool;
public class StatsUpdater {
private static final Updater UPDATER = new Updater();
public static void updateStats(Delegator delegator, String entityName, Map<String, ? extends Object> keyFields, Map<String, ? extends Long> updateCountFields) throws GenericEntityException {
GenericPK pk = delegator.makePK(entityName, keyFields);
Map<String, Long> value = UPDATER.getValue(pk);
synchronized (value) {
for (Map.Entry<String, ? extends Long> entry: updateCountFields.entrySet()) {
Long oldValue = value.get(entry.getKey());
if (oldValue != null) {
value.put(entry.getKey(), Long.valueOf(oldValue.longValue() + entry.getValue()));
} else {
value.put(entry.getKey(), entry.getValue());
}
}
}
}
private static final class Updater implements Callable<Void> {
protected AtomicReference<EntityHolder> entities = new AtomicReference<EntityHolder>(new EntityHolder(Updater.class, "entities", null));
protected ScheduledFuture<Void> future;
protected Map<String, Long> getValue(GenericPK pk) throws GenericEntityException {
synchronized (this) {
if (future == null || future.isDone()) {
future = ExecutionPool.schedule(this, 1, TimeUnit.SECONDS);
}
}
try {
return entities.get().get(pk);
} catch (RuntimeException e) {
throw e;
} catch (GenericEntityException e) {
throw e;
} catch (Exception e) {
throw UtilMisc.initCause(new GenericEntityException(e.getMessage()), e);
}
}
public Void call() {
EntityHolder oldEntities;
EntityHolder newEntities = new EntityHolder(Updater.class, "entities", null);
do {
oldEntities = entities.get();
} while (!entities.compareAndSet(oldEntities, newEntities));
synchronized (Updater.class) {
for (GenericPK pk: oldEntities.keys()) {
try {
Map<String, Long> add = oldEntities.get(pk);
GenericValue existing = pk.getDelegator().findOne(pk.getEntityName(), pk, false);
if (existing == null) {
existing = pk.getDelegator().create(pk.getEntityName(), pk);
}
for (Map.Entry<String, Long> entry: add.entrySet()) {
Long value = entry.getValue();
Long oldValue = existing.getLong(entry.getKey());
if (oldValue != null) {
existing.put(entry.getKey(), Long.valueOf(value.longValue() + oldValue.longValue()));
} else {
existing.put(entry.getKey(), value);
}
}
existing.store();
} catch (Exception e) {
e.printStackTrace();
}
}
}
return null;
}
}
private static final class EntityHolder extends ConcurrentCache<GenericPK, Map<String, Long>> {
protected EntityHolder(Class<?> owner, String field, String label) {
super(owner, field, label, HARD);
}
@Override
protected Map<String, Long> createValue(GenericPK pk) throws Exception {
return new HashMap<String, Long>();
}
}
}
@@ -1,62 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.ofbiz.webslinger;
import java.io.IOException;
import java.util.Map;
import org.apache.bsf.BSFException;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.ModelService;
import org.ofbiz.service.ServiceDispatcher;
import org.ofbiz.service.engine.GenericAsyncEngine;
public class WebslingerBSFServiceEngine extends GenericAsyncEngine {
private static final String[] paramNames;
private static final Class<?>[] paramTypes;
static {
paramNames = new String[] { "dispatcher", "context" };
paramTypes = new Class<?>[] { DispatchContext.class, Map.class };
}
public WebslingerBSFServiceEngine(ServiceDispatcher dispatcher) {
super(dispatcher);
}
@Override
public void runSyncIgnore(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException {
runSync(localName, modelService, context);
}
@Override
public Map<String, Object> runSync(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException {
Object[] params = new Object[] { dispatcher.getLocalContext(localName), context };
try {
return UtilGenerics.checkMap(WebslingerContainer.runEvent(modelService.engineName, modelService.location, paramNames, paramTypes, params));
} catch (IOException e) {
throw UtilMisc.initCause(new GenericServiceException(e.getMessage()), e);
} catch (BSFException e) {
throw UtilMisc.initCause(new GenericServiceException(e.getMessage()), e);
}
}
}
@@ -1,53 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.ofbiz.webslinger;
import java.io.File;
import org.apache.catalina.Engine;
import org.apache.catalina.core.StandardEngine;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.container.ContainerConfig;
import org.ofbiz.base.container.ContainerException;
import org.ofbiz.catalina.container.CatalinaContainer;
import org.webslinger.catalina.WebslingerAccessLogValve;
public class WebslingerCatalinaContainer extends CatalinaContainer {
@Override
protected Engine createEngine(ContainerConfig.Container.Property engineConfig) throws ContainerException {
Engine engine = super.createEngine(engineConfig);
String logDir = ContainerConfig.getPropertyValue(engineConfig, "access-log-dir", null);
if (logDir == null) return engine;
WebslingerAccessLogValve al = new WebslingerAccessLogValve();
if (!logDir.startsWith("/")) logDir = System.getProperty("ofbiz.home") + "/" + logDir;
File logFile = new File(logDir);
if (!logFile.isDirectory()) throw new ContainerException("Log directory [" + logDir + "] is not available; make sure the directory is created");
al.setDirectory(logFile.getAbsolutePath());
String alp2 = ContainerConfig.getPropertyValue(engineConfig, "access-log-pattern", null);
if (!UtilValidate.isEmpty(alp2)) al.setPattern(alp2);
String alp3 = ContainerConfig.getPropertyValue(engineConfig, "access-log-prefix", null);
if (!UtilValidate.isEmpty(alp3)) al.setPrefix(alp3);
al.setResolveHosts(ContainerConfig.getPropertyValue(engineConfig, "access-log-resolve", true));
al.setRotatable(ContainerConfig.getPropertyValue(engineConfig, "access-log-rotate", false));
((StandardEngine) engine).addValve(al);
return engine;
}
}
@@ -1,100 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.ofbiz.webslinger;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Map;
import org.apache.bsf.BSFException;
import org.apache.commons.vfs.FileName;
import org.apache.commons.vfs.FileObject;
import org.ofbiz.base.container.Container;
import org.ofbiz.base.container.ContainerException;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.commons.vfs.CommonsVfsContainer;
import org.webslinger.bsf.LanguageManager;
import org.webslinger.template.CompiledTemplate;
import org.webslinger.template.TemplateManager;
import org.webslinger.vfs.CommonsVfsFileNameVFSDelegate;
import org.webslinger.vfs.TypeVFSDelegate;
public class WebslingerContainer implements Container {
private static TypeVFSDelegate vfsDelegate;
private static LanguageManager languageManager;
private static TemplateManager templateManager;
public void init(String[] args, String configFile) throws ContainerException {
}
@SuppressWarnings("unchecked")
public boolean start() throws ContainerException {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
TypeVFSDelegate.Resolver resolver = new TypeVFSDelegate.Resolver() {
public Object resolve(String name) throws IOException {
return CommonsVfsContainer.resolveFile(name);
}
};
try {
vfsDelegate = new TypeVFSDelegate(resolver);
vfsDelegate.addVFSDelegate(FileName.class, new CommonsVfsFileNameVFSDelegate(vfsDelegate, CommonsVfsContainer.getFileSystemManager()));
languageManager = new LanguageManager(vfsDelegate, null);
languageManager.setClassLoader(loader);
templateManager = new TemplateManager(vfsDelegate, null);
templateManager.setClassLoader(loader);
} catch (BSFException e) {
throw UtilMisc.initCause(new ContainerException("Initializing StandardFileSystemManager"), e);
}
return true;
}
public void stop() throws ContainerException {
}
public static LanguageManager getLanguageManager() {
return languageManager;
}
public static TemplateManager getTemplateManager() {
return templateManager;
}
public static Object runEvent(String language, String name, String[] paramNames, Class<?>[] paramTypes, Object[] params) throws BSFException, IOException {
return getLanguageManager().apply(language, "top", 0, 0, CommonsVfsContainer.resolveFile(name), paramNames, params, paramTypes);
}
public static String runTemplate(String language, String name, Map<String, Object> context) throws IOException {
StringWriter writer = new StringWriter();
runTemplate(language, name, writer, context);
return writer.toString();
}
public static void runTemplate(String language, String name, Writer writer, Map<String, Object> context) throws IOException {
FileObject file = CommonsVfsContainer.resolveFile(name);
CompiledTemplate template = getTemplate(language, file);
template.run(file, writer, context);
}
public static CompiledTemplate getTemplate(String language, FileObject file) throws IOException {
return getTemplateManager().compileTemplate(language, "top", 0, 0, file);
}
}
@@ -1,216 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.ofbiz.webslinger;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.DelegatorFactory;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.cache.Cache;
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.security.SecurityFactory;
import org.ofbiz.security.authz.AuthorizationFactory;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GenericDispatcher;
import org.ofbiz.service.ServiceDispatcher;
import org.webslinger.AbstractMappingWebslingerServletContextFactory;
import org.webslinger.WebslingerServletContext;
import org.webslinger.collections.CollectionUtil;
import org.webslinger.lang.ObjectUtil;
public class WebslingerContextMapper extends AbstractMappingWebslingerServletContextFactory {
protected ServletContext servletContext;
protected Delegator delegator;
protected final ArrayList<URL> globalReaderURLs = new ArrayList<URL>();
public void init(ServletConfig config) throws ServletException, IOException {
System.err.println(org.webslinger.commons.vfs.flat.FlatFileProvider.class);
servletContext = config.getServletContext();
String delegatorName = servletContext.getInitParameter("entityDelegatorName");
delegator = DelegatorFactory.getDelegator(delegatorName);
String readerFiles = servletContext.getInitParameter("serviceReaderUrls");
if (readerFiles != null) {
for (String reader: CollectionUtil.split(readerFiles, ";")) {
URL url = config.getServletContext().getResource(reader);
if (url != null) globalReaderURLs.add(url);
}
}
super.init(config, UtilProperties.getPropertyValue("webslinger.properties", "moduleBase"));
}
@Override
protected Layout[] getStartLayouts() throws Exception {
ArrayList<Layout> layouts = new ArrayList<Layout>();
try {
for (GenericValue value: delegator.findByAnd("WebslingerServer", UtilMisc.toMap("loadAtStart", "Y"))) {
layouts.add(new OfbizLayout(value));
}
} catch (GenericEntityException e) {
}
return layouts.toArray(new Layout[layouts.size()]);
}
@Override
public void initializeRequest(WebslingerServletContext context, HttpServletRequest request) {
request.setAttribute("servletContext", context);
Object delegator = context.getAttribute("delegator");
Object dispatcher = context.getAttribute("dispatcher");
Object authz = context.getAttribute("authz");
Object security = context.getAttribute("security");
request.setAttribute("delegator", delegator);
request.setAttribute("dispatcher", dispatcher);
request.setAttribute("authz", authz);
request.setAttribute("security", security);
// FIXME!!! These next two are a hack until proper fake/wrapped session support is done in webslinger
servletContext.setAttribute("delegator", delegator);
servletContext.setAttribute("dispatcher", dispatcher);
servletContext.setAttribute("authz", authz);
servletContext.setAttribute("security", security);
}
@Override
protected void initializeContext(WebslingerServletContext context, Layout layout) throws Exception {
OfbizLayout ofbizLayout = (OfbizLayout) layout;
Delegator delegator = null;
delegator = DelegatorFactory.getDelegator(ofbizLayout.delegatorName);
context.setAttribute("delegator", delegator);
context.setAttribute("dispatcher", new WebslingerGenericDispatcher(context, layout.getTarget(), delegator, globalReaderURLs));
context.setAttribute("authz", AuthorizationFactory.getInstance(delegator));
context.setAttribute("security", SecurityFactory.getInstance(delegator));
}
protected static final class WebslingerGenericDispatcher extends GenericDispatcher {
protected WebslingerGenericDispatcher(WebslingerServletContext context, String name, Delegator delegator, List<URL> globalReaderURLs) throws IOException {
ArrayList<URL> readerURLs = new ArrayList<URL>(globalReaderURLs);
String readerFiles = context.getInitParameter("serviceReaderUrls");
if (readerFiles != null) {
for (String reader: CollectionUtil.split(readerFiles, ";")) {
URL url = context.getResource(reader);
if (url != null) readerURLs.add(url);
}
}
System.err.println(readerURLs);
this.dispatcher = new ServiceDispatcher(delegator, true, true, true) {
};
ClassLoader loader = null;
try {
loader = Thread.currentThread().getContextClassLoader();
} catch (SecurityException e) {
loader = WebslingerContextMapper.class.getClassLoader();
}
DispatchContext dc = new DispatchContext(name, readerURLs, loader, null);
init(name, delegator, dc);
}
}
@Override
protected Set<String> getSuffixes() throws Exception {
Cache cache = delegator.getCache();
Set<String> suffixes;
synchronized (WebslingerContextMapper.class) {
suffixes = cache.get("WebslingerHostSuffix", null, "WebslingerContextMapper.Suffixes");
if (suffixes == null) {
suffixes = new HashSet<String>();
for (GenericValue value: delegator.findList("WebslingerHostSuffix", null, null, null, null, false)) {
suffixes.add(value.getString("hostSuffix"));
}
cache.put("WebslingerHostSuffix", null, "WebslingerContextMapper.Suffixes", suffixes);
}
}
return suffixes;
}
@Override
protected Layout lookupLayout(String hostName, String contextPath) throws Exception {
GenericValue layout = EntityUtil.getOnly(delegator.findByAndCache("WebslingerLayout", UtilMisc.toMap("hostName", hostName, "contextPath", contextPath)));
if (layout == null) return null;
return new OfbizLayout(layout);
}
protected class OfbizLayout implements Layout {
private final String contextPath;
private final String id;
private final String target;
private final String[] bases;
private final int hashCode;
protected final String delegatorName;
protected final String dispatcherName;
protected OfbizLayout(GenericValue server) throws GenericEntityException {
contextPath = server.getString("contextPath");
id = server.getString("webslingerServerId");
target = server.getString("target");
List<GenericValue> baseValues = server.getRelatedCache("WebslingerServerBase", UtilMisc.toList("seqNum"));
bases = new String[baseValues.size()];
for (int i = 0; i < bases.length; i++) {
GenericValue baseValue = baseValues.get(i);
bases[i] = baseValue.getString("baseName");
}
delegatorName = server.getString("delegatorName");
dispatcherName = server.getString("dispatcherName");
hashCode = target.hashCode() ^ ObjectUtil.hashCodeHelper(delegatorName) ^ Arrays.hashCode(bases);
}
public String getContextPath() {
return contextPath;
}
public String getId() {
return id;
}
public String getTarget() {
return target;
}
public String[] getBases() {
return bases;
}
@Override
public int hashCode() {
return hashCode;
}
@Override
public boolean equals(Object o) {
if (!(o instanceof OfbizLayout)) return false;
OfbizLayout other = (OfbizLayout) o;
if (!contextPath.equals(other.contextPath)) return false;
if (!target.equals(other.target)) return false;
if (!ObjectUtil.equalsHelper(delegatorName, other.delegatorName)) return false;
return Arrays.equals(bases, other.bases);
}
}
}
@@ -1,59 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.ofbiz.webslinger;
import java.util.Map;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.ModelService;
import org.ofbiz.service.ServiceDispatcher;
import org.ofbiz.service.engine.GenericAsyncEngine;
import org.webslinger.WebslingerServletContext;
public class WebslingerServerEngine extends GenericAsyncEngine {
public WebslingerServerEngine(ServiceDispatcher dispatcher) {
super(dispatcher);
}
@Override
public void runSyncIgnore(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException {
runSync(localName, modelService, context);
}
@Override
public Map<String, Object> runSync(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException {
Delegator delegator = dispatcher.getDelegator();
try {
GenericValue found = EntityUtil.getFirst(delegator.findByAndCache("WebslingerLayout", UtilMisc.toMap("webslingerServerId", modelService.location)));
if (found == null) throw new GenericServiceException("Couldn't find server mapping for(" + modelService.location + ")");
return UtilGenerics.checkMap(WebslingerServletContext.invokeInVM(found.getString("hostName"), 8080, modelService.invoke, context));
} catch (RuntimeException e) {
throw e;
} catch (GenericServiceException e) {
throw e;
} catch (Exception e) {
throw UtilMisc.initCause(new GenericServiceException(e.getMessage()), e);
}
}
}
@@ -1,66 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<web-app>
<display-name>Open For Business - Catalog</display-name>
<description>Catalog Module of the Open For Business Project</description>
<context-param>
<param-name>entityDelegatorName</param-name>
<param-value>default</param-value>
<description>The Name of the Entity Delegator to use, defined in entityengine.xml</description>
</context-param>
<context-param>
<param-name>ofbiz.webslinger.baseLocation</param-name>
<param-value>ofbiz-component://webslinger/webapp/bases</param-value>
</context-param>
<servlet>
<servlet-name>WebslingerServlet</servlet-name>
<display-name>WebslingerServlet</display-name>
<description>Webslinger Servlet</description>
<servlet-class>org.webslinger.servlet.WebslingerServlet</servlet-class>
<init-param>
<param-name>ofbiz.mapping.ttl</param-name>
<param-value>60000</param-value>
</init-param>
<init-param>
<param-name>org.webslinger.servlet.WebslingerServlet.WebslingerServletContextFactory</param-name>
<param-value>org.ofbiz.webslinger.WebslingerContextMapper</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>WebslingerServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout> <!-- in minutes -->
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
</web-app>
@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<module-state>
<module name="defaults" url="wsmodule://defaults.zip" enabled="true"/>
<module name="ofbiz" url="wsmodule://ofbiz" enabled="true"/>
</module-state>
@@ -1,33 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<section>
<actions>
<set field="headerItem" value="main"/>
<set field="titleProperty" value="WebtoolsCertsX509"/>
</actions>
<widgets>
<decorator-screen name="component://webtools/widget/CommonScreens.xml#main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<platform-specific>
<html><html-template location="component://webtools/webapp/webtools/cert/viewbrowsercerts.ftl"/></html>
</platform-specific>
</decorator-section>
</decorator-screen>
</widgets>
</section>
@@ -1 +0,0 @@
java.lang.String:None
@@ -1,19 +0,0 @@
#*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*#
#Merge("DemoScreen.ofbiz-screen")
@@ -1,21 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
webslinger.response.writer.println('groovy start')
webslinger.merge('Middle')
webslinger.response.writer.println('groovy end')
@@ -1,22 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
webslinger.getResponse().getWriter().println("java start");
webslinger.merge("Middle");
webslinger.getResponse().getWriter().println("java end");
return null;
@@ -1,19 +0,0 @@
#*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*#
Something in the middle of an event.
@@ -1,19 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
webslinger.response.writer.write("Howdy from groovy.")
@@ -1,24 +0,0 @@
#*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*#
<ul>
<li><a href="#">One</a></li>
<li><a href="#">Two</a></li>
<li><a href="#">Three</a></li>
<li><a href="#">Four</a></li>
</ul>
@@ -1,21 +0,0 @@
#*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*#
<p>
Page by itself, or merged inside another.
</p>
@@ -1 +0,0 @@
java.lang.String:SomeLeftMenu
@@ -1 +0,0 @@
java.lang.String:TwoColumn
@@ -1,19 +0,0 @@
#*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*#
This is the middle of a template.
@@ -1,21 +0,0 @@
#*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*#
velocity start
#Merge("Middle")
velocity end
@@ -1,26 +0,0 @@
#*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*#
<pre>
#Merge("Events/Groovy")
#Merge("Events/Java")
#Merge("Templates/Velocity")
</pre>
#Merge("Middle", "$ThemePath/Templates/Box/Blue")
#Merge("StandAlonePage")
@@ -1,64 +0,0 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
import java.util.concurrent.Callable
import org.ofbiz.entity.sql.SQLUtil
import org.ofbiz.entity.transaction.TransactionUtil
response.contentType = 'text/html'
def delegator = request.delegator
/*
def ec1 = SQLUtil.parseCondition("partyId = 'foo' AND partyTypeId = 'PARTY_GROUP' OR sequenceNum IN (1, 2) or foo BETWEEN 'a' and 'b'")
println("ec1=$ec1")
response.writer.println("ec1=$ec1<br />")
def ec2 = SQLUtil.parseCondition(ec1.toString())
println("ec2=$ec2")
response.writer.println("ec2=$ec2<br />")
//return
*/
def sql = """
SELECT
a.partyId,
a.partyTypeId AS type,
COALESCE(b.firstName, '') AS firstName,
COALESCE(b.lastName, '') AS lastName,
COALESCE(c.groupName, '') AS groupName
FROM
Party a LEFT JOIN Person b USING partyId LEFT JOIN PartyGroup c USING partyId
RELATION TYPE one Party USING partyId
WHERE
partyId = ?partyId
;
"""
def sqlSelect = SQLUtil.parseSelect(sql)
TransactionUtil.doNewTransaction("Test", [call: {
def eli
try {
eli = sqlSelect.getEntityListIterator(delegator, [partyId: 'admin'])
def gv;
while ((gv = eli.next()) != null) {
response.writer.println("gv=$gv<br />")
def party = gv.getRelatedOneCache('Party'); response.writer.println("\tparty=$party<br />")
//def person = gv.getRelatedOneCache('Person'); response.writer.println("\tperson=$person<br />")
}
} finally {
if (eli != null) eli.close()
}
}] as Callable)
@@ -1,20 +0,0 @@
#*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*#
#set($boxStyle = $webslinger.pathInfo.split("/").get(1))
<div class="box-$boxStyle">#Content()</div>
@@ -1 +0,0 @@
java.lang.String:true
@@ -1,20 +0,0 @@
#*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*#
#set($cause = $webslinger.planCause)
<div class="Editable" path="$cause.servletPath">#Content()</div>
@@ -1,26 +0,0 @@
#*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*#
<div class="TwoColumn">
<div class="TwoColumnLeft">
#Section("LeftMenu")
</div>
<div class="TwoColumnContent">
#Content("Editable")
</div>
</div>
@@ -1 +0,0 @@
java.lang.String:/Includes/DefaultMenu
@@ -1,51 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<listener><listener-class>org.ofbiz.webapp.control.ControlEventListener</listener-class></listener>
<listener><listener-class>org.ofbiz.webapp.control.LoginEventListener</listener-class></listener>
<!-- NOTE: not all app servers support mounting implementations of the HttpSessionActivationListener interface -->
<!-- <listener><listener-class>org.ofbiz.webapp.control.ControlActivationEventListener</listener-class></listener> -->
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param><param-name>fork</param-name><param-value>false</param-value></init-param>
<init-param><param-name>xpoweredBy</param-name><param-value>false</param-value></init-param>
<init-param><param-name>mappedFile</param-name><param-value>false</param-value></init-param>
<init-param><param-name>genStrAsCharArray</param-name><param-value>true</param-value></init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet>
<description>Main Control Servlet</description>
<display-name>ControlServlet</display-name>
<servlet-name>ControlServlet</servlet-name>
<servlet-class>org.ofbiz.webapp.control.ControlServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping><servlet-name>jsp</servlet-name><url-pattern>*.jsp</url-pattern></servlet-mapping>
<servlet-mapping>
<servlet-name>ControlServlet</servlet-name>
<url-pattern>/control/*</url-pattern>
</servlet-mapping>
</web-app>

Some files were not shown because too many files have changed in this diff Show More