http://ofbiz.116.s1.nabble.com/Re-svn-commit-r753081-in-ofbiz-trunk-framework-webslinger-config-data-entitydef-lib-modules-modules-m-tp2335067p2527276.html
I'm still waiting an explanation about Webslinger, is there someting else than the code?
> I found
> <author>Adam Heath</author> by chance.
> I wonder if we should keep it in Apache OFBiz...
> Also I understand that it's good for BrainFood to have Webslinger in OFBiz repo, but for OFBiz?
> What Webslinger is bringing to the project?
>
> Thanks to clarify please
>
> Jacques
>
> From: <
[hidden email]>
>> Author: doogie
>> Date: Fri Mar 13 01:12:11 2009
>> New Revision: 753081
>>
>> URL:
http://svn.apache.org/viewvc?rev=753081&view=rev>> Log:
>> New webslinger component. This is being added to framework, based
>> on the desire to make use of it in a support role.
>>
>> It is *not* enabled yet, not part of the build, nor used at runtime
>> by the server. That will come shortly.
>>
>> Added:
>> ofbiz/trunk/framework/webslinger/ (with props)
>> ofbiz/trunk/framework/webslinger/build.xml
>> ofbiz/trunk/framework/webslinger/config/
>> ofbiz/trunk/framework/webslinger/config/webslinger.properties
>> ofbiz/trunk/framework/webslinger/data/
>> ofbiz/trunk/framework/webslinger/data/WebslingerSeedData.xml
>> ofbiz/trunk/framework/webslinger/entitydef/
>> ofbiz/trunk/framework/webslinger/entitydef/entitygroup.xml
>> ofbiz/trunk/framework/webslinger/entitydef/entitymodel.xml
>> ofbiz/trunk/framework/webslinger/lib/
>> ofbiz/trunk/framework/webslinger/lib/webslinger-20090312-2018a822aa51.jar (with props)
>> ofbiz/trunk/framework/webslinger/lib/webslinger-catalina-20090312-2018a822aa51.jar (with props)
>> ofbiz/trunk/framework/webslinger/lib/webslinger-ext-20090312-2018a822aa51.jar (with props)
>> ofbiz/trunk/framework/webslinger/lib/webslinger-launcher-20090312-2018a822aa51.jar (with props)
>> ofbiz/trunk/framework/webslinger/modules/
>> ofbiz/trunk/framework/webslinger/modules/defaults.zip (with props)
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/Classes/
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/Classes/org/
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/Classes/org/webslinger/
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/Classes/org/webslinger/mime.types
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/www/
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/application/
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/application/x-ofbiz-condition
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/application/x-ofbiz-condition@/
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/application/x-ofbiz-condition@/data-filter
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/application/x-ofbiz-condition@/type
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/Events/
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/Events/System/
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/Events/System/Ofbiz/
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/Events/System/Ofbiz/FilterOfbizConditionData.groovy
>> ofbiz/trunk/framework/webslinger/ofbiz-component.xml
>> ofbiz/trunk/framework/webslinger/src/
>> ofbiz/trunk/framework/webslinger/src/META-INF/
>> ofbiz/trunk/framework/webslinger/src/META-INF/vfs-providers.xml
>> ofbiz/trunk/framework/webslinger/src/org/
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/CommonsVfsContainer.java
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/ofbiz/
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/ofbiz/OfbizComponentProvider.java
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/ofbiz/OfbizHomeProvider.java
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/EntityHttpUtil.java
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/EntityTransactionUtil.java
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/StatsUpdater.java
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerBSFServiceEngine.java
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerCatalinaContainer.java
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContainer.java
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerServerEngine.java
>> ofbiz/trunk/framework/webslinger/webapp/
>> ofbiz/trunk/framework/webslinger/webapp/webslinger/
>> ofbiz/trunk/framework/webslinger/webapp/webslinger/WEB-INF/
>> ofbiz/trunk/framework/webslinger/webapp/webslinger/WEB-INF/web.xml
>> ofbiz/trunk/framework/webslinger/websites/
>> ofbiz/trunk/framework/webslinger/websites/webslinger/
>> ofbiz/trunk/framework/webslinger/websites/webslinger/Config/
>> ofbiz/trunk/framework/webslinger/websites/webslinger/Config/ModuleState.xml
>> ofbiz/trunk/framework/webslinger/websites/webslinger/Var/ (with props)
>> ofbiz/trunk/framework/webslinger/websites/webslinger/www/
>> ofbiz/trunk/framework/webslinger/websites/webslinger/www/index.whtml
>>
>> Propchange: ofbiz/trunk/framework/webslinger/
>> ------------------------------------------------------------------------------
>> --- svn:ignore (added)
>> +++ svn:ignore Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1 @@
>> +build
>>
>> Added: ofbiz/trunk/framework/webslinger/build.xml
>> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/build.xml?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/build.xml (added)
>> +++ ofbiz/trunk/framework/webslinger/build.xml Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,69 @@
>> +<?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>
>> +
>> + <!-- ================================================================== -->
>> + <!-- Compilation of the source
>> -->
>> + <!-- ================================================================== -->
>> +
>> + <target name="classes" depends="prepare">
>> + <javac15/>
>> + </target>
>> +
>> + <!-- ================================================================== -->
>> + <!-- Build JavaDoc -->
>> + <!-- ================================================================== -->
>> +
>> + <target name="docs" depends="prepare-docs">
>> + <mkdir dir="${build.dir}/javadocs"/>
>> + <javadoc packagenames="org.ofbiz.webslinger.*"
>> + classpathref="local.class.path"
>> + destdir="${build.dir}/javadocs"
>> + Windowtitle="Open for Business - ${desc}">
>> + <sourcepath path="${src.dir}"/>
>> + </javadoc>
>> + </target>
>> +</project>
>>
>> Added: ofbiz/trunk/framework/webslinger/config/webslinger.properties
>> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/config/webslinger.properties?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/config/webslinger.properties (added)
>> +++ ofbiz/trunk/framework/webslinger/config/webslinger.properties Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,17 @@
>> +# 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
>>
>> Added: ofbiz/trunk/framework/webslinger/data/WebslingerSeedData.xml
>> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/data/WebslingerSeedData.xml?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/data/WebslingerSeedData.xml (added)
>> +++ ofbiz/trunk/framework/webslinger/data/WebslingerSeedData.xml Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,28 @@
>> +<?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>
>>
>> Added: ofbiz/trunk/framework/webslinger/entitydef/entitygroup.xml
>> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/entitydef/entitygroup.xml?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/entitydef/entitygroup.xml (added)
>> +++ ofbiz/trunk/framework/webslinger/entitydef/entitygroup.xml Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,32 @@
>> +<?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.
>> +-->
>> +<entitygroup xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
>> + xsi:noNamespaceSchemaLocation="
http://www.ofbiz.org/dtds/entitygroup.xsd">
>> + <entity-group group="org.ofbiz" entity="WebslingerServer" />
>> + <entity-group group="org.ofbiz" entity="WebslingerServerBase" />
>> + <entity-group group="org.ofbiz" entity="WebslingerHostMapping" />
>> + <entity-group group="org.ofbiz" entity="WebslingerLayout" />
>> + <entity-group group="org.ofbiz" entity="WebslingerHostSuffix" />
>> + <!--
>> + <entity-group group="org.ofbiz" entity="WebslingerModule" />
>> + <entity-group group="org.ofbiz" entity="WebslingerServerModule" />
>> + <entity-group group="org.ofbiz" entity="WebslingerServerModuleLayout" />
>> + -->
>> +</entitygroup>
>>
>> Added: ofbiz/trunk/framework/webslinger/entitydef/entitymodel.xml
>> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/entitydef/entitymodel.xml?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/entitydef/entitymodel.xml (added)
>> +++ ofbiz/trunk/framework/webslinger/entitydef/entitymodel.xml Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,146 @@
>> +<?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://www.ofbiz.org/dtds/entitymodel.xsd">
>> + <title></title>
>> + <description></description>
>> + <copyright></copyright>
>> + <author>Adam Heath</author>
>> + <version>0.0</version>
>> +
>> + <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>
>>
>> Added: ofbiz/trunk/framework/webslinger/lib/webslinger-20090312-2018a822aa51.jar
>> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/lib/webslinger-20090312-2018a822aa51.jar?rev=753081&view=auto>> ==============================================================================
>> Binary file - no diff available.
>>
>> Propchange: ofbiz/trunk/framework/webslinger/lib/webslinger-20090312-2018a822aa51.jar
>> ------------------------------------------------------------------------------
>> svn:mime-type = application/octet-stream
>>
>> Added: ofbiz/trunk/framework/webslinger/lib/webslinger-catalina-20090312-2018a822aa51.jar
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/lib/webslinger-catalina-20090312-2018a822aa51.jar?rev=753081&view=auto>> ==============================================================================
>> Binary file - no diff available.
>>
>> Propchange: ofbiz/trunk/framework/webslinger/lib/webslinger-catalina-20090312-2018a822aa51.jar
>> ------------------------------------------------------------------------------
>> svn:mime-type = application/octet-stream
>>
>> Added: ofbiz/trunk/framework/webslinger/lib/webslinger-ext-20090312-2018a822aa51.jar
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/lib/webslinger-ext-20090312-2018a822aa51.jar?rev=753081&view=auto>> ==============================================================================
>> Binary file - no diff available.
>>
>> Propchange: ofbiz/trunk/framework/webslinger/lib/webslinger-ext-20090312-2018a822aa51.jar
>> ------------------------------------------------------------------------------
>> svn:mime-type = application/octet-stream
>>
>> Added: ofbiz/trunk/framework/webslinger/lib/webslinger-launcher-20090312-2018a822aa51.jar
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/lib/webslinger-launcher-20090312-2018a822aa51.jar?rev=753081&view=auto>> ==============================================================================
>> Binary file - no diff available.
>>
>> Propchange: ofbiz/trunk/framework/webslinger/lib/webslinger-launcher-20090312-2018a822aa51.jar
>> ------------------------------------------------------------------------------
>> svn:mime-type = application/octet-stream
>>
>> Added: ofbiz/trunk/framework/webslinger/modules/defaults.zip
>> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/modules/defaults.zip?rev=753081&view=auto>> ==============================================================================
>> Binary file - no diff available.
>>
>> Propchange: ofbiz/trunk/framework/webslinger/modules/defaults.zip
>> ------------------------------------------------------------------------------
>> svn:mime-type = application/octet-stream
>>
>> Added: ofbiz/trunk/framework/webslinger/modules/ofbiz/Classes/org/webslinger/mime.types
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/modules/ofbiz/Classes/org/webslinger/mime.types?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/modules/ofbiz/Classes/org/webslinger/mime.types (added)
>> +++ ofbiz/trunk/framework/webslinger/modules/ofbiz/Classes/org/webslinger/mime.types Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,17 @@
>> +# 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
>>
>> Added: ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/application/x-ofbiz-condition
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/application/x-ofbiz-condition?rev=753081&view=auto>> ==============================================================================
>> (empty)
>>
>> Added:
>> ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/application/x-ofbiz-condition@/data-filter URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/application/x-ofbiz-condition%40/data-filter?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/application/x-ofbiz-condition@/data-filter
>> (added)
>> +++ ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/application/x-ofbiz-condition@/data-filter
>> Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1 @@
>> +java.lang.String:/WEB-INF/Events/System/Ofbiz/FilterOfbizConditionData
>>
>> Added: ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/application/x-ofbiz-condition@/type
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/application/x-ofbiz-condition%40/type?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/application/x-ofbiz-condition@/type (added)
>> +++ ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/DefaultMimeAttributes/application/x-ofbiz-condition@/type Fri Mar
>> 13 01:12:11 2009
>> @@ -0,0 +1 @@
>> +java.lang.String:data
>>
>> Added: ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/Events/System/Ofbiz/FilterOfbizConditionData.groovy
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/Events/System/Ofbiz/FilterOfbizConditionData.groovy?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/Events/System/Ofbiz/FilterOfbizConditionData.groovy (added)
>> +++ ofbiz/trunk/framework/webslinger/modules/ofbiz/www/WEB-INF/Events/System/Ofbiz/FilterOfbizConditionData.groovy Fri Mar 13
>> 01:12:11 2009
>> @@ -0,0 +1,46 @@
>> +/*******************************************************************************
>> + * 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.EntityConditionList
>> +import org.ofbiz.entity.condition.EntityExpr
>> +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 new EntityConditionList(conditions, EntityOperator.lookup(item.operator))
>> + case "EntityExpr":
>> + return new EntityExpr(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)
>>
>> Added: ofbiz/trunk/framework/webslinger/ofbiz-component.xml
>> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/ofbiz-component.xml?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/ofbiz-component.xml (added)
>> +++ ofbiz/trunk/framework/webslinger/ofbiz-component.xml Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,35 @@
>> +<?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://www.ofbiz.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="group" reader-name="main" loader="main" location="entitydef/entitygroup.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>
>> +
>>
>> Added: ofbiz/trunk/framework/webslinger/src/META-INF/vfs-providers.xml
>> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/META-INF/vfs-providers.xml?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/src/META-INF/vfs-providers.xml (added)
>> +++ ofbiz/trunk/framework/webslinger/src/META-INF/vfs-providers.xml Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,27 @@
>> +<?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>
>>
>> Added: ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/CommonsVfsContainer.java
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/CommonsVfsContainer.java?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/CommonsVfsContainer.java (added)
>> +++ ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/CommonsVfsContainer.java Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,67 @@
>> +/*******************************************************************************
>> + * 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.CacheStrategy;
>> +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.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 (ContainerException) new ContainerException("Initializing StandardFileSystemManager").initCause(e);
>> + } catch (MalformedURLException e) {
>> + throw (ContainerException) new ContainerException("Initializing StandardFileSystemManager").initCause(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;
>> + }
>> +}
>>
>> Added: ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/ofbiz/OfbizComponentProvider.java
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/ofbiz/OfbizComponentProvider.java?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/ofbiz/OfbizComponentProvider.java (added)
>> +++ ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/ofbiz/OfbizComponentProvider.java Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,59 @@
>> +/*******************************************************************************
>> + * 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.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) {
>> + FileSystemException fse = new FileSystemException(e.getMessage(), null, e);
>> + fse.initCause(e);
>> + throw fse;
>> + }
>> + }
>> +}
>>
>> Added: ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/ofbiz/OfbizHomeProvider.java
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/ofbiz/OfbizHomeProvider.java?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/ofbiz/OfbizHomeProvider.java (added)
>> +++ ofbiz/trunk/framework/webslinger/src/org/ofbiz/commons/vfs/ofbiz/OfbizHomeProvider.java Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,51 @@
>> +/*******************************************************************************
>> + * 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.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) {
>> + FileSystemException fse = new FileSystemException(e.getMessage(), null, e);
>> + fse.initCause(e);
>> + throw fse;
>> + }
>> + }
>> +}
>>
>> Added: ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/EntityHttpUtil.java
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/EntityHttpUtil.java?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/EntityHttpUtil.java (added)
>> +++ ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/EntityHttpUtil.java Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,78 @@
>> +/*******************************************************************************
>> + * 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.Iterator;
>> +import java.util.Locale;
>> +import java.util.Map;
>> +
>> +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.base.util.UtilMisc;
>> +import org.ofbiz.base.util.UtilValidate;
>> +import org.ofbiz.entity.GenericDelegator;
>> +import org.ofbiz.entity.GenericValue;
>> +import org.ofbiz.entity.jdbc.SqlJdbcUtil;
>> +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 {
>> + GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
>> + GenericValue value = delegator.makeValue(entityName, (Map) null);
>> + 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;
>> + }
>> +}
>> +
>>
>> Added: ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/EntityTransactionUtil.java
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/EntityTransactionUtil.java?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/EntityTransactionUtil.java (added)
>> +++ ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/EntityTransactionUtil.java Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,66 @@
>> +/*******************************************************************************
>> + * 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 javax.transaction.Transaction;
>> +
>> +import org.ofbiz.entity.transaction.TransactionUtil;
>> +import java.util.concurrent.Callable;
>> +
>> +public class EntityTransactionUtil {
>> + public static <V> V doNewTransaction(String ifErrorMessage, Callable<V> callable) throws Throwable {
>> + Transaction tx = TransactionUtil.suspend();
>> + try {
>> + return doTransaction(ifErrorMessage, callable);
>> + } finally {
>> + TransactionUtil.resume(tx);
>> + }
>> + }
>> +
>> + public static <V> V doTransaction(String ifErrorMessage, Callable<V> callable) throws Throwable {
>> + boolean tx = TransactionUtil.begin();
>> + Throwable transactionAbortCause = null;
>> + try {
>> + try {
>> + return callable.call();
>> + } catch (Throwable t) {
>> + while (t.getCause() != null) {
>> + t = t.getCause();
>> + }
>> + throw t;
>> + }
>> + } catch (Error e) {
>> + transactionAbortCause = e;
>> + throw e;
>> + } catch (RuntimeException e) {
>> + transactionAbortCause = e;
>> + throw e;
>> + } catch (Throwable t) {
>> + transactionAbortCause = t;
>> + throw t;
>> + } finally {
>> + if (transactionAbortCause == null) {
>> + TransactionUtil.commit(tx);
>> + } else {
>> + transactionAbortCause.printStackTrace();
>> + TransactionUtil.rollback(tx, ifErrorMessage, transactionAbortCause);
>> + }
>> + }
>> + }
>> +}
>>
>> Added: ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/StatsUpdater.java
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/StatsUpdater.java?rev=753081&view=auto>> ============================================================================== ---
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/StatsUpdater.java (added) +++
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/StatsUpdater.java Fri Mar 13 01:12:11 2009 @@ -0,0 +1,119 @@
>> +/*******************************************************************************
>> + * 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.Iterator;
>> +import java.util.Map;
>> +import java.util.concurrent.Callable;
>> +import java.util.concurrent.ConcurrentHashMap;
>> +import java.util.concurrent.ScheduledFuture;
>> +import java.util.concurrent.TimeUnit;
>> +import java.util.concurrent.atomic.AtomicReference;
>> +
>> +import org.ofbiz.entity.GenericDelegator;
>> +import org.ofbiz.entity.GenericEntityException;
>> +import org.ofbiz.entity.GenericPK;
>> +import org.ofbiz.entity.GenericValue;
>> +
>> +import org.webslinger.lang.ConcurrentCache;
>> +import org.webslinger.lang.ExecutionPool;
>> +
>> +public class StatsUpdater {
>> + private static final Updater UPDATER = new Updater();
>> +
>> + public static void updateStats(GenericDelegator 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 (GenericEntityException) new GenericEntityException(e.getMessage()).initCause(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);
>> + }
>> +
>> + protected Map<String, Long> createValue(GenericPK pk) throws Exception {
>> + return new HashMap<String, Long>();
>> + }
>> + }
>> +}
>>
>> Added: ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerBSFServiceEngine.java
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerBSFServiceEngine.java?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerBSFServiceEngine.java (added)
>> +++ ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerBSFServiceEngine.java Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,58 @@
>> +/*******************************************************************************
>> + * 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.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);
>> + }
>> +
>> + public void runSyncIgnore(String localName, ModelService modelService, Map<String, Object> context) throws
>> GenericServiceException {
>> + runSync(localName, modelService, context);
>> + }
>> +
>> + 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 (Map) WebslingerContainer.runEvent(modelService.engineName, modelService.location, paramNames, paramTypes,
>> params);
>> + } catch (IOException e) {
>> + throw (GenericServiceException) new GenericServiceException(e.getMessage()).initCause(e);
>> + } catch (BSFException e) {
>> + throw (GenericServiceException) new GenericServiceException(e.getMessage()).initCause(e);
>> + }
>> + }
>> +}
>>
>> Added: ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerCatalinaContainer.java
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerCatalinaContainer.java?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerCatalinaContainer.java (added)
>> +++ ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerCatalinaContainer.java Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,52 @@
>> +/*******************************************************************************
>> + * 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 {
>> + 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;
>> + }
>> +}
>>
>> Added: ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContainer.java
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContainer.java?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContainer.java (added)
>> +++ ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContainer.java Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,100 @@
>> +/*******************************************************************************
>> + * 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.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;
>> + private static final String[] templateParamNames = new String[] {"writer", "context"};
>> + private static final Class<?>[] templateParamTypes = new Class<?>[] {Writer.class, Map.class};
>> +
>> + public void init(String[] args, String configFile) throws ContainerException {
>> + }
>> +
>> + 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 (ContainerException) new ContainerException("Initializing StandardFileSystemManager").initCause(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);
>> + }
>> +}
>>
>> Added: ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java (added)
>> +++ ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,206 @@
>> +/*******************************************************************************
>> + * 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 java.io.IOException;
>> +import java.lang.ref.SoftReference;
>> +import java.net.URL;
>> +import java.util.ArrayList;
>> +import java.util.HashMap;
>> +import java.util.HashSet;
>> +import java.util.Iterator;
>> +import java.util.List;
>> +import java.util.Set;
>> +
>> +import javax.management.JMException;
>> +import javax.naming.NamingException;
>> +import javax.servlet.ServletConfig;
>> +import javax.servlet.ServletContext;
>> +import javax.servlet.ServletException;
>> +import javax.servlet.http.HttpServletRequest;
>> +import javax.servlet.http.HttpServletResponse;
>> +import javax.xml.parsers.ParserConfigurationException;
>> +
>> +import org.xml.sax.SAXException;
>> +
>> +import org.apache.commons.vfs.FileObject;
>> +import org.apache.commons.vfs.FileSystemException;
>> +import org.apache.commons.vfs.FileSystemManager;
>> +import org.apache.commons.vfs.NameScope;
>> +
>> +import org.ofbiz.base.util.UtilFormatOut;
>> +import org.ofbiz.base.util.UtilMisc;
>> +import org.ofbiz.base.util.UtilProperties;
>> +import org.ofbiz.base.util.UtilValidate;
>> +import org.ofbiz.entity.GenericEntity;
>> +import org.ofbiz.entity.GenericEntityException;
>> +import org.ofbiz.entity.GenericDelegator;
>> +import org.ofbiz.entity.GenericValue;
>> +import org.ofbiz.entity.transaction.TransactionFactory;
>> +import org.ofbiz.entity.cache.Cache;
>> +import org.ofbiz.entity.util.EntityUtil;
>> +import org.ofbiz.security.SecurityFactory;
>> +import org.ofbiz.service.LocalDispatcher;
>> +import org.ofbiz.service.WebAppDispatcher;
>> +
>> +import org.webslinger.AbstractMappingWebslingerServletContextFactory;
>> +import org.webslinger.WebslingerServletContext;
>> +import org.webslinger.container.WebslingerContainer;
>> +import org.webslinger.lang.ObjectUtil;
>> +import org.webslinger.servlet.WebslingerServlet;
>> +import org.webslinger.util.TTLObject;
>> +import org.webslinger.collections.ArrayUtil;
>> +import org.webslinger.collections.CollectionUtil;
>> +
>> +public class WebslingerContextMapper extends AbstractMappingWebslingerServletContextFactory {
>> + protected ServletContext servletContext;
>> + protected GenericDelegator 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 = GenericDelegator.getGenericDelegator(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"));
>> + }
>> +
>> + 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()]);
>> + }
>> +
>> + public void initializeRequest(WebslingerServletContext context, HttpServletRequest request) {
>> + request.setAttribute("servletContext", context);
>> + Object delegator = context.getAttribute("delegator");
>> + Object dispatcher = context.getAttribute("dispatcher");
>> + Object security = context.getAttribute("security");
>> + request.setAttribute("delegator", delegator);
>> + request.setAttribute("dispatcher", dispatcher);
>> + 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("security", security);
>> + }
>> +
>> + protected void initializeContext(WebslingerServletContext context, Layout layout) throws Exception {
>> + OfbizLayout ofbizLayout = (OfbizLayout) layout;
>> + GenericDelegator delegator = GenericDelegator.getGenericDelegator(ofbizLayout.delegatorName);
>> + context.setAttribute("delegator", delegator);
>> + context.setAttribute("dispatcher", createLocalDispatcher(context, layout.getTarget(), delegator));
>> + context.setAttribute("security", SecurityFactory.getInstance(delegator));
>> + }
>> +
>> + protected LocalDispatcher createLocalDispatcher(WebslingerServletContext context, String name, GenericDelegator delegator)
>> 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);
>> + return new WebAppDispatcher(name, delegator, readerURLs);
>> + }
>> +
>> + protected Set<String> getSuffixes() throws Exception {
>> + Cache cache = delegator.getCache();
>> + Set<String> suffixes;
>> + synchronized (WebslingerContextMapper.class) {
>> + suffixes = (Set<String>) 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;
>> + }
>> +
>> + 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 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 {
>> + 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) ^ ArrayUtil.hashCodeHelper(bases);
>> + }
>> +
>> + public String getId() {
>> + return id;
>> + }
>> +
>> + public String getTarget() {
>> + return target;
>> + }
>> +
>> + public String[] getBases() {
>> + return bases;
>> + }
>> +
>> + public int hashCode() {
>> + return hashCode;
>> + }
>> +
>> + public boolean equals(Object o) {
>> + if (!(o instanceof OfbizLayout)) return false;
>> + OfbizLayout other = (OfbizLayout) o;
>> + if (!target.equals(other.target)) return false;
>> + if (!ObjectUtil.equalsHelper(delegatorName, other.delegatorName)) return false;
>> + return ArrayUtil.equalsHelper(bases, other.bases);
>> + }
>> + }
>> +}
>>
>> Added: ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerServerEngine.java
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerServerEngine.java?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerServerEngine.java (added)
>> +++ ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerServerEngine.java Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,61 @@
>> +/*******************************************************************************
>> + * 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.StringReader;
>> +import java.io.StringWriter;
>> +import java.util.Collections;
>> +import java.util.Map;
>> +
>> +import org.ofbiz.base.util.UtilMisc;
>> +import org.ofbiz.entity.GenericDelegator;
>> +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);
>> + }
>> +
>> + public void runSyncIgnore(String localName, ModelService modelService, Map<String, Object> context) throws
>> GenericServiceException {
>> + runSync(localName, modelService, context);
>> + }
>> +
>> + public Map<String, Object> runSync(String localName, ModelService modelService, Map<String, Object> context) throws
>> GenericServiceException {
>> + GenericDelegator 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 (Map<String, Object>) WebslingerServletContext.invokeInVM(found.getString("hostName"), 8080,
>> modelService.invoke, context);
>> + } catch (RuntimeException e) {
>> + throw e;
>> + } catch (GenericServiceException e) {
>> + throw e;
>> + } catch (Exception e) {
>> + throw (GenericServiceException) new GenericServiceException(e.getMessage()).initCause(e);
>> + }
>> + }
>> +}
>>
>> Added: ofbiz/trunk/framework/webslinger/webapp/webslinger/WEB-INF/web.xml
>> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/webapp/webslinger/WEB-INF/web.xml?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/webapp/webslinger/WEB-INF/web.xml (added)
>> +++ ofbiz/trunk/framework/webslinger/webapp/webslinger/WEB-INF/web.xml Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,74 @@
>> +<?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">
>> +
>> +<!--
>> + * Copyright (c) 2001-2005 The Open For Business Project - www.ofbiz.org
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining a
>> + * copy of this software and associated documentation files (the "Software"),
>> + * to deal in the Software without restriction, including without limitation
>> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
>> + * and/or sell copies of the Software, and to permit persons to whom the
>> + * Software is furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice shall be included
>> + * in all copies or substantial portions of the Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
>> + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
>> + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
>> + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
>> + * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
>> + * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
>> +-->
>> +
>> +<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>ofbiz.mapping.default-file-system-id</param-name>
>> + <param-value>1</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>
>>
>> Added: ofbiz/trunk/framework/webslinger/websites/webslinger/Config/ModuleState.xml
>> URL:
>>
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/websites/webslinger/Config/ModuleState.xml?rev=753081&view=auto>> ============================================================================== ---
>> ofbiz/trunk/framework/webslinger/websites/webslinger/Config/ModuleState.xml (added) +++
>> ofbiz/trunk/framework/webslinger/websites/webslinger/Config/ModuleState.xml Fri Mar 13 01:12:11 2009 @@ -0,0 +1,22 @@
>> +<?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="ofbiz-component://webslinger/modules/defaults.zip" enabled="true"/>
>> +</module-state>
>>
>> Propchange: ofbiz/trunk/framework/webslinger/websites/webslinger/Var/
>> ------------------------------------------------------------------------------
>> --- svn:ignore (added)
>> +++ svn:ignore Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1 @@
>> +*
>>
>> Added: ofbiz/trunk/framework/webslinger/websites/webslinger/www/index.whtml
>> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/websites/webslinger/www/index.whtml?rev=753081&view=auto>> ==============================================================================
>> --- ofbiz/trunk/framework/webslinger/websites/webslinger/www/index.whtml (added)
>> +++ ofbiz/trunk/framework/webslinger/websites/webslinger/www/index.whtml Fri Mar 13 01:12:11 2009
>> @@ -0,0 +1,12 @@
>> +<p>
>> +This page is brought to you by Webslinger!
>> +</p>
>> +<p>
>> +It doesn't do a whole lot yet, but if you've gotten this far, here are the features that are available:
>> +</p>
>> +<ul>
>> + <li>Extension mapper</li>
>> + <li>janino/groovy event handler</li>
>> + <li>velocity template markup</li>
>> + <li>template/wrapper/section content split</li>
>> +</ul>