You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pp...@apache.org on 2010/12/02 12:40:02 UTC

svn commit: r1041335 - /openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.html

Author: ppoddar
Date: Thu Dec  2 11:40:01 2010
New Revision: 1041335

URL: http://svn.apache.org/viewvc?rev=1041335&view=rev
Log:
OPENJPA-1851: Add home page

Added:
    openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.html   (with props)

Added: openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.html
URL: http://svn.apache.org/viewvc/openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.html?rev=1041335&view=auto
==============================================================================
--- openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.html (added)
+++ openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.html Thu Dec  2 11:40:01 2010
@@ -0,0 +1,291 @@
+<!--
+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.
+-->
+
+<!--
+   The single web page for JEST is a templated HTML. This page consists of three major divisions
+   a) a section holds the menu items for available commands 
+   b) a section for the command window where user enters command specifications
+   c) a section displays the server response of the command execution
+     
+   This templated file contains replaceable tokens in ${token} form.  JEST servlet replaces the tokens with 
+   actual deployment values on initialization.
+     
+   The menu navigation and command window are managed by jest.js script.
+   The rendition of server response is managed by dojo script.
+   
+   All hyperlinks in this page are relative to the base URI of this page to prevent
+   any cross-domain scripting.
+     
+ -->
+<html>
+<head>
+<!-- ==================================================================================== -->
+<!-- Base URI is replaced with actual deployment data on initialization                   -->
+<!-- ==================================================================================== -->
+<base href="${jest.uri}">
+<!-- base href="http://localhost:8080/demo/jest/" -->
+<title>JEST: REST on OpenJPA</title>
+
+<link   type="text/css" rel="stylesheet" href="${dojo.base}/dijit/themes/${dojo.theme}/${dojo.theme}.css">
+<!-- link   type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css" -->
+<link   type="text/css" rel="stylesheet" href="jest.css">
+
+<meta content="REST,OpenJPA,JPA,JEST">
+</head>
+
+
+<body class=" ${dojo.theme} ">
+<!-- body class=" claro " -->
+<h1>JEST: REST on OpenJPA</h1><hr>
+<!-- ==================================================================================== -->
+<!--                     Section for menu based commands.                                 -->
+<!--                                                                                      -->
+<!-- Each menu opens a command window by making a div section visible                     -->
+<!-- ==================================================================================== -->
+<div id="menu" class="menu">
+<table cellspacing="1em">
+ <tr><td><img alt="Home" src="images/home.jpg" width="100" height="100"></td></tr>
+ <tr><td style="text-align:center"><a href="javascript:switchid('home', ['deploy', 'find', 'query', 'domain', 'properties']);">Info</a></td></tr>
+ <tr><td><img alt="Deploy" src="images/monitor.jpg" width="100" height="100"></td></tr>
+ <tr><td style="text-align:center"><a href="javascript:switchid('deploy', ['home', 'find', 'query', 'domain', 'properties']);">deploy</a></td></tr>
+ <tr><td><img alt="Find"   src="images/find.jpg" width="100" height="100"></td></tr>
+ <tr><td style="text-align:center"><a href="javascript:switchid('find', ['home', 'deploy', 'query', 'domain', 'properties']);">find instances</a></td></tr>
+ <tr><td><img alt="Query"  src="images/query2.png" width="100" height="100"></td></tr>
+ <tr><td style="text-align:center"><a href="javascript:switchid('query', ['home', 'deploy', 'find', 'domain', 'properties']);">query objects</a></td></tr>
+ <tr><td><img alt="Domain" src="images/domain.jpg" width="100" height="100"></td></tr>
+ <tr><td style="text-align:center"><a href="javascript:switchid('domain', ['home', 'deploy', 'find', 'query', 'properties']);">browse domain</a></td></tr>
+ <tr><td><img alt="View" src="images/properties.jpg"  width="100" height="100"></td></tr>
+ <tr><td style="text-align: center"><a href="javascript:switchid('properties', ['home', 'deploy', 'find', 'query', 'domain']);">view properties</a></td></tr>
+</table>
+</div>
+
+<!-- ==================================================================================== -->
+<!--                        Section for each command specification                        -->
+<!--                                                                                      -->
+<!-- Contains a set of div sub-sections each for a single command. A command window       -->
+<!-- consists of a brief description of the command and set of input elements where user  -->
+<!-- can enter command qualifiers and arguments.                                          -->
+<!-- The URI for the command is updated as user entry changes. If the user clicks on the  -->
+<!-- URI hyperlink, then a request with the URI is sent to the server.                    -->
+<!-- ==================================================================================== -->
+<!--                   Introduces basic information about JEST                            -->
+<!-- ==================================================================================== -->
+<div id="home" class="highlight" dojoType="dijit.TitlePane" 
+title="<b><a href='http://openjpa.apache.org/jest-usage.html' target='_blank'>JEST</a> facilitates 
+RESTful interaction with OpenJPA runtime.</b>">
+
+
+<UL>
+<LI>Deployed as a HTTP servlet in <b>any</b> web or enterprise application module using 
+OpenJPA as its JPA persistence provider. 
+</LI>
+
+<LI>Completely <b>metadata-driven</b> and hence <b>generic</b> as opposed to specific to any 
+application domain.
+</LI> 
+
+<LI>Introduces a <b>URI syntax</b>. Interprets the HTTP request as a JPA resource based on 
+that syntax. The response is in <tt>XML</tt> or <tt>JSON</tt> format. </LI>
+
+<LI>Representational state for persistent instances is <b>coherent</b>. 
+The response always contains the <em>closure</em> of the persistent instances. 
+</LI>
+      
+<LI>Connects to the <em>same</em> persistent unit used by the application. Allows the user to 
+find application objects by JPQL query or find by primary key. 
+</LI>
+</UL>
+</div>
+
+<!-- ==================================================================================== -->
+<!--        Describes deployment details                                                  -->
+<!-- ==================================================================================== -->
+<div id="deploy" class="highlight" style="display:none;" dojoType="dijit.TitlePane" 
+	title='<b><a href="http://openjpa.apache.org/jest-usage.html" target="_blank">Deploy JEST</a> 
+	as a servlet in a web application.</b>'>
+	
+	
+	Following <code>WEB-INF/web.xml</code> descriptor will enable JEST to
+	operate on a persistence unit named <code>${persistence.unit}</code>. Of course, JEST 
+	servlet must be in the same module scope of the application that is using using 
+	<code>${persistence.unit}</code> as its persistence unit.  
+	<br>
+<pre>
+<code class="tag">&lt;servlet&gt;</code>
+  <code class="tag">&lt;servlet-name&gt;</code>${webapp.name}<code class="tag">&lt;/servlet-name&gt;</code>
+  <code class="tag">&lt;servlet-class&gt;</code><span style="color:blue">org.apache.openjpa.persistence.jest.JESTServlet</span><code class="tag">&lt;/servlet-class&gt;</code>
+	<code class="tag">&lt;init-param&gt;</code>
+	  <code class="tag">&lt;param-name&gt;</code><span style="color:red;">persistence.unit</span><code class="tag">&lt;/param-name&gt;</code>
+	  <code class="tag">&lt;param-value&gt;</code><span style="color:red">${persistence.unit}</span><code class="tag">&lt;/param-value&gt;</code>
+	<code class="tag">&lt;/init-param&gt;</code>
+<code class="tag">&lt;/servlet&gt;</code>
+<code class="tag">&lt;servlet-mapping&gt;</code>
+  <code class="tag">&lt;servlet-name&gt;</code>${servlet.name}<code class="tag">&lt;/servlet-name&gt;</code>
+  <code class="tag">&lt;url-pattern&gt;</code><span style="color:red">/${servlet.name}/*</span><code class="tag">&lt;/url-pattern&gt;</code>
+<code class="tag">&lt;/servlet-mapping&gt;</code>
+
+</pre>
+	When an web application module named <code>${webapp.name}</code> containing the above JEST servlet 
+	in a servlet container runs on <code>${server.name}</code> at port ${server.port}, then the JEST servlet
+	can be accessed at <br>
+	<code class="url">http://${server.name}:${server.port}/${webapp.name}/${servlet.name}/</code> 
+	<br>
+	(<span style="color:red">do not miss the the trailing forward-slash / character</span>) 
+	<p>
+</div>
+		 
+<!-- ==================================================================================== -->
+<!--        Command window for find                                                       -->
+<!--                                                                                      -->
+<!-- The div element contains a table and some of the table columns hold the input        -->
+<!-- elements. The div, table and input elements are all identified with following        -->
+<!-- naming convention:                                                                   -->
+<!-- the main div section identifier is the moniker of the command itself i.e. 'find'     -->
+<!-- the table identifier is 'find.command'                                               -->
+<!-- the input element identifiers are 'find.{qualifier or argument name}' e.g.           -->
+<!-- 'find.type' or 'find.format'. The qualifier or argument name must be the same as     -->
+<!--  specified in jest.js JavaScript.                                                    -->
+<!--                                                                                      -->
+<!-- The naming convention is crucial because the JavaScript jest.js identifies these     -->
+<!-- elements by this implicit naming conventions.                                        -->
+<!--                                                                                      -->
+<!-- The user entries result in a relative URI displayed in this section itself.          -->
+<!-- The event handlers on the input elements update the URI on change.                   -->
+<!-- The user can click the hyperlink to send the request to the server.                  -->
+<!-- ==================================================================================== -->
+<div id="find"  class="highlight" style="display:none;" dojoType="dijit.TitlePane" 
+  title='<b><a href="http://openjpa.apache.org/jest-syntax.html" target="_blank">Find </a>  
+	persistent objects by simple or compound primary key.</b>'>
+	
+	
+	<table id="find.command">
+	<tr>
+	  <th>find</th>
+	  <th colspan="2">Arguments</th>
+	  <th colspan="2">Qualifiers</th>
+	</tr>
+	<tr>
+	  <td></td>
+	  <td class="mandatory" title="Name of a persistent entity to find.">Entity Name</td>
+	  <td class="mandatory" title="Primary Key of the entity.">Primary Key</td>
+	  <td title="Fetch Plan to use.">Fetch Plan</td>
+	  <td title="Format of the response.">Response Format</td>
+	</tr>
+	<tr>
+	  <td></td>
+	  <td><input id="find.type"   onblur="javascript:toURI('find');"></td>
+	  <td><input id="find.pk"     onblur="javascript:toURI('find');"></td>
+	  <td><input id="find.plan"   onblur="javascript:toURI('find');"></td>
+	  <td>
+	    <select id="find.format" onblur="javascript:toURI('find');" >
+	    <option value="">default</option>
+	    <option value="xml">XML</option>
+	    <option value="json">JSON</option>
+	    </select>
+	  </td>
+	</tr>
+	</table>
+	<p>
+	<b>URI: </b><span id="find.uri"></span><br>
+</div>
+		 
+<!-- ==================================================================================== -->
+<!--                      Command window for Query                                        -->
+<!--                                                                                      -->
+<!-- Similar to window for 'find' command. The added complexity is variable number of     -->
+<!-- query binding parameters that the user may enter for a query.                        -->
+<!-- Each query binding parameter is accepted via two inputs on a dynamically created row -->
+<!-- The dynamic row is identified as 'query.vararg.{n}' and the pair of input elements   -->
+<!-- 'query.vararg.{n}.key' and 'query.vararg.{n}.value' respectively. {n} is a monotonic -->
+<!-- integer. If a dynamically created row is removed by the user, the index {n} does not -->
+<!-- decrement.                                                                           -->
+<!-- ==================================================================================== -->
+<div id="query"  class="highlight" style="display:none;" dojoType="dijit.TitlePane" 
+	title='<b><a href="http://openjpa.apache.org/jest-syntax.html" target="_blank">Query</a> with 
+	JPQL or named query and binding parameters.</b>'>
+	
+	
+	<table id="query.command">
+	<tr>
+	  <th width="10%">Query</th>
+	  <th colspan="3">Arguments</th>
+	  <th colspan="3">Qualifiers</th>
+	</tr>
+	<tr>
+	  <td></td>
+	  <td class="mandatory" title="JPQL query or a named query" colspan="3">Query</td>
+	  <td title="Is it a named query?">Single</td>
+	  <td title="Returns single result?">Named</td>
+	</tr>
+	<tr>
+	  <td></td>
+	  <td colspan="2"><input id="query.q" size="60"                  onchange="javascript:toURI('query');"></td>
+	  <td><input id="query.single" type="checkbox" value="true"       onchange="javascript:toURI('query');"></td>
+	  <td><input id="query.named"  type="checkbox" value="true"       onchange="javascript:toURI('query');"></td>
+	</tr>
+	<tr id="query.vararg.0">
+	  <td><input type="button" value="Bind Query Parameter" 
+	       onclick="javascript:addVarArgRow('query.vararg', 0, 'Bind Query Parameter')"></td>
+	</tr>
+	</table>
+
+	<b>URI: </b><span id="query.uri" class="url" ></span>
+</div>
+		 
+<!-- ==================================================================================== -->
+<!--    Command window for browsing persistent domain model                               -->
+<!-- ==================================================================================== -->
+<div id="domain"  class="highlight" style="display:none;" dojoType="dijit.TitlePane" 
+  title='<b><a href="http://openjpa.apache.org/jest-syntax.html" target="_blank">Browse</a> 
+  persistent domain model.</b>'>
+  
+	This command accepts no qualifier or arguments	 <br>
+	
+	<b>JEST URI: </b><span id="domain.uri" class="url"
+	onclick="javascript:render('domain','canvas', 'domain', 'xml'); event.returnValue=false;return false;">domain</span>
+</div>
+		 
+<!-- ==================================================================================== -->
+<!--    Command window for viewing configuration of the persistence unit.                 -->
+<!-- ==================================================================================== -->
+<div id="properties"  class="highlight" style="display:none;" dojoType="dijit.TitlePane" 
+ title='<b><a href="http://openjpa.apache.org/jest-syntax.html" target="_blank">View</a> 
+ configuration properties of the persistence unit.</b>'>
+ 
+	This command accepts no qualifier or arguments	 <br>
+		 
+	<b>URI: </b><span id="properties.uri" class="url" 
+	onclick="javascript:render('properties','canvas', 'properties', 'xml'); event.returnValue=false;return false;">properties</span>
+</div>
+
+<!-- ==================================================================================== -->
+<!-- This empty section will be filled in by server response                              -->
+<!-- ==================================================================================== -->
+<div id="canvas" class="canvas">
+</div>
+
+<script type="text/javascript" language="javascript" djConfig="parseOnLoad: true, isDebug: true"  
+src="${dojo.base}/dojo/dojo.xd.js">
+</script>
+<!-- script type="text/javascript" djConfig="parseOnLoad:true;isDebug=true" src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js"></script -->
+<script type="text/javascript" language="javascript" src="jest.js">
+</script>
+
+</body>
+</html>
\ No newline at end of file

Propchange: openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain