Reintegrating the Jackrabbit Development branch into the turnk.

The Merge contains the basic integration of jackrabbit into ofbiz and provides a simple API for further development.

Features:
API for easy CRUD operations
Versioning 
Multi Language Support
Object Content Mapping
Sample Implementation in Example Area

See this merge as first step. The development is still in progress but this is the stable starting point for all feature developments.


Detailed description can be found in the Wiki: https://cwiki.apache.org/OFBIZ/jackrabbit-branch-development.html

For any questions, requests, issues use the jira post: https://issues.apache.org/jira/browse/OFBIZ-4659

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1231647 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sascha Rodekamp
2012-01-15 10:41:50 +00:00
parent 6eecbb9c20
commit 0141c39f55
83 changed files with 6023 additions and 305 deletions
@@ -0,0 +1,22 @@
/*
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.
*/
def localeMap = []
org.ofbiz.base.util.UtilMisc.availableLocales().each { localeMap.add(localeId:it.toString()) };
parameters.localeList = localeMap;
@@ -28,7 +28,7 @@ under the License.
<include location="component://example/webapp/birt/WEB-INF/controller.xml"/>
<description>Example Component Site Configuration File</description>
<!--
These can be used to return the reports as views; make sure the classes are compiled and available
<handler name="datavision" type="view" class="org.ofbiz.webapp.view.DataVisionViewHandler"/>
@@ -50,7 +50,7 @@ under the License.
<!-- Request Mappings -->
<request-map uri="main"><security https="true" auth="true"/><response name="success" type="view" value="main"/></request-map>
<!-- Example Requests -->
<request-map uri="FindExample"><security https="true" auth="true"/><response name="success" type="view" value="FindExample"/></request-map>
<request-map uri="EditExample"><security https="true" auth="true"/><response name="success" type="view" value="EditExample"/></request-map>
@@ -236,6 +236,95 @@ under the License.
</request-map>
<!-- end of request mappings -->
<!-- Jackrabbit Example Requests -->
<request-map uri="ExampleJackrabbit">
<security auth="true" https="true" />
<response name="success" type="view" value="ExampleJackrabbit" />
<response name="error" type="view" value="ExampleJackrabbit" />
</request-map>
<request-map uri="ExampleJackrabbitAddData">
<security auth="true" https="true" />
<response name="success" type="view" value="ExampleJackrabbitAddData" />
<response name="error" type="view" value="ExampleJackrabbitAddData" />
</request-map>
<request-map uri="StoreNewRepositoryData">
<security auth="true" https="true" />
<event type="java" path="org.ofbiz.example.JackrabbitEvents" invoke="addNewTextMessageToJcrRepository" />
<response name="success" type="request" value="ExampleJackrabbitShowContentData" />
<response name="error" type="view" value="ExampleJackrabbitAddData" />
</request-map>
<request-map uri="ExampleJackrabbitScanRepositoryStructure">
<security auth="true" https="true" />
<event type="java" path="org.ofbiz.example.JackrabbitEvents" invoke="scanRepositoryStructure"/>
<response name="success" type="view" value="ExampleJackrabbitScanRepositoryStructure" />
<response name="error" type="view" value="ExampleJackrabbitScanRepositoryStructure" />
</request-map>
<request-map uri="EditRepositoryContent">
<security auth="true" https="true" />
<event type="java" path="org.ofbiz.example.JackrabbitEvents" invoke="getNodeContent"/>
<response name="success" type="view" value="ExampleJackrabbitEditRepositoryContent" />
<response name="error" type="request" value="ExampleJackrabbitShowContentData" />
</request-map>
<request-map uri="UpdateRepositoryData">
<security auth="true" https="true" />
<event type="java" path="org.ofbiz.example.JackrabbitEvents" invoke="updateRepositoryData"/>
<response name="success" type="request" value="EditRepositoryContent" />
<response name="error" type="request" value="EditRepositoryContent" />
</request-map>
<request-map uri="RemoveRepositoryNode">
<security auth="true" https="true" />
<event type="java" path="org.ofbiz.example.JackrabbitEvents" invoke="removeRepositoryNode"/>
<response name="success" type="request" value="ExampleJackrabbitShowContentData" />
<response name="error" type="request" value="ExampleJackrabbitShowContentData" />
</request-map>
<request-map uri="RemoveRepositoryFile">
<security auth="true" https="true" />
<event type="java" path="org.ofbiz.example.JackrabbitEvents" invoke="removeRepositoryNode"/>
<response name="success" type="request" value="ExampleJackrabbitShowUploadedFiles" />
<response name="error" type="request" value="ExampleJackrabbitShowUploadedFiles" />
</request-map>
<request-map uri="ExampleJackrabbitUploadFileData">
<security auth="true" https="true" />
<response name="success" type="view" value="ExampleJackrabbitUploadFileData" />
<response name="error" type="view" value="ExampleJackrabbitUploadFileData" />
</request-map>
<request-map uri="StoreNewRepositoryFileData">
<security auth="true" https="true" />
<event type="java" path="org.ofbiz.example.JackrabbitEvents" invoke="uploadFileData"/>
<response name="success" type="request" value="ExampleJackrabbitShowUploadedFiles" />
<response name="error" type="view" value="ExampleJackrabbitUploadFileData" />
</request-map>
<request-map uri="ExampleJackrabbitShowUploadedFiles">
<security auth="true" https="true" />
<event type="java" path="org.ofbiz.example.JackrabbitEvents" invoke="getRepositoryFileTree"/>
<response name="success" type="view" value="ExampleJackrabbitShowUploadedFiles" />
<response name="error" type="view" value="ExampleJackrabbitShowUploadedFiles" />
</request-map>
<request-map uri="GetFileFromRepository">
<security auth="true" https="true" />
<event type="java" path="org.ofbiz.example.JackrabbitEvents" invoke="getFileFromRepository"/>
<response name="success" type="none" />
<response name="error" type="none" />
</request-map>
<request-map uri="ExampleJackrabbitShowContentData">
<security auth="true" https="true" />
<event type="java" path="org.ofbiz.example.JackrabbitEvents" invoke="getRepositoryDataTree"/>
<response name="success" type="view" value="ExampleJackrabbitShowContentData"/>
<response name="error" type="view" value="ExampleJackrabbitShowContentData"/>
</request-map>
<request-map uri="OpenFileInformation">
<security auth="true" https="true" />
<event type="java" path="org.ofbiz.example.JackrabbitEvents" invoke="getFileInformation"/>
<response name="success" type="view" value="ExampleJackrabbitOpenFileInformation"/>
<response name="error" type="view" value="ExampleJackrabbitShowUploadedFiles"/>
</request-map>
<request-map uri="QueryRepositoryData">
<security auth="true" https="true" />
<event type="java" path="org.ofbiz.example.JackrabbitEvents" invoke="queryRepositoryData"/>
<response name="success" type="view" value="ExampleJackrabbitShowQueryResult"/>
<response name="error" type="request" value="ExampleJackrabbitShowContentData"/>
</request-map>
<!-- View Mappings -->
<view-map name="main" type="screen" page="component://example/widget/example/CommonScreens.xml#main"/>
@@ -280,6 +369,18 @@ under the License.
<view-map name="ExampleBarChart" page="component://example/widget/example/ExampleScreens.xml#ExampleBarChart" type="screen"/>
<view-map name="ExamplePieChart" page="component://example/widget/example/ExampleScreens.xml#ExamplePieChart" type="screen"/>
<!-- Jackrabbit View Mapping -->
<view-map name="ExampleJackrabbit" page="component://example/widget/example/ExampleJackrabbitScreens.xml#ListRepositoryData" type="screen" />
<view-map name="ExampleJackrabbitAddData" page="component://example/widget/example/ExampleJackrabbitScreens.xml#ExampleJackrabbitAddData" type="screen" />
<view-map name="ExampleJackrabbitScanRepositoryStructure" page="component://example/widget/example/ExampleJackrabbitScreens.xml#ExampleJackrabbitScanRepositoryStructure" type="screen" />
<view-map name="ExampleJackrabbitEditRepositoryContent" page="component://example/widget/example/ExampleJackrabbitScreens.xml#ExampleJackrabbitEditRepositoryContent" type="screen" />
<view-map name="ExampleJackrabbitUploadFileData" page="component://example/widget/example/ExampleJackrabbitScreens.xml#ExampleJackrabbitUploadFileData" type="screen" />
<view-map name="ExampleJackrabbitShowUploadedFiles" page="component://example/widget/example/ExampleJackrabbitScreens.xml#ExampleJackrabbitShowUploadedFiles" type="screen" />
<view-map name="ExampleJackrabbitShowContentData" page="component://example/widget/example/ExampleJackrabbitScreens.xml#ExampleJackrabbitShowContentData" type="screen" />
<view-map name="ExampleJackrabbitOpenFileInformation" page="component://example/widget/example/ExampleJackrabbitScreens.xml#ExampleJackrabbitShowFileInformation" type="screen" />
<view-map name="ExampleJackrabbitShowQueryResult" page="component://example/widget/example/ExampleJackrabbitScreens.xml#ExampleJackrabbitShowQueryResult" type="screen" />
<!-- Supported Content Types -->
<!--
text/html
@@ -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.
-->
${uiLabelMap.ExampleJackrabbitQuickContentSelect}
<form id="selectNode" action="EditRepositoryContent" type="post">
<select name="path" id="nodePath">
<option value="" selected></option>
<#list parameters.contentList as content>
<option value="${content}">${content}</option>
</#list>
</select>
<select name="language" id="nodeLanguage">
<option value="" selected></option>
</select>
<input type="submit" />
</form>
<script type="text/javascript">
var languageList = ${parameters.languageList}
jQuery("#nodePath").change(function() {
var newOptions = languageList[jQuery(this).val()];
var options = "";
for (option in newOptions) {
options = options + "<option value='" + newOptions[option] + "'>" + newOptions[option] + "</option>";
}
options = options + "<option value='' ></option>"
jQuery("#nodeLanguage").children().remove();
jQuery("#nodeLanguage").append(options);
});
</script>
<br />
@@ -0,0 +1,94 @@
<#--
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="jackrabbitDataTree">${parameters.dataTree!""}</div>
<script type="text/javascript">
var rawdata = ${parameters.dataTree!};
jQuery(function () {
jQuery("#jackrabbitDataTree").jstree({
"plugins" : [ "themes", "json_data", "ui", "contextmenu"],
"json_data" : {
"data" : rawdata
},
'contextmenu': {
'items': {
'ccp' : false,
'create' : false,
'rename' : false,
'open' : {
'label' : "${uiLabelMap.ExampelsJackrabbitOpenData}",
'action' : function(obj) {
openDataFromRepository(obj.attr('nodepath'), obj.attr('nodetype'));
}
},
'remove' : {
'label' : "${uiLabelMap.ExampelsJackrabbitRemoveData}",
'action' : function(obj) {
removeDataFromRepository(obj.attr('nodepath'), obj.attr('nodetype'));
}
}
}
}
});
});
function removeDataFromRepository(nodepath, nodetype) {
var parameters = {"path" : nodepath};
var url = "RemoveRepositoryNode";
runPostRequest(url, parameters)
}
function openDataFromRepository(nodepath, nodetype) {
var parameters = {"path" : nodepath};
var url = "EditRepositoryContent";
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>
@@ -0,0 +1,110 @@
<#--
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,
'open' : {
'label' : "${uiLabelMap.ExampelsJackrabbitOpenFile}",
'action' : function(obj) {
openFileFromRepository(obj.attr('nodepath'), obj.attr('nodetype'));
}
},
'remove' : {
'label' : "${uiLabelMap.ExampelsJackrabbitRemoveFile}",
'action' : function(obj) {
removeFileFromRepository(obj.attr('nodepath'), obj.attr('nodetype'));
}
},
'download' : {
'label' : "${uiLabelMap.ExampelsJackrabbitDownloadFile}",
'action' : function(obj) {
downloadFileFromRepository(obj.attr('nodepath'), obj.attr('nodetype'));
}
}
}
}
});
});
function openFileFromRepository(nodepath, nodetype) {
var parameters = {"path" : nodepath};
var url = "OpenFileInformation";
runPostRequest(url, parameters)
}
function removeFileFromRepository(nodepath, nodetype) {
var parameters = {"path" : nodepath};
var url = "RemoveRepositoryFile";
runPostRequest(url, parameters)
}
function downloadFileFromRepository(nodepath, nodetype) {
if ("nt:folder" == nodetype) { // the open function for foldes is not supported yet.
return;
}
var parameters = {"path" : 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>