svn commit: r1094371 [2/2] - in /ofbiz/branches/jackrabbit20100709: ./ applications/content/ applications/content/data/ applications/content/entitydef/ applications/content/src/org/ofbiz/content/jcr/ applications/content/src/org/ofbiz/content/jcr/helpe...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1094371 [2/2] - in /ofbiz/branches/jackrabbit20100709: ./ applications/content/ applications/content/data/ applications/content/entitydef/ applications/content/src/org/ofbiz/content/jcr/ applications/content/src/org/ofbiz/content/jcr/helpe...

sascharodekamp
Added: ofbiz/branches/jackrabbit20100709/framework/example/webapp/example/jackrabbit/JackrabbitFileTree.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/example/webapp/example/jackrabbit/JackrabbitFileTree.ftl?rev=1094371&view=auto
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/example/webapp/example/jackrabbit/JackrabbitFileTree.ftl (added)
+++ ofbiz/branches/jackrabbit20100709/framework/example/webapp/example/jackrabbit/JackrabbitFileTree.ftl Mon Apr 18 09:08:14 2011
@@ -0,0 +1,97 @@
+<#--
+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.
+-->
+<script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/jquery/plugins/jsTree/jquery.jstree.js</@ofbizContentUrl>"></script>
+
+<div id="jackrabbitFileTree">${parameters.fileTree!}</div>
+
+<script type="text/javascript">
+ var rawdata = ${parameters.fileTree!};
+
+    jQuery(function () {
+    jQuery("#jackrabbitFileTree").jstree({
+        "plugins" : [ "themes", "json_data", "ui", "contextmenu"],
+        "json_data" : {
+            "data" : rawdata
+        },
+        'contextmenu': {
+                'items': {
+                    'ccp' : false,
+                    'create' : false,
+                    'rename' : false,
+                    'remove' : {
+                        'label' : "${uiLabelMap.ExampelsJackrabbitRemoveFile}",
+                        'action' : function(obj) {
+                            removeFileFromRepository(obj.attr('nodepath'), obj.attr('nodetype'));
+                         }
+                        },
+                    'open' : {
+                        'label' : "${uiLabelMap.ExampelsJackrabbitDownloadFile}",
+                        'action' : function(obj) {
+                            openFileFromRepository(obj.attr('nodepath'), obj.attr('nodetype'));
+                        }
+                   }
+                 }
+             }
+    });
+    });
+
+    function removeFileFromRepository(nodepath, nodetype) {
+     var parameters = {"repositoryNode" : nodepath};
+     var url = "RemoveRepositoryFile";
+
+     runPostRequest(url, parameters)
+    }
+
+    function openFileFromRepository(nodepath, nodetype) {
+     if ("nt:folder" == nodetype) { // the open function for foldes is not supported yet.
+     return;
+     }
+
+     var parameters = {"repositoryNode" : nodepath};
+     var url = "GetFileFromRepository";
+
+     runPostRequest(url, parameters)
+    }
+
+    function runPostRequest(url, parameters) {
+     // create a hidden form
+     var form = jQuery('<form></form>');
+
+    form.attr("method", "POST");
+    form.attr("action", url);
+
+    jQuery.each(parameters, function(key, value) {
+        var field = jQuery('<input></input>');
+
+        field.attr("type", "hidden");
+        field.attr("name", key);
+        field.attr("value", value);
+
+        form.append(field);
+    });
+
+    // The form needs to be apart of the document in
+    // order for us to be able to submit it.
+    jQuery(document.body).append(form);
+    form.submit();
+    form.remove();
+    }
+
+
+</script>
\ No newline at end of file

Modified: ofbiz/branches/jackrabbit20100709/framework/example/widget/example/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/example/widget/example/CommonScreens.xml?rev=1094371&r1=1094370&r2=1094371&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/example/widget/example/CommonScreens.xml (original)
+++ ofbiz/branches/jackrabbit20100709/framework/example/widget/example/CommonScreens.xml Mon Apr 18 09:08:14 2011
@@ -287,6 +287,32 @@ under the License.
         </section>
     </screen>
 
+    <screen name="CommonExampleJackrabbitDecorator">
+        <section>
+            <actions>
+                <set field="headerItem" value="ExampleJackrabbit" />
+                <set field="labelFieldName" value="exampleTypeId" />
+                <set field="dataFieldName" value="total" />
+            </actions>
+            <widgets>
+                <decorator-screen name="main-decorator"
+                    location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="pre-body">
+                        <include-menu name="ExampleJackrabbit" location="component://example/widget/example/ExampleMenus.xml"/>
+                    </decorator-section>
+                    <decorator-section name="body">
+                        <container style="clear" />
+                        <section>
+                            <widgets>
+                                <decorator-section-include name="body" />
+                            </widgets>
+                        </section>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
     <screen name="main">
         <!-- This is the screen for the Main page in the Example component. A common pattern
             in OFBiz is to have each component include a Main page as a starting point for

Added: ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitForms.xml?rev=1094371&view=auto
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitForms.xml (added)
+++ ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitForms.xml Mon Apr 18 09:08:14 2011
@@ -0,0 +1,79 @@
+<?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. -->
+
+<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
+
+ <form name="ListRepositoryData" type="list" list-name="repositoryContent" default-entity-name="Content" separate-columns="true" odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
+ <field name="contentId">
+ <hyperlink target="EditRepositoryContent" description="${contentId}">
+ <parameter param-name="contentId" from-field="contentId" />
+ <parameter param-name="repositoryNode" from-field="repositoryNode" />
+ </hyperlink>
+ </field>
+ <field name="contentTypeId">
+ <display />
+ </field>
+ <field name="repositoryNode">
+ <display />
+ </field>
+ <field name="statusId">
+ <display />
+ </field>
+ <field name="statusId">
+ <display />
+ </field>
+ </form>
+
+ <form name="AddRepositoryData" type="single" target="StoreNewRepositoryData">
+ <field name="repositoryNode" title="${uiLabelMap.ExampleRepositoryNode}" tooltip="${uiLabelMap.ExampleAddNewNodePath}">
+ <text></text>
+ </field>
+ <field name="message" title="${uiLabelMap.ExampleRepositoryMessage}">
+ <text></text>
+ </field>
+ <field name="submit">
+ <submit />
+ </field>
+ </form>
+
+ <form name="UploadRepositoryFileData" type="upload" target="StoreNewRepositoryFileData">
+ <field name="repositoryNode" title="${uiLabelMap.ExampleRepositoryFolder}" tooltip="${uiLabelMap.ExampleAddNewNodePath}">
+ <text></text>
+ </field>
+ <field name="fileData" title="${uiLabelMap.ExampleRepositoryFile}">
+ <file size="28"></file>
+ </field>
+ <field name="submit">
+ <submit />
+ </field>
+ </form>
+
+ <form name="EditRepositoryData" type="single" target="UpdateRepositoryData" default-entity-name="Content">
+ <field name="contentId" map-name="content">
+ <display />
+ </field>
+ <field name="repositoryNode" title="${uiLabelMap.ExampleRepositoryNode}" map-name="content">
+ <display />
+ </field>
+ <field name="message" title="${uiLabelMap.ExampleRepositoryMessage}" map-name="content">
+ <text default-value="${parameters.message}"></text>
+ </field>
+ <field name="submit">
+ <submit />
+ </field>
+ </form>
+
+ <form name="ScanRepositoryStructure" type="list" list-name="listIt" default-entity-name="Content" separate-columns="true" odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
+ <field name="repositoryNode">
+ <display />
+ </field>
+ <field name="nodeContent">
+ <display />
+ </field>
+ <field name="primaryNodeType">
+ <display />
+ </field>
+ </form>
+</forms>
\ No newline at end of file

Propchange: ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitForms.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitScreens.xml?rev=1094371&view=auto
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitScreens.xml (added)
+++ ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitScreens.xml Mon Apr 18 09:08:14 2011
@@ -0,0 +1,149 @@
+<?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.
+-->
+
+<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd">
+
+    <screen name="ListRepositoryData">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleExampleJackrabbit" />
+                <set field="tabButtonItem" value="ExampleJackrabbitMainPage" />
+                <entity-condition list="repositoryContent" entity-name="Content">
+                    <condition-expr field-name="contentTypeId" operator="equals" value="REPOSITORY"/>
+                </entity-condition>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonExampleJackrabbitDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <container>
+                            <include-form location="component://example/widget/example/ExampleJackrabbitForms.xml" name="ListRepositoryData" />
+                        </container>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
+    <screen name="ExampleJackrabbitAddData">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleExampleJackrabbit" />
+                <set field="tabButtonItem" value="ExampleJackrabbitAddData" />
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonExampleJackrabbitDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <container>
+                            <include-form location="component://example/widget/example/ExampleJackrabbitForms.xml" name="AddRepositoryData" />
+                        </container>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
+    <screen name="ExampleJackrabbitUploadFileData">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleExampleJackrabbit" />
+                <set field="tabButtonItem" value="ExampleJackrabbitUploadFileData" />
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonExampleJackrabbitDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <container>
+                            <include-form location="component://example/widget/example/ExampleJackrabbitForms.xml" name="UploadRepositoryFileData" />
+                        </container>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
+    <screen name="ExampleJackrabbitScanRepositoryStructure">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleExampleJackrabbit" />
+                <set field="tabButtonItem" value="ExampleJackrabbitScanRepositoryStrukture" />
+                <set field="listIt" from-field="parameters.listIt"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonExampleJackrabbitDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                     <container>
+                     <link target="CleanJcrRepository" style="buttontext" text="${uiLabelMap.ExampleJackrabbitCleanRepository}"></link> <label>${uiLabelMap.ExampleJackrabbitCleanRepositoryTooltip}</label>
+                     </container>
+                        <container>
+                            <include-form location="component://example/widget/example/ExampleJackrabbitForms.xml" name="ScanRepositoryStructure" />
+                        </container>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
+    <screen name="ExampleJackrabbitEditRepositoryContent">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleExampleJackrabbit" />
+                <set field="tabButtonItem" value="ExampleJackrabbitMainPage" />
+                <entity-one value-field="content" entity-name="Content">
+                    <field-map field-name="contentId" from-field="parameters.contentId"/>
+                </entity-one>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonExampleJackrabbitDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <container>
+                            <include-form location="component://example/widget/example/ExampleJackrabbitForms.xml" name="EditRepositoryData" />
+                            <link target="RemoveRepositoryNode" text="remove" style="buttontext">
+                                <parameter param-name="repositoryNode" from-field="content.repositoryNode" />
+                                <parameter param-name="contentId" from-field="content.contentId"/>
+                            </link>
+                        </container>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
+    <screen name="ExampleJackrabbitShowUploadedFiles">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleExampleJackrabbit" />
+                <set field="tabButtonItem" value="ExampleJackrabbitShowUploadedFiles" />
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonExampleJackrabbitDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <container>
+                         <label>${uiLabelMap.ExampleJackrabbitTryRightClick}</label>
+                         <platform-specific>
+                         <html><html-template location="component://example/webapp/example/jackrabbit/JackrabbitFileTree.ftl"/></html>
+                         </platform-specific>
+                        </container>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
+</screens>
\ No newline at end of file

Propchange: ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitScreens.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleMenus.xml?rev=1094371&r1=1094370&r2=1094371&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleMenus.xml (original)
+++ ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleMenus.xml Mon Apr 18 09:08:14 2011
@@ -34,6 +34,7 @@ under the License.
         <menu-item name="ExampleGeoLocation" title="${uiLabelMap.CommonGeoLocation}"><link target="ExampleGeoLocationPointSet1"/></menu-item>
         <menu-item name="Birt" title="${uiLabelMap.Birt}"><link target="BirtMain"/></menu-item>
         <menu-item name="ExampleCharts" title="Chart examples"><link target="ExampleBarChart"/></menu-item>
+        <menu-item name="ExampleJackrabbit" title="Jackrabbit Sandbox"><link target="ExampleJackrabbit"/></menu-item>
     </menu>
 
     <menu name="EditExample" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
@@ -93,4 +94,12 @@ under the License.
         <menu-item name="ExampleBarChart" title="Bar chart"><link target="ExampleBarChart"/></menu-item>
         <menu-item name="ExamplePieChart" title="Pie chart"><link target="ExamplePieChart"/></menu-item>
     </menu>
+
+    <menu name="ExampleJackrabbit" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
+        <menu-item name="ExampleJackrabbitMainPage" title="${uiLabelMap.ExampleMainPage}"><link target="ExampleJackrabbit"/></menu-item>
+        <menu-item name="ExampleJackrabbitAddData" title="${uiLabelMap.ExampleAddNewContentEntry}"><link target="ExampleJackrabbitAddData"/></menu-item>
+        <menu-item name="ExampleJackrabbitUploadFileData" title="${uiLabelMap.ExampleJackrabbitUploadFileData}"><link target="ExampleJackrabbitUploadFileData"/></menu-item>
+        <menu-item name="ExampleJackrabbitShowUploadedFiles" title="${uiLabelMap.ExampleJackrabbitShowUploadedFiles}"><link target="ExampleJackrabbitShowUploadedFiles"/></menu-item>
+        <menu-item name="ExampleJackrabbitScanRepositoryStrukture" title="${uiLabelMap.ExampleScanRepositoryStrukture}"><link target="ExampleJackrabbitScanRepositoryStructure"/></menu-item>
+    </menu>
 </menus>

Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/build.xml?rev=1094371&r1=1094370&r2=1094371&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/build.xml (original)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/build.xml Mon Apr 18 09:08:14 2011
@@ -33,7 +33,9 @@ under the License.
         <fileset dir="${lib.dir}" includes="*.jar"/>
         <fileset dir="../../framework/base/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/commons" includes="*.jar"/>
+        <fileset dir="../../framework/base/lib/j2eespecs" includes="*.jar"/>
         <fileset dir="../../framework/base/build/lib" includes="*.jar"/>
+        <fileset dir="../../framework/webapp/lib" includes="*.jar"/>
         <fileset dir="../../framework/entity/build/lib" includes="*.jar"/>
         <fileset dir="../../framework/service/build/lib" includes="*.jar"/>
 

Added: ofbiz/branches/jackrabbit20100709/framework/jcr/lib/apache-mime4j-0.6.1.jar
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/lib/apache-mime4j-0.6.1.jar?rev=1094371&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ofbiz/branches/jackrabbit20100709/framework/jcr/lib/apache-mime4j-0.6.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/ofbiz-component.xml?rev=1094371&r1=1094370&r2=1094371&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/ofbiz-component.xml (original)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/ofbiz-component.xml Mon Apr 18 09:08:14 2011
@@ -25,5 +25,7 @@ under the License.
     <classpath type="dir" location="config"/>
     <classpath type="jar" location="build/lib/*"/>
     <classpath type="jar" location="lib/*"/>
+
+    <test-suite loader="main" location="testdef/jcrtests.xml"/>
 </ofbiz-component>
 

Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/JackrabbitContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/JackrabbitContainer.java?rev=1094371&r1=1094370&r2=1094371&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/JackrabbitContainer.java (original)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/JackrabbitContainer.java Mon Apr 18 09:08:14 2011
@@ -56,6 +56,7 @@ public class JackrabbitContainer impleme
     private static File homeDir = null;
     private static File jackrabbitConfigFile = null;
     private static String jndiName;
+    private static String removeRepositoryOnShutdown = null;;
     protected static Repository repository;
     private static Session session;
 
@@ -66,6 +67,7 @@ public class JackrabbitContainer impleme
         try {
             homeDirURL = ContainerConfig.getPropertyValue(cc, "repHomeDir", "runtime/data/jackrabbit/");
             jndiName = ContainerConfig.getPropertyValue(cc, "jndiName", "jcr/local");
+            removeRepositoryOnShutdown = ContainerConfig.getPropertyValue(cc, "removeRepositoryOnShutdown", "false");
             homeDir = new File(homeDirURL);
             URL jackrabbitConfigUrl = FlexibleLocation.resolveLocation(ContainerConfig.getPropertyValue(cc, "configFilePath", "framework/jcr/config/jackrabbit.xml"));
             jackrabbitConfigFile = new File(jackrabbitConfigUrl.toURI());
@@ -117,7 +119,11 @@ public class JackrabbitContainer impleme
         }
         if (repository != null) {
             // Not needed - Jackrabbit shuts down when the session is closed
-//            repository.shutdown();
+            // repository.shutdown();
+        }
+
+        if ("true".equals(removeRepositoryOnShutdown)) {
+            homeDir.deleteOnExit();
         }
     }
 

Added: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelper.java?rev=1094371&view=auto
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelper.java (added)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelper.java Mon Apr 18 09:08:14 2011
@@ -0,0 +1,108 @@
+package org.ofbiz.jcr.helper;
+
+import java.io.InputStream;
+
+import javax.jcr.RepositoryException;
+
+import net.sf.json.JSONArray;
+
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
+
+public interface JcrFileHelper {
+
+    /**
+     * Upload a file to the repository file tree.
+     *
+     * @param file
+     * @param fileName
+     * @return
+     * @throws RepositoryException
+     * @throws GenericEntityException
+     */
+    public GenericValue uploadFileData(byte[] file, String fileName) throws RepositoryException, GenericEntityException;
+
+    /**
+     * Upload a file to the repository file tree.
+     *
+     * @param file
+     * @param fileName
+     * @return
+     * @throws RepositoryException
+     * @throws GenericEntityException
+     */
+    public GenericValue uploadFileData(InputStream file, String fileName) throws RepositoryException, GenericEntityException;
+
+    /**
+     * Return the file passed file from the current folder node.
+     *
+     * @return
+     * @throws RepositoryException
+     */
+    public InputStream getFileContent(String fileName) throws RepositoryException;
+
+    /**
+     * Return the file from the current file node.
+     *
+     * @return
+     * @throws RepositoryException
+     */
+    public InputStream getFileContent() throws RepositoryException;
+
+    /**
+     * Add a child node to the current node. All Files are stored under a file
+     * root directory which will add automatically. The new JcrFileHelper object
+     * will be returned.
+     *
+     * @param newNode
+     * @return
+     * @throws RepositoryException
+     * @throws GenericEntityException
+     */
+    public JcrFileHelper addNewNode(String newNode) throws RepositoryException, GenericEntityException;
+
+    /**
+     * close the current jcr session.
+     */
+    public void closeSession();
+
+    /**
+     * Remove the current repository node. Removes also all child nodes.
+     *
+     * @throws GenericEntityException
+     * @throws RepositoryException
+     */
+    public void removeRepositoryNode() throws GenericEntityException, RepositoryException;
+
+    /**
+     * Returns the database content object.
+     *
+     * @return
+     */
+    public GenericValue getContentObject();
+
+    /**
+     * Returns the Repository File Tree as JSON Object
+     *
+     * @return
+     * @throws RepositoryException
+     */
+    public JSONArray getJsonFileTree() throws RepositoryException;
+
+    /**
+     * Returns the name of the node.
+     *
+     * @return
+     */
+    public String getNodeName();
+
+    /**
+     * Returns the content type of the file. An empty String will be returned if
+     * the node is not a file node or no mimeType exists.
+     *
+     * @return
+     * @throws RepositoryException
+     */
+    public String getFileMimeType() throws RepositoryException;
+
+}
\ No newline at end of file

Propchange: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelperAbstract.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelperAbstract.java?rev=1094371&view=auto
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelperAbstract.java (added)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelperAbstract.java Mon Apr 18 09:08:14 2011
@@ -0,0 +1,27 @@
+package org.ofbiz.jcr.helper;
+
+import java.io.InputStream;
+
+import javax.jcr.RepositoryException;
+
+import net.sf.json.JSONArray;
+
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
+
+public abstract class JcrFileHelperAbstract extends JcrHelperAbstract {
+
+    public abstract GenericValue uploadFileData(byte[] file, String fileName) throws RepositoryException, GenericEntityException;
+
+    public abstract GenericValue uploadFileData(InputStream file, String fileName) throws RepositoryException, GenericEntityException;
+
+    public abstract InputStream getFileContent(String fileName) throws RepositoryException;
+
+    public abstract InputStream getFileContent() throws RepositoryException;
+
+    public abstract String getFileMimeType() throws RepositoryException;
+
+    public abstract JSONArray getJsonFileTree() throws RepositoryException;
+
+    public abstract JcrFileHelper addNewNode(String newNode) throws RepositoryException, GenericEntityException;
+}

Propchange: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelperAbstract.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrHelperAbstract.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrHelperAbstract.java?rev=1094371&view=auto
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrHelperAbstract.java (added)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrHelperAbstract.java Mon Apr 18 09:08:14 2011
@@ -0,0 +1,64 @@
+package org.ofbiz.jcr.helper;
+
+import javax.jcr.RepositoryException;
+
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.jcr.orm.OfbizRepositoryMapping;
+
+/**
+ *
+ *
+ */
+public abstract class JcrHelperAbstract {
+
+    public static final String module = JcrHelperAbstract.class.getName();
+
+    protected OfbizRepositoryMapping orm = null;
+    protected GenericValue userLogin = null;
+
+    /**
+     * close the current jcr session.
+     */
+    public void closeSession() {
+        orm.closeSession();
+    }
+
+    /**
+     * Remove the current repository node. Removes also all child nodes.
+     *
+     * @throws GenericEntityException
+     * @throws RepositoryException
+     */
+    public void removeRepositoryNode() throws GenericEntityException, RepositoryException {
+        orm.removeRepositoryNode();
+    }
+
+    /**
+     * Returns the database content object.
+     *
+     * @return
+     */
+    public GenericValue getContentObject() {
+        return orm.getContentObject();
+    }
+
+    /**
+     * Returns the name of the node.
+     *
+     * @return
+     */
+    public String getNodeName() {
+        return orm.getNodeName();
+    }
+
+    protected Boolean checkNodeWritePermission(GenericValue userLogin) {
+        // TODO have to be specified
+        return Boolean.TRUE;
+    }
+
+    protected Boolean checkNodeReadPermission(GenericValue userLogin) {
+        // TODO have to be specified
+        return Boolean.TRUE;
+    }
+}

Propchange: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrHelperAbstract.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrTextHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrTextHelper.java?rev=1094371&view=auto
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrTextHelper.java (added)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrTextHelper.java Mon Apr 18 09:08:14 2011
@@ -0,0 +1,78 @@
+package org.ofbiz.jcr.helper;
+
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
+
+public interface JcrTextHelper {
+
+ /**
+ * Store new text content in the text content tree. Returns the contentId of
+ * the database content object
+ *
+ * @param message
+ * @return
+ * @throws RepositoryException
+ */
+ public String storeNewTextData(String message) throws RepositoryException;
+
+ /**
+ * Get the String content to the current node.
+ *
+ * @return
+ * @throws PathNotFoundException
+ * @throws RepositoryException
+ */
+ public String getTextData() throws PathNotFoundException, RepositoryException;
+
+ /**
+ * Update the text content of a current text node.
+ *
+ * @param message
+ * @return
+ * @throws PathNotFoundException
+ * @throws RepositoryException
+ */
+ public String updateTextData(String message) throws PathNotFoundException, RepositoryException;
+
+ /**
+ * Add a child node to the current node. The new JcrTextHelper object will
+ * be returned.
+ *
+ * @param newNode
+ * @return
+ * @throws RepositoryException
+ * @throws GenericEntityException
+ */
+ public JcrTextHelper addNewNode(String newNode) throws RepositoryException, GenericEntityException;
+
+ /**
+ * close the current jcr session.
+ */
+ public void closeSession();
+
+ /**
+ * Remove the current repository node. Removes also all child nodes.
+ *
+ * @throws GenericEntityException
+ * @throws RepositoryException
+ */
+ public void removeRepositoryNode() throws GenericEntityException, RepositoryException;
+
+ /**
+ * Returns the database content object.
+ *
+ * @return
+ */
+ public GenericValue getContentObject();
+
+ /**
+ * Returns the name of the node.
+ *
+ * @return
+ */
+ public String getNodeName();
+
+}
\ No newline at end of file

Propchange: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrTextHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrTextHelperAbstract.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrTextHelperAbstract.java?rev=1094371&view=auto
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrTextHelperAbstract.java (added)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrTextHelperAbstract.java Mon Apr 18 09:08:14 2011
@@ -0,0 +1,18 @@
+package org.ofbiz.jcr.helper;
+
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+
+import org.ofbiz.entity.GenericEntityException;
+
+public abstract class JcrTextHelperAbstract extends JcrHelperAbstract {
+
+    public abstract String storeNewTextData(String message) throws RepositoryException;
+
+    public abstract String getTextData() throws PathNotFoundException, RepositoryException;
+
+    public abstract String updateTextData(String message) throws PathNotFoundException, RepositoryException;
+
+    public abstract JcrTextHelper addNewNode(String newNode) throws RepositoryException, GenericEntityException;
+
+}

Propchange: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrTextHelperAbstract.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/orm/OfbizRepositoryMapping.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/orm/OfbizRepositoryMapping.java?rev=1094371&view=auto
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/orm/OfbizRepositoryMapping.java (added)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/orm/OfbizRepositoryMapping.java Mon Apr 18 09:08:14 2011
@@ -0,0 +1,136 @@
+package org.ofbiz.jcr.orm;
+
+import java.io.InputStream;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+
+import net.sf.json.JSONArray;
+
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
+
+public interface OfbizRepositoryMapping {
+
+ /**
+ * Object delegator reference
+ */
+ public Delegator getDelegator();
+
+ /**
+ * Close the current repository session should be used when the operation
+ * with this object are finished.
+ */
+ public void closeSession();
+
+ /**
+ * Updates only the node text property data
+ *
+ * @param message
+ * @return
+ * @throws RepositoryException
+ */
+ public void updateOrStoreTextData(String message) throws RepositoryException;
+
+ /**
+ * Returns the related Content Object
+ *
+ * @return
+ */
+ public GenericValue getContentObject();
+
+ /**
+ * Returns the related Repository Node
+ *
+ * @return
+ */
+ public Node getNode();
+
+ /**
+ * Returns the contentId from the related content object. If the content
+ * object is null, an empty string will be retunred.
+ *
+ * @return
+ */
+ public String getContentId();
+
+ /**
+ * Returns the absolute path of the node.
+ *
+ * @return
+ */
+ public String getNodePath();
+
+ /**
+ * Returns the name of the node.
+ *
+ * @return
+ */
+ public String getNodeName();
+
+ /**
+ * Remove a repository Node and the related database entry.
+ *
+ * @throws RepositoryException
+ * @throws GenericEntityException
+ */
+ public void removeRepositoryNode() throws RepositoryException, GenericEntityException;
+
+ /**
+ * Returns only the String Content of a node, if none exists an empty String
+ * will be returned
+ *
+ * @return
+ * @throws PathNotFoundException
+ * @throws RepositoryException
+ */
+ public String getStringContent() throws PathNotFoundException, RepositoryException;
+
+ /**
+ * Upload and store a file in the repository
+ *
+ * @param description
+ * @param file
+ * @return
+ * @throws PathNotFoundException
+ * @throws RepositoryException
+ * @throws GenericEntityException
+ */
+ public void uploadFileData(InputStream file, String fileName) throws PathNotFoundException, RepositoryException, GenericEntityException;
+
+ /**
+ * Return the file stream from the current node object.
+ *
+ * @param fileName
+ * @return
+ * @throws RepositoryException
+ */
+ public InputStream getFileContent(String fileName) throws RepositoryException;
+
+ /**
+ * Returns the content type of the file. An empty String will be returned if the node
+ * is not a file node or no mimeType exists.
+ *
+ * @return
+ * @throws RepositoryException
+ */
+ public String getFileMimeType() throws RepositoryException;
+
+ /**
+ * Returns the repository file tree as Json Object.
+ *
+ * @return
+ * @throws RepositoryException
+ */
+ public JSONArray getJsonFileTree() throws RepositoryException;
+
+ /**
+ * Get the file stream from the current node.
+ *
+ * @return
+ * @throws RepositoryException
+ */
+ public InputStream getFileContent() throws RepositoryException;
+}
\ No newline at end of file

Propchange: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/orm/OfbizRepositoryMapping.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/jackrabbit20100709/framework/jcr/testdef/jcrtests.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/testdef/jcrtests.xml?rev=1094371&view=auto
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/testdef/jcrtests.xml (added)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/testdef/jcrtests.xml Mon Apr 18 09:08:14 2011
@@ -0,0 +1,34 @@
+<?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.
+  -->
+
+<test-suite suite-name="jcrtests"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
+
+    <!--
+    <test-case case-name="jcr-tests-data-load">
+        <entity-xml action="load" entity-xml-url="component://accounting/testdef/data/AccountingTestsData.xml"/>
+    </test-case>
+    -->
+
+
+    <test-case case-name="jcr-tests"><junit-test-suite class-name="org.ofbiz.content.test.JcrTests"/></test-case>
+
+</test-suite>
\ No newline at end of file

Propchange: ofbiz/branches/jackrabbit20100709/framework/jcr/testdef/jcrtests.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain