complex datatypes in messages ?

14 views
Skip to first unread message

tobber harley

unread,
Oct 20, 2009, 5:56:28 AM10/20/09
to Merapi
Hey,

is it possible to transmit also complex datatypes like lists,
hashtables and custom datatypes in the messages? Or are only primitive
types allowed for the communication?

Thanks!!!
-tobber

Adam Flater

unread,
Oct 20, 2009, 11:22:12 AM10/20/09
to merapi-...@googlegroups.com
Merapi uses AMF just like Blaze DS. So, yes, with the proper remote alias tags you can transmit complex types.

-adma

dasha.filippova

unread,
Oct 27, 2009, 2:32:24 PM10/27/09
to Merapi
what do you mean by the "remote alias tags"? is it the metadata on the
AS classes like [RemoteClass( alias="messages.MyMessage" ) ]?

On Oct 20, 11:22 am, Adam Flater <adamfla...@gmail.com> wrote:
> Merapi uses AMF just like Blaze DS. So, yes, with the proper remote alias
> tags you can transmit complex types.
>
> -adma
>
> On Tue, Oct 20, 2009 at 3:56 AM, tobber harley
> <tobias.h...@googlemail.com>wrote:

Adam Flater

unread,
Oct 27, 2009, 4:35:12 PM10/27/09
to merapi-...@googlegroups.com
Yes.. that's correct.

gurk...@googlemail.com

unread,
Oct 27, 2009, 7:54:43 PM10/27/09
to Merapi
Hi, could someone please post a complete example of the remote alias
tags ?

regards gurkerl

mglazer

unread,
Oct 28, 2009, 9:31:09 AM10/28/09
to Merapi
On the ActionScript side :

package com.domain
{
[RemoteClass("com.mglazer.lab.domain.MessageDTO")]
public dynamic class MessageDTO
{
public function MessageDTO()
{
}

}
}

On the Java side:

package com.mglazer.lab.merapi.domain;

import java.math.BigDecimal;

public class MessageDTO {

private String symbol;
private BigDecimal bid;
private BigDecimal offer;
private long qty;

public String getSymbol() {
return symbol;
}

public void setSymbol(String symbol) {
this.symbol = symbol;
}

public BigDecimal getBid() {
return bid;
}

public void setBid(BigDecimal bid) {
this.bid = bid;
}

public BigDecimal getOffer() {
return offer;
}

public void setOffer(BigDecimal offer) {
this.offer = offer;
}

public int getQty() {
return qty;
}

public void setQty(int qty) {
this.qty = qty;
}
public int getMessageCount() {
return messageCount;
}
}

In Java communicator:

Message msg = new Message();
msg.setType("messageFromJava");
msg.setData(new MessageDTO());
try{
Bridge.getInstance().sendMessage(msg);
}catch(Exception e){
System.out.println(e);
}

I hope that will help...

Thanks,
Mike




On Oct 27, 7:54 pm, "gurker...@googlemail.com"

Adam Flater

unread,
Oct 28, 2009, 11:07:16 AM10/28/09
to merapi-...@googlegroups.com
Thanks Mike... Gurker, you can always look at the SystemExecuteMessage in the framework for an example of this as well.

-adam


gurk...@googlemail.com

unread,
Oct 28, 2009, 3:54:35 PM10/28/09
to Merapi
thanks mglazer!

Regards gurkerl

dasha.filippova

unread,
Nov 4, 2009, 10:30:24 PM11/4/09
to Merapi
I am sending an array of custom classes from Java to AIR and although
I do have the remoteAlias tag in the air classes and the classes'
properties match, the array gets to AIR as array of Objects, not as
array of my custom classes. Example:

AIR:

package
{
[RemoteClass("myClass.A")]
public dynamic class A
{
public var name:String;
public function A()
{
}
}
}

Java:

package myClass;

public class A {
public String name;
}

Java sends a message back:

A [] array = new A[2];
array[0] = new A();
array[1] = new A();
message.setData(array);
message.send();

On the AIR side I get an array of Objects that each have a "name"
property. Is this behavior to be expected or should I be getting an
array of A objects?



On Oct 28, 2:54 pm, "gurker...@googlemail.com"

dasha.filippova

unread,
Nov 5, 2009, 10:28:31 PM11/5/09
to Merapi
My bad: the classes do convert to their equivalents. the reason -
"RemoteAlias" instead "RemoteClass" in the metatag. Watch out!

On Nov 4, 10:30 pm, "dasha.filippova" <dasha.filipp...@gmail.com>
wrote:

Marcelo Daniel

unread,
Nov 12, 2010, 7:42:41 PM11/12/10
to merapi-...@googlegroups.com
I'm trying to execute the same test, even when I put RemoteAlias I get a array of Object. Do you solve this problem? Can anybode help me?

2009/11/6 dasha.filippova <dasha.f...@gmail.com>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Merapi" group.
To post to this group, send email to merapi-...@googlegroups.com
To unsubscribe from this group, send email to merapi-projec...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/merapi-project?hl=en
-~----------~----~----~----~------~----~------~--~---




--
Todas as coisas cooperam para o bem daqueles que amam a Deus.

naveen SR

unread,
Nov 13, 2010, 5:22:11 AM11/13/10
to merapi-...@googlegroups.com
Hi


I have found two reasons why your code fails:

1) Please make sure that you generate getters and setters as per the java naming standards for the bean that your trying to send across from Java to Flex. IN java bean please add setName and getName for the code below.

2) In flex side at the class level please add the Bindable tag.


The remote mapping would only allow the compiler to know the binding details. The actual transfer of the data works on the getter of the respective attribute.

Hope this helps you out.

Cheers,
Naveen

--
You received this message because you are subscribed to the Google Groups "Merapi" group.
To post to this group, send email to merapi-...@googlegroups.com.
To unsubscribe from this group, send email to merapi-projec...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/merapi-project?hl=en.

Reply all
Reply to author
Forward
0 new messages