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/11/21 05:33:23 UTC
svn commit: r1037380 - in /openjpa/sandboxes/jest:
openjpa-examples/jest/src/main/resources/demo/
openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/
Author: ppoddar
Date: Sun Nov 21 04:33:22 2010
New Revision: 1037380
URL: http://svn.apache.org/viewvc?rev=1037380&view=rev
Log:
OPENJPA-1851: Modify jest-instance.xsd to match attribute category
Added:
openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/instances.js (with props)
Modified:
openjpa/sandboxes/jest/openjpa-examples/jest/src/main/resources/demo/index.html
openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/index.html
openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest-instance.xsd
openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.css
openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/localizer.properties
Modified: openjpa/sandboxes/jest/openjpa-examples/jest/src/main/resources/demo/index.html
URL: http://svn.apache.org/viewvc/openjpa/sandboxes/jest/openjpa-examples/jest/src/main/resources/demo/index.html?rev=1037380&r1=1037379&r2=1037380&view=diff
==============================================================================
--- openjpa/sandboxes/jest/openjpa-examples/jest/src/main/resources/demo/index.html (original)
+++ openjpa/sandboxes/jest/openjpa-examples/jest/src/main/resources/demo/index.html Sun Nov 21 04:33:22 2010
@@ -1,10 +1,27 @@
+<!--
+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.
+-->
<html>
<body>
- <h1>Welcome to a do-nothing application</h1>
+ <h1>Do-Nothing Application</h1>
<br>
This do-nothing application initializes a JPA persistence unit with OpenJPA as provider and its <em>only</em>
- response
- is the page you are reading now.
+ response is the page you are reading now.
<br>
This application is used to demonstrate JEST.
<br>
Modified: openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/index.html
URL: http://svn.apache.org/viewvc/openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/index.html?rev=1037380&r1=1037379&r2=1037380&view=diff
==============================================================================
--- openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/index.html (original)
+++ openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/index.html Sun Nov 21 04:33:22 2010
@@ -16,14 +16,14 @@ KIND, either express or implied. See th
specific language governing permissions and limitations
under the License.
-->
-<!-- This is the root resource of JEST servlet. -->
-<!-- All referenced resource are relative to this resource. -->
-<!-- Instead of src="images/x.jpg", use src="./images/x.jpg" -->
+<!-- IMPORTANT -->
+<!-- This is the root resource of JEST servlet. -->
+<!-- All referenced resource (stylesheet, script, images) are relative to this resource. -->
<html>
<head>
-<script language="javascript" type="text/javascript" src="./showhide.js">
+<script language="javascript" type="text/javascript" src="showhide.js">
</script>
-<LINK href="./jest.css" rel="stylesheet" type="text/css">
+<LINK href="jest.css" rel="stylesheet" type="text/css">
</head>
<body>
@@ -42,11 +42,11 @@ The documentation on JEST is available i
-->
<table cellspacing="20">
<tr>
- <td><img alt="Deploy" src="./images/monitor.jpg" width="100" height="100"></td>
- <td><img alt="Find" src="./images/find.jpg" width="100" height="100"></td>
- <td><img alt="Query" src="./images/query2.png" width="100" height="100"></td>
- <td><img alt="Browse" src="./images/domain.jpg" width="100" height="100"></td>
- <td><img alt="View" src="./images/properties.jpg" width="100" height="100"></td>
+ <td><img alt="Deploy" src="images/monitor.jpg" width="100" height="100"></td>
+ <td><img alt="Find" src="images/find.jpg" width="100" height="100"></td>
+ <td><img alt="Query" src="images/query2.png" width="100" height="100"></td>
+ <td><img alt="Browse" src="images/domain.jpg" width="100" height="100"></td>
+ <td><img alt="View" src="images/properties.jpg" width="100" height="100"></td>
</tr>
<tr>
<td><a href="javascript:switchid('deploy');">Deploy</a> </td>
@@ -56,7 +56,7 @@ The documentation on JEST is available i
<td><a href="javascript:switchid('properties');">view properties</a></td>
</tr>
</table>
-
+<p>
<div id="deploy" style="display:none;">
You can deploy JEST as a servlet in a web application.
<hr>
Added: openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/instances.js
URL: http://svn.apache.org/viewvc/openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/instances.js?rev=1037380&view=auto
==============================================================================
--- openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/instances.js (added)
+++ openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/instances.js Sun Nov 21 04:33:22 2010
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+/**
+ * A JavaScript to render a set of instances as dojo widgets.
+ */
+dojo.require("dijit.form.Button");
+dojo.require("dijit.TitlePane");
+dojo.ready(function(){
+ // data is supplied in a hidden div with id="data"
+ var data = dojo.byId("data");
+
+ // Find all instance node within data node and create TitlePanel for each
+ var panels = new Array();
+ dojo.query("instance", data).forEach(function(item, index) {
+ var panel = create(item);
+ panels[index] = panel;
+ });
+
+ // widgets are placed on a empty div with id="canvas"
+ var canvas = dojo.byId("canvas");
+ // assign random location to each panel and add them to canvas
+ dojo.forEach(panels, function(item, index) {
+ var domNode = item.domNode;
+ domNode.style.width = "200px";
+ domNode.style.position = "absolute";
+ domNode.style.left = 100 + (index % 5)*300 + "px";
+ domNode.style.top = 10 + Math.floor(index / 5)*200 +"px";
+ canvas.appendChild(domNode);
+ });
+
+});
+
+/**
+ * Creates a dojo Title Pane from a DOM instance node.
+ * The pane has the instance id as its title.
+ * The content is name and value of each attribute in separate line.
+ *
+ * @param node an instance node
+ * @returns
+ */
+function create(node) {
+ var attrs = document.createElement("table");
+ dojo.query('basic, one-to-one', node)
+ .forEach(function(item) {
+ var attr = document.createElement("tr");
+ var name = document.createElement("td");
+ name.innerHTML = item.getAttribute("name").bold();
+ var value = document.createElement("td");
+ value.innerHTML = item.innerHTML;
+ attr.appendChild(name);
+ attr.appendChild(value);
+ attrs.appendChild(attr);
+ }
+ );
+ var pane = new dijit.TitlePane({
+ title: node.getAttribute("id"),
+ content:attrs
+ }
+ );
+
+ dojo.connect(pane, "onMouseDown",
+ function(event){
+ pane.domNode.style.cursor = "move";
+ }
+ );
+ dojo.connect(pane, "onMouseEnter",
+ function(event){
+ pane.domNode.style.cursor = "move";
+ }
+ );
+ dojo.connect(pane, "onMouseLeave",
+ function(event){
+ pane.domNode.style.cursor = "default";
+ }
+ );
+ dojo.connect(pane, "onMouseUp",
+ function(event){
+ setPosition(pane, event);
+ }
+ );
+ return pane;
+};
+
+function setPosition(widget, event) {
+ widget.domNode.style.left = event.pageX+"px";
+ widget.domNode.style.top = event.pageY+"px";
+}
Propchange: openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/instances.js
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest-instance.xsd
URL: http://svn.apache.org/viewvc/openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest-instance.xsd?rev=1037380&r1=1037379&r2=1037380&view=diff
==============================================================================
--- openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest-instance.xsd (original)
+++ openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest-instance.xsd Sun Nov 21 04:33:22 2010
@@ -38,15 +38,24 @@
</xsd:complexType>
</xsd:element>
- <!-- The root element for a single instance -->
+ <!-- The root element for a single instance. Children of this element are persistent attribute -->
+ <!-- Persistent Attributes occur in order. The order is determined by the attribute category. -->
+ <!-- Attribute category is determined by the enumerated PersistentAttributeType defined in -->
+ <!-- javax.persistence.metamodel and then further refined by id, version, lob and enum. -->
+ <!-- See org.apache.openjpa.persistence.jest.MetamodelHelper for further details. -->
<xsd:complexType name="instance-type">
<xsd:sequence>
- <xsd:element name="basic" type="basic-attr-type" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="lob" type="lob-attr-type" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="embedded" type="instance-type" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="singular" type="singular-attr-type" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="collection" type="collection-attr-type" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="map" type="map-attr-type" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="id" type="basic-attr-type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="version" type="basic-attr-type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="basic" type="basic-attr-type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="enum" type="basic-attr-type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="embedded" type="instance-type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="lob" type="lob-attr-type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="one-to-one" type="singular-attr-type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="many-to-one" type="singular-attr-type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="element-collection" type="collection-attr-type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="one-to-many" type="collection-attr-type" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="many-to-many" type="map-attr-type" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID" use="required" />
</xsd:complexType>
Modified: openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.css
URL: http://svn.apache.org/viewvc/openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.css?rev=1037380&r1=1037379&r2=1037380&view=diff
==============================================================================
--- openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.css (original)
+++ openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/jest.css Sun Nov 21 04:33:22 2010
@@ -1,3 +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.
+ */
+
.open {
display:block;
}
@@ -19,17 +38,48 @@ div {
border:1px solid black;
padding:2em 4em 2em 2em;
}
-
+/* Table Styles */
table {
+ width : 70%;
+ border-collapse:collapse;
+}
+table td th {
padding:1em 10em 2m 10em;
+ border:2px solid black;
+}
+th {
+ background-color:black;
+ color:white;
+}
+
+.error-message {
+ color:red;
+ font-weight:bold;
+ font-size:1.5em;
+}
+
+tr.even td {
+ background-color: #FFFFFF; color: black;
+ padding:2x 20px;
+ border:2px solid black;
+}
+tr.odd td {
+ background-color: #EEEEEE; color: black;
+ padding:2x 20px;
+ border:2px solid black;
}
a {
target:_blank;
}
+
.url {
color:blue;
font-size:1.2em;
font-family:"Courier New", Arial;
}
+body
+{
+background-color:#FFFFFF;
+}
Modified: openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/localizer.properties?rev=1037380&r1=1037379&r2=1037380&view=diff
==============================================================================
--- openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/localizer.properties (original)
+++ openjpa/sandboxes/jest/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/jest/localizer.properties Sun Nov 21 04:33:22 2010
@@ -15,18 +15,22 @@
# specific language governing permissions and limitations
# under the License.
-server-starting: Starting {0} ...
-server-request: Received new client request at {0}
-server-reconfigured: Server is reconfigured at port {0}
-server-failed: {0} at port {1} failed to start. Error message {2}
-request-read:Reading request from client {0}
-request-read-error:Error while reading request from client {0}
-request-status-line: Request [{0}] from client {1}
-request-bad-status:Can not determine Protocol or Method from request [{0}] from client {1}
-request-bad-protocol: JEST can not process protocol [{0}]. Currently JEST processes only HTTP protocol.
-request-bad-method: JEST can not process HTTP method [{0}]. Currently JEST supports only {1} request.
-request-unrecognized: JEST does not recognize HTTP method [{0}]. Currently JEST supports only {1} request.
-
+no-persistence-unit-param: Missing <b>persistence.unit</b> parameter. JEST Servlet must be \
+ configured with a parameter named <b>persistence.unit<b> in <init-param> clause \
+ of <servlet> declaration in <code>WEB-INF/web.xml</code> descriptor.
+servlet-init: JEST Servlet is initialized for "{0}" persistence unit.
+servlet-not-init: JEST Servlet can not find "{0}" persistence unit during servlet initialization. \
+ JEST Servlet will try to locate the unit when a request is to be served.
+
+no-persistence-unit: JEST can not locate the component using persistence unit <b>{0}</b>. This can happen \
+ for several reasons: \
+ <OL>the component is not initialized. </OL>\
+ <OL>the component and JEST servlet do not belong to the same deployment module</OL>\
+ <OL>the component did not configure the persistence unit for pooling. To enable pooling, \
+ create the persistence unit with configuration property <code>openjpa.EntityManagerFactoryPool=true</code>.<br> \
+ The property must be passed to <code>Persistence.createEntityManagerFactory(String unit, Map props)</code> \
+ with the second <code>Map</code> argument and <em>not</em> via <code>META-INF/persistence.xml</code></OL>.
+
resource-not-found: Can not locate resource {0}. <br>This can happen for wrong URI syntax. See \
<A href="http://openjpa.apache.org/jest-syntax.html" target="_blank">JEST URI Help page</A> for correct syntax.
@@ -40,4 +44,12 @@ parse-less-argument: {0} command must ha
# ----------------------------------------------------------------------
format-xml-null-parent: A null XML parent element encountered during serialization
format-xml-null-doc: Given parent element is not part of XML document
-format-xml-null-closure: Set of visited instances can not be null for serialization
\ No newline at end of file
+format-xml-null-closure: Set of visited instances can not be null for serialization
+
+
+DOCTYPE: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+dojo-lib: http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js
+dojo-theme:http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css
+dojo-config:parseOnLoad:true, isDebug:true
+javascript-instances:instances.js
+jest-css:jest.css