Seam SVN: r11760 - in modules/remoting/trunk/src/main: java/org/jboss/seam/remoting/model and 2 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-06 08:24:44 -0500 (Sun, 06 Dec 2009)
New Revision: 11760
Added:
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ChangeSet.java
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/Model.java
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ModelRegistry.java
Modified:
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/ExecutionHandler.java
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/BagWrapper.java
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/BeanWrapper.java
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/DateWrapper.java
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/NumberWrapper.java
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/StringWrapper.java
modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/Wrapper.java
modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js
Log:
flesh out the fetch model request method, fix some compiler warnings
Modified: modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java
===================================================================
--- modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java 2009-12-05 18:13:20 UTC (rev 11759)
+++ modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/AnnotationsParser.java 2009-12-06 13:24:44 UTC (rev 11760)
@@ -71,6 +71,7 @@
}
}
+ @SuppressWarnings("all")
private class AnyQualifier extends AnnotationLiteral<Any> implements Any {};
private Class<?> beanType;
Modified: modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/ExecutionHandler.java
===================================================================
--- modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/ExecutionHandler.java 2009-12-05 18:13:20 UTC (rev 11759)
+++ modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/ExecutionHandler.java 2009-12-06 13:24:44 UTC (rev 11760)
@@ -42,10 +42,8 @@
private static final byte[] CONTEXT_TAG_OPEN = "<context>".getBytes();
private static final byte[] CONTEXT_TAG_CLOSE = "</context>".getBytes();
- @Inject
- BeanManager beanManager;
- @Inject
- Conversation conversation;
+ @Inject BeanManager beanManager;
+ @Inject Conversation conversation;
/**
* The entry point for handling a request.
@@ -81,6 +79,12 @@
Document doc = xmlReader.read(new StringReader(requestData));
final Element env = doc.getRootElement();
final RequestContext ctx = unmarshalContext(env);
+
+ if (!ctx.getConversationId().isEmpty())
+ {
+ // TODO restore the conversation if there is a conversation ID in the context
+ //conversation.
+ }
// Extract the calls from the request
List<Call> calls = unmarshalCalls(env);
Added: modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ChangeSet.java
===================================================================
--- modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ChangeSet.java (rev 0)
+++ modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ChangeSet.java 2009-12-06 13:24:44 UTC (rev 11760)
@@ -0,0 +1,6 @@
+package org.jboss.seam.remoting.model;
+
+public class ChangeSet
+{
+
+}
Added: modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/Model.java
===================================================================
--- modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/Model.java (rev 0)
+++ modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/Model.java 2009-12-06 13:24:44 UTC (rev 11760)
@@ -0,0 +1,42 @@
+package org.jboss.seam.remoting.model;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+public class Model implements Serializable
+{
+ private static final long serialVersionUID = 8318288750036758325L;
+
+ private BeanManager beanManager;
+ private String id;
+ private Map<Integer,Object> refs;
+
+ private Set<Bean<?>> beans;
+
+ public Model(BeanManager beanManager)
+ {
+ this.beanManager = beanManager;
+ id = UUID.randomUUID().toString();
+ refs = new HashMap<Integer,Object>();
+ beans = new HashSet<Bean<?>>();
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void addBean()
+
+ public void applyChanges(Set<ChangeSet> delta)
+ {
+
+ }
+}
Added: modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ModelRegistry.java
===================================================================
--- modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ModelRegistry.java (rev 0)
+++ modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/model/ModelRegistry.java 2009-12-06 13:24:44 UTC (rev 11760)
@@ -0,0 +1,37 @@
+package org.jboss.seam.remoting.model;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+@ConversationScoped
+public class ModelRegistry implements Serializable
+{
+ private static final long serialVersionUID = -2952670948046596460L;
+
+ @Inject BeanManager beanManager;
+ private Map<String,Model> models;
+
+ public ModelRegistry()
+ {
+ models = new HashMap<String,Model>();
+ }
+
+ public Model createModel()
+ {
+ Model model = new Model(beanManager);
+ models.put(model.getId(), model);
+ return model;
+ }
+
+ public Model getModel(String id)
+ {
+ return models.get(id);
+ }
+
+
+}
Modified: modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/BagWrapper.java
===================================================================
--- modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/BagWrapper.java 2009-12-05 18:13:20 UTC (rev 11759)
+++ modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/BagWrapper.java 2009-12-06 13:24:44 UTC (rev 11760)
@@ -36,6 +36,7 @@
private static final byte[] ELEMENT_TAG_OPEN = "<element>".getBytes();
private static final byte[] ELEMENT_TAG_CLOSE = "</element>".getBytes();
+ @SuppressWarnings("unchecked")
public void marshal(OutputStream out) throws IOException
{
out.write(BAG_TAG_OPEN);
@@ -50,12 +51,12 @@
}
}
- Collection vals = null;
+ Collection<Object> vals = null;
// If the value is an array, convert it to a Collection
if (value.getClass().isArray())
{
- vals = new ArrayList();
+ vals = new ArrayList<Object>();
for (int i = 0; i < Array.getLength(value); i++)
vals.add(Array.get(value, i));
} else if (Collection.class.isAssignableFrom(value.getClass()))
@@ -133,7 +134,7 @@
return value;
}
- private Class getConcreteClass(Class c)
+ private Class<?> getConcreteClass(Class<?> c)
{
if (c.isInterface())
{
@@ -154,7 +155,7 @@
* Class
* @return ConversionScore
*/
- public ConversionScore conversionScore(Class cls)
+ public ConversionScore conversionScore(Class<?> cls)
{
// There's no such thing as an exact match for a bag, so we'll just look
// for
Modified: modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/BeanWrapper.java
===================================================================
--- modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/BeanWrapper.java 2009-12-05 18:13:20 UTC (rev 11759)
+++ modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/BeanWrapper.java 2009-12-06 13:24:44 UTC (rev 11760)
@@ -314,7 +314,7 @@
out.write(BEAN_CLOSE_TAG);
}
- public ConversionScore conversionScore(Class cls)
+ public ConversionScore conversionScore(Class<?> cls)
{
if (cls.equals(value.getClass()))
return ConversionScore.exact;
Modified: modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/DateWrapper.java
===================================================================
--- modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/DateWrapper.java 2009-12-05 18:13:20 UTC (rev 11759)
+++ modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/DateWrapper.java 2009-12-06 13:24:44 UTC (rev 11760)
@@ -86,7 +86,7 @@
return value;
}
- public ConversionScore conversionScore(Class cls)
+ public ConversionScore conversionScore(Class<?> cls)
{
if (Date.class.isAssignableFrom(cls)
|| Calendar.class.isAssignableFrom(cls))
Modified: modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/NumberWrapper.java
===================================================================
--- modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/NumberWrapper.java 2009-12-05 18:13:20 UTC (rev 11759)
+++ modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/NumberWrapper.java 2009-12-06 13:24:44 UTC (rev 11760)
@@ -94,7 +94,7 @@
* Class
* @return ConversionScore
*/
- public ConversionScore conversionScore(Class cls)
+ public ConversionScore conversionScore(Class<?> cls)
{
if (cls.equals(Integer.class) || cls.equals(Integer.TYPE)
|| cls.equals(Long.class) || cls.equals(Long.TYPE)
Modified: modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/StringWrapper.java
===================================================================
--- modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/StringWrapper.java 2009-12-05 18:13:20 UTC (rev 11759)
+++ modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/StringWrapper.java 2009-12-06 13:24:44 UTC (rev 11760)
@@ -217,12 +217,13 @@
}
}
- public ConversionScore conversionScore(Class cls)
+ @SuppressWarnings("unchecked")
+ public ConversionScore conversionScore(Class<?> cls)
{
if (cls.equals(String.class) || StringBuffer.class.isAssignableFrom(cls))
return ConversionScore.exact;
- for (Class c : COMPATIBLE_CLASSES)
+ for (Class<?> c : COMPATIBLE_CLASSES)
{
if (cls.equals(c))
return ConversionScore.compatible;
@@ -234,7 +235,7 @@
{
String elementValue = URLDecoder.decode(element.getStringValue(),
DEFAULT_ENCODING);
- Enum.valueOf(cls, elementValue);
+ Enum.valueOf((Class<? extends Enum>) cls, elementValue);
return ConversionScore.compatible;
} catch (IllegalArgumentException ex)
{
Modified: modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/Wrapper.java
===================================================================
--- modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/Wrapper.java 2009-12-05 18:13:20 UTC (rev 11759)
+++ modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/wrapper/Wrapper.java 2009-12-06 13:24:44 UTC (rev 11760)
@@ -67,5 +67,5 @@
* 2 - Param is this exact type
*
*/
- public ConversionScore conversionScore(Class cls);
+ public ConversionScore conversionScore(Class<?> cls);
}
Modified: modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js
===================================================================
--- modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js 2009-12-05 18:13:20 UTC (rev 11759)
+++ modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js 2009-12-06 13:24:44 UTC (rev 11760)
@@ -71,6 +71,7 @@
Seam.Remoting.PATH_EXECUTE = "/execute";
Seam.Remoting.PATH_SUBSCRIPTION = "/subscription";
+Seam.Remoting.PATH_MODEL = "/model";
Seam.Remoting.PATH_POLL = "/poll";
Seam.Remoting.encodedSessionId = Seam.Remoting.extractEncodedSessionId(window.location.href);
@@ -757,6 +758,39 @@
/* Remote Model API */
+Seam.Remoting.Action = function() {
+ this.beanType = null;
+ this.qualifiers = null;
+ this.method = null;
+ this.params = new Array();
+ this.expression = null;
+
+ Seam.Remoting.Action.prototype.setBeanType = function(beanType) {
+ this.beanType = beanType;
+ return this;
+ }
+
+ Seam.Remoting.Action.prototype.setQualifiers = function(qualifiers) {
+ this.qualifiers = qualifiers;
+ return this;
+ }
+
+ Seam.Remoting.Action.prototype.setMethod = function(method) {
+ this.method = method;
+ return this;
+ }
+
+ Seam.Remoting.Action.prototype.addParam = function(param) {
+ this.params.push(param);
+ return this;
+ }
+
+ Seam.Remoting.Action.prototype.setExpression = function(expr) {
+ this.expression = expr;
+ return this;
+ }
+}
+
Seam.Remoting.Model = function() {
this.expressions = new Array();
this.beans = new Array();
@@ -765,21 +799,86 @@
this.expressions.push({alias: alias, expr: expr});
}
- Seam.Remoting.Model.prototype.addBean = function(alias, bean) {
+ Seam.Remoting.Model.prototype.addBean = function(alias, bean, property) {
var q = null;
- if (arguments.length > 2) {
+ if (arguments.length > 3) {
q = new Array();
- for (var i = 1; i < arguments.length; i++) {
+ for (var i = 3; i < arguments.length; i++) {
q.push(arguments[i]);
}
}
- this.beans.push({alias: alias, bean: bean; qualifiers: q});
+ this.beans.push({alias: alias, bean: bean, property: property, qualifiers: q});
}
-
+
Seam.Remoting.Model.prototype.fetch = function(action) {
-
+ var r = this.createFetchRequest(action);
+ var env = Seam.Remoting.createEnvelope(Seam.Remoting.createHeader(), r.data);
+ Seam.Remoting.pendingCalls.put(r.id, r);
+ Seam.Remoting.sendAjaxRequest(env, Seam.Remoting.PATH_MODEL, this.processFetchResponse, false);
}
+ Seam.Remoting.Model.prototype.createFetchRequest = function(a) { // a = action
+ var callId = "" + Seam.Remoting.__callId++;
+ var d = "<model operation=\"fetch\" callId=\"" + callId + ">";
+ var refs = new Array();
+
+ if (a) {
+ d += "<action>";
+ if (a.beanType) {
+ d += "<target>" + a.beanType + "</target>";
+ if (a.qualifiers) d += "<qualifiers>" + a.qualifiers + "</qualifiers>";
+ if (a.method) d += "<method>" + a.method + "</method>";
+ if (a.params.length > 0) {
+ d += "<params>";
+ for (var i = 0; i < a.params.length; i++) {
+ d += "<param>" + Seam.Remoting.serializeValue(a.params[i], null, refs) + "</param>";
+ }
+ d += "</params>";
+ }
+ }
+ else if (a.expression) {
+ d += "<target>" + a.expression + "</target>";
+ }
+ d += "</action>";
+ }
+ if (this.beans.length > 0) {
+ for (var i = 0; i < this.beans.length; i++) {
+ var b = this.beans[i];
+ d += "<bean alias=\"" + b.alias + "\"><name>" + b.name + "</name>";
+ if (b.qualifiers && b.qualifiers.length > 0) {
+ d += "<qualifiers>";
+ for (var j = 0; j < b.qualifiers.length; j++) {
+ d += (j > 0 ? "," : "") + b.qualifiers[j];
+ }
+ d += "</qualifiers>";
+ }
+ d += "<property>" + b.property + "</property></bean>";
+ }
+ }
+ if (this.expressions.length > 0) {
+ for (var i = 0; i < this.expressions.length; i++) {
+ var e = this.expressions[i];
+ d += "<expression alias=\"" + e.alias + "\">" + e.expr + "</expression>";
+ }
+ }
+ if (refs.length > 0) {
+ d += "<refs>";
+ for (var i = 0; i < refs.length; i++) {
+ d += "<ref id=\"" + i + "\">";
+ d += Seam.Remoting.serializeType(refs[i], refs);
+ d += "</ref>";
+ }
+ d += "</refs>";
+ }
+ d += "</model>";
+
+ return {data: d, id: callId};
+ }
+
+ Seam.Remoting.Model.prototype.processFetchResponse = function(doc) {
+
+ }
+
Seam.Remoting.Model.prototype.applyUpdates = function(action) {
}
15 years
Seam SVN: r11759 - in modules: trunk and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-05 13:13:20 -0500 (Sat, 05 Dec 2009)
New Revision: 11759
Added:
modules/resources/trunk/
Removed:
modules/trunk/resources/
Log:
moved resources module
Copied: modules/resources/trunk (from rev 11758, modules/trunk/resources)
15 years
Seam SVN: r11758 - in modules: trunk and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-05 13:12:14 -0500 (Sat, 05 Dec 2009)
New Revision: 11758
Added:
modules/persistence/trunk/
Removed:
modules/trunk/persistence/
Log:
moved persistence module
Copied: modules/persistence/trunk (from rev 11757, modules/trunk/persistence)
15 years
Seam SVN: r11757 - in modules: trunk and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-05 13:11:08 -0500 (Sat, 05 Dec 2009)
New Revision: 11757
Added:
modules/pdf/trunk/
Removed:
modules/trunk/pdf/
Log:
moved pdf module
Copied: modules/pdf/trunk (from rev 11756, modules/trunk/pdf)
15 years
Seam SVN: r11756 - in modules: trunk and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-05 13:10:06 -0500 (Sat, 05 Dec 2009)
New Revision: 11756
Added:
modules/openwebbeans-bridge/trunk/
Removed:
modules/trunk/openwebbeans-bridge/
Log:
moved openwebbeans-bridge module
Copied: modules/openwebbeans-bridge/trunk (from rev 11755, modules/trunk/openwebbeans-bridge)
15 years
Seam SVN: r11755 - in modules: trunk and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-05 13:08:54 -0500 (Sat, 05 Dec 2009)
New Revision: 11755
Added:
modules/mock/trunk/
Removed:
modules/trunk/mock/
Log:
moved mock module
Copied: modules/mock/trunk (from rev 11754, modules/trunk/mock)
15 years
Seam SVN: r11754 - in modules: trunk and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-05 13:07:01 -0500 (Sat, 05 Dec 2009)
New Revision: 11754
Added:
modules/mail/trunk/
Removed:
modules/trunk/mail/
Log:
moved mail module
Copied: modules/mail/trunk (from rev 11753, modules/trunk/mail)
15 years
Seam SVN: r11753 - in modules: trunk and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-05 13:05:25 -0500 (Sat, 05 Dec 2009)
New Revision: 11753
Added:
modules/jsf-upgrade-tool/trunk/
Removed:
modules/trunk/jsf-upgrade-tool/
Log:
moved jsf-upgrade-tool module
Copied: modules/jsf-upgrade-tool/trunk (from rev 11752, modules/trunk/jsf-upgrade-tool)
15 years
Seam SVN: r11752 - in modules: trunk and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-05 13:04:08 -0500 (Sat, 05 Dec 2009)
New Revision: 11752
Added:
modules/jndi-bridge/trunk/
Removed:
modules/trunk/jndi-bridge/
Log:
moved jndi-bridge module
Copied: modules/jndi-bridge/trunk (from rev 11751, modules/trunk/jndi-bridge)
15 years
Seam SVN: r11751 - in modules: trunk and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-12-05 13:03:05 -0500 (Sat, 05 Dec 2009)
New Revision: 11751
Added:
modules/jms/trunk/
Removed:
modules/trunk/jms/
Log:
moved jms module
Copied: modules/jms/trunk (from rev 11750, modules/trunk/jms)
15 years