Seam SVN: r11719 - in branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide: en-US and 1 other directory.
by seam-commits@lists.jboss.org
Author: laubai
Date: 2009-12-04 02:00:03 -0500 (Fri, 04 Dec 2009)
New Revision: 11719
Modified:
branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/en-US/Annotations.xml
branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/en-US/Book_Info.xml
branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/en-US/Migration.xml
branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/publican.cfg
Log:
Edited config file.
Modified: branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/en-US/Annotations.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/en-US/Annotations.xml 2009-12-04 06:38:40 UTC (rev 11718)
+++ branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/en-US/Annotations.xml 2009-12-04 07:00:03 UTC (rev 11719)
@@ -135,7 +135,7 @@
<listitem>
<programlisting role="JAVA"><![CDATA[@Conversational]]></programlisting>
<para>
- Specifies that a conversation scope component is
+ Specifies that a conversation scoped component is
conversational, meaning that no method of the component may be
called unless a long-running conversation is active.
</para>
@@ -148,7 +148,7 @@
<listitem>
<programlisting role="JAVA"><![CDATA[@PerNestedConversation]]></programlisting>
<para>
- Limits the scope of a CONVERSATION-scoped component to just
+ Limits the scope of a conversation-scoped component to just
the parent conversation in which it was instantiated. The
component instance will not be visible to nested child
conversations, which will get their own instance.
Modified: branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/en-US/Book_Info.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/en-US/Book_Info.xml 2009-12-04 06:38:40 UTC (rev 11718)
+++ branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/en-US/Book_Info.xml 2009-12-04 07:00:03 UTC (rev 11719)
@@ -1,7 +1,7 @@
<?xml version='1.0'?>
<!DOCTYPE bookinfo PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
-<bookinfo id="Seam2_Reference_Guide">
+<bookinfo id="Seam_Reference_Guide">
<title>Seam Reference Guide</title>
<subtitle>for Use with JBoss Enterprise Application Platform 4.3.0 Cumulative Patch 7</subtitle>
<edition>2.0</edition>
Modified: branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/en-US/Migration.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/en-US/Migration.xml 2009-12-04 06:38:40 UTC (rev 11718)
+++ branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/en-US/Migration.xml 2009-12-04 07:00:03 UTC (rev 11719)
@@ -425,7 +425,7 @@
<table>
<title>Component's in Seam 2</title>
- <tgroup cols="2">
+ <tgroup cols="6">
<!-- <colspec colnum="1" colwidth="2*" />
<colspec colnum="2" colwidth="2*" />
<colspec colnum="3" colwidth="2*" />
Modified: branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/publican.cfg
===================================================================
--- branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/publican.cfg 2009-12-04 06:38:40 UTC (rev 11718)
+++ branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/publican.cfg 2009-12-04 07:00:03 UTC (rev 11719)
@@ -1,5 +1,5 @@
# Config::Simple 4.59
-# Fri Dec 4 16:36:22 2009
+# Fri Dec 4 16:57:52 2009
debug: 1
xml_lang: en-US
15 years
Seam SVN: r11718 - branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide.
by seam-commits@lists.jboss.org
Author: laubai
Date: 2009-12-04 01:38:40 -0500 (Fri, 04 Dec 2009)
New Revision: 11718
Added:
branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/publican.cfg
Log:
Added new publican config file.
Added: branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/publican.cfg
===================================================================
--- branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/publican.cfg (rev 0)
+++ branches/enterprise/JBPAPP_4_3_CP07/doc/Seam2_Reference_Guide/publican.cfg 2009-12-04 06:38:40 UTC (rev 11718)
@@ -0,0 +1,7 @@
+# Config::Simple 4.59
+# Fri Dec 4 16:36:22 2009
+
+debug: 1
+xml_lang: en-US
+brand: JBoss
+
15 years
Seam SVN: r11717 - in modules/trunk/remoting: src/main/java/org/jboss/seam/remoting and 1 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-03 08:28:32 -0500 (Thu, 03 Dec 2009)
New Revision: 11717
Modified:
modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/InterfaceGenerator.java
modules/trunk/remoting/src/main/resources/org/jboss/seam/remoting/remote.js
Log:
js api changes, reduced js resource size
Modified: modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml 2009-12-03 10:20:11 UTC (rev 11716)
+++ modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml 2009-12-03 13:28:32 UTC (rev 11717)
@@ -68,7 +68,7 @@
var callback = function(result) { alert(result); };
// Get a reference to the HelloAction bean and invoke the sayHello() method
- Seam.Component.create("org.jboss.seam.remoting.examples.helloworld.HelloAction", qualifiers).sayHello(name, callback);
+ Seam.Remoting.instance("org.jboss.seam.remoting.examples.helloworld.HelloAction", qualifiers).sayHello(name, callback);
// ]]>
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java 2009-12-03 10:20:11 UTC (rev 11716)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java 2009-12-03 13:28:32 UTC (rev 11717)
@@ -170,6 +170,8 @@
List<org.jboss.seam.remoting.annotationparser.syntaxtree.Annotation> annotations =
new ArrayList<org.jboss.seam.remoting.annotationparser.syntaxtree.Annotation>();
+ // TODO messy! turn this into a recursive function
+
NodeOptional n = (NodeOptional) node.f0;
if (n.present())
{
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/InterfaceGenerator.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/InterfaceGenerator.java 2009-12-03 10:20:11 UTC (rev 11716)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/InterfaceGenerator.java 2009-12-03 13:28:32 UTC (rev 11717)
@@ -405,7 +405,7 @@
componentSrc.append("\";\n\n");
// Register the component
- componentSrc.append("Seam.Component.register(Seam.Remoting.type.");
+ componentSrc.append("Seam.Remoting.registerBean(Seam.Remoting.type.");
componentSrc.append(beanName);
componentSrc.append(");\n\n");
@@ -681,7 +681,7 @@
// TODO fix this - a bean might not be named
if (classType.isAnnotationPresent(Named.class))
{
- typeSource.append("Seam.Component.register(Seam.Remoting.type.");
+ typeSource.append("Seam.Remoting.registerBean(Seam.Remoting.type.");
}
else
{
Modified: modules/trunk/remoting/src/main/resources/org/jboss/seam/remoting/remote.js
===================================================================
--- modules/trunk/remoting/src/main/resources/org/jboss/seam/remoting/remote.js 2009-12-03 10:20:11 UTC (rev 11716)
+++ modules/trunk/remoting/src/main/resources/org/jboss/seam/remoting/remote.js 2009-12-03 13:28:32 UTC (rev 11717)
@@ -1,95 +1,72 @@
-// Init base-level objects
var Seam = new Object();
Seam.Remoting = new Object();
-Seam.Component = new Object();
-Seam.pageContext = new Object();
+Seam.Remoting.beans = new Array();
-// Components registered here
-Seam.Component.components = new Array();
-Seam.Component.instances = new Array();
-
-Seam.Component.create = function(name)
-{
- for (var i = 0; i < Seam.Component.components.length; i++)
- {
- if (Seam.Component.components[i].__name == name)
- {
- var value = new Seam.Component.components[i];
- if (arguments.length > 1)
- {
- value.__qualifiers = new Array();
- for (var j = 1; j < arguments.length; j++)
- {
- value.__qualifiers.push(arguments[j]);
+Seam.Remoting.instance = function(name) {
+ var b = Seam.Remoting.beans;
+ for (var i = 0; i < b.length; i++) {
+ if (b[i].__name == name) {
+ var v = new b[i];
+ if (arguments.length > 1) {
+ v.__qualifiers = new Array();
+ for (var j = 1; j < arguments.length; j++) {
+ v.__qualifiers.push(arguments[j]);
}
}
-
- return value;
+ return v;
}
}
return null;
}
-Seam.Component.getComponentType = function(obj)
-{
- for (var i = 0; i < Seam.Component.components.length; i++)
- {
- if (obj instanceof Seam.Component.components[i])
- return Seam.Component.components[i];
+Seam.Remoting.getBeanType = function(obj) {
+ var b = Seam.Remoting.beans;
+ for (var i = 0; i < b.length; i++) {
+ if (obj instanceof b[i]) return b[i];
}
return null;
}
-Seam.Component.getComponentName = function(obj)
-{
- var componentType = Seam.Component.getComponentType(obj);
- return componentType ? componentType.__name : null;
+Seam.Remoting.getBeanName = function(obj) {
+ var t = Seam.Remoting.getBeanType(obj);
+ return t ? t.__name : null;
}
-Seam.Component.register = function(component)
-{
- for (var i = 0; i < Seam.Component.components.length; i++)
- {
- if (Seam.Component.components[i].__name == component.__name)
- {
- // Replace the existing component with the new one
- Seam.Component.components[i] = component;
+Seam.Remoting.registerBean = function(bean) {
+ var b = Seam.Remoting.beans;
+ for (var i = 0; i < b.length; i++) {
+ if (b[i].__name == bean.__name) {
+ b[i] = bean;
return;
}
}
- Seam.Component.components.push(component);
- component.__instance = null;
+ b.push(bean);
}
-Seam.Component.isRegistered = function(name)
-{
- for (var i = 0; i < Seam.Component.components.length; i++)
- {
- if (Seam.Component.components[i].__name == name)
+Seam.Remoting.isBeanRegistered = function(name) {
+ var b = Seam.Remoting.beans;
+ for (var i = 0; i < b.length; i++) {
+ if (b[i].__name == name)
return true;
}
return false;
}
-Seam.Component.getMetadata = function(obj)
-{
- for (var i = 0; i < Seam.Component.components.length; i++)
- {
- if (obj instanceof Seam.Component.components[i])
- return Seam.Component.components[i].__metadata;
+Seam.Remoting.getBeanMetadata = function(obj) {
+ var b = Seam.Remoting.beans;
+ for (var i = 0; i < b.length; i++) {
+ if (obj instanceof b[i]) return b[i].__metadata;
}
return null;
}
-Seam.Remoting.extractEncodedSessionId = function(url)
-{
- var sessionId = null;
- if (url.indexOf(';jsessionid=') >= 0)
- {
+Seam.Remoting.extractEncodedSessionId = function(url) {
+ var sid = null;
+ if (url.indexOf(';jsessionid=') >= 0) {
var qpos = url.indexOf('?');
- sessionId = url.substring(url.indexOf(';jsessionid=') + 12, qpos >= 0 ? qpos : url.length);
+ sid = url.substring(url.indexOf(';jsessionid=') + 12, qpos >= 0 ? qpos : url.length);
}
- return sessionId;
+ return sid;
}
Seam.Remoting.PATH_EXECUTE = "/execute";
@@ -98,137 +75,106 @@
Seam.Remoting.encodedSessionId = Seam.Remoting.extractEncodedSessionId(window.location.href);
-// Type declarations will live in this namespace
-Seam.Remoting.type = new Object();
+Seam.Remoting.type = new Object(); // namespace
+Seam.Remoting.types = new Array();
-// Types are registered in an array
-Seam.Remoting.types = new Array();
-
Seam.Remoting.debug = false;
Seam.Remoting.debugWindow = null;
-Seam.Remoting.setDebug = function(val)
-{
+Seam.Remoting.setDebug = function(val) {
Seam.Remoting.debug = val;
}
-// Log a message to a popup debug window
-Seam.Remoting.log = function(msg)
-{
- if (!Seam.Remoting.debug)
- return;
+Seam.Remoting.log = function(msg) {
+ if (!Seam.Remoting.debug) return;
- if (!Seam.Remoting.debugWindow || Seam.Remoting.debugWindow.document == null)
- {
+ if (!Seam.Remoting.debugWindow || Seam.Remoting.debugWindow.document == null) {
var attr = "left=400,top=400,resizable=yes,scrollbars=yes,width=400,height=400";
Seam.Remoting.debugWindow = window.open("", "__seamDebugWindow", attr);
- if (Seam.Remoting.debugWindow)
- {
+ if (Seam.Remoting.debugWindow) {
Seam.Remoting.debugWindow.document.write("<html><head><title>Seam Debug Window</title></head><body></body></html>");
- var bodyTag = Seam.Remoting.debugWindow.document.getElementsByTagName("body").item(0);
- bodyTag.style.fontFamily = "arial";
- bodyTag.style.fontSize = "8pt";
+ var t = Seam.Remoting.debugWindow.document.getElementsByTagName("body").item(0);
+ t.style.fontFamily = "arial";
+ t.style.fontSize = "8pt";
}
}
- if (Seam.Remoting.debugWindow)
- {
- msg = msg.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
- Seam.Remoting.debugWindow.document.write("<pre>" + (new Date()) + ": " + msg + "</pre><br/>");
+ if (Seam.Remoting.debugWindow) {
+ Seam.Remoting.debugWindow.document.write("<pre>" + (new Date()) + ": " + msg.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">") + "</pre><br/>");
}
}
-Seam.Remoting.createNamespace = function(namespace)
-{
- var parts = namespace.split(".");
- var base = Seam.Remoting.type;
+Seam.Remoting.createNamespace = function(namespace) {
+ var p = namespace.split(".");
+ var b = Seam.Remoting.type;
- for(var i = 0; i < parts.length; i++)
- {
- if (typeof base[parts[i]] == "undefined")
- base[parts[i]] = new Object();
- base = base[parts[i]];
+ for(var i = 0; i < p.length; i++) {
+ if (typeof b[p[i]] == "undefined") b[p[i]] = new Object();
+ b = b[p[i]];
}
}
-Seam.Remoting.__Context = function()
-{
+Seam.Remoting.__Context = function() {
this.conversationId = null;
-
- Seam.Remoting.__Context.prototype.setConversationId = function(conversationId)
- {
+ Seam.Remoting.__Context.prototype.setConversationId = function(conversationId) {
this.conversationId = conversationId;
}
- Seam.Remoting.__Context.prototype.getConversationId = function()
- {
+ Seam.Remoting.__Context.prototype.getConversationId = function() {
return this.conversationId;
}
}
-Seam.Remoting.Exception = function(msg)
-{
+Seam.Remoting.Exception = function(msg) {
this.message = msg;
-
- Seam.Remoting.Exception.prototype.getMessage = function()
- {
+ Seam.Remoting.Exception.prototype.getMessage = function() {
return this.message;
}
}
Seam.Remoting.context = new Seam.Remoting.__Context();
-Seam.Remoting.getContext = function()
-{
+Seam.Remoting.getContext = function() {
return Seam.Remoting.context;
}
-Seam.Remoting.Map = function()
-{
+Seam.Remoting.Map = function() {
this.elements = new Array();
- Seam.Remoting.Map.prototype.size = function()
- {
+ Seam.Remoting.Map.prototype.size = function() {
return this.elements.length;
}
- Seam.Remoting.Map.prototype.isEmpty = function()
- {
+ Seam.Remoting.Map.prototype.isEmpty = function() {
return this.elements.length == 0;
}
- Seam.Remoting.Map.prototype.keySet = function()
- {
+ Seam.Remoting.Map.prototype.keySet = function() {
var keySet = new Array();
- for (var i = 0; i < this.elements.length; i++)
+ for (var i = 0; i < this.elements.length; i++) {
keySet[keySet.length] = this.elements[i].key;
+ }
return keySet;
}
- Seam.Remoting.Map.prototype.values = function()
- {
+ Seam.Remoting.Map.prototype.values = function() {
var values = new Array();
- for (var i = 0; i < this.elements.length; i++)
+ for (var i = 0; i < this.elements.length; i++) {
values[values.length] = this.elements[i].value;
+ }
return values;
}
- Seam.Remoting.Map.prototype.get = function(key)
- {
- for (var i = 0; i < this.elements.length; i++)
- {
- if (this.elements[i].key == key)
- return this.elements[i].value;
+ Seam.Remoting.Map.prototype.get = function(key) {
+ for (var i = 0; i < this.elements.length; i++) {
+ if (this.elements[i].key == key) return this.elements[i].value;
}
return null;
}
- Seam.Remoting.Map.prototype.put = function(key, value)
- {
- for (var i = 0; i < this.elements.length; i++)
- {
- if (this.elements[i].key == key)
- {
+ Seam.Remoting.Map.prototype.put = function(key, value) {
+ for (var i = 0; i < this.elements.length; i++) {
+ if (this.elements[i].key == key) {
this.elements[i].value = value;
return;
}
@@ -236,32 +182,24 @@
this.elements.push({key:key,value:value});
}
- Seam.Remoting.Map.prototype.remove = function(key)
- {
- for (var i = 0; i < this.elements.length; i++)
- {
+ Seam.Remoting.Map.prototype.remove = function(key) {
+ for (var i = 0; i < this.elements.length; i++) {
if (this.elements[i].key == key)
this.elements.splice(i, 1);
}
}
- Seam.Remoting.Map.prototype.contains = function(key)
- {
- for (var i = 0; i < this.elements.length; i++)
- {
- if (this.elements[i].key == key)
- return true;
+ Seam.Remoting.Map.prototype.contains = function(key) {
+ for (var i = 0; i < this.elements.length; i++) {
+ if (this.elements[i].key == key) return true;
}
return false;
}
}
-Seam.Remoting.registerType = function(type)
-{
- for (var i = 0; i < Seam.Remoting.types.length; i++)
- {
- if (Seam.Remoting.types[i].__name == type.__name)
- {
+Seam.Remoting.registerType = function(type) {
+ for (var i = 0; i < Seam.Remoting.types.length; i++) {
+ if (Seam.Remoting.types[i].__name == type.__name) {
Seam.Remoting.types[i] = type;
return;
}
@@ -269,68 +207,49 @@
Seam.Remoting.types.push(type);
}
-Seam.Remoting.createType = function(name)
-{
- for (var i = 0; i < Seam.Remoting.types.length; i++)
- {
+Seam.Remoting.createType = function(name) {
+ for (var i = 0; i < Seam.Remoting.types.length; i++) {
if (Seam.Remoting.types[i].__name == name)
return new Seam.Remoting.types[i];
}
}
-Seam.Remoting.getType = function(obj)
-{
- for (var i = 0; i < Seam.Remoting.types.length; i++)
- {
- if (obj instanceof Seam.Remoting.types[i])
- return Seam.Remoting.types[i];
+Seam.Remoting.getType = function(obj) {
+ for (var i = 0; i < Seam.Remoting.types.length; i++) {
+ if (obj instanceof Seam.Remoting.types[i]) return Seam.Remoting.types[i];
}
return null;
}
-Seam.Remoting.getTypeName = function(obj)
-{
+Seam.Remoting.getTypeName = function(obj) {
var type = Seam.Remoting.getType(obj);
return type ? type.__name : null;
}
-Seam.Remoting.getMetadata = function(obj)
-{
- for (var i = 0; i < Seam.Remoting.types.length; i++)
- {
+Seam.Remoting.getMetadata = function(obj) {
+ for (var i = 0; i < Seam.Remoting.types.length; i++) {
if (obj instanceof Seam.Remoting.types[i])
return Seam.Remoting.types[i].__metadata;
}
return null;
}
-Seam.Remoting.serializeValue = function(value, type, refs)
-{
- if (value == null)
+Seam.Remoting.serializeValue = function(value, type, refs) {
+ if (value == null) {
return "<null/>";
- else if (type)
- {
+ }
+ else if (type) {
switch (type) {
- // Boolean
case "bool": return "<bool>" + (value ? "true" : "false") + "</bool>";
-
- // Numerical types
case "number": return "<number>" + value + "</number>";
-
- // Date
case "date": return Seam.Remoting.serializeDate(value);
- // Beans
case "bean": return Seam.Remoting.getTypeRef(value, refs);
-
- // Collections
case "bag": return Seam.Remoting.serializeBag(value, refs);
case "map": return Seam.Remoting.serializeMap(value, refs);
-
default: return "<str>" + encodeURIComponent(value) + "</str>";
}
}
- else // We don't know the type.. try to guess
- {
+ else {
switch (typeof(value)) {
case "number":
return "<number>" + value + "</number>";
@@ -346,403 +265,285 @@
else
return Seam.Remoting.getTypeRef(value, refs);
default:
- return "<str>" + encodeURIComponent(value) + "</str>"; // Default to String
+ return "<str>" + encodeURIComponent(value) + "</str>";
}
}
}
-Seam.Remoting.serializeBag = function(value, refs)
-{
- var data = "<bag>";
-
- for (var i = 0; i < value.length; i++)
- {
- data += "<element>";
- data += Seam.Remoting.serializeValue(value[i], null, refs);
- data += "</element>";
+Seam.Remoting.serializeBag = function(value, refs) {
+ var d = "<bag>";
+ for (var i = 0; i < value.length; i++) {
+ d += "<element>";
+ d += Seam.Remoting.serializeValue(value[i], null, refs);
+ d += "</element>";
}
-
- data += "</bag>";
- return data;
+ d += "</bag>";
+ return d;
}
-Seam.Remoting.serializeMap = function(value, refs)
-{
- var data = "<map>";
-
+Seam.Remoting.serializeMap = function(value, refs) {
+ var d = "<map>";
var keyset = value.keySet();
- for (var i = 0; i < keyset.length; i++)
- {
- data += "<element><k>";
- data += Seam.Remoting.serializeValue(keyset[i], null, refs);
- data += "</k><v>";
- data += Seam.Remoting.serializeValue(value.get(keyset[i]), null, refs);
- data += "</v></element>";
+ for (var i = 0; i < keyset.length; i++) {
+ d += "<element><k>";
+ d += Seam.Remoting.serializeValue(keyset[i], null, refs);
+ d += "</k><v>";
+ d += Seam.Remoting.serializeValue(value.get(keyset[i]), null, refs);
+ d += "</v></element>";
}
- data += "</map>";
- return data;
+ d += "</map>";
+ return d;
}
-Seam.Remoting.serializeDate = function(value)
-{
+Seam.Remoting.serializeDate = function(value) {
var zeroPad = function(val, digits) { while (("" + val).length < digits) val = "0" + val; return val; };
- var data = "<date>";
- data += value.getFullYear();
- data += zeroPad(value.getMonth() + 1, 2);
- data += zeroPad(value.getDate(), 2);
- data += zeroPad(value.getHours(), 2);
- data += zeroPad(value.getMinutes(), 2);
- data += zeroPad(value.getSeconds(), 2);
- data += zeroPad(value.getMilliseconds(), 3);
- data += "</date>";
- return data;
+ return "<date>" + value.getFullYear() + zeroPad(value.getMonth() + 1, 2) + zeroPad(value.getDate(), 2) +
+ zeroPad(value.getHours(), 2) + zeroPad(value.getMinutes(), 2) + zeroPad(value.getSeconds(), 2) +
+ zeroPad(value.getMilliseconds(), 3) +"</date>";
}
-Seam.Remoting.getTypeRef = function(obj, refs)
-{
+Seam.Remoting.getTypeRef = function(obj, refs) {
var refId = -1;
-
- for (var i = 0; i < refs.length; i++)
- {
- if (refs[i] == obj)
- {
+ for (var i = 0; i < refs.length; i++) {
+ if (refs[i] == obj) {
refId = i;
break;
}
}
-
- if (refId == -1)
- {
+ if (refId == -1) {
refId = refs.length;
refs[refId] = obj;
}
-
return "<ref id=\"" + refId + "\"/>";
}
-Seam.Remoting.serializeType = function(obj, refs)
-{
- var data = "<bean type=\"";
+Seam.Remoting.serializeType = function(obj, refs) {
+ var d = "<bean type=\"";
+ var t = Seam.Remoting.getBeanType(obj);
+ var isComponent = t != null;
+ if (!isComponent) t = Seam.Remoting.getType(obj);
- var objType = Seam.Component.getComponentType(obj);
- var isComponent = objType != null;
-
- if (!isComponent)
- objType = Seam.Remoting.getType(obj);
-
- if (!objType)
- {
+ if (!t) {
alert("Unknown Type error.");
return null;
}
- data += objType.__name;
- data += "\">\n";
+ d += t.__name;
+ d += "\">\n";
- var meta = isComponent ? Seam.Component.getMetadata(obj) : Seam.Remoting.getMetadata(obj);
- for (var i = 0; i < meta.length; i++)
- {
- data += "<member name=\"";
- data += meta[i].field;
- data += "\">";
- data += Seam.Remoting.serializeValue(obj[meta[i].field], meta[i].type, refs);
- data += "</member>\n";
+ var meta = isComponent ? Seam.Remoting.getBeanMetadata(obj) : Seam.Remoting.getMetadata(obj);
+ for (var i = 0; i < meta.length; i++) {
+ d += "<member name=\"";
+ d += meta[i].field;
+ d += "\">";
+ d += Seam.Remoting.serializeValue(obj[meta[i].field], meta[i].type, refs);
+ d += "</member>\n";
}
- data += "</bean>";
+ d += "</bean>";
- return data;
+ return d;
}
Seam.Remoting.__callId = 0;
-// eval() disabled until security issues resolved.
-
-//Seam.Remoting.eval = function(expression, callback)
-//{
-// var callId = "" + Seam.Remoting.__callId++;
-// var data = "<eval expr=\"";
-// data += expression;
-// data += "\" id=\"";
-// data += callId;
-// data += "\"/>";
-// var call = {data: data, id: callId, callback: callback};
-
-// var envelope = Seam.Remoting.createEnvelope(Seam.Remoting.createHeader(), data);
-// Seam.Remoting.pendingCalls.put(call.id, call);
-
-// call.asyncReq = Seam.Remoting.sendAjaxRequest(envelope, Seam.Remoting.PATH_EXECUTE, Seam.Remoting.processResponse, false);
-//}
-
-Seam.Remoting.createCall = function(component, methodName, params, callback, exceptionHandler)
-{
+Seam.Remoting.createCall = function(component, methodName, params, callback, exceptionHandler) {
var callId = "" + Seam.Remoting.__callId++;
- if (!callback)
- callback = component.__callback[methodName];
+ if (!callback) callback = component.__callback[methodName];
- var data = "<call id=\"" + callId + "\">\n";
- data += "<target>" + Seam.Component.getComponentType(component).__name + "</target>";
+ var d = "<call id=\"" + callId + "\">\n";
+ d += "<target>" + Seam.Remoting.getBeanType(component).__name + "</target>";
- if (component.__qualifiers != null)
- {
- data += "<qualifiers>";
-
- for (var i = 0; i < component.__qualifiers.length; i++)
- {
- data += component.__qualifiers[i];
+ if (component.__qualifiers != null) {
+ d += "<qualifiers>";
+ for (var i = 0; i < component.__qualifiers.length; i++) {
+ d += component.__qualifiers[i];
if (i < component.__qualifiers.length - 1) data += ",";
- }
-
- data += "</qualifiers>";
+ }
+ d += "</qualifiers>";
}
- data += "<method>" + methodName + "</method>";
+ d += "<method>" + methodName + "</method>";
+ d += "<params>";
- // Add parameters
- data += "<params>";
-
var refs = new Array();
-
- for (var i = 0; i < params.length; i++)
- {
- data += "<param>";
- data += Seam.Remoting.serializeValue(params[i], null, refs);
- data += "</param>";
+ for (var i = 0; i < params.length; i++) {
+ d += "<param>";
+ d += Seam.Remoting.serializeValue(params[i], null, refs);
+ d += "</param>";
}
- data += "</params>";
-
- // Add refs
- data += "<refs>";
- for (var i = 0; i < refs.length; i++)
- {
- data += "<ref id=\"" + i + "\">";
- data += Seam.Remoting.serializeType(refs[i], refs);
- data += "</ref>";
+ d += "</params>";
+ d += "<refs>";
+ for (var i = 0; i < refs.length; i++) {
+ d += "<ref id=\"" + i + "\">";
+ d += Seam.Remoting.serializeType(refs[i], refs);
+ d += "</ref>";
}
- data += "</refs>";
+ d += "</refs>";
+ d += "</call>";
- data += "</call>";
-
- return {data: data, id: callId, callback: callback, exceptionHandler: exceptionHandler};
+ return {data: d, id: callId, callback: callback, exceptionHandler: exceptionHandler};
}
-Seam.Remoting.createHeader = function()
-{
- var header = "";
-
- header += "<context>";
- if (Seam.Remoting.getContext().getConversationId())
- {
- header += "<conversationId>";
- header += Seam.Remoting.getContext().getConversationId();
- header += "</conversationId>";
+Seam.Remoting.createHeader = function() {
+ var h = "<context>";
+ if (Seam.Remoting.getContext().getConversationId()) {
+ h += "<conversationId>";
+ h += Seam.Remoting.getContext().getConversationId();
+ h += "</conversationId>";
}
- header += "</context>";
-
- return header;
+ h += "</context>";
+ return h;
}
-Seam.Remoting.createEnvelope = function(header, body)
-{
- var data = "<envelope>";
-
- if (header)
- {
- data += "<header>";
- data += header;
- data += "</header>";
- }
-
- if (body)
- {
- data += "<body>";
- data += body;
- data += "</body>";
- }
-
- data += "</envelope>";
-
- return data;
+Seam.Remoting.createEnvelope = function(header, body) {
+ var d = "<envelope>";
+ if (header) d += "<header>" + header + "</header>";
+ if (body) d += "<body>" + body + "</body>";
+ d += "</envelope>";
+ return d;
}
Seam.Remoting.pendingCalls = new Seam.Remoting.Map();
Seam.Remoting.inBatch = false;
Seam.Remoting.batchedCalls = new Array();
-Seam.Remoting.startBatch = function()
-{
+Seam.Remoting.startBatch = function() {
Seam.Remoting.inBatch = true;
Seam.Remoting.batchedCalls.length = 0;
}
-Seam.Remoting.executeBatch = function()
-{
- if (!Seam.Remoting.inBatch)
- return;
+Seam.Remoting.executeBatch = function() {
+ if (!Seam.Remoting.inBatch) return;
- var data = "";
- for (var i = 0; i < Seam.Remoting.batchedCalls.length; i++)
- {
+ var d = "";
+ for (var i = 0; i < Seam.Remoting.batchedCalls.length; i++) {
Seam.Remoting.pendingCalls.put(Seam.Remoting.batchedCalls[i].id, Seam.Remoting.batchedCalls[i]);
- data += Seam.Remoting.batchedCalls[i].data;
+ d += Seam.Remoting.batchedCalls[i].data;
}
- var envelope = Seam.Remoting.createEnvelope(Seam.Remoting.createHeader(), data);
- Seam.Remoting.batchAsyncReq = Seam.Remoting.sendAjaxRequest(envelope, Seam.Remoting.PATH_EXECUTE, Seam.Remoting.processResponse, false);
+ var envelope = Seam.Remoting.createEnvelope(Seam.Remoting.createHeader(), d);
+ Seam.Remoting.batchAsyncReq = Seam.Remoting.sendAjaxRequest(envelope, Seam.Remoting.PATH_EXECUTE,
+ Seam.Remoting.processResponse, false);
Seam.Remoting.inBatch = false;
}
-Seam.Remoting.cancelBatch = function()
-{
+Seam.Remoting.cancelBatch = function() {
Seam.Remoting.inBatch = false;
- for (var i = 0; i < Seam.Remoting.batchedCalls.length; i++)
+ for (var i = 0; i < Seam.Remoting.batchedCalls.length; i++) {
Seam.Remoting.pendingCalls.remove(Seam.Remoting.batchedCalls[i].id);
+ }
}
-Seam.Remoting.cancelCall = function(callId)
-{
- var call = Seam.Remoting.pendingCalls.get(callId);
+Seam.Remoting.cancelCall = function(callId) {
+ var c = Seam.Remoting.pendingCalls.get(callId);
Seam.Remoting.pendingCalls.remove(callId);
- if (call && call.asyncReq)
- {
- if (Seam.Remoting.pendingCalls.isEmpty())
- Seam.Remoting.hideLoadingMessage();
+ if (c && c.asyncReq) {
+ if (Seam.Remoting.pendingCalls.isEmpty()) Seam.Remoting.hideLoadingMessage();
window.setTimeout(function() {
- call.asyncReq.onreadystatechange = function() {};
+ c.asyncReq.onreadystatechange = function() {};
}, 0);
- call.asyncReq.abort();
+ c.asyncReq.abort();
}
}
-Seam.Remoting.execute = function(component, methodName, params, callback, exceptionHandler)
-{
- var call = Seam.Remoting.createCall(component, methodName, params, callback, exceptionHandler);
-
- if (Seam.Remoting.inBatch)
- {
- Seam.Remoting.batchedCalls[Seam.Remoting.batchedCalls.length] = call;
+Seam.Remoting.execute = function(component, methodName, params, callback, exceptionHandler) {
+ var c = Seam.Remoting.createCall(component, methodName, params, callback, exceptionHandler);
+ if (Seam.Remoting.inBatch) {
+ Seam.Remoting.batchedCalls[Seam.Remoting.batchedCalls.length] = c;
}
- else
- {
- // Marshal the request
- var envelope = Seam.Remoting.createEnvelope(Seam.Remoting.createHeader(), call.data);
- Seam.Remoting.pendingCalls.put(call.id, call);
+ else {
+ var envelope = Seam.Remoting.createEnvelope(Seam.Remoting.createHeader(), c.data);
+ Seam.Remoting.pendingCalls.put(c.id, c);
Seam.Remoting.sendAjaxRequest(envelope, Seam.Remoting.PATH_EXECUTE, Seam.Remoting.processResponse, false);
}
-
- return call;
+ return c;
}
Seam.Remoting.sendAjaxRequest = function(envelope, path, callback, silent)
{
Seam.Remoting.log("Request packet:\n" + envelope);
-
- if (!silent)
- Seam.Remoting.displayLoadingMessage();
-
- var asyncReq;
-
- if (window.XMLHttpRequest)
- {
- asyncReq = new XMLHttpRequest();
- if (asyncReq.overrideMimeType)
- asyncReq.overrideMimeType('text/xml');
+ if (!silent) Seam.Remoting.displayLoadingMessage();
+ var r;
+ if (window.XMLHttpRequest) {
+ r = new XMLHttpRequest();
+ if (r.overrideMimeType) r.overrideMimeType('text/xml');
}
- else
- {
- asyncReq = new ActiveXObject("Microsoft.XMLHTTP");
+ else {
+ r = new ActiveXObject("Microsoft.XMLHTTP");
}
- asyncReq.onreadystatechange = function()
- {
- if (asyncReq.readyState == 4)
- {
- var inScope = typeof(Seam) == "undefined" ? false : true;
-
+ r.onreadystatechange = function() {
+ if (r.readyState == 4) {
+ var inScope = typeof(Seam) == "undefined" ? false : true;
if (inScope) Seam.Remoting.hideLoadingMessage();
- if (asyncReq.status == 200)
- {
+ if (r.status == 200) {
// We do this to avoid a memory leak
window.setTimeout(function() {
- asyncReq.onreadystatechange = function() {};
+ r.onreadystatechange = function() {};
}, 0);
- if (inScope) Seam.Remoting.log("Response packet:\n" + asyncReq.responseText);
+ if (inScope) Seam.Remoting.log("Response packet:\n" + r.responseText);
- if (callback)
- {
+ if (callback) {
// The following code deals with a Firefox security issue. It reparses the XML
// response if accessing the documentElement throws an exception
- try
- {
- asyncReq.responseXML.documentElement;
- //Seam.Remoting.processResponse(asyncReq.responseXML);
- callback(asyncReq.responseXML);
+ try {
+ r.responseXML.documentElement;
+ callback(r.responseXML);
}
- catch (ex)
- {
- try
- {
+ catch (ex) {
+ try {
// Try it the IE way first...
var doc = new ActiveXObject("Microsoft.XMLDOM");
doc.async = "false";
- doc.loadXML(asyncReq.responseText);
+ doc.loadXML(r.responseText);
callback(doc);
}
- catch (e)
- {
+ catch (e) {
// If that fails, use standards
var parser = new DOMParser();
- //Seam.Remoting.processResponse(parser.parseFromString(asyncReq.responseText, "text/xml"));
- callback(parser.parseFromString(asyncReq.responseText, "text/xml"));
+ callback(parser.parseFromString(r.responseText, "text/xml"));
}
}
}
}
- else
- {
- Seam.Remoting.displayError(asyncReq.status);
+ else {
+ Seam.Remoting.displayError(r.status);
}
}
}
- if (Seam.Remoting.encodedSessionId)
- {
+ if (Seam.Remoting.encodedSessionId) {
path += ';jsessionid=' + Seam.Remoting.encodedSessionId;
}
- asyncReq.open("POST", Seam.Remoting.resourcePath + path, true);
- asyncReq.send(envelope);
+ r.open("POST", Seam.Remoting.resourcePath + path, true);
+ r.send(envelope);
}
-Seam.Remoting.displayError = function(code)
-{
+Seam.Remoting.displayError = function(code) {
alert("There was an error processing your request. Error code: " + code);
}
-Seam.Remoting.setCallback = function(component, methodName, callback)
-{
+Seam.Remoting.setCallback = function(component, methodName, callback) {
component.__callback[methodName] = callback;
}
-Seam.Remoting.processResponse = function(doc)
-{
+Seam.Remoting.processResponse = function(doc) {
var headerNode;
var bodyNode;
-
var inScope = typeof(Seam) == "undefined" ? false : true;
if (!inScope) return;
var context = new Seam.Remoting.__Context;
- if (doc.documentElement)
- {
- for (var i = 0; i < doc.documentElement.childNodes.length; i++)
- {
+ if (doc.documentElement) {
+ for (var i = 0; i < doc.documentElement.childNodes.length; i++) {
var node = doc.documentElement.childNodes.item(i);
if (node.tagName == "header")
headerNode = node;
@@ -751,122 +552,97 @@
}
}
- if (headerNode)
- {
+ if (headerNode) {
var contextNode;
- for (var i = 0; i < headerNode.childNodes.length; i++)
- {
+ for (var i = 0; i < headerNode.childNodes.length; i++) {
var node = headerNode.childNodes.item(i);
- if (node.tagName == "context")
- {
+ if (node.tagName == "context") {
contextNode = node;
break;
}
}
- if (contextNode && context)
- {
+ if (contextNode && context) {
Seam.Remoting.unmarshalContext(contextNode, context);
if (context.getConversationId() && Seam.Remoting.getContext().getConversationId() == null)
Seam.Remoting.getContext().setConversationId(context.getConversationId());
}
}
- if (bodyNode)
- {
- for (var i = 0; i < bodyNode.childNodes.length; i++)
- {
- var node = bodyNode.childNodes.item(i);
- if (node.tagName == "result")
- Seam.Remoting.processResult(node, context);
+ if (bodyNode) {
+ for (var i = 0; i < bodyNode.childNodes.length; i++) {
+ var n = bodyNode.childNodes.item(i);
+ if (n.tagName == "result") Seam.Remoting.processResult(n, context);
}
}
}
-Seam.Remoting.processResult = function(result, context)
-{
+Seam.Remoting.processResult = function(result, context) {
var callId = result.getAttribute("id");
var call = Seam.Remoting.pendingCalls.get(callId);
Seam.Remoting.pendingCalls.remove(callId);
- if (call && (call.callback || call.exceptionHandler))
- {
+ if (call && (call.callback || call.exceptionHandler)) {
var valueNode = null;
var refsNode = null;
var exceptionNode = null;
- var children = result.childNodes;
- for (var i = 0; i < children.length; i++)
- {
- var tag = children.item(i).tagName;
+ var c = result.childNodes;
+ for (var i = 0; i < c.length; i++) {
+ var tag = c.item(i).tagName;
if (tag == "value")
- valueNode = children.item(i);
+ valueNode = c.item(i);
else if (tag == "refs")
- refsNode = children.item(i);
+ refsNode = c.item(i);
else if (tag == "exception")
- exceptionNode = children.item(i);
+ exceptionNode = c.item(i);
}
- if (exceptionNode != null)
- {
+ if (exceptionNode != null) {
var msgNode = null;
- var children = exceptionNode.childNodes;
- for (var i = 0; i < children.length; i++)
- {
- var tag = children.item(i).tagName;
+ var c = exceptionNode.childNodes;
+ for (var i = 0; i < c.length; i++) {
+ var tag = c.item(i).tagName;
if (tag == "message")
- msgNode = children.item(i);
+ msgNode = c.item(i);
}
var msg = Seam.Remoting.unmarshalValue(msgNode.firstChild);
var ex = new Seam.Remoting.Exception(msg);
call.exceptionHandler(ex);
}
- else
- {
+ else {
var refs = new Array();
- if (refsNode)
- Seam.Remoting.unmarshalRefs(refsNode, refs);
-
+ if (refsNode) Seam.Remoting.unmarshalRefs(refsNode, refs);
var value = Seam.Remoting.unmarshalValue(valueNode.firstChild, refs);
-
call.callback(value, context, callId);
}
}
}
-Seam.Remoting.unmarshalContext = function(ctxNode, context)
-{
- for (var i = 0; i < ctxNode.childNodes.length; i++)
- {
+Seam.Remoting.unmarshalContext = function(ctxNode, context) {
+ for (var i = 0; i < ctxNode.childNodes.length; i++) {
var tag = ctxNode.childNodes.item(i).tagName;
- if (tag == "conversationId")
- context.setConversationId(ctxNode.childNodes.item(i).firstChild.nodeValue);
+ if (tag == "conversationId") context.setConversationId(ctxNode.childNodes.item(i).firstChild.nodeValue);
}
}
-Seam.Remoting.unmarshalRefs = function(refsNode, refs)
-{
+Seam.Remoting.unmarshalRefs = function(refsNode, refs) {
var objs = new Array();
- // Pass 1 - create the reference objects
- for (var i = 0; i < refsNode.childNodes.length; i++)
- {
- if (refsNode.childNodes.item(i).tagName == "ref")
- {
+ for (var i = 0; i < refsNode.childNodes.length; i++) {
+ if (refsNode.childNodes.item(i).tagName == "ref") {
var refNode = refsNode.childNodes.item(i);
var refId = parseInt(refNode.getAttribute("id"));
var valueNode = refNode.firstChild;
- if (valueNode.tagName == "bean")
- {
+ if (valueNode.tagName == "bean") {
var obj = null;
var typeName = valueNode.getAttribute("type");
- if (Seam.Component.isRegistered(typeName))
- obj = Seam.Component.newInstance(typeName);
+ if (Seam.Remoting.isBeanRegistered(typeName))
+ obj = Seam.Remoting.instance(typeName);
else
obj = Seam.Remoting.createType(typeName);
- if (obj)
- {
+ if (obj) {
refs[refId] = obj;
objs[objs.length] = {obj: obj, node: valueNode};
}
@@ -874,14 +650,10 @@
}
}
- // Pass 2 - populate the object members
- for (var i = 0; i < objs.length; i++)
- {
- for (var j = 0; j < objs[i].node.childNodes.length; j++)
- {
+ for (var i = 0; i < objs.length; i++) {
+ for (var j = 0; j < objs[i].node.childNodes.length; j++) {
var child = objs[i].node.childNodes.item(j);
- if (child.tagName == "member")
- {
+ if (child.tagName == "member") {
var name = child.getAttribute("name");
objs[i].obj[name] = Seam.Remoting.unmarshalValue(child.firstChild, refs);
}
@@ -889,12 +661,10 @@
}
}
-Seam.Remoting.unmarshalValue = function(element, refs)
-{
+Seam.Remoting.unmarshalValue = function(element, refs) {
var tag = element.tagName;
- switch (tag)
- {
+ switch (tag) {
case "bool": return element.firstChild.nodeValue == "true";
case "number":
if (element.firstChild.nodeValue.indexOf(".") == -1)
@@ -903,41 +673,35 @@
return parseFloat(element.firstChild.nodeValue);
case "str":
var data = "";
- for (var i = 0; i < element.childNodes.length; i++)
- {
- if (element.childNodes[i].nodeType == 3) // NODE_TEXT
+ for (var i = 0; i < element.childNodes.length; i++) {
+ if (element.childNodes[i].nodeType == 3)
data += element.childNodes[i].nodeValue;
}
return decodeURIComponent(data);
case "ref": return refs[parseInt(element.getAttribute("id"))];
case "bag":
var value = new Array();
- for (var i = 0; i < element.childNodes.length; i++)
- {
+ for (var i = 0; i < element.childNodes.length; i++) {
if (element.childNodes.item(i).tagName == "element")
value[value.length] = Seam.Remoting.unmarshalValue(element.childNodes.item(i).firstChild, refs);
}
return value;
case "map":
var map = new Seam.Remoting.Map();
- for (var i = 0; i < element.childNodes.length; i++)
- {
+ for (var i = 0; i < element.childNodes.length; i++) {
var childNode = element.childNodes.item(i);
- if (childNode.tagName == "element")
- {
+ if (childNode.tagName == "element") {
var key = null
var value = null;
- for (var j = 0; j < childNode.childNodes.length; j++)
- {
+ for (var j = 0; j < childNode.childNodes.length; j++) {
if (key == null && childNode.childNodes.item(j).tagName == "k")
key = Seam.Remoting.unmarshalValue(childNode.childNodes.item(j).firstChild, refs);
else if (value == null && childNode.childNodes.item(j).tagName == "v")
value = Seam.Remoting.unmarshalValue(childNode.childNodes.item(j).firstChild, refs);
}
- if (key != null)
- map.put(key, value);
+ if (key != null) map.put(key, value);
}
}
return map;
@@ -946,8 +710,7 @@
}
}
-Seam.Remoting.deserializeDate = function(val)
-{
+Seam.Remoting.deserializeDate = function(val) {
var dte = new Date();
dte.setFullYear(parseInt(val.substring(0,4), 10),
parseInt(val.substring(4,6), 10) - 1,
@@ -961,38 +724,33 @@
Seam.Remoting.loadingMsgDiv = null;
Seam.Remoting.loadingMessage = "Please wait...";
-Seam.Remoting.displayLoadingMessage = function()
-{
- if (!Seam.Remoting.loadingMsgDiv)
- {
+Seam.Remoting.displayLoadingMessage = function() {
+ if (!Seam.Remoting.loadingMsgDiv) {
Seam.Remoting.loadingMsgDiv = document.createElement('div');
- var msgDiv = Seam.Remoting.loadingMsgDiv;
- msgDiv.setAttribute('id', 'loadingMsg');
+ var d = Seam.Remoting.loadingMsgDiv;
+ d.setAttribute('id', 'loadingMsg');
+ d.style.position = "absolute";
+ d.style.top = "0px";
+ d.style.right = "0px";
+ d.style.background = "red";
+ d.style.color = "white";
+ d.style.fontFamily = "Verdana,Helvetica,Arial";
+ d.style.fontSize = "small";
+ d.style.padding = "2px";
+ d.style.border = "1px solid black";
- msgDiv.style.position = "absolute";
- msgDiv.style.top = "0px";
- msgDiv.style.right = "0px";
- msgDiv.style.background = "red";
- msgDiv.style.color = "white";
- msgDiv.style.fontFamily = "Verdana,Helvetica,Arial";
- msgDiv.style.fontSize = "small";
- msgDiv.style.padding = "2px";
- msgDiv.style.border = "1px solid black";
+ document.body.appendChild(d);
- document.body.appendChild(msgDiv);
-
var text = document.createTextNode(Seam.Remoting.loadingMessage);
- msgDiv.appendChild(text);
+ d.appendChild(text);
}
- else
- {
+ else {
Seam.Remoting.loadingMsgDiv.innerHTML = Seam.Remoting.loadingMessage;
Seam.Remoting.loadingMsgDiv.style.visibility = 'visible';
}
}
-Seam.Remoting.hideLoadingMessage = function()
-{
+Seam.Remoting.hideLoadingMessage = function() {
if (Seam.Remoting.loadingMsgDiv)
Seam.Remoting.loadingMsgDiv.style.visibility = 'hidden';
}
@@ -1003,22 +761,18 @@
Seam.Remoting.pollTimeout = 0; // Default timeout of 0 seconds
Seam.Remoting.polling = false;
-Seam.Remoting.setPollInterval = function(interval)
-{
+Seam.Remoting.setPollInterval = function(interval) {
Seam.Remoting.pollInterval = interval;
}
-Seam.Remoting.setPollTimeout = function(timeout)
-{
+Seam.Remoting.setPollTimeout = function(timeout) {
Seam.Remoting.pollTimeout = timeout;
}
Seam.Remoting.subscriptionRegistry = new Array();
-Seam.Remoting.subscribe = function(topicName, callback)
-{
- for (var i = 0; i < Seam.Remoting.subscriptionRegistry.length; i++)
- {
+Seam.Remoting.subscribe = function(topicName, callback) {
+ for (var i = 0; i < Seam.Remoting.subscriptionRegistry.length; i++) {
if (Seam.Remoting.subscriptionRegistry[i].topic == topicName)
return;
}
@@ -1029,41 +783,32 @@
Seam.Remoting.sendAjaxRequest(env, Seam.Remoting.PATH_SUBSCRIPTION, Seam.Remoting.subscriptionCallback, false);
}
-Seam.Remoting.unsubscribe = function(topicName)
-{
+Seam.Remoting.unsubscribe = function(topicName) {
var token = null;
- for (var i = 0; i < Seam.Remoting.subscriptionRegistry.length; i++)
- {
- if (Seam.Remoting.subscriptionRegistry[i].topic == topicName)
- {
+ for (var i = 0; i < Seam.Remoting.subscriptionRegistry.length; i++) {
+ if (Seam.Remoting.subscriptionRegistry[i].topic == topicName) {
token = Seam.Remoting.subscriptionRegistry[i].token;
Seam.Remoting.subscriptionRegistry.splice(i, 1);
}
}
- if (token)
- {
+ if (token) {
var body = "<unsubscribe token=\"" + token + "\"/>";
var env = Seam.Remoting.createEnvelope(null, body);
Seam.Remoting.sendAjaxRequest(env, Seam.Remoting.PATH_SUBSCRIPTION, null, false);
}
}
-Seam.Remoting.subscriptionCallback = function(doc)
-{
+Seam.Remoting.subscriptionCallback = function(doc) {
var body = doc.documentElement.firstChild;
- for (var i = 0; i < body.childNodes.length; i++)
- {
+ for (var i = 0; i < body.childNodes.length; i++) {
var node = body.childNodes.item(i);
- if (node.tagName == "subscription")
- {
+ if (node.tagName == "subscription") {
var topic = node.getAttribute("topic");
var token = node.getAttribute("token");
- for (var i = 0; i < Seam.Remoting.subscriptionRegistry.length; i++)
- {
- if (Seam.Remoting.subscriptionRegistry[i].topic == topic)
- {
+ for (var i = 0; i < Seam.Remoting.subscriptionRegistry.length; i++) {
+ if (Seam.Remoting.subscriptionRegistry[i].topic == topic) {
Seam.Remoting.subscriptionRegistry[i].token = token;
Seam.Remoting.poll();
break;
@@ -1075,24 +820,20 @@
Seam.Remoting.pollTimeoutFunction = null;
-Seam.Remoting.poll = function()
-{
- if (Seam.Remoting.polling)
- return;
+Seam.Remoting.poll = function() {
+ if (Seam.Remoting.polling) return;
Seam.Remoting.polling = true;
clearTimeout(Seam.Remoting.pollTimeoutFunction);
var body = "";
- if (Seam.Remoting.subscriptionRegistry.length == 0)
- {
+ if (Seam.Remoting.subscriptionRegistry.length == 0) {
Seam.Remoting.polling = false;
return;
}
- for (var i = 0; i < Seam.Remoting.subscriptionRegistry.length; i++)
- {
+ for (var i = 0; i < Seam.Remoting.subscriptionRegistry.length; i++) {
body += "<poll token=\"" + Seam.Remoting.subscriptionRegistry[i].token + "\" ";
body += "timeout=\"" + Seam.Remoting.pollTimeout + "\"/>";
}
@@ -1101,13 +842,11 @@
Seam.Remoting.sendAjaxRequest(env, Seam.Remoting.PATH_POLL, Seam.Remoting.pollCallback, true);
}
-Seam.Remoting.pollCallback = function(doc)
-{
+Seam.Remoting.pollCallback = function(doc) {
Seam.Remoting.polling = false;
var body = doc.documentElement.firstChild;
- for (var i = 0; i < body.childNodes.length; i++)
- {
+ for (var i = 0; i < body.childNodes.length; i++) {
var node = body.childNodes.item(i);
if (node.tagName == "messages")
Seam.Remoting.processMessages(node);
@@ -1118,13 +857,11 @@
Seam.Remoting.pollTimeoutFunction = setTimeout("Seam.Remoting.poll()", Math.max(Seam.Remoting.pollInterval * 1000, 1000));
}
-Seam.Remoting.processMessages = function(messages)
-{
+Seam.Remoting.processMessages = function(messages) {
var token = messages.getAttribute("token");
var callback = null;
- for (var i = 0; i < Seam.Remoting.subscriptionRegistry.length; i++)
- {
+ for (var i = 0; i < Seam.Remoting.subscriptionRegistry.length; i++) {
if (Seam.Remoting.subscriptionRegistry[i].token == token)
{
callback = Seam.Remoting.subscriptionRegistry[i].callback;
@@ -1132,23 +869,19 @@
}
}
- if (callback != null)
- {
- var messageNode = null;
-
- var children = messages.childNodes;
- for (var i = 0; i < children.length; i++)
- {
- if (children.item(i).tagName == "message")
+ if (callback != null) {
+ var m = null;
+ var c = messages.childNodes;
+ for (var i = 0; i < c.length; i++) {
+ if (c.item(i).tagName == "message")
{
- messageNode = children.item(i);
- var messageType = messageNode.getAttribute("type");
+ m = c.item(i);
+ var messageType = m.getAttribute("type");
var valueNode = null;
var refsNode = null;
- for (var j = 0; j < messageNode.childNodes.length; j++)
- {
- var node = messageNode.childNodes.item(j);
+ for (var j = 0; j < m.childNodes.length; j++) {
+ var node = m.childNodes.item(j);
if (node.tagName == "value")
valueNode = node;
else if (node.tagName == "refs")
@@ -1156,35 +889,26 @@
}
var refs = new Array();
- if (refsNode)
- Seam.Remoting.unmarshalRefs(refsNode, refs);
-
- var value = Seam.Remoting.unmarshalValue(valueNode.firstChild, refs);
-
- callback(Seam.Remoting.createMessage(messageType, value));
+ if (refsNode) Seam.Remoting.unmarshalRefs(refsNode, refs);
+ var v = Seam.Remoting.unmarshalValue(valueNode.firstChild, refs);
+ callback(Seam.Remoting.createMessage(messageType, v));
}
}
}
}
-Seam.Remoting.processErrors = function(errors)
-{
- var token = errors.getAttribute("token");
+Seam.Remoting.processErrors = function(errors) {
+ var t = errors.getAttribute("token");
- // Unsubscribe to the topic
- for (var i = 0; i < Seam.Remoting.subscriptionRegistry.length; i++)
- {
- if (Seam.Remoting.subscriptionRegistry[i].token == token)
- {
+ for (var i = 0; i < Seam.Remoting.subscriptionRegistry.length; i++) {
+ if (Seam.Remoting.subscriptionRegistry[i].token == t) {
Seam.Remoting.subscriptionRegistry.splice(i, 1);
break;
}
}
- for (var i = 0; i < errors.childNodes.length; i++)
- {
- if (errors.childNodes.item(i).tagName == "error")
- {
+ for (var i = 0; i < errors.childNodes.length; i++) {
+ if (errors.childNodes.item(i).tagName == "error") {
var errorNode = errors.childNodes.item(i);
var code = errorNode.getAttribute("code");
var message = errorNode.firstChild.nodeValue;
@@ -1197,40 +921,32 @@
}
}
-Seam.Remoting.ObjectMessage = function()
-{
+Seam.Remoting.ObjectMessage = function() {
this.value = null;
- Seam.Remoting.ObjectMessage.prototype.getValue = function()
- {
+ Seam.Remoting.ObjectMessage.prototype.getValue = function() {
return this.value;
}
- Seam.Remoting.ObjectMessage.prototype.setValue = function(value)
- {
+ Seam.Remoting.ObjectMessage.prototype.setValue = function(value) {
this.value = value;
}
}
-Seam.Remoting.TextMessage = function()
-{
+Seam.Remoting.TextMessage = function() {
this.text = null;
- Seam.Remoting.TextMessage.prototype.getText = function()
- {
+ Seam.Remoting.TextMessage.prototype.getText = function() {
return this.text;
}
- Seam.Remoting.TextMessage.prototype.setText = function(text)
- {
+ Seam.Remoting.TextMessage.prototype.setText = function(text) {
this.text = text;
}
}
-Seam.Remoting.createMessage = function(messageType, value)
-{
- switch (messageType)
- {
+Seam.Remoting.createMessage = function(messageType, value) {
+ switch (messageType) {
case "object":
var msg = new Seam.Remoting.ObjectMessage();
msg.setValue(value);
15 years
Seam SVN: r11716 - in branches/community/Seam_2_2: examples and 1 other directories.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2009-12-03 05:20:11 -0500 (Thu, 03 Dec 2009)
New Revision: 11716
Modified:
branches/community/Seam_2_2/build/resteasy.pom.xml
branches/community/Seam_2_2/build/root.pom.xml
branches/community/Seam_2_2/examples/build.xml
branches/community/Seam_2_2/src/resteasy/org/jboss/seam/resteasy/ResourceHome.java
Log:
JBSEAM-4492 JBSEAM-4491 Upgraded to RESTEasy 1.2.1.GA
Modified: branches/community/Seam_2_2/build/resteasy.pom.xml
===================================================================
--- branches/community/Seam_2_2/build/resteasy.pom.xml 2009-12-02 11:41:03 UTC (rev 11715)
+++ branches/community/Seam_2_2/build/resteasy.pom.xml 2009-12-03 10:20:11 UTC (rev 11716)
@@ -30,6 +30,11 @@
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jettison-provider</artifactId>
+ </dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
Modified: branches/community/Seam_2_2/build/root.pom.xml
===================================================================
--- branches/community/Seam_2_2/build/root.pom.xml 2009-12-02 11:41:03 UTC (rev 11715)
+++ branches/community/Seam_2_2/build/root.pom.xml 2009-12-03 10:20:11 UTC (rev 11716)
@@ -42,6 +42,7 @@
<version.wicket>1.3.5.jboss1</version.wicket>
<version.drools>5.0.1</version.drools>
<version.testng>5.9</version.testng>
+ <version.resteasy>1.2.1.GA</version.resteasy>
</properties>
<dependencyManagement>
@@ -301,7 +302,7 @@
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
- <version>1.1-RC2</version>
+ <version>${version.resteasy}</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
@@ -341,19 +342,29 @@
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
- <version>1.1-RC2</version>
+ <version>${version.resteasy}</version>
<exclusions>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>com.sun.xml.stream</groupId>
+ <artifactId>sjsxp</artifactId>
+ </exclusion>
</exclusions>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jettison-provider</artifactId>
+ <version>${version.resteasy}</version>
+ </dependency>
<dependency>
- <groupId>org.jboss.resteasy</groupId>
- <artifactId>resteasy-atom-provider</artifactId>
- <version>1.1-RC2</version>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-atom-provider</artifactId>
+ <version>${version.resteasy}</version>
</dependency>
<dependency>
Modified: branches/community/Seam_2_2/examples/build.xml
===================================================================
--- branches/community/Seam_2_2/examples/build.xml 2009-12-02 11:41:03 UTC (rev 11715)
+++ branches/community/Seam_2_2/examples/build.xml 2009-12-03 10:20:11 UTC (rev 11716)
@@ -242,6 +242,8 @@
<include name="jaxrs-api.jar" if="seam.resteasy.lib" />
<include name="resteasy-jaxrs.jar" if="seam.resteasy.lib" />
<include name="resteasy-jaxb-provider.jar" if="seam.resteasy.lib" />
+ <include name="resteasy-jettison-provider.jar" if="seam.resteasy.lib" />
+ <include name="jettison.jar" if="seam.resteasy.lib" />
<include name="resteasy-atom-provider.jar" if="seam.resteasy.lib" />
<include name="slf4j-api.jar" if="seam.resteasy.lib" />
<include name="slf4j-log4j12.jar" if="seam.resteasy.lib" />
Modified: branches/community/Seam_2_2/src/resteasy/org/jboss/seam/resteasy/ResourceHome.java
===================================================================
--- branches/community/Seam_2_2/src/resteasy/org/jboss/seam/resteasy/ResourceHome.java 2009-12-02 11:41:03 UTC (rev 11715)
+++ branches/community/Seam_2_2/src/resteasy/org/jboss/seam/resteasy/ResourceHome.java 2009-12-03 10:20:11 UTC (rev 11716)
@@ -24,6 +24,7 @@
import java.io.InputStream;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
+import java.lang.annotation.Annotation;
import java.net.URI;
import javax.ws.rs.DELETE;
@@ -73,6 +74,8 @@
private Class entityIdClass = null;
private boolean readonly;
+
+ private static final PathParamAnnotation pathParamAnnotation = new PathParamAnnotation();
/**
* Called at component instantiation. EntityHome component must be set in
@@ -289,7 +292,7 @@
*/
private T2 unmarshallId(String id)
{
- StringParameterInjector injector = new StringParameterInjector(getEntityIdClass(), getEntityIdClass(), "id", PathParam.class, null, null, SeamResteasyProviderFactory.getInstance());
+ StringParameterInjector injector = new StringParameterInjector(getEntityIdClass(), getEntityIdClass(), "id", PathParam.class, null, null, new Annotation[] {pathParamAnnotation}, SeamResteasyProviderFactory.getInstance());
return (T2) injector.extractValue(id);
}
@@ -369,4 +372,20 @@
{
this.entityIdClass = entityIdClass;
}
+
+ /**
+ * Annotation implementation (@PathParam("id")) for providing RESTEasy with metadata.
+ */
+ static class PathParamAnnotation implements PathParam {
+
+ public String value()
+ {
+ return "id";
+ }
+
+ public Class<? extends Annotation> annotationType()
+ {
+ return PathParam.class;
+ }
+ }
}
15 years
Seam SVN: r11715 - modules/trunk/remoting/src/main/java/org/jboss/seam/remoting.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-02 06:41:03 -0500 (Wed, 02 Dec 2009)
New Revision: 11715
Modified:
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java
Log:
fix parsing of multiple qualifiers
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java 2009-12-02 11:40:36 UTC (rev 11714)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java 2009-12-02 11:41:03 UTC (rev 11715)
@@ -190,9 +190,15 @@
{
for (Node nloNode : nlo.nodes)
{
- if (nloNode instanceof org.jboss.seam.remoting.annotationparser.syntaxtree.Annotation)
+ if (nloNode instanceof NodeSequence)
{
- annotations.add((org.jboss.seam.remoting.annotationparser.syntaxtree.Annotation) nloNode);
+ for (Node cn : ((NodeSequence) nloNode).nodes)
+ {
+ if (cn instanceof org.jboss.seam.remoting.annotationparser.syntaxtree.Annotation)
+ {
+ annotations.add((org.jboss.seam.remoting.annotationparser.syntaxtree.Annotation) cn);
+ }
+ }
}
}
}
15 years
Seam SVN: r11714 - in modules/trunk/remoting/examples/helloworld/src/main: webapp and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-02 06:40:36 -0500 (Wed, 02 Dec 2009)
New Revision: 11714
Added:
modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/Formal.java
modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/RussianHelloAction.java
Modified:
modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/CasualHelloAction.java
modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloAction.java
modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml
Log:
example enhancements
Modified: modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/CasualHelloAction.java
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/CasualHelloAction.java 2009-12-02 09:36:04 UTC (rev 11713)
+++ modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/CasualHelloAction.java 2009-12-02 11:40:36 UTC (rev 11714)
@@ -1,8 +1,10 @@
package org.jboss.seam.remoting.examples.helloworld;
+import static org.jboss.seam.remoting.examples.helloworld.Localized.Language.ENGLISH;
+
import org.jboss.seam.remoting.annotations.WebRemote;
-@Casual
+@Casual @Localized(ENGLISH)
public class CasualHelloAction extends HelloAction
{
@WebRemote
Added: modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/Formal.java
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/Formal.java (rev 0)
+++ modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/Formal.java 2009-12-02 11:40:36 UTC (rev 11714)
@@ -0,0 +1,17 @@
+package org.jboss.seam.remoting.examples.helloworld;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Retention(RUNTIME)
+@Target(TYPE)
+@Qualifier
+public @interface Formal
+{
+
+}
Modified: modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloAction.java
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloAction.java 2009-12-02 09:36:04 UTC (rev 11713)
+++ modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloAction.java 2009-12-02 11:40:36 UTC (rev 11714)
@@ -1,10 +1,12 @@
package org.jboss.seam.remoting.examples.helloworld;
+import static org.jboss.seam.remoting.examples.helloworld.Localized.Language.ENGLISH;
+
import javax.enterprise.inject.Default;
import org.jboss.seam.remoting.annotations.WebRemote;
-@Default
+@Default @Formal @Localized(ENGLISH)
public class HelloAction
{
@WebRemote
Added: modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/RussianHelloAction.java
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/RussianHelloAction.java (rev 0)
+++ modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/RussianHelloAction.java 2009-12-02 11:40:36 UTC (rev 11714)
@@ -0,0 +1,15 @@
+package org.jboss.seam.remoting.examples.helloworld;
+
+import static org.jboss.seam.remoting.examples.helloworld.Localized.Language.RUSSIAN;
+
+import org.jboss.seam.remoting.annotations.WebRemote;
+
+@Formal @Localized(RUSSIAN)
+public class RussianHelloAction extends HelloAction
+{
+ @WebRemote
+ public String sayHello(String name)
+ {
+ return "Zdravstvuite, " + name;
+ }
+}
Modified: modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml 2009-12-02 09:36:04 UTC (rev 11713)
+++ modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml 2009-12-02 11:40:36 UTC (rev 11714)
@@ -15,30 +15,62 @@
<div style="border:1px solid black;margin:8px;padding:8px;width:360px">
<span style="font-weight:bold">Select bean qualifiers</span><br/>
- <input id="qualifier_casual" type="checkbox">Casual</input><br/>
- <input id="qualifier_russian" type="checkbox">Localized (Russian)</input><br/>
+
+ <form name="qualifiers">
+ <p>
+ Formality:<br/>
+ <input type="radio" name="formality" value="Casual" checked="yes">Casual</input><br/>
+ <input type="radio" name="formality" value="Formal">Formal</input><br/>
+ </p>
+
+ <p>
+ Localization:<br/>
+ <input type="radio" name="lang" value="ENGLISH" checked="yes">Localized (English)</input><br/>
+ <input type="radio" name="lang" value="RUSSIAN">Localized (Russian)</input>
+ </p>
+ </form>
+
+ <p>
+ Selected qualifiers:<br/>
+ <input id="qualifierValue" readonly="true" style="width:300px"/>
+ </p>
</div>
<script type="text/javascript" src="seam/resource/remoting/resource/remote.js"></script>
<script type="text/javascript" src="seam/resource/remoting/interface.js?org.jboss.seam.remoting.examples.helloworld.HelloAction"></script>
<script type="text/javascript">
- function sayHello() {
+ //<![CDATA[
+
+ function getRadioValue(options)
+ {
+ for (var i = 0; i < options.length; i++)
+ {
+ if (options[i].checked) return options[i].value;
+ }
+ }
+
+ function getQualifiers() {
+ var qualifiers = "@" + getRadioValue(document.qualifiers.formality) + "," +
+ "@Localized(" + getRadioValue(document.qualifiers.lang) + ")";
+ document.getElementById("qualifierValue").value = qualifiers;
+ return qualifiers;
+ }
+
+ function sayHello() {
+ var qualifiers = getQualifiers();
+
+ // Prompt the user for their name, if they don't enter one then return.
var name = prompt("What is your name?");
if (name == null) return;
+
+ // Define an inline callback function
var callback = function(result) { alert(result); };
- var qualifiers = "";
- if (document.getElementById("qualifier_casual").checked)
- qualifiers += "@Casual";
-
- if (document.getElementById("qualifier_russian").checked)
- {
- if (qualifiers.length > 0) qualifiers += ",";
- qualifiers += "@Localized(RUSSIAN)";
- }
+ // Get a reference to the HelloAction bean and invoke the sayHello() method
+ Seam.Component.create("org.jboss.seam.remoting.examples.helloworld.HelloAction", qualifiers).sayHello(name, callback);
- Seam.Component.create("org.jboss.seam.remoting.examples.helloworld.HelloAction", qualifiers).sayHello(name, callback);
+ // ]]>
}
</script>
15 years
Seam SVN: r11713 - in modules/trunk/remoting: examples/helloworld/src/main/webapp and 5 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-02 04:36:04 -0500 (Wed, 02 Dec 2009)
New Revision: 11713
Added:
modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/Casual.java
modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/CasualHelloAction.java
modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/CasualRussianHelloAction.java
modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/Localized.java
Modified:
modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/AnnotationParser.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/ClassOrInterfaceType.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/DepthFirstVisitor.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJDepthFirst.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguDepthFirst.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguVisitor.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVisitor.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidDepthFirst.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidVisitor.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/Visitor.java
modules/trunk/remoting/src/main/javacc/AnnotationParser.jj
Log:
oops, add enum support
Added: modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/Casual.java
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/Casual.java (rev 0)
+++ modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/Casual.java 2009-12-02 09:36:04 UTC (rev 11713)
@@ -0,0 +1,17 @@
+package org.jboss.seam.remoting.examples.helloworld;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Retention(RUNTIME)
+@Target(TYPE)
+@Qualifier
+public @interface Casual
+{
+
+}
Added: modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/CasualHelloAction.java
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/CasualHelloAction.java (rev 0)
+++ modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/CasualHelloAction.java 2009-12-02 09:36:04 UTC (rev 11713)
@@ -0,0 +1,13 @@
+package org.jboss.seam.remoting.examples.helloworld;
+
+import org.jboss.seam.remoting.annotations.WebRemote;
+
+@Casual
+public class CasualHelloAction extends HelloAction
+{
+ @WebRemote
+ public String sayHello(String name)
+ {
+ return "Hi, " + name;
+ }
+}
Added: modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/CasualRussianHelloAction.java
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/CasualRussianHelloAction.java (rev 0)
+++ modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/CasualRussianHelloAction.java 2009-12-02 09:36:04 UTC (rev 11713)
@@ -0,0 +1,15 @@
+package org.jboss.seam.remoting.examples.helloworld;
+
+import static org.jboss.seam.remoting.examples.helloworld.Localized.Language.RUSSIAN;
+
+import org.jboss.seam.remoting.annotations.WebRemote;
+
+@Casual @Localized(RUSSIAN)
+public class CasualRussianHelloAction extends HelloAction
+{
+ @WebRemote
+ public String sayHello(String name)
+ {
+ return "Privyet, " + name;
+ }
+}
Added: modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/Localized.java
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/Localized.java (rev 0)
+++ modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/Localized.java 2009-12-02 09:36:04 UTC (rev 11713)
@@ -0,0 +1,19 @@
+package org.jboss.seam.remoting.examples.helloworld;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Retention(RUNTIME)
+@Target(TYPE)
+@Qualifier
+public @interface Localized
+{
+ public static enum Language { ENGLISH, RUSSIAN }
+
+ Language value() default Language.ENGLISH;
+}
Modified: modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml 2009-12-02 08:25:30 UTC (rev 11712)
+++ modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml 2009-12-02 09:36:04 UTC (rev 11713)
@@ -13,9 +13,11 @@
<h1>Seam Remoting - Hello World Example</h1>
- <p>
-
- </p>
+ <div style="border:1px solid black;margin:8px;padding:8px;width:360px">
+ <span style="font-weight:bold">Select bean qualifiers</span><br/>
+ <input id="qualifier_casual" type="checkbox">Casual</input><br/>
+ <input id="qualifier_russian" type="checkbox">Localized (Russian)</input><br/>
+ </div>
<script type="text/javascript" src="seam/resource/remoting/resource/remote.js"></script>
<script type="text/javascript" src="seam/resource/remoting/interface.js?org.jboss.seam.remoting.examples.helloworld.HelloAction"></script>
@@ -25,11 +27,22 @@
var name = prompt("What is your name?");
if (name == null) return;
var callback = function(result) { alert(result); };
- Seam.Component.create("org.jboss.seam.remoting.examples.helloworld.HelloAction", "@Casual").sayHello(name, callback);
+
+ var qualifiers = "";
+ if (document.getElementById("qualifier_casual").checked)
+ qualifiers += "@Casual";
+
+ if (document.getElementById("qualifier_russian").checked)
+ {
+ if (qualifiers.length > 0) qualifiers += ",";
+ qualifiers += "@Localized(RUSSIAN)";
+ }
+
+ Seam.Component.create("org.jboss.seam.remoting.examples.helloworld.HelloAction", qualifiers).sayHello(name, callback);
}
</script>
- <button onclick="javascript:sayHello()">Say Hello</button>
+ <button onclick="javascript:sayHello()">Invoke</button>
</body>
</html>
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java 2009-12-02 08:25:30 UTC (rev 11712)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java 2009-12-02 09:36:04 UTC (rev 11713)
@@ -290,7 +290,8 @@
value = convertLiteral((Literal) memberValue.f0.choice);
break;
case 3: // ClassOrInterfaceType
- value = convertClassOrInterfaceType((ClassOrInterfaceType) memberValue.f0.choice);
+ value = convertClassOrInterfaceType(
+ (ClassOrInterfaceType) memberValue.f0.choice, memberType);
break;
}
@@ -318,7 +319,7 @@
return null;
}
- private Class<?> convertClassOrInterfaceType(ClassOrInterfaceType node)
+ private Object convertClassOrInterfaceType(ClassOrInterfaceType node, Class<?> memberType)
{
StringBuilder sb = new StringBuilder();
sb.append(node.f0.tokenImage);
@@ -342,25 +343,38 @@
String className = sb.toString();
- try
+ if (memberType.isEnum())
{
- return Class.forName(className);
+ for (Object e : memberType.getEnumConstants())
+ {
+ if (className.equals(((Enum<?>) e).name())) return e;
+ }
+
+ throw new IllegalArgumentException(
+ "Invalid enum specified for annotation member value: " + className);
}
- catch (ClassNotFoundException e)
+ else
{
- if (!className.startsWith("java.lang."))
+ try
{
- // try finding the class in the java.lang package
- try
+ return Class.forName(className);
+ }
+ catch (ClassNotFoundException e)
+ {
+ if (!className.startsWith("java.lang."))
{
- return Class.forName("java.lang." + className);
+ // try finding the class in the java.lang package
+ try
+ {
+ return Class.forName("java.lang." + className);
+ }
+ catch (ClassNotFoundException e1) { }
}
- catch (ClassNotFoundException e1) { }
+
+ throw new IllegalArgumentException(
+ "Invalid class name specified for annotation member value: " + className);
}
-
- throw new IllegalArgumentException(
- "Invalid class name specified for annotation member value: " + className);
- }
+ }
}
private String extractName(Name name)
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/AnnotationParser.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/AnnotationParser.java 2009-12-02 08:25:30 UTC (rev 11712)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/AnnotationParser.java 2009-12-02 09:36:04 UTC (rev 11713)
@@ -467,10 +467,12 @@
Token n5;
NodeToken n6;
Token n7;
- NodeToken n8;
- Token n9;
+ NodeOptional n8 = new NodeOptional();
+ NodeSequence n9;
NodeToken n10;
Token n11;
+ NodeToken n12;
+ Token n13;
n1 = jj_consume_token(IDENTIFIER);
n0 = JTBToolkit.makeNodeToken(n1);
label_4:
@@ -490,11 +492,21 @@
n2.addNode(n3);
}
n2.nodes.trimToSize();
- n9 = jj_consume_token(DOT);
- n8 = JTBToolkit.makeNodeToken(n9);
- n11 = jj_consume_token(CLASS);
- n10 = JTBToolkit.makeNodeToken(n11);
- {if (true) return new ClassOrInterfaceType(n0,n2,n8,n10);}
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DOT:
+ n9 = new NodeSequence(2);
+ n11 = jj_consume_token(DOT);
+ n10 = JTBToolkit.makeNodeToken(n11);
+ n9.addNode(n10);
+ n13 = jj_consume_token(CLASS);
+ n12 = JTBToolkit.makeNodeToken(n13);
+ n9.addNode(n12);
+ n8.addNode(n9);
+ break;
+ default:
+ ;
+ }
+ {if (true) return new ClassOrInterfaceType(n0,n2,n8);}
throw new Error("Missing return statement in function");
}
@@ -670,27 +682,38 @@
return false;
}
- private boolean jj_3R_23() {
- if (jj_scan_token(CHARACTER_LITERAL)) return true;
- return false;
- }
-
private boolean jj_3_3() {
if (jj_scan_token(DOT)) return true;
if (jj_scan_token(IDENTIFIER)) return true;
return false;
}
+ private boolean jj_3R_23() {
+ if (jj_scan_token(CHARACTER_LITERAL)) return true;
+ return false;
+ }
+
private boolean jj_3R_22() {
if (jj_scan_token(FLOATING_POINT_LITERAL)) return true;
return false;
}
+ private boolean jj_3_4() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_8()) return true;
+ return false;
+ }
+
private boolean jj_3R_31() {
if (jj_scan_token(NULL)) return true;
return false;
}
+ private boolean jj_3R_17() {
+ if (jj_scan_token(IDENTIFIER)) return true;
+ return false;
+ }
+
private boolean jj_3R_27() {
if (jj_scan_token(AT)) return true;
return false;
@@ -707,8 +730,8 @@
return false;
}
- private boolean jj_3R_17() {
- if (jj_scan_token(IDENTIFIER)) return true;
+ private boolean jj_3R_15() {
+ if (jj_scan_token(LBRACE)) return true;
return false;
}
@@ -739,22 +762,11 @@
return false;
}
- private boolean jj_3_4() {
- if (jj_scan_token(COMMA)) return true;
- if (jj_3R_8()) return true;
- return false;
- }
-
private boolean jj_3R_33() {
if (jj_scan_token(FALSE)) return true;
return false;
}
- private boolean jj_3R_15() {
- if (jj_scan_token(LBRACE)) return true;
- return false;
- }
-
private boolean jj_3_2() {
if (jj_scan_token(AT)) return true;
if (jj_3R_6()) return true;
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/ClassOrInterfaceType.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/ClassOrInterfaceType.java 2009-12-02 08:25:30 UTC (rev 11712)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/ClassOrInterfaceType.java 2009-12-02 09:36:04 UTC (rev 11713)
@@ -8,29 +8,19 @@
* Grammar production:
* f0 -> <IDENTIFIER>
* f1 -> ( "." <IDENTIFIER> )*
- * f2 -> "."
- * f3 -> "class"
+ * f2 -> [ "." "class" ]
*/
public class ClassOrInterfaceType implements Node {
public NodeToken f0;
public NodeListOptional f1;
- public NodeToken f2;
- public NodeToken f3;
+ public NodeOptional f2;
- public ClassOrInterfaceType(NodeToken n0, NodeListOptional n1, NodeToken n2, NodeToken n3) {
+ public ClassOrInterfaceType(NodeToken n0, NodeListOptional n1, NodeOptional n2) {
f0 = n0;
f1 = n1;
f2 = n2;
- f3 = n3;
}
- public ClassOrInterfaceType(NodeToken n0, NodeListOptional n1) {
- f0 = n0;
- f1 = n1;
- f2 = new NodeToken(".");
- f3 = new NodeToken("class");
- }
-
public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/DepthFirstVisitor.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/DepthFirstVisitor.java 2009-12-02 08:25:30 UTC (rev 11712)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/DepthFirstVisitor.java 2009-12-02 09:36:04 UTC (rev 11713)
@@ -179,14 +179,12 @@
/**
* f0 -> <IDENTIFIER>
* f1 -> ( "." <IDENTIFIER> )*
- * f2 -> "."
- * f3 -> "class"
+ * f2 -> [ "." "class" ]
*/
public void visit(ClassOrInterfaceType n) {
n.f0.accept(this);
n.f1.accept(this);
n.f2.accept(this);
- n.f3.accept(this);
}
/**
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJDepthFirst.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJDepthFirst.java 2009-12-02 08:25:30 UTC (rev 11712)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJDepthFirst.java 2009-12-02 09:36:04 UTC (rev 11713)
@@ -225,15 +225,13 @@
/**
* f0 -> <IDENTIFIER>
* f1 -> ( "." <IDENTIFIER> )*
- * f2 -> "."
- * f3 -> "class"
+ * f2 -> [ "." "class" ]
*/
public R visit(ClassOrInterfaceType n, A argu) {
R _ret=null;
n.f0.accept(this, argu);
n.f1.accept(this, argu);
n.f2.accept(this, argu);
- n.f3.accept(this, argu);
return _ret;
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguDepthFirst.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguDepthFirst.java 2009-12-02 08:25:30 UTC (rev 11712)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguDepthFirst.java 2009-12-02 09:36:04 UTC (rev 11713)
@@ -225,15 +225,13 @@
/**
* f0 -> <IDENTIFIER>
* f1 -> ( "." <IDENTIFIER> )*
- * f2 -> "."
- * f3 -> "class"
+ * f2 -> [ "." "class" ]
*/
public R visit(ClassOrInterfaceType n) {
R _ret=null;
n.f0.accept(this);
n.f1.accept(this);
n.f2.accept(this);
- n.f3.accept(this);
return _ret;
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguVisitor.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguVisitor.java 2009-12-02 08:25:30 UTC (rev 11712)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguVisitor.java 2009-12-02 09:36:04 UTC (rev 11713)
@@ -125,8 +125,7 @@
/**
* f0 -> <IDENTIFIER>
* f1 -> ( "." <IDENTIFIER> )*
- * f2 -> "."
- * f3 -> "class"
+ * f2 -> [ "." "class" ]
*/
public R visit(ClassOrInterfaceType n);
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVisitor.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVisitor.java 2009-12-02 08:25:30 UTC (rev 11712)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVisitor.java 2009-12-02 09:36:04 UTC (rev 11713)
@@ -125,8 +125,7 @@
/**
* f0 -> <IDENTIFIER>
* f1 -> ( "." <IDENTIFIER> )*
- * f2 -> "."
- * f3 -> "class"
+ * f2 -> [ "." "class" ]
*/
public R visit(ClassOrInterfaceType n, A argu);
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidDepthFirst.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidDepthFirst.java 2009-12-02 08:25:30 UTC (rev 11712)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidDepthFirst.java 2009-12-02 09:36:04 UTC (rev 11713)
@@ -189,14 +189,12 @@
/**
* f0 -> <IDENTIFIER>
* f1 -> ( "." <IDENTIFIER> )*
- * f2 -> "."
- * f3 -> "class"
+ * f2 -> [ "." "class" ]
*/
public void visit(ClassOrInterfaceType n, A argu) {
n.f0.accept(this, argu);
n.f1.accept(this, argu);
n.f2.accept(this, argu);
- n.f3.accept(this, argu);
}
/**
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidVisitor.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidVisitor.java 2009-12-02 08:25:30 UTC (rev 11712)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidVisitor.java 2009-12-02 09:36:04 UTC (rev 11713)
@@ -125,8 +125,7 @@
/**
* f0 -> <IDENTIFIER>
* f1 -> ( "." <IDENTIFIER> )*
- * f2 -> "."
- * f3 -> "class"
+ * f2 -> [ "." "class" ]
*/
public void visit(ClassOrInterfaceType n, A argu);
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/Visitor.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/Visitor.java 2009-12-02 08:25:30 UTC (rev 11712)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/Visitor.java 2009-12-02 09:36:04 UTC (rev 11713)
@@ -125,8 +125,7 @@
/**
* f0 -> <IDENTIFIER>
* f1 -> ( "." <IDENTIFIER> )*
- * f2 -> "."
- * f3 -> "class"
+ * f2 -> [ "." "class" ]
*/
public void visit(ClassOrInterfaceType n);
Modified: modules/trunk/remoting/src/main/javacc/AnnotationParser.jj
===================================================================
--- modules/trunk/remoting/src/main/javacc/AnnotationParser.jj 2009-12-02 08:25:30 UTC (rev 11712)
+++ modules/trunk/remoting/src/main/javacc/AnnotationParser.jj 2009-12-02 09:36:04 UTC (rev 11713)
@@ -446,7 +446,7 @@
void ClassOrInterfaceType():
{}
{
- <IDENTIFIER> ( LOOKAHEAD(2) "." <IDENTIFIER> )* "." "class"
+ <IDENTIFIER> ( LOOKAHEAD(2) "." <IDENTIFIER> )* ["." "class"]
}
void MemberValueArrayInitializer():
15 years
Seam SVN: r11712 - in modules/trunk/remoting: examples/helloworld/src/main/webapp and 1 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-02 03:25:30 -0500 (Wed, 02 Dec 2009)
New Revision: 11712
Removed:
modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloQualifier.java
Modified:
modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloAction.java
modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/Call.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/InterfaceGenerator.java
Log:
a little more flexibility in specifying qualifiers
Modified: modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloAction.java
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloAction.java 2009-12-01 23:47:16 UTC (rev 11711)
+++ modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloAction.java 2009-12-02 08:25:30 UTC (rev 11712)
@@ -1,11 +1,15 @@
package org.jboss.seam.remoting.examples.helloworld;
+import javax.enterprise.inject.Default;
+
import org.jboss.seam.remoting.annotations.WebRemote;
-@HelloQualifier(foo = 123, bar = String.class)
-public class HelloAction {
+@Default
+public class HelloAction
+{
@WebRemote
- public String sayHello(String name) {
+ public String sayHello(String name)
+ {
return "Hello, " + name;
}
}
Deleted: modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloQualifier.java
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloQualifier.java 2009-12-01 23:47:16 UTC (rev 11711)
+++ modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloQualifier.java 2009-12-02 08:25:30 UTC (rev 11712)
@@ -1,18 +0,0 @@
-package org.jboss.seam.remoting.examples.helloworld;
-
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static java.lang.annotation.ElementType.TYPE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.enterprise.util.Nonbinding;
-import javax.inject.Qualifier;
-
-@Retention(RUNTIME)
-@Target(TYPE)
-@Qualifier
-public @interface HelloQualifier {
- int foo();
- Class bar();
-}
Modified: modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml 2009-12-01 23:47:16 UTC (rev 11711)
+++ modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml 2009-12-02 08:25:30 UTC (rev 11712)
@@ -25,8 +25,7 @@
var name = prompt("What is your name?");
if (name == null) return;
var callback = function(result) { alert(result); };
- Seam.Component.create("org.jboss.seam.remoting.examples.helloworld.HelloAction",
- "@HelloQualifier(foo = 123, bar = String.class)").sayHello(name, callback);
+ Seam.Component.create("org.jboss.seam.remoting.examples.helloworld.HelloAction", "@Casual").sayHello(name, callback);
}
</script>
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java 2009-12-01 23:47:16 UTC (rev 11711)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java 2009-12-02 08:25:30 UTC (rev 11712)
@@ -9,7 +9,14 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.util.AnnotationLiteral;
+
import org.jboss.seam.remoting.annotationparser.AnnotationParser;
import org.jboss.seam.remoting.annotationparser.ParseException;
import org.jboss.seam.remoting.annotationparser.syntaxtree.AnnotationsUnit;
@@ -45,7 +52,7 @@
public AnnotationMetadata(String name)
{
- this.annotationType = calcAnnotationType(name, beanType);
+ this.annotationType = determineAnnotationType(name, beanType);
}
public void addMemberValue(String name, Object value)
@@ -63,15 +70,20 @@
return annotationType;
}
}
+
+ private class AnyQualifier extends AnnotationLiteral<Any> implements Any {};
private Class<?> beanType;
+ private BeanManager beanManager;
private List<AnnotationMetadata> meta = new ArrayList<AnnotationMetadata>();
private Annotation[] annotations;
- public AnnotationsParser(Class<?> beanType, String declaration)
+ public AnnotationsParser(Class<?> beanType, String declaration, BeanManager beanManager)
{
this.beanType = beanType;
+ this.beanManager = beanManager;
+
// TODO cache the results somewhere
AnnotationParser parser = new AnnotationParser(new StringReader(declaration));
@@ -108,7 +120,7 @@
}
@SuppressWarnings("unchecked")
- private Class<? extends Annotation> calcAnnotationType(String name, Class<?> beanType)
+ private Class<? extends Annotation> determineAnnotationType(String name, Class<?> beanType)
{
try
{
@@ -125,6 +137,29 @@
}
}
+ // Couldn't find the annotation on the bean type itself - let's look at all beans
+ // with the same type
+ Set<Bean<?>> beans = beanManager.getBeans(beanType, new AnyQualifier());
+ for (Bean<?> bean : beans)
+ {
+ for (Annotation beanAnnotation : bean.getBeanClass().getAnnotations())
+ {
+ if (name.equals(beanAnnotation.annotationType().getSimpleName()))
+ {
+ return beanAnnotation.annotationType();
+ }
+ }
+ }
+
+ if ("Default".equals(name))
+ {
+ return Default.class;
+ }
+ else if ("Any".equals(name))
+ {
+ return Any.class;
+ }
+
return null;
}
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/Call.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/Call.java 2009-12-01 23:47:16 UTC (rev 11711)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/Call.java 2009-12-02 08:25:30 UTC (rev 11712)
@@ -27,6 +27,8 @@
*/
public class Call
{
+ public static Annotation[] EMPTY_ANNOTATIONS = new Annotation[]{};
+
private BeanManager beanManager;
private String id;
@@ -61,7 +63,8 @@
Class<?> beanType = Class.forName(beanName);
Annotation[] q = qualifiers != null && !qualifiers.isEmpty() ?
- new AnnotationsParser(beanType, qualifiers).getAnnotations() : null;
+ new AnnotationsParser(beanType, qualifiers, beanManager).getAnnotations() :
+ EMPTY_ANNOTATIONS;
beans = beanManager.getBeans(beanType, q);
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/InterfaceGenerator.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/InterfaceGenerator.java 2009-12-01 23:47:16 UTC (rev 11711)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/InterfaceGenerator.java 2009-12-02 08:25:30 UTC (rev 11712)
@@ -19,10 +19,8 @@
import java.util.Map;
import java.util.Set;
-import javax.enterprise.inject.Any;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.util.AnnotationLiteral;
import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.ServletException;
@@ -50,12 +48,10 @@
private static Map<Class<?>, Set<String>> accessibleProperties = new HashMap<Class<?>, Set<String>>();
/**
- * A cache of component interfaces, keyed by component name.
+ * A cache of component interfaces, keyed by name.
*/
private Map<Class<?>, byte[]> interfaceCache = new HashMap<Class<?>, byte[]>();
- private final class AnyQualifier extends AnnotationLiteral<Any> implements Any {}
-
/**
*
* @param request
@@ -72,7 +68,7 @@
throw new ServletException("Invalid request - no component specified");
}
- Set<Bean<?>> beansCached = new HashSet<Bean<?>>();
+ Set<Class<?>> typesCached = new HashSet<Class<?>>();
Set<Type> types = new HashSet<Type>();
response.setContentType("text/javascript");
@@ -81,50 +77,33 @@
while (e.hasMoreElements())
{
String componentName = ((String) e.nextElement()).trim();
+ Class<?> beanClass = null;
Set<Bean<?>> beans = beanManager.getBeans(componentName);
- if (beans.isEmpty())
- {
- Type beanType = null;
-
- try
- {
- beanType = Class.forName(componentName);
- }
- catch (ClassNotFoundException e1) {}
-
- beans = beanManager.getBeans(beanType, new AnyQualifier());
- }
-
- Bean<?> bean = null;
if (!beans.isEmpty())
{
- bean = beans.iterator().next();
+ beanClass = beans.iterator().next().getBeanClass();
}
-
- if (bean == null)
+ else
{
try
{
- Class<?> c = Class.forName(componentName);
- appendClassSource(response.getOutputStream(), c, types);
+ beanClass = Class.forName(componentName);
}
- catch (ClassNotFoundException ex)
+ catch (ClassNotFoundException ex)
{
log.error(String.format("Component not found: [%s]",
componentName));
throw new ServletException(
- "Invalid request - component not found.");
- }
+ "Invalid request - component not found.");
+ }
}
- else
- {
- beansCached.add(bean);
- }
+
+ typesCached.add(beanClass);
}
- generateBeanInterface(beansCached, response.getOutputStream(), types);
+ generateBeanInterface(typesCached, response.getOutputStream(), types);
}
/**
@@ -139,27 +118,26 @@
* @throws IOException
* Thrown if there is an error writing to the OutputStream
*/
- public void generateBeanInterface(Set<Bean<?>> beans, OutputStream out,
+ public void generateBeanInterface(Set<Class<?>> classes, OutputStream out,
Set<Type> types) throws IOException
{
- for (Bean<?> bean : beans)
+ for (Class<?> cls : classes)
{
- if (bean != null)
+ if (cls != null)
{
- if (!interfaceCache.containsKey(bean.getBeanClass()))
+ if (!interfaceCache.containsKey(cls))
{
synchronized (interfaceCache)
{
- if (!interfaceCache.containsKey(bean.getBeanClass()))
+ if (!interfaceCache.containsKey(cls))
{
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
- appendBeanSource(bOut, bean, types);
- interfaceCache
- .put(bean.getBeanClass(), bOut.toByteArray());
+ appendBeanSource(bOut, cls, types);
+ interfaceCache.put(cls, bOut.toByteArray());
}
}
}
- out.write(interfaceCache.get(bean.getBeanClass()));
+ out.write(interfaceCache.get(cls));
}
}
}
@@ -305,7 +283,7 @@
* @throws IOException
* If there is an error writing to the OutputStream.
*/
- private void appendBeanSource(OutputStream out, Bean<?> bean, Set<Type> types)
+ private void appendBeanSource(OutputStream out, Class<?> beanClass, Set<Type> types)
throws IOException
{
StringBuilder componentSrc = new StringBuilder();
@@ -314,18 +292,18 @@
// Check if any of the methods are annotated with @WebRemote, and if so
// treat it as an "action" component instead of a type component
- for (Method m : bean.getBeanClass().getDeclaredMethods())
+ for (Method m : beanClass.getDeclaredMethods())
{
if (m.getAnnotation(WebRemote.class) != null)
{
- componentTypes.add(bean.getBeanClass());
+ componentTypes.add(beanClass);
break;
}
}
if (componentTypes.isEmpty())
{
- appendTypeSource(out, bean.getBeanClass(), types);
+ appendTypeSource(out, beanClass, types);
return;
}
@@ -345,7 +323,8 @@
return;
}
- String beanName = bean.getName() != null ? bean.getName() : bean.getBeanClass().getName();
+ String name = beanManager.getBeans(beanClass).iterator().next().getName();
+ String beanName = name != null ? name : beanClass.getName();
if (beanName.contains("."))
{
componentSrc.append("Seam.Remoting.createNamespace('");
15 years
Seam SVN: r11711 - in modules/trunk/remoting: examples/helloworld/src/main/webapp and 5 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-01 18:47:16 -0500 (Tue, 01 Dec 2009)
New Revision: 11711
Added:
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/ClassOrInterfaceType.java
Modified:
modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloAction.java
modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloQualifier.java
modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationInvocationHandler.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/Call.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/AnnotationParser.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Annotation.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/AnnotationsUnit.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/BooleanLiteral.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Literal.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MarkerAnnotation.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValue.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValueArrayInitializer.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValuePair.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValuePairs.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Name.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Node.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeChoice.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeList.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeListInterface.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeListOptional.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeOptional.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeSequence.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeToken.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NormalAnnotation.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NullLiteral.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/PrimitiveType.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/SingleMemberAnnotation.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/DepthFirstVisitor.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJDepthFirst.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguDepthFirst.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguVisitor.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVisitor.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidDepthFirst.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidVisitor.java
modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/Visitor.java
modules/trunk/remoting/src/main/javacc/AnnotationParser.jj
modules/trunk/remoting/src/main/javacc/readme.txt
Log:
added support for class-valued qualifier members
Modified: modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloAction.java
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloAction.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloAction.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -2,7 +2,7 @@
import org.jboss.seam.remoting.annotations.WebRemote;
-@HelloQualifier(foo = "abc")
+@HelloQualifier(foo = 123, bar = String.class)
public class HelloAction {
@WebRemote
public String sayHello(String name) {
Modified: modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloQualifier.java
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloQualifier.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/examples/helloworld/src/main/java/org/jboss/seam/remoting/examples/helloworld/HelloQualifier.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -6,11 +6,13 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
+import javax.enterprise.util.Nonbinding;
import javax.inject.Qualifier;
@Retention(RUNTIME)
@Target(TYPE)
@Qualifier
public @interface HelloQualifier {
- String foo() default "bar";
+ int foo();
+ Class bar();
}
Modified: modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml
===================================================================
--- modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/examples/helloworld/src/main/webapp/helloworld.xhtml 2009-12-01 23:47:16 UTC (rev 11711)
@@ -25,7 +25,8 @@
var name = prompt("What is your name?");
if (name == null) return;
var callback = function(result) { alert(result); };
- Seam.Component.create("org.jboss.seam.remoting.examples.helloworld.HelloAction", "@org.jboss.seam.remoting.examples.helloworld.HelloQualifier(foo=\"abc\")").sayHello(name, callback);
+ Seam.Component.create("org.jboss.seam.remoting.examples.helloworld.HelloAction",
+ "@HelloQualifier(foo = 123, bar = String.class)").sayHello(name, callback);
}
</script>
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationInvocationHandler.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationInvocationHandler.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationInvocationHandler.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -57,7 +57,7 @@
for (int i = 0; i < annotationType.getDeclaredMethods().length; i++)
{
string.append(annotationType.getDeclaredMethods()[i].getName()).append('=');
- Object value = invoke(annotationType.getDeclaredMethods()[i], this);
+ Object value = memberValues.get(annotationType.getDeclaredMethods()[i].getName());
if (value instanceof boolean[])
{
appendInBraces(string, Arrays.toString((boolean[]) value));
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -13,6 +13,8 @@
import org.jboss.seam.remoting.annotationparser.AnnotationParser;
import org.jboss.seam.remoting.annotationparser.ParseException;
import org.jboss.seam.remoting.annotationparser.syntaxtree.AnnotationsUnit;
+import org.jboss.seam.remoting.annotationparser.syntaxtree.BooleanLiteral;
+import org.jboss.seam.remoting.annotationparser.syntaxtree.ClassOrInterfaceType;
import org.jboss.seam.remoting.annotationparser.syntaxtree.Literal;
import org.jboss.seam.remoting.annotationparser.syntaxtree.MarkerAnnotation;
import org.jboss.seam.remoting.annotationparser.syntaxtree.MemberValue;
@@ -20,7 +22,6 @@
import org.jboss.seam.remoting.annotationparser.syntaxtree.MemberValuePairs;
import org.jboss.seam.remoting.annotationparser.syntaxtree.Name;
import org.jboss.seam.remoting.annotationparser.syntaxtree.Node;
-import org.jboss.seam.remoting.annotationparser.syntaxtree.NodeChoice;
import org.jboss.seam.remoting.annotationparser.syntaxtree.NodeListOptional;
import org.jboss.seam.remoting.annotationparser.syntaxtree.NodeOptional;
import org.jboss.seam.remoting.annotationparser.syntaxtree.NodeSequence;
@@ -68,7 +69,6 @@
private Annotation[] annotations;
- @SuppressWarnings("unchecked")
public AnnotationsParser(Class<?> beanType, String declaration)
{
this.beanType = beanType;
@@ -84,7 +84,7 @@
catch (ParseException e)
{
throw new IllegalArgumentException(
- "Error while parsing annotation declaration: " + declaration);
+ "Error while parsing annotation declaration: " + declaration, e);
}
annotations = new Annotation[meta.size()];
@@ -195,10 +195,16 @@
{
for (Node n : mvp.f1.nodes)
{
- if (n instanceof MemberValuePair)
+ if (n instanceof NodeSequence)
{
- MemberValuePair p = (MemberValuePair) n;
- extractMemberValue(metadata, p.f0.tokenImage, p.f2);
+ for (Node nsn : ((NodeSequence) n).nodes)
+ {
+ if (nsn instanceof MemberValuePair)
+ {
+ MemberValuePair p = (MemberValuePair) nsn;
+ extractMemberValue(metadata, p.f0.tokenImage, p.f2);
+ }
+ }
}
}
}
@@ -243,35 +249,85 @@
case 0: // Annotation
break;
case 1: // MemberValueArray
+ // not supported - array member values are non-binding
break;
case 2: // Literal
value = convertLiteral((Literal) memberValue.f0.choice);
break;
+ case 3: // ClassOrInterfaceType
+ value = convertClassOrInterfaceType((ClassOrInterfaceType) memberValue.f0.choice);
+ break;
}
metadata.addMemberValue(memberName, value);
}
private Object convertLiteral(Literal literal)
- {
- // TODO add the missing conversions
-
+ {
switch (literal.f0.which)
{
case 0: // <INTEGER_LITERAL>
return Integer.parseInt(((NodeToken) literal.f0.choice).tokenImage);
case 1: // <FLOATING_POINT_LITERAL>
return Float.parseFloat(((NodeToken) literal.f0.choice).tokenImage);
- case 2: // <CHARACTER_LITERAL>
+ case 2: // <CHARACTER_LITERAL>
+ return ((NodeToken) literal.f0.choice).tokenImage.charAt(1); // ignore the single quotes
case 3: // <STRING_LITERAL>
- String value = ((NodeToken) literal.f0.choice).tokenImage;
- return value.substring(1, value.length() - 1); // strip the double quotes
+ String stringVal = ((NodeToken) literal.f0.choice).tokenImage;
+ return stringVal.substring(1, stringVal.length() - 1); // strip the double quotes
case 4: // BooleanLiteral()
+ return "true".equals(((NodeToken) ((BooleanLiteral) literal.f0.choice).f0.choice).tokenImage);
case 5: // NullLiteral()
+ return null;
}
return null;
}
+
+ private Class<?> convertClassOrInterfaceType(ClassOrInterfaceType node)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append(node.f0.tokenImage);
+ if (node.f1.present())
+ {
+ for (Node n : node.f1.nodes)
+ {
+ if (n instanceof NodeSequence)
+ {
+ for (Node nsn : ((NodeSequence) n).nodes)
+ {
+ if (nsn instanceof NodeToken)
+ {
+ sb.append(((NodeToken) nsn).tokenImage);
+ }
+ }
+ }
+ }
+ }
+
+ String className = sb.toString();
+
+ try
+ {
+ return Class.forName(className);
+ }
+ catch (ClassNotFoundException e)
+ {
+ if (!className.startsWith("java.lang."))
+ {
+ // try finding the class in the java.lang package
+ try
+ {
+ return Class.forName("java.lang." + className);
+ }
+ catch (ClassNotFoundException e1) { }
+ }
+
+ throw new IllegalArgumentException(
+ "Invalid class name specified for annotation member value: " + className);
+ }
+ }
+
private String extractName(Name name)
{
StringBuilder sb = new StringBuilder();
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/Call.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/Call.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/Call.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -72,7 +72,9 @@
if (beans.isEmpty())
{
- throw new IllegalArgumentException("Invalid bean name specified: " + beanName);
+ throw new IllegalArgumentException(
+ "Could not find bean with bean with type/name " + beanName +
+ ", qualifiers [" + qualifiers + "]");
}
}
@@ -193,7 +195,6 @@
Object[] params = convertParams(m.getGenericParameterTypes());
- // Invoke!
try
{
result = m.invoke(instance, params);
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/AnnotationParser.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/AnnotationParser.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/AnnotationParser.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -426,6 +426,7 @@
Annotation n1;
MemberValueArrayInitializer n2;
Literal n3;
+ ClassOrInterfaceType n4;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case AT:
n1 = Annotation();
@@ -445,6 +446,10 @@
n3 = Literal();
n0 = new NodeChoice(n3, 2);
break;
+ case IDENTIFIER:
+ n4 = ClassOrInterfaceType();
+ n0 = new NodeChoice(n4, 3);
+ break;
default:
jj_consume_token(-1);
throw new ParseException();
@@ -453,6 +458,46 @@
throw new Error("Missing return statement in function");
}
+ final public ClassOrInterfaceType ClassOrInterfaceType() throws ParseException {
+ NodeToken n0;
+ Token n1;
+ NodeListOptional n2 = new NodeListOptional();
+ NodeSequence n3;
+ NodeToken n4;
+ Token n5;
+ NodeToken n6;
+ Token n7;
+ NodeToken n8;
+ Token n9;
+ NodeToken n10;
+ Token n11;
+ n1 = jj_consume_token(IDENTIFIER);
+ n0 = JTBToolkit.makeNodeToken(n1);
+ label_4:
+ while (true) {
+ if (jj_2_3(2)) {
+ ;
+ } else {
+ break label_4;
+ }
+ n3 = new NodeSequence(2);
+ n5 = jj_consume_token(DOT);
+ n4 = JTBToolkit.makeNodeToken(n5);
+ n3.addNode(n4);
+ n7 = jj_consume_token(IDENTIFIER);
+ n6 = JTBToolkit.makeNodeToken(n7);
+ n3.addNode(n6);
+ n2.addNode(n3);
+ }
+ n2.nodes.trimToSize();
+ n9 = jj_consume_token(DOT);
+ n8 = JTBToolkit.makeNodeToken(n9);
+ n11 = jj_consume_token(CLASS);
+ n10 = JTBToolkit.makeNodeToken(n11);
+ {if (true) return new ClassOrInterfaceType(n0,n2,n8,n10);}
+ throw new Error("Missing return statement in function");
+ }
+
final public MemberValueArrayInitializer MemberValueArrayInitializer() throws ParseException {
NodeToken n0;
Token n1;
@@ -470,12 +515,12 @@
n1 = jj_consume_token(LBRACE);
n0 = JTBToolkit.makeNodeToken(n1);
n2 = MemberValue();
- label_4:
+ label_5:
while (true) {
- if (jj_2_3(2)) {
+ if (jj_2_4(2)) {
;
} else {
- break label_4;
+ break label_5;
}
n4 = new NodeSequence(2);
n6 = jj_consume_token(COMMA);
@@ -519,154 +564,168 @@
catch(LookaheadSuccess ls) { return true; }
}
- private boolean jj_3R_17() {
- if (jj_3R_26()) return true;
+ private boolean jj_2_4(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_4(); }
+ catch(LookaheadSuccess ls) { return true; }
+ }
+
+ private boolean jj_3R_20() {
+ if (jj_3R_29()) return true;
return false;
}
- private boolean jj_3R_16() {
- if (jj_3R_25()) return true;
+ private boolean jj_3R_19() {
+ if (jj_3R_28()) return true;
return false;
}
- private boolean jj_3R_26() {
+ private boolean jj_3R_13() {
+ if (jj_3R_17()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_29() {
if (jj_scan_token(AT)) return true;
return false;
}
- private boolean jj_3R_15() {
- if (jj_3R_24()) return true;
+ private boolean jj_3R_12() {
+ if (jj_3R_16()) return true;
return false;
}
- private boolean jj_3R_11() {
- if (jj_3R_14()) return true;
+ private boolean jj_3R_18() {
+ if (jj_3R_27()) return true;
return false;
}
- private boolean jj_3R_10() {
- if (jj_3R_13()) return true;
+ private boolean jj_3R_11() {
+ if (jj_3R_15()) return true;
return false;
}
- private boolean jj_3R_8() {
+ private boolean jj_3R_9() {
if (jj_scan_token(DOT)) return true;
if (jj_scan_token(IDENTIFIER)) return true;
return false;
}
- private boolean jj_3R_12() {
+ private boolean jj_3R_14() {
Token xsp;
xsp = jj_scanpos;
- if (jj_3R_15()) {
+ if (jj_3R_18()) {
jj_scanpos = xsp;
- if (jj_3R_16()) {
+ if (jj_3R_19()) {
jj_scanpos = xsp;
- if (jj_3R_17()) return true;
+ if (jj_3R_20()) return true;
}
}
return false;
}
- private boolean jj_3R_23() {
- if (jj_3R_28()) return true;
+ private boolean jj_3R_10() {
+ if (jj_3R_14()) return true;
return false;
}
- private boolean jj_3R_9() {
- if (jj_3R_12()) return true;
+ private boolean jj_3R_26() {
+ if (jj_3R_31()) return true;
return false;
}
- private boolean jj_3R_22() {
- if (jj_3R_27()) return true;
+ private boolean jj_3R_25() {
+ if (jj_3R_30()) return true;
return false;
}
- private boolean jj_3R_5() {
+ private boolean jj_3R_6() {
if (jj_scan_token(IDENTIFIER)) return true;
Token xsp;
while (true) {
xsp = jj_scanpos;
- if (jj_3R_8()) { jj_scanpos = xsp; break; }
+ if (jj_3R_9()) { jj_scanpos = xsp; break; }
}
return false;
}
- private boolean jj_3R_7() {
+ private boolean jj_3R_8() {
Token xsp;
xsp = jj_scanpos;
- if (jj_3R_9()) {
- jj_scanpos = xsp;
if (jj_3R_10()) {
jj_scanpos = xsp;
- if (jj_3R_11()) return true;
+ if (jj_3R_11()) {
+ jj_scanpos = xsp;
+ if (jj_3R_12()) {
+ jj_scanpos = xsp;
+ if (jj_3R_13()) return true;
}
}
+ }
return false;
}
- private boolean jj_3R_21() {
+ private boolean jj_3R_24() {
if (jj_scan_token(STRING_LITERAL)) return true;
return false;
}
- private boolean jj_3R_20() {
+ private boolean jj_3R_23() {
if (jj_scan_token(CHARACTER_LITERAL)) return true;
return false;
}
- private boolean jj_3R_19() {
- if (jj_scan_token(FLOATING_POINT_LITERAL)) return true;
+ private boolean jj_3_3() {
+ if (jj_scan_token(DOT)) return true;
+ if (jj_scan_token(IDENTIFIER)) return true;
return false;
}
- private boolean jj_3_3() {
- if (jj_scan_token(COMMA)) return true;
- if (jj_3R_7()) return true;
+ private boolean jj_3R_22() {
+ if (jj_scan_token(FLOATING_POINT_LITERAL)) return true;
return false;
}
- private boolean jj_3R_28() {
+ private boolean jj_3R_31() {
if (jj_scan_token(NULL)) return true;
return false;
}
- private boolean jj_3R_24() {
+ private boolean jj_3R_27() {
if (jj_scan_token(AT)) return true;
return false;
}
- private boolean jj_3R_6() {
+ private boolean jj_3R_7() {
if (jj_scan_token(IDENTIFIER)) return true;
if (jj_scan_token(ASSIGN)) return true;
return false;
}
- private boolean jj_3R_18() {
+ private boolean jj_3R_21() {
if (jj_scan_token(INTEGER_LITERAL)) return true;
return false;
}
- private boolean jj_3R_13() {
- if (jj_scan_token(LBRACE)) return true;
+ private boolean jj_3R_17() {
+ if (jj_scan_token(IDENTIFIER)) return true;
return false;
}
- private boolean jj_3R_14() {
+ private boolean jj_3R_16() {
Token xsp;
xsp = jj_scanpos;
- if (jj_3R_18()) {
+ if (jj_3R_21()) {
jj_scanpos = xsp;
- if (jj_3R_19()) {
+ if (jj_3R_22()) {
jj_scanpos = xsp;
- if (jj_3R_20()) {
+ if (jj_3R_23()) {
jj_scanpos = xsp;
- if (jj_3R_21()) {
+ if (jj_3R_24()) {
jj_scanpos = xsp;
- if (jj_3R_22()) {
+ if (jj_3R_25()) {
jj_scanpos = xsp;
- if (jj_3R_23()) return true;
+ if (jj_3R_26()) return true;
}
}
}
@@ -675,47 +734,58 @@
return false;
}
- private boolean jj_3R_25() {
+ private boolean jj_3R_28() {
if (jj_scan_token(AT)) return true;
return false;
}
- private boolean jj_3R_30() {
+ private boolean jj_3_4() {
+ if (jj_scan_token(COMMA)) return true;
+ if (jj_3R_8()) return true;
+ return false;
+ }
+
+ private boolean jj_3R_33() {
if (jj_scan_token(FALSE)) return true;
return false;
}
+ private boolean jj_3R_15() {
+ if (jj_scan_token(LBRACE)) return true;
+ return false;
+ }
+
private boolean jj_3_2() {
if (jj_scan_token(AT)) return true;
- if (jj_3R_5()) return true;
+ if (jj_3R_6()) return true;
if (jj_scan_token(LPAREN)) return true;
return false;
}
- private boolean jj_3R_29() {
+ private boolean jj_3R_32() {
if (jj_scan_token(TRUE)) return true;
return false;
}
private boolean jj_3_1() {
if (jj_scan_token(AT)) return true;
- if (jj_3R_5()) return true;
+ if (jj_3R_6()) return true;
if (jj_scan_token(LPAREN)) return true;
Token xsp;
xsp = jj_scanpos;
- if (jj_3R_6()) {
+ if (jj_3R_7()) {
jj_scanpos = xsp;
if (jj_scan_token(78)) return true;
}
return false;
}
- private boolean jj_3R_27() {
+ private boolean jj_3R_30() {
Token xsp;
xsp = jj_scanpos;
- if (jj_3R_29()) {
+ if (jj_3R_32()) {
jj_scanpos = xsp;
- if (jj_3R_30()) return true;
+ if (jj_3R_33()) return true;
}
return false;
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Annotation.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Annotation.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Annotation.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Grammar production:
* f0 -> NormalAnnotation()
@@ -19,16 +17,16 @@
f0 = n0;
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/AnnotationsUnit.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/AnnotationsUnit.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/AnnotationsUnit.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Grammar production:
* f0 -> [ Annotation() ( "," Annotation() )* ]
@@ -17,16 +15,16 @@
f0 = n0;
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/BooleanLiteral.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/BooleanLiteral.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/BooleanLiteral.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Grammar production:
* f0 -> "true"
@@ -18,16 +16,16 @@
f0 = n0;
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
}
Added: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/ClassOrInterfaceType.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/ClassOrInterfaceType.java (rev 0)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/ClassOrInterfaceType.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -0,0 +1,47 @@
+//
+// Generated by JTB 1.3.2
+//
+
+package org.jboss.seam.remoting.annotationparser.syntaxtree;
+
+/**
+ * Grammar production:
+ * f0 -> <IDENTIFIER>
+ * f1 -> ( "." <IDENTIFIER> )*
+ * f2 -> "."
+ * f3 -> "class"
+ */
+public class ClassOrInterfaceType implements Node {
+ public NodeToken f0;
+ public NodeListOptional f1;
+ public NodeToken f2;
+ public NodeToken f3;
+
+ public ClassOrInterfaceType(NodeToken n0, NodeListOptional n1, NodeToken n2, NodeToken n3) {
+ f0 = n0;
+ f1 = n1;
+ f2 = n2;
+ f3 = n3;
+ }
+
+ public ClassOrInterfaceType(NodeToken n0, NodeListOptional n1) {
+ f0 = n0;
+ f1 = n1;
+ f2 = new NodeToken(".");
+ f3 = new NodeToken("class");
+ }
+
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
+ v.visit(this);
+ }
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
+ return v.visit(this,argu);
+ }
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
+ return v.visit(this);
+ }
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
+ v.visit(this,argu);
+ }
+}
+
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Literal.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Literal.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Literal.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Grammar production:
* f0 -> <INTEGER_LITERAL>
@@ -22,16 +20,16 @@
f0 = n0;
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MarkerAnnotation.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MarkerAnnotation.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MarkerAnnotation.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Grammar production:
* f0 -> "@"
@@ -25,16 +23,16 @@
f1 = n0;
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValue.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValue.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValue.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,13 +4,12 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Grammar production:
* f0 -> Annotation()
* | MemberValueArrayInitializer()
* | Literal()
+ * | ClassOrInterfaceType()
*/
public class MemberValue implements Node {
public NodeChoice f0;
@@ -19,16 +18,16 @@
f0 = n0;
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValueArrayInitializer.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValueArrayInitializer.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValueArrayInitializer.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Grammar production:
* f0 -> "{"
@@ -37,16 +35,16 @@
f4 = new NodeToken("}");
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValuePair.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValuePair.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValuePair.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Grammar production:
* f0 -> <IDENTIFIER>
@@ -29,16 +27,16 @@
f2 = n1;
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValuePairs.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValuePairs.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/MemberValuePairs.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Grammar production:
* f0 -> MemberValuePair()
@@ -20,16 +18,16 @@
f1 = n1;
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Name.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Name.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Name.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Grammar production:
* f0 -> <IDENTIFIER>
@@ -20,16 +18,16 @@
f1 = n1;
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Node.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Node.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/Node.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,15 +4,13 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* The interface which all syntax tree classes must implement.
*/
public interface Node extends java.io.Serializable {
- public void accept(Visitor v);
- public <R,A> R accept(GJVisitor<R,A> v, A argu);
- public <R> R accept(GJNoArguVisitor<R> v);
- public <A> void accept(GJVoidVisitor<A> v, A argu);
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v);
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu);
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v);
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu);
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeChoice.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeChoice.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeChoice.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Represents a grammar choice, e.g. ( A | B )
*/
@@ -19,16 +17,16 @@
which = whichChoice;
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
choice.accept(v);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return choice.accept(v,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return choice.accept(v);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
choice.accept(v,argu);
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeList.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeList.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeList.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,7 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
import java.util.*;
/**
@@ -27,16 +26,16 @@
public Enumeration<Node> elements() { return nodes.elements(); }
public Node elementAt(int i) { return nodes.elementAt(i); }
public int size() { return nodes.size(); }
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeListInterface.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeListInterface.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeListInterface.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* The interface which NodeList, NodeListOptional, and NodeSequence
* implement.
@@ -16,9 +14,9 @@
public java.util.Enumeration<Node> elements();
public int size();
- public void accept(Visitor v);
- public <R,A> R accept(GJVisitor<R,A> v, A argu);
- public <R> R accept(GJNoArguVisitor<R> v);
- public <A> void accept(GJVoidVisitor<A> v, A argu);
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v);
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu);
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v);
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu);
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeListOptional.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeListOptional.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeListOptional.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,7 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
import java.util.*;
/**
@@ -28,16 +27,16 @@
public Node elementAt(int i) { return nodes.elementAt(i); }
public int size() { return nodes.size(); }
public boolean present() { return nodes.size() != 0; }
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeOptional.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeOptional.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeOptional.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Represents an grammar optional node, e.g. ( A )? or [ A ]
*/
@@ -24,16 +22,16 @@
node = n;
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
public boolean present() { return node != null; }
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeSequence.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeSequence.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeSequence.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,7 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
import java.util.*;
/**
@@ -28,16 +27,16 @@
public Node elementAt(int i) { return nodes.elementAt(i); }
public Enumeration<Node> elements() { return nodes.elements(); }
public int size() { return nodes.size(); }
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeToken.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeToken.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NodeToken.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,7 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
import java.util.*;
/**
* Represents a single token in the grammar. If the "-tk" option
@@ -60,16 +59,16 @@
return buf.toString();
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NormalAnnotation.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NormalAnnotation.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NormalAnnotation.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Grammar production:
* f0 -> "@"
@@ -37,16 +35,16 @@
f4 = new NodeToken(")");
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NullLiteral.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NullLiteral.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/NullLiteral.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Grammar production:
* f0 -> "null"
@@ -21,16 +19,16 @@
f0 = new NodeToken("null");
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/PrimitiveType.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/PrimitiveType.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/PrimitiveType.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Grammar production:
* f0 -> "boolean"
@@ -24,16 +22,16 @@
f0 = n0;
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/SingleMemberAnnotation.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/SingleMemberAnnotation.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/syntaxtree/SingleMemberAnnotation.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -4,8 +4,6 @@
package org.jboss.seam.remoting.annotationparser.syntaxtree;
-import org.jboss.seam.remoting.annotationparser.visitor.*;
-
/**
* Grammar production:
* f0 -> "@"
@@ -37,16 +35,16 @@
f4 = new NodeToken(")");
}
- public void accept(Visitor v) {
+ public void accept(org.jboss.seam.remoting.annotationparser.visitor.Visitor v) {
v.visit(this);
}
- public <R,A> R accept(GJVisitor<R,A> v, A argu) {
+ public <R,A> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
- public <R> R accept(GJNoArguVisitor<R> v) {
+ public <R> R accept(org.jboss.seam.remoting.annotationparser.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
- public <A> void accept(GJVoidVisitor<A> v, A argu) {
+ public <A> void accept(org.jboss.seam.remoting.annotationparser.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
}
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/DepthFirstVisitor.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/DepthFirstVisitor.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/DepthFirstVisitor.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -170,12 +170,26 @@
* f0 -> Annotation()
* | MemberValueArrayInitializer()
* | Literal()
+ * | ClassOrInterfaceType()
*/
public void visit(MemberValue n) {
n.f0.accept(this);
}
/**
+ * f0 -> <IDENTIFIER>
+ * f1 -> ( "." <IDENTIFIER> )*
+ * f2 -> "."
+ * f3 -> "class"
+ */
+ public void visit(ClassOrInterfaceType n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ }
+
+ /**
* f0 -> "{"
* f1 -> MemberValue()
* f2 -> ( "," MemberValue() )*
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJDepthFirst.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJDepthFirst.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJDepthFirst.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -214,6 +214,7 @@
* f0 -> Annotation()
* | MemberValueArrayInitializer()
* | Literal()
+ * | ClassOrInterfaceType()
*/
public R visit(MemberValue n, A argu) {
R _ret=null;
@@ -222,6 +223,21 @@
}
/**
+ * f0 -> <IDENTIFIER>
+ * f1 -> ( "." <IDENTIFIER> )*
+ * f2 -> "."
+ * f3 -> "class"
+ */
+ public R visit(ClassOrInterfaceType n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ return _ret;
+ }
+
+ /**
* f0 -> "{"
* f1 -> MemberValue()
* f2 -> ( "," MemberValue() )*
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguDepthFirst.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguDepthFirst.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguDepthFirst.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -214,6 +214,7 @@
* f0 -> Annotation()
* | MemberValueArrayInitializer()
* | Literal()
+ * | ClassOrInterfaceType()
*/
public R visit(MemberValue n) {
R _ret=null;
@@ -222,6 +223,21 @@
}
/**
+ * f0 -> <IDENTIFIER>
+ * f1 -> ( "." <IDENTIFIER> )*
+ * f2 -> "."
+ * f3 -> "class"
+ */
+ public R visit(ClassOrInterfaceType n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ return _ret;
+ }
+
+ /**
* f0 -> "{"
* f1 -> MemberValue()
* f2 -> ( "," MemberValue() )*
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguVisitor.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguVisitor.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJNoArguVisitor.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -118,10 +118,19 @@
* f0 -> Annotation()
* | MemberValueArrayInitializer()
* | Literal()
+ * | ClassOrInterfaceType()
*/
public R visit(MemberValue n);
/**
+ * f0 -> <IDENTIFIER>
+ * f1 -> ( "." <IDENTIFIER> )*
+ * f2 -> "."
+ * f3 -> "class"
+ */
+ public R visit(ClassOrInterfaceType n);
+
+ /**
* f0 -> "{"
* f1 -> MemberValue()
* f2 -> ( "," MemberValue() )*
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVisitor.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVisitor.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVisitor.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -118,10 +118,19 @@
* f0 -> Annotation()
* | MemberValueArrayInitializer()
* | Literal()
+ * | ClassOrInterfaceType()
*/
public R visit(MemberValue n, A argu);
/**
+ * f0 -> <IDENTIFIER>
+ * f1 -> ( "." <IDENTIFIER> )*
+ * f2 -> "."
+ * f3 -> "class"
+ */
+ public R visit(ClassOrInterfaceType n, A argu);
+
+ /**
* f0 -> "{"
* f1 -> MemberValue()
* f2 -> ( "," MemberValue() )*
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidDepthFirst.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidDepthFirst.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidDepthFirst.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -180,12 +180,26 @@
* f0 -> Annotation()
* | MemberValueArrayInitializer()
* | Literal()
+ * | ClassOrInterfaceType()
*/
public void visit(MemberValue n, A argu) {
n.f0.accept(this, argu);
}
/**
+ * f0 -> <IDENTIFIER>
+ * f1 -> ( "." <IDENTIFIER> )*
+ * f2 -> "."
+ * f3 -> "class"
+ */
+ public void visit(ClassOrInterfaceType n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ }
+
+ /**
* f0 -> "{"
* f1 -> MemberValue()
* f2 -> ( "," MemberValue() )*
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidVisitor.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidVisitor.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/GJVoidVisitor.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -118,10 +118,19 @@
* f0 -> Annotation()
* | MemberValueArrayInitializer()
* | Literal()
+ * | ClassOrInterfaceType()
*/
public void visit(MemberValue n, A argu);
/**
+ * f0 -> <IDENTIFIER>
+ * f1 -> ( "." <IDENTIFIER> )*
+ * f2 -> "."
+ * f3 -> "class"
+ */
+ public void visit(ClassOrInterfaceType n, A argu);
+
+ /**
* f0 -> "{"
* f1 -> MemberValue()
* f2 -> ( "," MemberValue() )*
Modified: modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/Visitor.java
===================================================================
--- modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/Visitor.java 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/java/org/jboss/seam/remoting/annotationparser/visitor/Visitor.java 2009-12-01 23:47:16 UTC (rev 11711)
@@ -118,10 +118,19 @@
* f0 -> Annotation()
* | MemberValueArrayInitializer()
* | Literal()
+ * | ClassOrInterfaceType()
*/
public void visit(MemberValue n);
/**
+ * f0 -> <IDENTIFIER>
+ * f1 -> ( "." <IDENTIFIER> )*
+ * f2 -> "."
+ * f3 -> "class"
+ */
+ public void visit(ClassOrInterfaceType n);
+
+ /**
* f0 -> "{"
* f1 -> MemberValue()
* f2 -> ( "," MemberValue() )*
Modified: modules/trunk/remoting/src/main/javacc/AnnotationParser.jj
===================================================================
--- modules/trunk/remoting/src/main/javacc/AnnotationParser.jj 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/javacc/AnnotationParser.jj 2009-12-01 23:47:16 UTC (rev 11711)
@@ -439,8 +439,16 @@
MemberValueArrayInitializer()
|
Literal()
+ |
+ ClassOrInterfaceType()
}
+void ClassOrInterfaceType():
+{}
+{
+ <IDENTIFIER> ( LOOKAHEAD(2) "." <IDENTIFIER> )* "." "class"
+}
+
void MemberValueArrayInitializer():
{}
{
Modified: modules/trunk/remoting/src/main/javacc/readme.txt
===================================================================
--- modules/trunk/remoting/src/main/javacc/readme.txt 2009-12-01 19:18:09 UTC (rev 11710)
+++ modules/trunk/remoting/src/main/javacc/readme.txt 2009-12-01 23:47:16 UTC (rev 11711)
@@ -2,4 +2,18 @@
JavaCC can be downloaded from https://javacc.dev.java.net/.
-Usage: /path/to/javacc AnnotationParser.jj
+JTB (Java Tree Builder) can be downloaded from http://compilers.cs.ucla.edu/jtb/
+
+Steps:
+
+1. First run JTB on the grammar file:
+
+ java -jar jtb132.jar -np org.jboss.seam.remoting.annotationparser.syntaxtree
+-vp org.jboss.seam.remoting.annotationparser.visitor AnnotationParser.jj
+
+This command should be run from the src/main/java/org/jboss/seam/remoting/annotationparser directory.
+
+2. Next run javacc on jtb.out.jj. This command should also be run in the
+annotationparser directory.
+
+Usage: /path/to/javacc jtb.out.jj
15 years
Seam SVN: r11710 - in branches/community/Seam_2_2/src/pdf: org/jboss/seam/pdf and 1 other directories.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-12-01 14:18:09 -0500 (Tue, 01 Dec 2009)
New Revision: 11710
Added:
branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UIMultiColumnText.java
Modified:
branches/community/Seam_2_2/src/pdf/META-INF/faces-config.xml
branches/community/Seam_2_2/src/pdf/META-INF/seam-pdf.taglib.xml
branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ITextUtils.java
Log:
JBSEAM-4493
Modified: branches/community/Seam_2_2/src/pdf/META-INF/faces-config.xml
===================================================================
--- branches/community/Seam_2_2/src/pdf/META-INF/faces-config.xml 2009-12-01 10:55:16 UTC (rev 11709)
+++ branches/community/Seam_2_2/src/pdf/META-INF/faces-config.xml 2009-12-01 19:18:09 UTC (rev 11710)
@@ -168,7 +168,11 @@
<component-class>org.jboss.seam.pdf.ui.UIForm</component-class>
</component>
-
+ <component>
+ <component-type>org.jboss.seam.pdf.ui.UIMultiColumnText</component-type>
+ <component-class>org.jboss.seam.pdf.ui.UIMultiColumnText</component-class>
+ </component>
+
<!--
<render-kit>
<render-kit-id>PDF</render-kit-id>
Modified: branches/community/Seam_2_2/src/pdf/META-INF/seam-pdf.taglib.xml
===================================================================
--- branches/community/Seam_2_2/src/pdf/META-INF/seam-pdf.taglib.xml 2009-12-01 10:55:16 UTC (rev 11709)
+++ branches/community/Seam_2_2/src/pdf/META-INF/seam-pdf.taglib.xml 2009-12-01 19:18:09 UTC (rev 11710)
@@ -237,4 +237,11 @@
</component>
</tag>
+ <tag>
+ <tag-name>textcolumn</tag-name>
+ <component>
+ <component-type>org.jboss.seam.pdf.ui.UIMultiColumnText</component-type>
+ </component>
+ </tag>
+
</facelet-taglib>
Modified: branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ITextUtils.java
===================================================================
--- branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ITextUtils.java 2009-12-01 10:55:16 UTC (rev 11709)
+++ branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ITextUtils.java 2009-12-01 19:18:09 UTC (rev 11710)
@@ -7,6 +7,7 @@
import com.lowagie.text.ElementTags;
import com.lowagie.text.PageSize;
import com.lowagie.text.Rectangle;
+import com.lowagie.text.pdf.PdfWriter;
public class ITextUtils
{
@@ -129,4 +130,19 @@
return values;
}
+
+ public static int runDirection(String direction)
+ {
+ if (direction == null || direction.equalsIgnoreCase("default")) {
+ return PdfWriter.RUN_DIRECTION_DEFAULT;
+ } else if (direction.equalsIgnoreCase("rtl")) {
+ return PdfWriter.RUN_DIRECTION_RTL;
+ } else if (direction.equalsIgnoreCase("ltr")) {
+ return PdfWriter.RUN_DIRECTION_LTR;
+ } else if (direction.equalsIgnoreCase("no-bidi")) {
+ return PdfWriter.RUN_DIRECTION_NO_BIDI;
+ } else {
+ throw new RuntimeException("unknown run direction " + direction);
+ }
+ }
}
Added: branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UIMultiColumnText.java
===================================================================
--- branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UIMultiColumnText.java (rev 0)
+++ branches/community/Seam_2_2/src/pdf/org/jboss/seam/pdf/ui/UIMultiColumnText.java 2009-12-01 19:18:09 UTC (rev 11710)
@@ -0,0 +1,92 @@
+package org.jboss.seam.pdf.ui;
+
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.pdf.ITextUtils;
+
+import com.lowagie.text.DocumentException;
+import com.lowagie.text.Element;
+import com.lowagie.text.PageSize;
+import com.lowagie.text.pdf.MultiColumnText;
+
+
+public class UIMultiColumnText
+ extends ITextComponent
+{
+
+ float left = 36;
+ float right = PageSize.LETTER.getWidth()-36;
+ String direction = "default";
+
+ MultiColumnText multiColumnText = null;
+
+
+ public float getLeft()
+ {
+ return (Float) valueBinding("left", left);
+ }
+
+ public void setLeft(float left)
+ {
+ this.left = left;
+ }
+
+ public float getRight()
+ {
+ return (Float) valueBinding("right", right);
+ }
+
+ public void setRight(float right)
+ {
+ this.right = right;
+ }
+
+ public String getDirection()
+ {
+ return (String) valueBinding("direction", direction);
+ }
+
+ public void setDirection(String direction)
+ {
+ this.direction = direction;
+ }
+
+ @Override
+ public void createITextObject(FacesContext context) throws IOException, DocumentException
+ {
+ multiColumnText = new MultiColumnText();
+
+ multiColumnText.addSimpleColumn(getLeft(), getRight());
+ multiColumnText.setRunDirection(ITextUtils.runDirection(getDirection()));
+ }
+
+ @Override
+ public Object getITextObject()
+ {
+ return multiColumnText;
+ }
+
+ @Override
+ public void handleAdd(Object other)
+ {
+ if (other instanceof Element) {
+ try {
+ multiColumnText.addElement((Element)other);
+ } catch (DocumentException e) {
+ throw new RuntimeException(e);
+ }
+ } else {
+ throw new RuntimeException("UIMultiColumnText only supports Element children");
+ }
+
+ }
+
+ @Override
+ public void removeITextObject()
+ {
+ multiColumnText = null;
+ }
+
+}
15 years