You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Franck Wolff <fr...@gmail.com> on 2014/05/14 14:51:48 UTC

AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Hi everybody,

We have just published the benchmark results on the GraniteDS blog:
http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds-3-1-vs-blazeds-4-0
.

Feedback would be very appreciated.

Franck
@graniteds

Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Dana White <da...@me.com>.
Thx

Cheers,

Dana A. White

> On Jun 6, 2014, at 12:04 PM, Subscriptions <su...@leeburrows.com> wrote:
> 
> send a message to users-unsubscribe@flex.apache.org <ma...@flex.apache.org>
> 
> 
>> On 06/06/2014 13:35, Dana White wrote:
>> What email address should I use to unsubscribe from the group?
>> 
>> Cheers,
>> 
>> Dana A. White
>> 
>>> On Jun 6, 2014, at 7:32 AM, Franck Wolff <fr...@gmail.com> wrote:
>>> 
>>> Nice ! I'm looking forward to reading your post ;)
>>> 
>>> Franck.
>>> 
>>> 
>>> 2014-06-04 13:24 GMT+02:00 Gary Yang <fl...@gmail.com>:
>>> 
>>>> Franck,
>>>> 
>>>> I will post some example usages of Stage3D, GraniteDS and Spring together
>>>> in July.
>>>> 
>>>> The Vector serialization is very important for 3D because the 3D data is
>>>> all Vector<int> and Vector<Number>, I am very surprised that after Stage3D
>>>> has been release 3 years, I still can't find related topics online, it
>>>> seems most developers are following HTML/JS bluffing!
>>>> 
>>>> Great job!
>>>> 
>>>> Thanks.
>>>> 
>>>> -Gary
>>>> 
>>>> 
>>>>> On Wed, Jun 4, 2014 at 5:44 AM, Franck Wolff <fr...@gmail.com> wrote:
>>>>> 
>>>>> Gary,
>>>>> 
>>>>> Nice to know you're happy with GraniteDS!
>>>>> 
>>>>> Unfortunately, I can't see your image, something went wrong with the
>>>>> post... Any link outside this mailing list?
>>>>> 
>>>>> Cheers,
>>>>> Franck.
>>>>> 
>>>>> 
>>>>> 2014-06-03 22:17 GMT+02:00 Gary Yang <fl...@gmail.com>:
>>>>> 
>>>>>> Franck,
>>>>>> 
>>>>>> Version 3.1.0 working perfect!
>>>>>> 
>>>>>> After overring the writingCollection( very little code change ), I have
>>>>>> managed to load very complex type of data from server!!!
>>>>>> 
>>>>>> Please see:
>>>>>> 
>>>>>> [image: Inline image 1]
>>>>>> 
>>>>>> Thank you very much!
>>>>>> 
>>>>>> Best,
>>>>>> 
>>>>>> -Gary
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On Tue, Jun 3, 2014 at 6:52 AM, Franck Wolff <fr...@gmail.com>
>>>> wrote:
>>>>>>> See https://github.com/fwolff/flex-vectors-example and especially
>>>>>>> 
>>>>>>> 
>>>> https://github.com/fwolff/flex-vectors-example/blob/master/java/org/granite/example/vectors/java/VectorService.java
>>>>>>> ,
>>>>>>> which shows how to serialize java arrays / collections as AMF vectors
>>>>>>> (sorry this feature isn't well documented yet).
>>>>>>> 
>>>>>>> Franck.
>>>>>>> 
>>>>>>> 
>>>>>>> 2014-06-02 23:18 GMT+02:00 Gary Yang <fl...@gmail.com>:
>>>>>>> 
>>>>>>>> Hi Frank,
>>>>>>>> 
>>>>>>>> I just did a little test against GraniteDS, it can parse bytes into
>>>>> Java
>>>>>>>> Object very well even for strong typed vector array.
>>>>>>>> 
>>>>>>>> But I don't see GraniteDS can convert a Java Array into Actionscript
>>>>>>>> Vector, could you help me please?
>>>>>>>> 
>>>>>>>> 
>>>>>>>> I also took a look in org.granite.messaging.amf.io.AMF3Serializer,
>>>> it
>>>>>>>> serializes all Java Collection into actionscript
>>>>>>>> mx.collection.ArrayCollection, does mobile app based on Flex have
>>>>>>>> ArrayCollection compiled in? Which is the best way to change this
>>>>>>> default
>>>>>>>> behaviour please?
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Best,
>>>>>>>> 
>>>>>>>> -Gary
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On Fri, May 30, 2014 at 12:02 PM, Gary Yang <flashflexpro@gmail.com
>>>>>>>> wrote:
>>>>>>>> 
>>>>>>>>> Right, I want to try GraniteDS because
>>>>>>>>> 
>>>>>>>>> 1) Vector support is important!
>>>>>>>>> 
>>>>>>>>> 2) BlazeDS is too old, 2011 code based on JDK5! No one can
>>>> guarantee
>>>>>>> it
>>>>>>>>> works with JDK8/Servlet3!!
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> But I am very sure BlazeDS can catch up very fast once development
>>>>>>> back
>>>>>>>> on
>>>>>>>>> track!
>>>>>>>>> 
>>>>>>>>> -Gary
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On Fri, May 30, 2014 at 11:50 AM, Christofer Dutz <
>>>>>>>>> christofer.dutz@c-ware.de> wrote:
>>>>>>>>> 
>>>>>>>>>> Or we will be able to finally start tweaking BlazeDS as soon as
>>>> we
>>>>>>> have
>>>>>>>>>> the parity release out the door ;-)
>>>>>>>>>> 
>>>>>>>>>> Chris
>>>>>>>>>> 
>>>>>>>>>> -----Ursprüngliche Nachricht-----
>>>>>>>>>> Von: Gary Yang [mailto:flashflexpro@gmail.com]
>>>>>>>>>> Gesendet: Freitag, 30. Mai 2014 17:14
>>>>>>>>>> An: users@flex.apache.org
>>>>>>>>>> Betreff: Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs.
>>>>>>>> BlazeDS
>>>>>>>>>> 4.0.0)
>>>>>>>>>> 
>>>>>>>>>> Franck,
>>>>>>>>>> 
>>>>>>>>>> Very impressive!
>>>>>>>>>> 
>>>>>>>>>> I guess it is time to switch to GraniteDS.
>>>>>>>>>> 
>>>>>>>>>> Thanks.
>>>>>>>>>> 
>>>>>>>>>> -Gary
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> On Fri, May 30, 2014 at 4:41 AM, Franck Wolff <
>>>> frawolff@gmail.com>
>>>>>>>> wrote:
>>>>>>>>>>> Gary,
>>>>>>>>>>> 
>>>>>>>>>>> Just have a look at the link I gave you before:
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
>>>>>>>>>>> nchmark/amf/BenchmarkGraniteDSAmf.java
>>>>>>>>>>> .
>>>>>>>>>>> It doesn't run inside a servlet container, does it?
>>>>>>>>>>> 
>>>>>>>>>>> F.
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 2014-05-29 17:22 GMT+02:00 Gary Yang <fl...@gmail.com>:
>>>>>>>>>>> 
>>>>>>>>>>>> Franck,
>>>>>>>>>>>> 
>>>>>>>>>>>> Does GraniteDS have to run inside a servlet container? I only
>>>>>>> want
>>>>>>>>>>>> to AMF serialization/deserialization function which has
>>>> nothing
>>>>>>> to
>>>>>>>>>>>> do with network, http or servlet.
>>>>>>>>>>>> 
>>>>>>>>>>>> thanks.
>>>>>>>>>>>> 
>>>>>>>>>>>> -Gary
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> On Thu, May 29, 2014 at 7:44 AM, Franck Wolff <
>>>>>>> frawolff@gmail.com>
>>>>>>>>>>> wrote:
>>>>>>>>>>>>> Gary,
>>>>>>>>>>>>> 
>>>>>>>>>>>>> See the benchmark classes:
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
>>>>>>>>>>> nchmark/amf/BenchmarkBlazeDSAmf.java
>>>>>>>>>>>>> vs.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
>>>>>>>>>>> nchmark/amf/BenchmarkGraniteDSAmf.java
>>>>>>>>>>>>> GraniteDS needs a bit more configuration, but is still very
>>>>>>> easy
>>>>>>>>>>>>> to
>>>>>>>>>>> use.
>>>>>>>>>>>>> BTW, about DTOs: you can have a look to our
>>>>> Converter/Reverter
>>>>>>>>>>>>> feature, even if it isn't meant to be used this way in the
>>>>>>> first
>>>>>>>>>>>>> place (see documentation
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>> http://www.granitedataservices.com/public/docs/latest/docs/reference/f
>>>>>>>>>>> lex/graniteds-refguide-flex.html#extensibility.customtypes
>>>>>>>>>>>>> ).
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Let's say you have a bean MyBean on your server and you
>>>> want
>>>>> to
>>>>>>>>>>> serialize
>>>>>>>>>>>>> MyBeanDTO instead (and vice-versa). You can easily write
>>>> this
>>>>>>> kind
>>>>>>>>>>>>> of
>>>>>>>>>>>>> converter:
>>>>>>>>>>>>> 
>>>>>>>>>>>>> public class MyBeanConverter extends Converter implements
>>>>>>> Reverter
>>>>>>>>>>>>> {
>>>>>>>>>>>>> 
>>>>>>>>>>>>>    public MyBeanConverter(Converters converters) {
>>>>>>>>>>>>>        super(converters);
>>>>>>>>>>>>>    }
>>>>>>>>>>>>> 
>>>>>>>>>>>>>    // AMF3Deserialization (Converter)...
>>>>>>>>>>>>> 
>>>>>>>>>>>>>    @Override
>>>>>>>>>>>>>    protected boolean internalCanConvert(Object value, Type
>>>>>>>>>>> targetType) {
>>>>>>>>>>>>>    return (value instanceof MyBeanDTO);
>>>>>>>>>>>>>    }
>>>>>>>>>>>>> 
>>>>>>>>>>>>>    @Override
>>>>>>>>>>>>>    protected Object internalConvert(Object value, Type
>>>>>>>> targetType)
>>>>>>>>>> {
>>>>>>>>>>>>>    MyBean bean = new MyBean();
>>>>>>>>>>>>>    MyBeanDTO dto = (MyBeanDTO)value;
>>>>>>>>>>>>>    // copy properties from dto to bean...
>>>>>>>>>>>>>        return bean;
>>>>>>>>>>>>>    }
>>>>>>>>>>>>> 
>>>>>>>>>>>>>    // AMF3Serialization (Reverter)...
>>>>>>>>>>>>> 
>>>>>>>>>>>>>    public boolean canRevert(Object value) {
>>>>>>>>>>>>>        return (value instanceof MyBean);
>>>>>>>>>>>>>    }
>>>>>>>>>>>>> 
>>>>>>>>>>>>>    public Object revert(Object value) {
>>>>>>>>>>>>>    MyBeanDTO dto = new MyBeanDTO();
>>>>>>>>>>>>>    MyBean bean = (MyBean)value;
>>>>>>>>>>>>>    // copy properties from bean to dto...
>>>>>>>>>>>>>        return dto;
>>>>>>>>>>>>>    }
>>>>>>>>>>>>> }
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Then, just plug this new converter (along with any others)
>>>> in
>>>>>>> your
>>>>>>>>>>>>> granite-config.xml:
>>>>>>>>>>>>> 
>>>>>>>>>>>>> <granite-config>
>>>>>>>>>>>>>  <converters>
>>>>>>>>>>>>>    <converter type="path.to.MyBeanConverter" />
>>>>>>>>>>>>>  </converters>
>>>>>>>>>>>>> </granite-config>
>>>>>>>>>>>>> 
>>>>>>>>>>>>> According to this configuration, all MyBean instances will
>>>> be
>>>>>>>>>>> serialized
>>>>>>>>>>>> as
>>>>>>>>>>>>> MyBeanDTOs and all MyBeanDTOs will be deserialized as
>>>> MyBeans
>>>>>>> (you
>>>>>>>>>>> don't
>>>>>>>>>>>>> need to anything else, your services can return eg. a
>>>>>>> collection
>>>>>>>>>>>>> of
>>>>>>>>>>>> MyBeans
>>>>>>>>>>>>> it will be serialized as a collection of MyBeanDTOs). Of
>>>>>>> course,
>>>>>>>>>>>>> it can
>>>>>>>>>>>> be
>>>>>>>>>>>>> a bit restrictive if you want to have different DTOs
>>>> classes
>>>>>>> for a
>>>>>>>>>>>>> same bean class...
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Franck.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 2014-05-29 2:33 GMT+02:00 Gary Yang <
>>>> flashflexpro@gmail.com
>>>>>> :
>>>>>>>>>>>>>> Sounds great!
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Do you think it is possible that I can use the
>>>>>>>>>>>>>> serialization/deserialization features as simple as using
>>>>>>>>>>>>>> BlazeDS
>>>>>>>>>>> like
>>>>>>>>>>>>>> below?
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> in pom.xml :
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>        <dependency>
>>>>>>>>>>>>>>            <groupId>org.springframework.flex</groupId>
>>>>>>>>>>>>>>            <artifactId>spring-flex-core</artifactId>
>>>>>>>>>>>>>>        </dependency>
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> then in Java file:
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>        ... ...
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>        Amf3Output aOut= new Amf3Output(new
>>>>>>>>>> SerializationContext());
>>>>>>>>>>>>>>        aOut.setOutputStream( outStream );
>>>>>>>>>>>>>>        aOut.writeObject(data);
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>        ... ...
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>        Amf3Input aIn = new Amf3Input( new
>>>>>>>> SerializationContext()
>>>>>>>>>> );
>>>>>>>>>>>>>>        aIn.setInputStream( inputStream );
>>>>>>>>>>>>>>        data = aIn.readObject();
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Thanks.
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> - Gary
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> On Wed, May 14, 2014 at 8:51 AM, Franck Wolff
>>>>>>>>>>>>>> <fr...@gmail.com>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>> Hi everybody,
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> We have just published the benchmark results on the
>>>>>>> GraniteDS
>>>>>>>>>> blog:
>>>>>>>>>>>>>>> 
>>>>> http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds
>>>>>>>>>>> -3-1-vs-blazeds-4-0
>>>>>>>>>>>>>>> .
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> Feedback would be very appreciated.
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> Franck
>>>>>>>>>>>>>>> @graniteds
>>>>>>>>>>>>>>> 
>>>>>>>>> 
>>>>>> 
> 
> -- 
> Lee Burrows
> ActionScripter
> 

Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Subscriptions <su...@leeburrows.com>.
send a message to users-unsubscribe@flex.apache.org 
<ma...@flex.apache.org>


On 06/06/2014 13:35, Dana White wrote:
> What email address should I use to unsubscribe from the group?
>
> Cheers,
>
> Dana A. White
>
>> On Jun 6, 2014, at 7:32 AM, Franck Wolff <fr...@gmail.com> wrote:
>>
>> Nice ! I'm looking forward to reading your post ;)
>>
>> Franck.
>>
>>
>> 2014-06-04 13:24 GMT+02:00 Gary Yang <fl...@gmail.com>:
>>
>>> Franck,
>>>
>>> I will post some example usages of Stage3D, GraniteDS and Spring together
>>> in July.
>>>
>>> The Vector serialization is very important for 3D because the 3D data is
>>> all Vector<int> and Vector<Number>, I am very surprised that after Stage3D
>>> has been release 3 years, I still can't find related topics online, it
>>> seems most developers are following HTML/JS bluffing!
>>>
>>> Great job!
>>>
>>> Thanks.
>>>
>>> -Gary
>>>
>>>
>>>> On Wed, Jun 4, 2014 at 5:44 AM, Franck Wolff <fr...@gmail.com> wrote:
>>>>
>>>> Gary,
>>>>
>>>> Nice to know you're happy with GraniteDS!
>>>>
>>>> Unfortunately, I can't see your image, something went wrong with the
>>>> post... Any link outside this mailing list?
>>>>
>>>> Cheers,
>>>> Franck.
>>>>
>>>>
>>>> 2014-06-03 22:17 GMT+02:00 Gary Yang <fl...@gmail.com>:
>>>>
>>>>> Franck,
>>>>>
>>>>> Version 3.1.0 working perfect!
>>>>>
>>>>> After overring the writingCollection( very little code change ), I have
>>>>> managed to load very complex type of data from server!!!
>>>>>
>>>>> Please see:
>>>>>
>>>>> [image: Inline image 1]
>>>>>
>>>>> Thank you very much!
>>>>>
>>>>> Best,
>>>>>
>>>>> -Gary
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Jun 3, 2014 at 6:52 AM, Franck Wolff <fr...@gmail.com>
>>> wrote:
>>>>>> See https://github.com/fwolff/flex-vectors-example and especially
>>>>>>
>>>>>>
>>> https://github.com/fwolff/flex-vectors-example/blob/master/java/org/granite/example/vectors/java/VectorService.java
>>>>>> ,
>>>>>> which shows how to serialize java arrays / collections as AMF vectors
>>>>>> (sorry this feature isn't well documented yet).
>>>>>>
>>>>>> Franck.
>>>>>>
>>>>>>
>>>>>> 2014-06-02 23:18 GMT+02:00 Gary Yang <fl...@gmail.com>:
>>>>>>
>>>>>>> Hi Frank,
>>>>>>>
>>>>>>> I just did a little test against GraniteDS, it can parse bytes into
>>>> Java
>>>>>>> Object very well even for strong typed vector array.
>>>>>>>
>>>>>>> But I don't see GraniteDS can convert a Java Array into Actionscript
>>>>>>> Vector, could you help me please?
>>>>>>>
>>>>>>>
>>>>>>> I also took a look in org.granite.messaging.amf.io.AMF3Serializer,
>>> it
>>>>>>> serializes all Java Collection into actionscript
>>>>>>> mx.collection.ArrayCollection, does mobile app based on Flex have
>>>>>>> ArrayCollection compiled in? Which is the best way to change this
>>>>>> default
>>>>>>> behaviour please?
>>>>>>>
>>>>>>>
>>>>>>> Best,
>>>>>>>
>>>>>>> -Gary
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Fri, May 30, 2014 at 12:02 PM, Gary Yang <flashflexpro@gmail.com
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Right, I want to try GraniteDS because
>>>>>>>>
>>>>>>>> 1) Vector support is important!
>>>>>>>>
>>>>>>>> 2) BlazeDS is too old, 2011 code based on JDK5! No one can
>>> guarantee
>>>>>> it
>>>>>>>> works with JDK8/Servlet3!!
>>>>>>>>
>>>>>>>>
>>>>>>>> But I am very sure BlazeDS can catch up very fast once development
>>>>>> back
>>>>>>> on
>>>>>>>> track!
>>>>>>>>
>>>>>>>> -Gary
>>>>>>>>
>>>>>>>>
>>>>>>>> On Fri, May 30, 2014 at 11:50 AM, Christofer Dutz <
>>>>>>>> christofer.dutz@c-ware.de> wrote:
>>>>>>>>
>>>>>>>>> Or we will be able to finally start tweaking BlazeDS as soon as
>>> we
>>>>>> have
>>>>>>>>> the parity release out the door ;-)
>>>>>>>>>
>>>>>>>>> Chris
>>>>>>>>>
>>>>>>>>> -----Ursprüngliche Nachricht-----
>>>>>>>>> Von: Gary Yang [mailto:flashflexpro@gmail.com]
>>>>>>>>> Gesendet: Freitag, 30. Mai 2014 17:14
>>>>>>>>> An: users@flex.apache.org
>>>>>>>>> Betreff: Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs.
>>>>>>> BlazeDS
>>>>>>>>> 4.0.0)
>>>>>>>>>
>>>>>>>>> Franck,
>>>>>>>>>
>>>>>>>>> Very impressive!
>>>>>>>>>
>>>>>>>>> I guess it is time to switch to GraniteDS.
>>>>>>>>>
>>>>>>>>> Thanks.
>>>>>>>>>
>>>>>>>>> -Gary
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Fri, May 30, 2014 at 4:41 AM, Franck Wolff <
>>> frawolff@gmail.com>
>>>>>>> wrote:
>>>>>>>>>> Gary,
>>>>>>>>>>
>>>>>>>>>> Just have a look at the link I gave you before:
>>>>>>>>>>
>>>>>>>>>>
>>>> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
>>>>>>>>>> nchmark/amf/BenchmarkGraniteDSAmf.java
>>>>>>>>>> .
>>>>>>>>>> It doesn't run inside a servlet container, does it?
>>>>>>>>>>
>>>>>>>>>> F.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> 2014-05-29 17:22 GMT+02:00 Gary Yang <fl...@gmail.com>:
>>>>>>>>>>
>>>>>>>>>>> Franck,
>>>>>>>>>>>
>>>>>>>>>>> Does GraniteDS have to run inside a servlet container? I only
>>>>>> want
>>>>>>>>>>> to AMF serialization/deserialization function which has
>>> nothing
>>>>>> to
>>>>>>>>>>> do with network, http or servlet.
>>>>>>>>>>>
>>>>>>>>>>> thanks.
>>>>>>>>>>>
>>>>>>>>>>> -Gary
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Thu, May 29, 2014 at 7:44 AM, Franck Wolff <
>>>>>> frawolff@gmail.com>
>>>>>>>>>> wrote:
>>>>>>>>>>>> Gary,
>>>>>>>>>>>>
>>>>>>>>>>>> See the benchmark classes:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
>>>>>>>>>> nchmark/amf/BenchmarkBlazeDSAmf.java
>>>>>>>>>>>> vs.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
>>>>>>>>>> nchmark/amf/BenchmarkGraniteDSAmf.java
>>>>>>>>>>>> GraniteDS needs a bit more configuration, but is still very
>>>>>> easy
>>>>>>>>>>>> to
>>>>>>>>>> use.
>>>>>>>>>>>> BTW, about DTOs: you can have a look to our
>>>> Converter/Reverter
>>>>>>>>>>>> feature, even if it isn't meant to be used this way in the
>>>>>> first
>>>>>>>>>>>> place (see documentation
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>> http://www.granitedataservices.com/public/docs/latest/docs/reference/f
>>>>>>>>>> lex/graniteds-refguide-flex.html#extensibility.customtypes
>>>>>>>>>>>> ).
>>>>>>>>>>>>
>>>>>>>>>>>> Let's say you have a bean MyBean on your server and you
>>> want
>>>> to
>>>>>>>>>> serialize
>>>>>>>>>>>> MyBeanDTO instead (and vice-versa). You can easily write
>>> this
>>>>>> kind
>>>>>>>>>>>> of
>>>>>>>>>>>> converter:
>>>>>>>>>>>>
>>>>>>>>>>>> public class MyBeanConverter extends Converter implements
>>>>>> Reverter
>>>>>>>>>>>> {
>>>>>>>>>>>>
>>>>>>>>>>>>     public MyBeanConverter(Converters converters) {
>>>>>>>>>>>>         super(converters);
>>>>>>>>>>>>     }
>>>>>>>>>>>>
>>>>>>>>>>>>     // AMF3Deserialization (Converter)...
>>>>>>>>>>>>
>>>>>>>>>>>>     @Override
>>>>>>>>>>>>     protected boolean internalCanConvert(Object value, Type
>>>>>>>>>> targetType) {
>>>>>>>>>>>>     return (value instanceof MyBeanDTO);
>>>>>>>>>>>>     }
>>>>>>>>>>>>
>>>>>>>>>>>>     @Override
>>>>>>>>>>>>     protected Object internalConvert(Object value, Type
>>>>>>> targetType)
>>>>>>>>> {
>>>>>>>>>>>>     MyBean bean = new MyBean();
>>>>>>>>>>>>     MyBeanDTO dto = (MyBeanDTO)value;
>>>>>>>>>>>>     // copy properties from dto to bean...
>>>>>>>>>>>>         return bean;
>>>>>>>>>>>>     }
>>>>>>>>>>>>
>>>>>>>>>>>>     // AMF3Serialization (Reverter)...
>>>>>>>>>>>>
>>>>>>>>>>>>     public boolean canRevert(Object value) {
>>>>>>>>>>>>         return (value instanceof MyBean);
>>>>>>>>>>>>     }
>>>>>>>>>>>>
>>>>>>>>>>>>     public Object revert(Object value) {
>>>>>>>>>>>>     MyBeanDTO dto = new MyBeanDTO();
>>>>>>>>>>>>     MyBean bean = (MyBean)value;
>>>>>>>>>>>>     // copy properties from bean to dto...
>>>>>>>>>>>>         return dto;
>>>>>>>>>>>>     }
>>>>>>>>>>>> }
>>>>>>>>>>>>
>>>>>>>>>>>> Then, just plug this new converter (along with any others)
>>> in
>>>>>> your
>>>>>>>>>>>> granite-config.xml:
>>>>>>>>>>>>
>>>>>>>>>>>> <granite-config>
>>>>>>>>>>>>   <converters>
>>>>>>>>>>>>     <converter type="path.to.MyBeanConverter" />
>>>>>>>>>>>>   </converters>
>>>>>>>>>>>> </granite-config>
>>>>>>>>>>>>
>>>>>>>>>>>> According to this configuration, all MyBean instances will
>>> be
>>>>>>>>>> serialized
>>>>>>>>>>> as
>>>>>>>>>>>> MyBeanDTOs and all MyBeanDTOs will be deserialized as
>>> MyBeans
>>>>>> (you
>>>>>>>>>> don't
>>>>>>>>>>>> need to anything else, your services can return eg. a
>>>>>> collection
>>>>>>>>>>>> of
>>>>>>>>>>> MyBeans
>>>>>>>>>>>> it will be serialized as a collection of MyBeanDTOs). Of
>>>>>> course,
>>>>>>>>>>>> it can
>>>>>>>>>>> be
>>>>>>>>>>>> a bit restrictive if you want to have different DTOs
>>> classes
>>>>>> for a
>>>>>>>>>>>> same bean class...
>>>>>>>>>>>>
>>>>>>>>>>>> Franck.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> 2014-05-29 2:33 GMT+02:00 Gary Yang <
>>> flashflexpro@gmail.com
>>>>> :
>>>>>>>>>>>>> Sounds great!
>>>>>>>>>>>>>
>>>>>>>>>>>>> Do you think it is possible that I can use the
>>>>>>>>>>>>> serialization/deserialization features as simple as using
>>>>>>>>>>>>> BlazeDS
>>>>>>>>>> like
>>>>>>>>>>>>> below?
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> in pom.xml :
>>>>>>>>>>>>>
>>>>>>>>>>>>>         <dependency>
>>>>>>>>>>>>>             <groupId>org.springframework.flex</groupId>
>>>>>>>>>>>>>             <artifactId>spring-flex-core</artifactId>
>>>>>>>>>>>>>         </dependency>
>>>>>>>>>>>>>
>>>>>>>>>>>>> then in Java file:
>>>>>>>>>>>>>
>>>>>>>>>>>>>         ... ...
>>>>>>>>>>>>>
>>>>>>>>>>>>>         Amf3Output aOut= new Amf3Output(new
>>>>>>>>> SerializationContext());
>>>>>>>>>>>>>         aOut.setOutputStream( outStream );
>>>>>>>>>>>>>         aOut.writeObject(data);
>>>>>>>>>>>>>
>>>>>>>>>>>>>         ... ...
>>>>>>>>>>>>>
>>>>>>>>>>>>>         Amf3Input aIn = new Amf3Input( new
>>>>>>> SerializationContext()
>>>>>>>>> );
>>>>>>>>>>>>>         aIn.setInputStream( inputStream );
>>>>>>>>>>>>>         data = aIn.readObject();
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> - Gary
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Wed, May 14, 2014 at 8:51 AM, Franck Wolff
>>>>>>>>>>>>> <fr...@gmail.com>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>> Hi everybody,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> We have just published the benchmark results on the
>>>>>> GraniteDS
>>>>>>>>> blog:
>>>>>>>>>>>>>>
>>>> http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds
>>>>>>>>>> -3-1-vs-blazeds-4-0
>>>>>>>>>>>>>> .
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Feedback would be very appreciated.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Franck
>>>>>>>>>>>>>> @graniteds
>>>>>>>>>>>>>>
>>>>>>>>
>>>>>

-- 
Lee Burrows
ActionScripter


Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Alex Harui <ah...@adobe.com>.
On 6/6/14 5:35 AM, "Dana White" <da...@me.com> wrote:

>What email address should I use to unsubscribe from the group?
users-unsubscribe@flex.apache.org


Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Dana White <da...@me.com>.
What email address should I use to unsubscribe from the group?

Cheers,

Dana A. White

> On Jun 6, 2014, at 7:32 AM, Franck Wolff <fr...@gmail.com> wrote:
> 
> Nice ! I'm looking forward to reading your post ;)
> 
> Franck.
> 
> 
> 2014-06-04 13:24 GMT+02:00 Gary Yang <fl...@gmail.com>:
> 
>> Franck,
>> 
>> I will post some example usages of Stage3D, GraniteDS and Spring together
>> in July.
>> 
>> The Vector serialization is very important for 3D because the 3D data is
>> all Vector<int> and Vector<Number>, I am very surprised that after Stage3D
>> has been release 3 years, I still can't find related topics online, it
>> seems most developers are following HTML/JS bluffing!
>> 
>> Great job!
>> 
>> Thanks.
>> 
>> -Gary
>> 
>> 
>>> On Wed, Jun 4, 2014 at 5:44 AM, Franck Wolff <fr...@gmail.com> wrote:
>>> 
>>> Gary,
>>> 
>>> Nice to know you're happy with GraniteDS!
>>> 
>>> Unfortunately, I can't see your image, something went wrong with the
>>> post... Any link outside this mailing list?
>>> 
>>> Cheers,
>>> Franck.
>>> 
>>> 
>>> 2014-06-03 22:17 GMT+02:00 Gary Yang <fl...@gmail.com>:
>>> 
>>>> Franck,
>>>> 
>>>> Version 3.1.0 working perfect!
>>>> 
>>>> After overring the writingCollection( very little code change ), I have
>>>> managed to load very complex type of data from server!!!
>>>> 
>>>> Please see:
>>>> 
>>>> [image: Inline image 1]
>>>> 
>>>> Thank you very much!
>>>> 
>>>> Best,
>>>> 
>>>> -Gary
>>>> 
>>>> 
>>>> 
>>>> On Tue, Jun 3, 2014 at 6:52 AM, Franck Wolff <fr...@gmail.com>
>> wrote:
>>>> 
>>>>> See https://github.com/fwolff/flex-vectors-example and especially
>>>>> 
>>>>> 
>>> 
>> https://github.com/fwolff/flex-vectors-example/blob/master/java/org/granite/example/vectors/java/VectorService.java
>>>>> ,
>>>>> which shows how to serialize java arrays / collections as AMF vectors
>>>>> (sorry this feature isn't well documented yet).
>>>>> 
>>>>> Franck.
>>>>> 
>>>>> 
>>>>> 2014-06-02 23:18 GMT+02:00 Gary Yang <fl...@gmail.com>:
>>>>> 
>>>>>> Hi Frank,
>>>>>> 
>>>>>> I just did a little test against GraniteDS, it can parse bytes into
>>> Java
>>>>>> Object very well even for strong typed vector array.
>>>>>> 
>>>>>> But I don't see GraniteDS can convert a Java Array into Actionscript
>>>>>> Vector, could you help me please?
>>>>>> 
>>>>>> 
>>>>>> I also took a look in org.granite.messaging.amf.io.AMF3Serializer,
>> it
>>>>>> serializes all Java Collection into actionscript
>>>>>> mx.collection.ArrayCollection, does mobile app based on Flex have
>>>>>> ArrayCollection compiled in? Which is the best way to change this
>>>>> default
>>>>>> behaviour please?
>>>>>> 
>>>>>> 
>>>>>> Best,
>>>>>> 
>>>>>> -Gary
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On Fri, May 30, 2014 at 12:02 PM, Gary Yang <flashflexpro@gmail.com
>>> 
>>>>>> wrote:
>>>>>> 
>>>>>>> Right, I want to try GraniteDS because
>>>>>>> 
>>>>>>> 1) Vector support is important!
>>>>>>> 
>>>>>>> 2) BlazeDS is too old, 2011 code based on JDK5! No one can
>> guarantee
>>>>> it
>>>>>>> works with JDK8/Servlet3!!
>>>>>>> 
>>>>>>> 
>>>>>>> But I am very sure BlazeDS can catch up very fast once development
>>>>> back
>>>>>> on
>>>>>>> track!
>>>>>>> 
>>>>>>> -Gary
>>>>>>> 
>>>>>>> 
>>>>>>> On Fri, May 30, 2014 at 11:50 AM, Christofer Dutz <
>>>>>>> christofer.dutz@c-ware.de> wrote:
>>>>>>> 
>>>>>>>> Or we will be able to finally start tweaking BlazeDS as soon as
>> we
>>>>> have
>>>>>>>> the parity release out the door ;-)
>>>>>>>> 
>>>>>>>> Chris
>>>>>>>> 
>>>>>>>> -----Ursprüngliche Nachricht-----
>>>>>>>> Von: Gary Yang [mailto:flashflexpro@gmail.com]
>>>>>>>> Gesendet: Freitag, 30. Mai 2014 17:14
>>>>>>>> An: users@flex.apache.org
>>>>>>>> Betreff: Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs.
>>>>>> BlazeDS
>>>>>>>> 4.0.0)
>>>>>>>> 
>>>>>>>> Franck,
>>>>>>>> 
>>>>>>>> Very impressive!
>>>>>>>> 
>>>>>>>> I guess it is time to switch to GraniteDS.
>>>>>>>> 
>>>>>>>> Thanks.
>>>>>>>> 
>>>>>>>> -Gary
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On Fri, May 30, 2014 at 4:41 AM, Franck Wolff <
>> frawolff@gmail.com>
>>>>>> wrote:
>>>>>>>> 
>>>>>>>>> Gary,
>>>>>>>>> 
>>>>>>>>> Just have a look at the link I gave you before:
>>>>>>>>> 
>>>>>>>>> 
>>>>>> 
>>> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
>>>>>>>>> nchmark/amf/BenchmarkGraniteDSAmf.java
>>>>>>>>> .
>>>>>>>>> It doesn't run inside a servlet container, does it?
>>>>>>>>> 
>>>>>>>>> F.
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 2014-05-29 17:22 GMT+02:00 Gary Yang <fl...@gmail.com>:
>>>>>>>>> 
>>>>>>>>>> Franck,
>>>>>>>>>> 
>>>>>>>>>> Does GraniteDS have to run inside a servlet container? I only
>>>>> want
>>>>>>>>>> to AMF serialization/deserialization function which has
>> nothing
>>>>> to
>>>>>>>>>> do with network, http or servlet.
>>>>>>>>>> 
>>>>>>>>>> thanks.
>>>>>>>>>> 
>>>>>>>>>> -Gary
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> On Thu, May 29, 2014 at 7:44 AM, Franck Wolff <
>>>>> frawolff@gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>> 
>>>>>>>>>>> Gary,
>>>>>>>>>>> 
>>>>>>>>>>> See the benchmark classes:
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>> 
>>>>>> 
>>> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
>>>>>>>>> nchmark/amf/BenchmarkBlazeDSAmf.java
>>>>>>>>>>> vs.
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>> 
>>>>>> 
>>> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
>>>>>>>>> nchmark/amf/BenchmarkGraniteDSAmf.java
>>>>>>>>>>> 
>>>>>>>>>>> GraniteDS needs a bit more configuration, but is still very
>>>>> easy
>>>>>>>>>>> to
>>>>>>>>> use.
>>>>>>>>>>> 
>>>>>>>>>>> BTW, about DTOs: you can have a look to our
>>> Converter/Reverter
>>>>>>>>>>> feature, even if it isn't meant to be used this way in the
>>>>> first
>>>>>>>>>>> place (see documentation
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>> 
>>>>>> 
>>> http://www.granitedataservices.com/public/docs/latest/docs/reference/f
>>>>>>>>> lex/graniteds-refguide-flex.html#extensibility.customtypes
>>>>>>>>>>> ).
>>>>>>>>>>> 
>>>>>>>>>>> Let's say you have a bean MyBean on your server and you
>> want
>>> to
>>>>>>>>> serialize
>>>>>>>>>>> MyBeanDTO instead (and vice-versa). You can easily write
>> this
>>>>> kind
>>>>>>>>>>> of
>>>>>>>>>>> converter:
>>>>>>>>>>> 
>>>>>>>>>>> public class MyBeanConverter extends Converter implements
>>>>> Reverter
>>>>>>>>>>> {
>>>>>>>>>>> 
>>>>>>>>>>>    public MyBeanConverter(Converters converters) {
>>>>>>>>>>>        super(converters);
>>>>>>>>>>>    }
>>>>>>>>>>> 
>>>>>>>>>>>    // AMF3Deserialization (Converter)...
>>>>>>>>>>> 
>>>>>>>>>>>    @Override
>>>>>>>>>>>    protected boolean internalCanConvert(Object value, Type
>>>>>>>>> targetType) {
>>>>>>>>>>>    return (value instanceof MyBeanDTO);
>>>>>>>>>>>    }
>>>>>>>>>>> 
>>>>>>>>>>>    @Override
>>>>>>>>>>>    protected Object internalConvert(Object value, Type
>>>>>> targetType)
>>>>>>>> {
>>>>>>>>>>>    MyBean bean = new MyBean();
>>>>>>>>>>>    MyBeanDTO dto = (MyBeanDTO)value;
>>>>>>>>>>>    // copy properties from dto to bean...
>>>>>>>>>>>        return bean;
>>>>>>>>>>>    }
>>>>>>>>>>> 
>>>>>>>>>>>    // AMF3Serialization (Reverter)...
>>>>>>>>>>> 
>>>>>>>>>>>    public boolean canRevert(Object value) {
>>>>>>>>>>>        return (value instanceof MyBean);
>>>>>>>>>>>    }
>>>>>>>>>>> 
>>>>>>>>>>>    public Object revert(Object value) {
>>>>>>>>>>>    MyBeanDTO dto = new MyBeanDTO();
>>>>>>>>>>>    MyBean bean = (MyBean)value;
>>>>>>>>>>>    // copy properties from bean to dto...
>>>>>>>>>>>        return dto;
>>>>>>>>>>>    }
>>>>>>>>>>> }
>>>>>>>>>>> 
>>>>>>>>>>> Then, just plug this new converter (along with any others)
>> in
>>>>> your
>>>>>>>>>>> granite-config.xml:
>>>>>>>>>>> 
>>>>>>>>>>> <granite-config>
>>>>>>>>>>>  <converters>
>>>>>>>>>>>    <converter type="path.to.MyBeanConverter" />
>>>>>>>>>>>  </converters>
>>>>>>>>>>> </granite-config>
>>>>>>>>>>> 
>>>>>>>>>>> According to this configuration, all MyBean instances will
>> be
>>>>>>>>> serialized
>>>>>>>>>> as
>>>>>>>>>>> MyBeanDTOs and all MyBeanDTOs will be deserialized as
>> MyBeans
>>>>> (you
>>>>>>>>> don't
>>>>>>>>>>> need to anything else, your services can return eg. a
>>>>> collection
>>>>>>>>>>> of
>>>>>>>>>> MyBeans
>>>>>>>>>>> it will be serialized as a collection of MyBeanDTOs). Of
>>>>> course,
>>>>>>>>>>> it can
>>>>>>>>>> be
>>>>>>>>>>> a bit restrictive if you want to have different DTOs
>> classes
>>>>> for a
>>>>>>>>>>> same bean class...
>>>>>>>>>>> 
>>>>>>>>>>> Franck.
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 2014-05-29 2:33 GMT+02:00 Gary Yang <
>> flashflexpro@gmail.com
>>>> :
>>>>>>>>>>> 
>>>>>>>>>>>> Sounds great!
>>>>>>>>>>>> 
>>>>>>>>>>>> Do you think it is possible that I can use the
>>>>>>>>>>>> serialization/deserialization features as simple as using
>>>>>>>>>>>> BlazeDS
>>>>>>>>> like
>>>>>>>>>>>> below?
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> in pom.xml :
>>>>>>>>>>>> 
>>>>>>>>>>>>        <dependency>
>>>>>>>>>>>>            <groupId>org.springframework.flex</groupId>
>>>>>>>>>>>>            <artifactId>spring-flex-core</artifactId>
>>>>>>>>>>>>        </dependency>
>>>>>>>>>>>> 
>>>>>>>>>>>> then in Java file:
>>>>>>>>>>>> 
>>>>>>>>>>>>        ... ...
>>>>>>>>>>>> 
>>>>>>>>>>>>        Amf3Output aOut= new Amf3Output(new
>>>>>>>> SerializationContext());
>>>>>>>>>>>>        aOut.setOutputStream( outStream );
>>>>>>>>>>>>        aOut.writeObject(data);
>>>>>>>>>>>> 
>>>>>>>>>>>>        ... ...
>>>>>>>>>>>> 
>>>>>>>>>>>>        Amf3Input aIn = new Amf3Input( new
>>>>>> SerializationContext()
>>>>>>>> );
>>>>>>>>>>>>        aIn.setInputStream( inputStream );
>>>>>>>>>>>>        data = aIn.readObject();
>>>>>>>>>>>> 
>>>>>>>>>>>> Thanks.
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> - Gary
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> On Wed, May 14, 2014 at 8:51 AM, Franck Wolff
>>>>>>>>>>>> <fr...@gmail.com>
>>>>>>>>>>> wrote:
>>>>>>>>>>>> 
>>>>>>>>>>>>> Hi everybody,
>>>>>>>>>>>>> 
>>>>>>>>>>>>> We have just published the benchmark results on the
>>>>> GraniteDS
>>>>>>>> blog:
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>> 
>>>>>> 
>>> http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds
>>>>>>>>> -3-1-vs-blazeds-4-0
>>>>>>>>>>>>> .
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Feedback would be very appreciated.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Franck
>>>>>>>>>>>>> @graniteds
>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>> 

Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Franck Wolff <fr...@gmail.com>.
Nice ! I'm looking forward to reading your post ;)

Franck.


2014-06-04 13:24 GMT+02:00 Gary Yang <fl...@gmail.com>:

> Franck,
>
> I will post some example usages of Stage3D, GraniteDS and Spring together
> in July.
>
> The Vector serialization is very important for 3D because the 3D data is
> all Vector<int> and Vector<Number>, I am very surprised that after Stage3D
> has been release 3 years, I still can't find related topics online, it
> seems most developers are following HTML/JS bluffing!
>
> Great job!
>
> Thanks.
>
> -Gary
>
>
> On Wed, Jun 4, 2014 at 5:44 AM, Franck Wolff <fr...@gmail.com> wrote:
>
> > Gary,
> >
> > Nice to know you're happy with GraniteDS!
> >
> > Unfortunately, I can't see your image, something went wrong with the
> > post... Any link outside this mailing list?
> >
> > Cheers,
> > Franck.
> >
> >
> > 2014-06-03 22:17 GMT+02:00 Gary Yang <fl...@gmail.com>:
> >
> > > Franck,
> > >
> > > Version 3.1.0 working perfect!
> > >
> > > After overring the writingCollection( very little code change ), I have
> > > managed to load very complex type of data from server!!!
> > >
> > > Please see:
> > >
> > > [image: Inline image 1]
> > >
> > > Thank you very much!
> > >
> > > Best,
> > >
> > > -Gary
> > >
> > >
> > >
> > > On Tue, Jun 3, 2014 at 6:52 AM, Franck Wolff <fr...@gmail.com>
> wrote:
> > >
> > >> See https://github.com/fwolff/flex-vectors-example and especially
> > >>
> > >>
> >
> https://github.com/fwolff/flex-vectors-example/blob/master/java/org/granite/example/vectors/java/VectorService.java
> > >> ,
> > >> which shows how to serialize java arrays / collections as AMF vectors
> > >> (sorry this feature isn't well documented yet).
> > >>
> > >> Franck.
> > >>
> > >>
> > >> 2014-06-02 23:18 GMT+02:00 Gary Yang <fl...@gmail.com>:
> > >>
> > >> > Hi Frank,
> > >> >
> > >> > I just did a little test against GraniteDS, it can parse bytes into
> > Java
> > >> > Object very well even for strong typed vector array.
> > >> >
> > >> > But I don't see GraniteDS can convert a Java Array into Actionscript
> > >> > Vector, could you help me please?
> > >> >
> > >> >
> > >> > I also took a look in org.granite.messaging.amf.io.AMF3Serializer,
> it
> > >> > serializes all Java Collection into actionscript
> > >> > mx.collection.ArrayCollection, does mobile app based on Flex have
> > >> > ArrayCollection compiled in? Which is the best way to change this
> > >> default
> > >> > behaviour please?
> > >> >
> > >> >
> > >> > Best,
> > >> >
> > >> > -Gary
> > >> >
> > >> >
> > >> >
> > >> >
> > >> >
> > >> > On Fri, May 30, 2014 at 12:02 PM, Gary Yang <flashflexpro@gmail.com
> >
> > >> > wrote:
> > >> >
> > >> > > Right, I want to try GraniteDS because
> > >> > >
> > >> > > 1) Vector support is important!
> > >> > >
> > >> > > 2) BlazeDS is too old, 2011 code based on JDK5! No one can
> guarantee
> > >> it
> > >> > > works with JDK8/Servlet3!!
> > >> > >
> > >> > >
> > >> > > But I am very sure BlazeDS can catch up very fast once development
> > >> back
> > >> > on
> > >> > > track!
> > >> > >
> > >> > > -Gary
> > >> > >
> > >> > >
> > >> > > On Fri, May 30, 2014 at 11:50 AM, Christofer Dutz <
> > >> > > christofer.dutz@c-ware.de> wrote:
> > >> > >
> > >> > >> Or we will be able to finally start tweaking BlazeDS as soon as
> we
> > >> have
> > >> > >> the parity release out the door ;-)
> > >> > >>
> > >> > >> Chris
> > >> > >>
> > >> > >> -----Ursprüngliche Nachricht-----
> > >> > >> Von: Gary Yang [mailto:flashflexpro@gmail.com]
> > >> > >> Gesendet: Freitag, 30. Mai 2014 17:14
> > >> > >> An: users@flex.apache.org
> > >> > >> Betreff: Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs.
> > >> > BlazeDS
> > >> > >> 4.0.0)
> > >> > >>
> > >> > >> Franck,
> > >> > >>
> > >> > >> Very impressive!
> > >> > >>
> > >> > >> I guess it is time to switch to GraniteDS.
> > >> > >>
> > >> > >> Thanks.
> > >> > >>
> > >> > >> -Gary
> > >> > >>
> > >> > >>
> > >> > >>
> > >> > >> On Fri, May 30, 2014 at 4:41 AM, Franck Wolff <
> frawolff@gmail.com>
> > >> > wrote:
> > >> > >>
> > >> > >> > Gary,
> > >> > >> >
> > >> > >> > Just have a look at the link I gave you before:
> > >> > >> >
> > >> > >> >
> > >> >
> > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> > >> > >> > nchmark/amf/BenchmarkGraniteDSAmf.java
> > >> > >> > .
> > >> > >> > It doesn't run inside a servlet container, does it?
> > >> > >> >
> > >> > >> > F.
> > >> > >> >
> > >> > >> >
> > >> > >> > 2014-05-29 17:22 GMT+02:00 Gary Yang <fl...@gmail.com>:
> > >> > >> >
> > >> > >> > > Franck,
> > >> > >> > >
> > >> > >> > > Does GraniteDS have to run inside a servlet container? I only
> > >> want
> > >> > >> > > to AMF serialization/deserialization function which has
> nothing
> > >> to
> > >> > >> > > do with network, http or servlet.
> > >> > >> > >
> > >> > >> > > thanks.
> > >> > >> > >
> > >> > >> > > -Gary
> > >> > >> > >
> > >> > >> > >
> > >> > >> > > On Thu, May 29, 2014 at 7:44 AM, Franck Wolff <
> > >> frawolff@gmail.com>
> > >> > >> > wrote:
> > >> > >> > >
> > >> > >> > > > Gary,
> > >> > >> > > >
> > >> > >> > > > See the benchmark classes:
> > >> > >> > > >
> > >> > >> > > >
> > >> > >> > > >
> > >> > >> > >
> > >> > >> >
> > >> >
> > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> > >> > >> > nchmark/amf/BenchmarkBlazeDSAmf.java
> > >> > >> > > > vs.
> > >> > >> > > >
> > >> > >> > > >
> > >> > >> > >
> > >> > >> >
> > >> >
> > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> > >> > >> > nchmark/amf/BenchmarkGraniteDSAmf.java
> > >> > >> > > >
> > >> > >> > > > GraniteDS needs a bit more configuration, but is still very
> > >> easy
> > >> > >> > > > to
> > >> > >> > use.
> > >> > >> > > >
> > >> > >> > > > BTW, about DTOs: you can have a look to our
> > Converter/Reverter
> > >> > >> > > > feature, even if it isn't meant to be used this way in the
> > >> first
> > >> > >> > > > place (see documentation
> > >> > >> > > >
> > >> > >> > > >
> > >> > >> > >
> > >> > >> >
> > >> >
> > http://www.granitedataservices.com/public/docs/latest/docs/reference/f
> > >> > >> > lex/graniteds-refguide-flex.html#extensibility.customtypes
> > >> > >> > > > ).
> > >> > >> > > >
> > >> > >> > > > Let's say you have a bean MyBean on your server and you
> want
> > to
> > >> > >> > serialize
> > >> > >> > > > MyBeanDTO instead (and vice-versa). You can easily write
> this
> > >> kind
> > >> > >> > > > of
> > >> > >> > > > converter:
> > >> > >> > > >
> > >> > >> > > > public class MyBeanConverter extends Converter implements
> > >> Reverter
> > >> > >> > > > {
> > >> > >> > > >
> > >> > >> > > >     public MyBeanConverter(Converters converters) {
> > >> > >> > > >         super(converters);
> > >> > >> > > >     }
> > >> > >> > > >
> > >> > >> > > >     // AMF3Deserialization (Converter)...
> > >> > >> > > >
> > >> > >> > > >     @Override
> > >> > >> > > >     protected boolean internalCanConvert(Object value, Type
> > >> > >> > targetType) {
> > >> > >> > > >     return (value instanceof MyBeanDTO);
> > >> > >> > > >     }
> > >> > >> > > >
> > >> > >> > > >     @Override
> > >> > >> > > >     protected Object internalConvert(Object value, Type
> > >> > targetType)
> > >> > >> {
> > >> > >> > > >     MyBean bean = new MyBean();
> > >> > >> > > >     MyBeanDTO dto = (MyBeanDTO)value;
> > >> > >> > > >     // copy properties from dto to bean...
> > >> > >> > > >         return bean;
> > >> > >> > > >     }
> > >> > >> > > >
> > >> > >> > > >     // AMF3Serialization (Reverter)...
> > >> > >> > > >
> > >> > >> > > >     public boolean canRevert(Object value) {
> > >> > >> > > >         return (value instanceof MyBean);
> > >> > >> > > >     }
> > >> > >> > > >
> > >> > >> > > >     public Object revert(Object value) {
> > >> > >> > > >     MyBeanDTO dto = new MyBeanDTO();
> > >> > >> > > >     MyBean bean = (MyBean)value;
> > >> > >> > > >     // copy properties from bean to dto...
> > >> > >> > > >         return dto;
> > >> > >> > > >     }
> > >> > >> > > > }
> > >> > >> > > >
> > >> > >> > > > Then, just plug this new converter (along with any others)
> in
> > >> your
> > >> > >> > > > granite-config.xml:
> > >> > >> > > >
> > >> > >> > > > <granite-config>
> > >> > >> > > >   <converters>
> > >> > >> > > >     <converter type="path.to.MyBeanConverter" />
> > >> > >> > > >   </converters>
> > >> > >> > > > </granite-config>
> > >> > >> > > >
> > >> > >> > > > According to this configuration, all MyBean instances will
> be
> > >> > >> > serialized
> > >> > >> > > as
> > >> > >> > > > MyBeanDTOs and all MyBeanDTOs will be deserialized as
> MyBeans
> > >> (you
> > >> > >> > don't
> > >> > >> > > > need to anything else, your services can return eg. a
> > >> collection
> > >> > >> > > > of
> > >> > >> > > MyBeans
> > >> > >> > > > it will be serialized as a collection of MyBeanDTOs). Of
> > >> course,
> > >> > >> > > > it can
> > >> > >> > > be
> > >> > >> > > > a bit restrictive if you want to have different DTOs
> classes
> > >> for a
> > >> > >> > > > same bean class...
> > >> > >> > > >
> > >> > >> > > > Franck.
> > >> > >> > > >
> > >> > >> > > >
> > >> > >> > > > 2014-05-29 2:33 GMT+02:00 Gary Yang <
> flashflexpro@gmail.com
> > >:
> > >> > >> > > >
> > >> > >> > > > > Sounds great!
> > >> > >> > > > >
> > >> > >> > > > > Do you think it is possible that I can use the
> > >> > >> > > > > serialization/deserialization features as simple as using
> > >> > >> > > > > BlazeDS
> > >> > >> > like
> > >> > >> > > > > below?
> > >> > >> > > > >
> > >> > >> > > > >
> > >> > >> > > > > in pom.xml :
> > >> > >> > > > >
> > >> > >> > > > >         <dependency>
> > >> > >> > > > >             <groupId>org.springframework.flex</groupId>
> > >> > >> > > > >             <artifactId>spring-flex-core</artifactId>
> > >> > >> > > > >         </dependency>
> > >> > >> > > > >
> > >> > >> > > > > then in Java file:
> > >> > >> > > > >
> > >> > >> > > > >         ... ...
> > >> > >> > > > >
> > >> > >> > > > >         Amf3Output aOut= new Amf3Output(new
> > >> > >> SerializationContext());
> > >> > >> > > > >         aOut.setOutputStream( outStream );
> > >> > >> > > > >         aOut.writeObject(data);
> > >> > >> > > > >
> > >> > >> > > > >         ... ...
> > >> > >> > > > >
> > >> > >> > > > >         Amf3Input aIn = new Amf3Input( new
> > >> > SerializationContext()
> > >> > >> );
> > >> > >> > > > >         aIn.setInputStream( inputStream );
> > >> > >> > > > >         data = aIn.readObject();
> > >> > >> > > > >
> > >> > >> > > > > Thanks.
> > >> > >> > > > >
> > >> > >> > > > >
> > >> > >> > > > > - Gary
> > >> > >> > > > >
> > >> > >> > > > >
> > >> > >> > > > >
> > >> > >> > > > > On Wed, May 14, 2014 at 8:51 AM, Franck Wolff
> > >> > >> > > > > <fr...@gmail.com>
> > >> > >> > > > wrote:
> > >> > >> > > > >
> > >> > >> > > > > > Hi everybody,
> > >> > >> > > > > >
> > >> > >> > > > > > We have just published the benchmark results on the
> > >> GraniteDS
> > >> > >> blog:
> > >> > >> > > > > >
> > >> > >> > > > > >
> > >> > >> > > > >
> > >> > >> > > >
> > >> > >> > >
> > >> > >> >
> > >> >
> > http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds
> > >> > >> > -3-1-vs-blazeds-4-0
> > >> > >> > > > > > .
> > >> > >> > > > > >
> > >> > >> > > > > > Feedback would be very appreciated.
> > >> > >> > > > > >
> > >> > >> > > > > > Franck
> > >> > >> > > > > > @graniteds
> > >> > >> > > > > >
> > >> > >> > > > >
> > >> > >> > > >
> > >> > >> > >
> > >> > >> >
> > >> > >>
> > >> > >
> > >> > >
> > >> >
> > >>
> > >
> > >
> >
>

Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Gary Yang <fl...@gmail.com>.
Franck,

I will post some example usages of Stage3D, GraniteDS and Spring together
in July.

The Vector serialization is very important for 3D because the 3D data is
all Vector<int> and Vector<Number>, I am very surprised that after Stage3D
has been release 3 years, I still can't find related topics online, it
seems most developers are following HTML/JS bluffing!

Great job!

Thanks.

-Gary


On Wed, Jun 4, 2014 at 5:44 AM, Franck Wolff <fr...@gmail.com> wrote:

> Gary,
>
> Nice to know you're happy with GraniteDS!
>
> Unfortunately, I can't see your image, something went wrong with the
> post... Any link outside this mailing list?
>
> Cheers,
> Franck.
>
>
> 2014-06-03 22:17 GMT+02:00 Gary Yang <fl...@gmail.com>:
>
> > Franck,
> >
> > Version 3.1.0 working perfect!
> >
> > After overring the writingCollection( very little code change ), I have
> > managed to load very complex type of data from server!!!
> >
> > Please see:
> >
> > [image: Inline image 1]
> >
> > Thank you very much!
> >
> > Best,
> >
> > -Gary
> >
> >
> >
> > On Tue, Jun 3, 2014 at 6:52 AM, Franck Wolff <fr...@gmail.com> wrote:
> >
> >> See https://github.com/fwolff/flex-vectors-example and especially
> >>
> >>
> https://github.com/fwolff/flex-vectors-example/blob/master/java/org/granite/example/vectors/java/VectorService.java
> >> ,
> >> which shows how to serialize java arrays / collections as AMF vectors
> >> (sorry this feature isn't well documented yet).
> >>
> >> Franck.
> >>
> >>
> >> 2014-06-02 23:18 GMT+02:00 Gary Yang <fl...@gmail.com>:
> >>
> >> > Hi Frank,
> >> >
> >> > I just did a little test against GraniteDS, it can parse bytes into
> Java
> >> > Object very well even for strong typed vector array.
> >> >
> >> > But I don't see GraniteDS can convert a Java Array into Actionscript
> >> > Vector, could you help me please?
> >> >
> >> >
> >> > I also took a look in org.granite.messaging.amf.io.AMF3Serializer, it
> >> > serializes all Java Collection into actionscript
> >> > mx.collection.ArrayCollection, does mobile app based on Flex have
> >> > ArrayCollection compiled in? Which is the best way to change this
> >> default
> >> > behaviour please?
> >> >
> >> >
> >> > Best,
> >> >
> >> > -Gary
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > On Fri, May 30, 2014 at 12:02 PM, Gary Yang <fl...@gmail.com>
> >> > wrote:
> >> >
> >> > > Right, I want to try GraniteDS because
> >> > >
> >> > > 1) Vector support is important!
> >> > >
> >> > > 2) BlazeDS is too old, 2011 code based on JDK5! No one can guarantee
> >> it
> >> > > works with JDK8/Servlet3!!
> >> > >
> >> > >
> >> > > But I am very sure BlazeDS can catch up very fast once development
> >> back
> >> > on
> >> > > track!
> >> > >
> >> > > -Gary
> >> > >
> >> > >
> >> > > On Fri, May 30, 2014 at 11:50 AM, Christofer Dutz <
> >> > > christofer.dutz@c-ware.de> wrote:
> >> > >
> >> > >> Or we will be able to finally start tweaking BlazeDS as soon as we
> >> have
> >> > >> the parity release out the door ;-)
> >> > >>
> >> > >> Chris
> >> > >>
> >> > >> -----Ursprüngliche Nachricht-----
> >> > >> Von: Gary Yang [mailto:flashflexpro@gmail.com]
> >> > >> Gesendet: Freitag, 30. Mai 2014 17:14
> >> > >> An: users@flex.apache.org
> >> > >> Betreff: Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs.
> >> > BlazeDS
> >> > >> 4.0.0)
> >> > >>
> >> > >> Franck,
> >> > >>
> >> > >> Very impressive!
> >> > >>
> >> > >> I guess it is time to switch to GraniteDS.
> >> > >>
> >> > >> Thanks.
> >> > >>
> >> > >> -Gary
> >> > >>
> >> > >>
> >> > >>
> >> > >> On Fri, May 30, 2014 at 4:41 AM, Franck Wolff <fr...@gmail.com>
> >> > wrote:
> >> > >>
> >> > >> > Gary,
> >> > >> >
> >> > >> > Just have a look at the link I gave you before:
> >> > >> >
> >> > >> >
> >> >
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> >> > >> > nchmark/amf/BenchmarkGraniteDSAmf.java
> >> > >> > .
> >> > >> > It doesn't run inside a servlet container, does it?
> >> > >> >
> >> > >> > F.
> >> > >> >
> >> > >> >
> >> > >> > 2014-05-29 17:22 GMT+02:00 Gary Yang <fl...@gmail.com>:
> >> > >> >
> >> > >> > > Franck,
> >> > >> > >
> >> > >> > > Does GraniteDS have to run inside a servlet container? I only
> >> want
> >> > >> > > to AMF serialization/deserialization function which has nothing
> >> to
> >> > >> > > do with network, http or servlet.
> >> > >> > >
> >> > >> > > thanks.
> >> > >> > >
> >> > >> > > -Gary
> >> > >> > >
> >> > >> > >
> >> > >> > > On Thu, May 29, 2014 at 7:44 AM, Franck Wolff <
> >> frawolff@gmail.com>
> >> > >> > wrote:
> >> > >> > >
> >> > >> > > > Gary,
> >> > >> > > >
> >> > >> > > > See the benchmark classes:
> >> > >> > > >
> >> > >> > > >
> >> > >> > > >
> >> > >> > >
> >> > >> >
> >> >
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> >> > >> > nchmark/amf/BenchmarkBlazeDSAmf.java
> >> > >> > > > vs.
> >> > >> > > >
> >> > >> > > >
> >> > >> > >
> >> > >> >
> >> >
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> >> > >> > nchmark/amf/BenchmarkGraniteDSAmf.java
> >> > >> > > >
> >> > >> > > > GraniteDS needs a bit more configuration, but is still very
> >> easy
> >> > >> > > > to
> >> > >> > use.
> >> > >> > > >
> >> > >> > > > BTW, about DTOs: you can have a look to our
> Converter/Reverter
> >> > >> > > > feature, even if it isn't meant to be used this way in the
> >> first
> >> > >> > > > place (see documentation
> >> > >> > > >
> >> > >> > > >
> >> > >> > >
> >> > >> >
> >> >
> http://www.granitedataservices.com/public/docs/latest/docs/reference/f
> >> > >> > lex/graniteds-refguide-flex.html#extensibility.customtypes
> >> > >> > > > ).
> >> > >> > > >
> >> > >> > > > Let's say you have a bean MyBean on your server and you want
> to
> >> > >> > serialize
> >> > >> > > > MyBeanDTO instead (and vice-versa). You can easily write this
> >> kind
> >> > >> > > > of
> >> > >> > > > converter:
> >> > >> > > >
> >> > >> > > > public class MyBeanConverter extends Converter implements
> >> Reverter
> >> > >> > > > {
> >> > >> > > >
> >> > >> > > >     public MyBeanConverter(Converters converters) {
> >> > >> > > >         super(converters);
> >> > >> > > >     }
> >> > >> > > >
> >> > >> > > >     // AMF3Deserialization (Converter)...
> >> > >> > > >
> >> > >> > > >     @Override
> >> > >> > > >     protected boolean internalCanConvert(Object value, Type
> >> > >> > targetType) {
> >> > >> > > >     return (value instanceof MyBeanDTO);
> >> > >> > > >     }
> >> > >> > > >
> >> > >> > > >     @Override
> >> > >> > > >     protected Object internalConvert(Object value, Type
> >> > targetType)
> >> > >> {
> >> > >> > > >     MyBean bean = new MyBean();
> >> > >> > > >     MyBeanDTO dto = (MyBeanDTO)value;
> >> > >> > > >     // copy properties from dto to bean...
> >> > >> > > >         return bean;
> >> > >> > > >     }
> >> > >> > > >
> >> > >> > > >     // AMF3Serialization (Reverter)...
> >> > >> > > >
> >> > >> > > >     public boolean canRevert(Object value) {
> >> > >> > > >         return (value instanceof MyBean);
> >> > >> > > >     }
> >> > >> > > >
> >> > >> > > >     public Object revert(Object value) {
> >> > >> > > >     MyBeanDTO dto = new MyBeanDTO();
> >> > >> > > >     MyBean bean = (MyBean)value;
> >> > >> > > >     // copy properties from bean to dto...
> >> > >> > > >         return dto;
> >> > >> > > >     }
> >> > >> > > > }
> >> > >> > > >
> >> > >> > > > Then, just plug this new converter (along with any others) in
> >> your
> >> > >> > > > granite-config.xml:
> >> > >> > > >
> >> > >> > > > <granite-config>
> >> > >> > > >   <converters>
> >> > >> > > >     <converter type="path.to.MyBeanConverter" />
> >> > >> > > >   </converters>
> >> > >> > > > </granite-config>
> >> > >> > > >
> >> > >> > > > According to this configuration, all MyBean instances will be
> >> > >> > serialized
> >> > >> > > as
> >> > >> > > > MyBeanDTOs and all MyBeanDTOs will be deserialized as MyBeans
> >> (you
> >> > >> > don't
> >> > >> > > > need to anything else, your services can return eg. a
> >> collection
> >> > >> > > > of
> >> > >> > > MyBeans
> >> > >> > > > it will be serialized as a collection of MyBeanDTOs). Of
> >> course,
> >> > >> > > > it can
> >> > >> > > be
> >> > >> > > > a bit restrictive if you want to have different DTOs classes
> >> for a
> >> > >> > > > same bean class...
> >> > >> > > >
> >> > >> > > > Franck.
> >> > >> > > >
> >> > >> > > >
> >> > >> > > > 2014-05-29 2:33 GMT+02:00 Gary Yang <flashflexpro@gmail.com
> >:
> >> > >> > > >
> >> > >> > > > > Sounds great!
> >> > >> > > > >
> >> > >> > > > > Do you think it is possible that I can use the
> >> > >> > > > > serialization/deserialization features as simple as using
> >> > >> > > > > BlazeDS
> >> > >> > like
> >> > >> > > > > below?
> >> > >> > > > >
> >> > >> > > > >
> >> > >> > > > > in pom.xml :
> >> > >> > > > >
> >> > >> > > > >         <dependency>
> >> > >> > > > >             <groupId>org.springframework.flex</groupId>
> >> > >> > > > >             <artifactId>spring-flex-core</artifactId>
> >> > >> > > > >         </dependency>
> >> > >> > > > >
> >> > >> > > > > then in Java file:
> >> > >> > > > >
> >> > >> > > > >         ... ...
> >> > >> > > > >
> >> > >> > > > >         Amf3Output aOut= new Amf3Output(new
> >> > >> SerializationContext());
> >> > >> > > > >         aOut.setOutputStream( outStream );
> >> > >> > > > >         aOut.writeObject(data);
> >> > >> > > > >
> >> > >> > > > >         ... ...
> >> > >> > > > >
> >> > >> > > > >         Amf3Input aIn = new Amf3Input( new
> >> > SerializationContext()
> >> > >> );
> >> > >> > > > >         aIn.setInputStream( inputStream );
> >> > >> > > > >         data = aIn.readObject();
> >> > >> > > > >
> >> > >> > > > > Thanks.
> >> > >> > > > >
> >> > >> > > > >
> >> > >> > > > > - Gary
> >> > >> > > > >
> >> > >> > > > >
> >> > >> > > > >
> >> > >> > > > > On Wed, May 14, 2014 at 8:51 AM, Franck Wolff
> >> > >> > > > > <fr...@gmail.com>
> >> > >> > > > wrote:
> >> > >> > > > >
> >> > >> > > > > > Hi everybody,
> >> > >> > > > > >
> >> > >> > > > > > We have just published the benchmark results on the
> >> GraniteDS
> >> > >> blog:
> >> > >> > > > > >
> >> > >> > > > > >
> >> > >> > > > >
> >> > >> > > >
> >> > >> > >
> >> > >> >
> >> >
> http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds
> >> > >> > -3-1-vs-blazeds-4-0
> >> > >> > > > > > .
> >> > >> > > > > >
> >> > >> > > > > > Feedback would be very appreciated.
> >> > >> > > > > >
> >> > >> > > > > > Franck
> >> > >> > > > > > @graniteds
> >> > >> > > > > >
> >> > >> > > > >
> >> > >> > > >
> >> > >> > >
> >> > >> >
> >> > >>
> >> > >
> >> > >
> >> >
> >>
> >
> >
>

Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Franck Wolff <fr...@gmail.com>.
Gary,

Nice to know you're happy with GraniteDS!

Unfortunately, I can't see your image, something went wrong with the
post... Any link outside this mailing list?

Cheers,
Franck.


2014-06-03 22:17 GMT+02:00 Gary Yang <fl...@gmail.com>:

> Franck,
>
> Version 3.1.0 working perfect!
>
> After overring the writingCollection( very little code change ), I have
> managed to load very complex type of data from server!!!
>
> Please see:
>
> [image: Inline image 1]
>
> Thank you very much!
>
> Best,
>
> -Gary
>
>
>
> On Tue, Jun 3, 2014 at 6:52 AM, Franck Wolff <fr...@gmail.com> wrote:
>
>> See https://github.com/fwolff/flex-vectors-example and especially
>>
>> https://github.com/fwolff/flex-vectors-example/blob/master/java/org/granite/example/vectors/java/VectorService.java
>> ,
>> which shows how to serialize java arrays / collections as AMF vectors
>> (sorry this feature isn't well documented yet).
>>
>> Franck.
>>
>>
>> 2014-06-02 23:18 GMT+02:00 Gary Yang <fl...@gmail.com>:
>>
>> > Hi Frank,
>> >
>> > I just did a little test against GraniteDS, it can parse bytes into Java
>> > Object very well even for strong typed vector array.
>> >
>> > But I don't see GraniteDS can convert a Java Array into Actionscript
>> > Vector, could you help me please?
>> >
>> >
>> > I also took a look in org.granite.messaging.amf.io.AMF3Serializer, it
>> > serializes all Java Collection into actionscript
>> > mx.collection.ArrayCollection, does mobile app based on Flex have
>> > ArrayCollection compiled in? Which is the best way to change this
>> default
>> > behaviour please?
>> >
>> >
>> > Best,
>> >
>> > -Gary
>> >
>> >
>> >
>> >
>> >
>> > On Fri, May 30, 2014 at 12:02 PM, Gary Yang <fl...@gmail.com>
>> > wrote:
>> >
>> > > Right, I want to try GraniteDS because
>> > >
>> > > 1) Vector support is important!
>> > >
>> > > 2) BlazeDS is too old, 2011 code based on JDK5! No one can guarantee
>> it
>> > > works with JDK8/Servlet3!!
>> > >
>> > >
>> > > But I am very sure BlazeDS can catch up very fast once development
>> back
>> > on
>> > > track!
>> > >
>> > > -Gary
>> > >
>> > >
>> > > On Fri, May 30, 2014 at 11:50 AM, Christofer Dutz <
>> > > christofer.dutz@c-ware.de> wrote:
>> > >
>> > >> Or we will be able to finally start tweaking BlazeDS as soon as we
>> have
>> > >> the parity release out the door ;-)
>> > >>
>> > >> Chris
>> > >>
>> > >> -----Ursprüngliche Nachricht-----
>> > >> Von: Gary Yang [mailto:flashflexpro@gmail.com]
>> > >> Gesendet: Freitag, 30. Mai 2014 17:14
>> > >> An: users@flex.apache.org
>> > >> Betreff: Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs.
>> > BlazeDS
>> > >> 4.0.0)
>> > >>
>> > >> Franck,
>> > >>
>> > >> Very impressive!
>> > >>
>> > >> I guess it is time to switch to GraniteDS.
>> > >>
>> > >> Thanks.
>> > >>
>> > >> -Gary
>> > >>
>> > >>
>> > >>
>> > >> On Fri, May 30, 2014 at 4:41 AM, Franck Wolff <fr...@gmail.com>
>> > wrote:
>> > >>
>> > >> > Gary,
>> > >> >
>> > >> > Just have a look at the link I gave you before:
>> > >> >
>> > >> >
>> > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
>> > >> > nchmark/amf/BenchmarkGraniteDSAmf.java
>> > >> > .
>> > >> > It doesn't run inside a servlet container, does it?
>> > >> >
>> > >> > F.
>> > >> >
>> > >> >
>> > >> > 2014-05-29 17:22 GMT+02:00 Gary Yang <fl...@gmail.com>:
>> > >> >
>> > >> > > Franck,
>> > >> > >
>> > >> > > Does GraniteDS have to run inside a servlet container? I only
>> want
>> > >> > > to AMF serialization/deserialization function which has nothing
>> to
>> > >> > > do with network, http or servlet.
>> > >> > >
>> > >> > > thanks.
>> > >> > >
>> > >> > > -Gary
>> > >> > >
>> > >> > >
>> > >> > > On Thu, May 29, 2014 at 7:44 AM, Franck Wolff <
>> frawolff@gmail.com>
>> > >> > wrote:
>> > >> > >
>> > >> > > > Gary,
>> > >> > > >
>> > >> > > > See the benchmark classes:
>> > >> > > >
>> > >> > > >
>> > >> > > >
>> > >> > >
>> > >> >
>> > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
>> > >> > nchmark/amf/BenchmarkBlazeDSAmf.java
>> > >> > > > vs.
>> > >> > > >
>> > >> > > >
>> > >> > >
>> > >> >
>> > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
>> > >> > nchmark/amf/BenchmarkGraniteDSAmf.java
>> > >> > > >
>> > >> > > > GraniteDS needs a bit more configuration, but is still very
>> easy
>> > >> > > > to
>> > >> > use.
>> > >> > > >
>> > >> > > > BTW, about DTOs: you can have a look to our Converter/Reverter
>> > >> > > > feature, even if it isn't meant to be used this way in the
>> first
>> > >> > > > place (see documentation
>> > >> > > >
>> > >> > > >
>> > >> > >
>> > >> >
>> > http://www.granitedataservices.com/public/docs/latest/docs/reference/f
>> > >> > lex/graniteds-refguide-flex.html#extensibility.customtypes
>> > >> > > > ).
>> > >> > > >
>> > >> > > > Let's say you have a bean MyBean on your server and you want to
>> > >> > serialize
>> > >> > > > MyBeanDTO instead (and vice-versa). You can easily write this
>> kind
>> > >> > > > of
>> > >> > > > converter:
>> > >> > > >
>> > >> > > > public class MyBeanConverter extends Converter implements
>> Reverter
>> > >> > > > {
>> > >> > > >
>> > >> > > >     public MyBeanConverter(Converters converters) {
>> > >> > > >         super(converters);
>> > >> > > >     }
>> > >> > > >
>> > >> > > >     // AMF3Deserialization (Converter)...
>> > >> > > >
>> > >> > > >     @Override
>> > >> > > >     protected boolean internalCanConvert(Object value, Type
>> > >> > targetType) {
>> > >> > > >     return (value instanceof MyBeanDTO);
>> > >> > > >     }
>> > >> > > >
>> > >> > > >     @Override
>> > >> > > >     protected Object internalConvert(Object value, Type
>> > targetType)
>> > >> {
>> > >> > > >     MyBean bean = new MyBean();
>> > >> > > >     MyBeanDTO dto = (MyBeanDTO)value;
>> > >> > > >     // copy properties from dto to bean...
>> > >> > > >         return bean;
>> > >> > > >     }
>> > >> > > >
>> > >> > > >     // AMF3Serialization (Reverter)...
>> > >> > > >
>> > >> > > >     public boolean canRevert(Object value) {
>> > >> > > >         return (value instanceof MyBean);
>> > >> > > >     }
>> > >> > > >
>> > >> > > >     public Object revert(Object value) {
>> > >> > > >     MyBeanDTO dto = new MyBeanDTO();
>> > >> > > >     MyBean bean = (MyBean)value;
>> > >> > > >     // copy properties from bean to dto...
>> > >> > > >         return dto;
>> > >> > > >     }
>> > >> > > > }
>> > >> > > >
>> > >> > > > Then, just plug this new converter (along with any others) in
>> your
>> > >> > > > granite-config.xml:
>> > >> > > >
>> > >> > > > <granite-config>
>> > >> > > >   <converters>
>> > >> > > >     <converter type="path.to.MyBeanConverter" />
>> > >> > > >   </converters>
>> > >> > > > </granite-config>
>> > >> > > >
>> > >> > > > According to this configuration, all MyBean instances will be
>> > >> > serialized
>> > >> > > as
>> > >> > > > MyBeanDTOs and all MyBeanDTOs will be deserialized as MyBeans
>> (you
>> > >> > don't
>> > >> > > > need to anything else, your services can return eg. a
>> collection
>> > >> > > > of
>> > >> > > MyBeans
>> > >> > > > it will be serialized as a collection of MyBeanDTOs). Of
>> course,
>> > >> > > > it can
>> > >> > > be
>> > >> > > > a bit restrictive if you want to have different DTOs classes
>> for a
>> > >> > > > same bean class...
>> > >> > > >
>> > >> > > > Franck.
>> > >> > > >
>> > >> > > >
>> > >> > > > 2014-05-29 2:33 GMT+02:00 Gary Yang <fl...@gmail.com>:
>> > >> > > >
>> > >> > > > > Sounds great!
>> > >> > > > >
>> > >> > > > > Do you think it is possible that I can use the
>> > >> > > > > serialization/deserialization features as simple as using
>> > >> > > > > BlazeDS
>> > >> > like
>> > >> > > > > below?
>> > >> > > > >
>> > >> > > > >
>> > >> > > > > in pom.xml :
>> > >> > > > >
>> > >> > > > >         <dependency>
>> > >> > > > >             <groupId>org.springframework.flex</groupId>
>> > >> > > > >             <artifactId>spring-flex-core</artifactId>
>> > >> > > > >         </dependency>
>> > >> > > > >
>> > >> > > > > then in Java file:
>> > >> > > > >
>> > >> > > > >         ... ...
>> > >> > > > >
>> > >> > > > >         Amf3Output aOut= new Amf3Output(new
>> > >> SerializationContext());
>> > >> > > > >         aOut.setOutputStream( outStream );
>> > >> > > > >         aOut.writeObject(data);
>> > >> > > > >
>> > >> > > > >         ... ...
>> > >> > > > >
>> > >> > > > >         Amf3Input aIn = new Amf3Input( new
>> > SerializationContext()
>> > >> );
>> > >> > > > >         aIn.setInputStream( inputStream );
>> > >> > > > >         data = aIn.readObject();
>> > >> > > > >
>> > >> > > > > Thanks.
>> > >> > > > >
>> > >> > > > >
>> > >> > > > > - Gary
>> > >> > > > >
>> > >> > > > >
>> > >> > > > >
>> > >> > > > > On Wed, May 14, 2014 at 8:51 AM, Franck Wolff
>> > >> > > > > <fr...@gmail.com>
>> > >> > > > wrote:
>> > >> > > > >
>> > >> > > > > > Hi everybody,
>> > >> > > > > >
>> > >> > > > > > We have just published the benchmark results on the
>> GraniteDS
>> > >> blog:
>> > >> > > > > >
>> > >> > > > > >
>> > >> > > > >
>> > >> > > >
>> > >> > >
>> > >> >
>> > http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds
>> > >> > -3-1-vs-blazeds-4-0
>> > >> > > > > > .
>> > >> > > > > >
>> > >> > > > > > Feedback would be very appreciated.
>> > >> > > > > >
>> > >> > > > > > Franck
>> > >> > > > > > @graniteds
>> > >> > > > > >
>> > >> > > > >
>> > >> > > >
>> > >> > >
>> > >> >
>> > >>
>> > >
>> > >
>> >
>>
>
>

Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Gary Yang <fl...@gmail.com>.
Franck,

Version 3.1.0 working perfect!

After overring the writingCollection( very little code change ), I have
managed to load very complex type of data from server!!!

Please see:

[image: Inline image 1]

Thank you very much!

Best,

-Gary



On Tue, Jun 3, 2014 at 6:52 AM, Franck Wolff <fr...@gmail.com> wrote:

> See https://github.com/fwolff/flex-vectors-example and especially
>
> https://github.com/fwolff/flex-vectors-example/blob/master/java/org/granite/example/vectors/java/VectorService.java
> ,
> which shows how to serialize java arrays / collections as AMF vectors
> (sorry this feature isn't well documented yet).
>
> Franck.
>
>
> 2014-06-02 23:18 GMT+02:00 Gary Yang <fl...@gmail.com>:
>
> > Hi Frank,
> >
> > I just did a little test against GraniteDS, it can parse bytes into Java
> > Object very well even for strong typed vector array.
> >
> > But I don't see GraniteDS can convert a Java Array into Actionscript
> > Vector, could you help me please?
> >
> >
> > I also took a look in org.granite.messaging.amf.io.AMF3Serializer, it
> > serializes all Java Collection into actionscript
> > mx.collection.ArrayCollection, does mobile app based on Flex have
> > ArrayCollection compiled in? Which is the best way to change this default
> > behaviour please?
> >
> >
> > Best,
> >
> > -Gary
> >
> >
> >
> >
> >
> > On Fri, May 30, 2014 at 12:02 PM, Gary Yang <fl...@gmail.com>
> > wrote:
> >
> > > Right, I want to try GraniteDS because
> > >
> > > 1) Vector support is important!
> > >
> > > 2) BlazeDS is too old, 2011 code based on JDK5! No one can guarantee it
> > > works with JDK8/Servlet3!!
> > >
> > >
> > > But I am very sure BlazeDS can catch up very fast once development back
> > on
> > > track!
> > >
> > > -Gary
> > >
> > >
> > > On Fri, May 30, 2014 at 11:50 AM, Christofer Dutz <
> > > christofer.dutz@c-ware.de> wrote:
> > >
> > >> Or we will be able to finally start tweaking BlazeDS as soon as we
> have
> > >> the parity release out the door ;-)
> > >>
> > >> Chris
> > >>
> > >> -----Ursprüngliche Nachricht-----
> > >> Von: Gary Yang [mailto:flashflexpro@gmail.com]
> > >> Gesendet: Freitag, 30. Mai 2014 17:14
> > >> An: users@flex.apache.org
> > >> Betreff: Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs.
> > BlazeDS
> > >> 4.0.0)
> > >>
> > >> Franck,
> > >>
> > >> Very impressive!
> > >>
> > >> I guess it is time to switch to GraniteDS.
> > >>
> > >> Thanks.
> > >>
> > >> -Gary
> > >>
> > >>
> > >>
> > >> On Fri, May 30, 2014 at 4:41 AM, Franck Wolff <fr...@gmail.com>
> > wrote:
> > >>
> > >> > Gary,
> > >> >
> > >> > Just have a look at the link I gave you before:
> > >> >
> > >> >
> > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> > >> > nchmark/amf/BenchmarkGraniteDSAmf.java
> > >> > .
> > >> > It doesn't run inside a servlet container, does it?
> > >> >
> > >> > F.
> > >> >
> > >> >
> > >> > 2014-05-29 17:22 GMT+02:00 Gary Yang <fl...@gmail.com>:
> > >> >
> > >> > > Franck,
> > >> > >
> > >> > > Does GraniteDS have to run inside a servlet container? I only want
> > >> > > to AMF serialization/deserialization function which has nothing to
> > >> > > do with network, http or servlet.
> > >> > >
> > >> > > thanks.
> > >> > >
> > >> > > -Gary
> > >> > >
> > >> > >
> > >> > > On Thu, May 29, 2014 at 7:44 AM, Franck Wolff <frawolff@gmail.com
> >
> > >> > wrote:
> > >> > >
> > >> > > > Gary,
> > >> > > >
> > >> > > > See the benchmark classes:
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> > >> > nchmark/amf/BenchmarkBlazeDSAmf.java
> > >> > > > vs.
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> > >> > nchmark/amf/BenchmarkGraniteDSAmf.java
> > >> > > >
> > >> > > > GraniteDS needs a bit more configuration, but is still very easy
> > >> > > > to
> > >> > use.
> > >> > > >
> > >> > > > BTW, about DTOs: you can have a look to our Converter/Reverter
> > >> > > > feature, even if it isn't meant to be used this way in the first
> > >> > > > place (see documentation
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > http://www.granitedataservices.com/public/docs/latest/docs/reference/f
> > >> > lex/graniteds-refguide-flex.html#extensibility.customtypes
> > >> > > > ).
> > >> > > >
> > >> > > > Let's say you have a bean MyBean on your server and you want to
> > >> > serialize
> > >> > > > MyBeanDTO instead (and vice-versa). You can easily write this
> kind
> > >> > > > of
> > >> > > > converter:
> > >> > > >
> > >> > > > public class MyBeanConverter extends Converter implements
> Reverter
> > >> > > > {
> > >> > > >
> > >> > > >     public MyBeanConverter(Converters converters) {
> > >> > > >         super(converters);
> > >> > > >     }
> > >> > > >
> > >> > > >     // AMF3Deserialization (Converter)...
> > >> > > >
> > >> > > >     @Override
> > >> > > >     protected boolean internalCanConvert(Object value, Type
> > >> > targetType) {
> > >> > > >     return (value instanceof MyBeanDTO);
> > >> > > >     }
> > >> > > >
> > >> > > >     @Override
> > >> > > >     protected Object internalConvert(Object value, Type
> > targetType)
> > >> {
> > >> > > >     MyBean bean = new MyBean();
> > >> > > >     MyBeanDTO dto = (MyBeanDTO)value;
> > >> > > >     // copy properties from dto to bean...
> > >> > > >         return bean;
> > >> > > >     }
> > >> > > >
> > >> > > >     // AMF3Serialization (Reverter)...
> > >> > > >
> > >> > > >     public boolean canRevert(Object value) {
> > >> > > >         return (value instanceof MyBean);
> > >> > > >     }
> > >> > > >
> > >> > > >     public Object revert(Object value) {
> > >> > > >     MyBeanDTO dto = new MyBeanDTO();
> > >> > > >     MyBean bean = (MyBean)value;
> > >> > > >     // copy properties from bean to dto...
> > >> > > >         return dto;
> > >> > > >     }
> > >> > > > }
> > >> > > >
> > >> > > > Then, just plug this new converter (along with any others) in
> your
> > >> > > > granite-config.xml:
> > >> > > >
> > >> > > > <granite-config>
> > >> > > >   <converters>
> > >> > > >     <converter type="path.to.MyBeanConverter" />
> > >> > > >   </converters>
> > >> > > > </granite-config>
> > >> > > >
> > >> > > > According to this configuration, all MyBean instances will be
> > >> > serialized
> > >> > > as
> > >> > > > MyBeanDTOs and all MyBeanDTOs will be deserialized as MyBeans
> (you
> > >> > don't
> > >> > > > need to anything else, your services can return eg. a collection
> > >> > > > of
> > >> > > MyBeans
> > >> > > > it will be serialized as a collection of MyBeanDTOs). Of course,
> > >> > > > it can
> > >> > > be
> > >> > > > a bit restrictive if you want to have different DTOs classes
> for a
> > >> > > > same bean class...
> > >> > > >
> > >> > > > Franck.
> > >> > > >
> > >> > > >
> > >> > > > 2014-05-29 2:33 GMT+02:00 Gary Yang <fl...@gmail.com>:
> > >> > > >
> > >> > > > > Sounds great!
> > >> > > > >
> > >> > > > > Do you think it is possible that I can use the
> > >> > > > > serialization/deserialization features as simple as using
> > >> > > > > BlazeDS
> > >> > like
> > >> > > > > below?
> > >> > > > >
> > >> > > > >
> > >> > > > > in pom.xml :
> > >> > > > >
> > >> > > > >         <dependency>
> > >> > > > >             <groupId>org.springframework.flex</groupId>
> > >> > > > >             <artifactId>spring-flex-core</artifactId>
> > >> > > > >         </dependency>
> > >> > > > >
> > >> > > > > then in Java file:
> > >> > > > >
> > >> > > > >         ... ...
> > >> > > > >
> > >> > > > >         Amf3Output aOut= new Amf3Output(new
> > >> SerializationContext());
> > >> > > > >         aOut.setOutputStream( outStream );
> > >> > > > >         aOut.writeObject(data);
> > >> > > > >
> > >> > > > >         ... ...
> > >> > > > >
> > >> > > > >         Amf3Input aIn = new Amf3Input( new
> > SerializationContext()
> > >> );
> > >> > > > >         aIn.setInputStream( inputStream );
> > >> > > > >         data = aIn.readObject();
> > >> > > > >
> > >> > > > > Thanks.
> > >> > > > >
> > >> > > > >
> > >> > > > > - Gary
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > > On Wed, May 14, 2014 at 8:51 AM, Franck Wolff
> > >> > > > > <fr...@gmail.com>
> > >> > > > wrote:
> > >> > > > >
> > >> > > > > > Hi everybody,
> > >> > > > > >
> > >> > > > > > We have just published the benchmark results on the
> GraniteDS
> > >> blog:
> > >> > > > > >
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds
> > >> > -3-1-vs-blazeds-4-0
> > >> > > > > > .
> > >> > > > > >
> > >> > > > > > Feedback would be very appreciated.
> > >> > > > > >
> > >> > > > > > Franck
> > >> > > > > > @graniteds
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> > >
> > >
> >
>

Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Franck Wolff <fr...@gmail.com>.
See https://github.com/fwolff/flex-vectors-example and especially
https://github.com/fwolff/flex-vectors-example/blob/master/java/org/granite/example/vectors/java/VectorService.java,
which shows how to serialize java arrays / collections as AMF vectors
(sorry this feature isn't well documented yet).

Franck.


2014-06-02 23:18 GMT+02:00 Gary Yang <fl...@gmail.com>:

> Hi Frank,
>
> I just did a little test against GraniteDS, it can parse bytes into Java
> Object very well even for strong typed vector array.
>
> But I don't see GraniteDS can convert a Java Array into Actionscript
> Vector, could you help me please?
>
>
> I also took a look in org.granite.messaging.amf.io.AMF3Serializer, it
> serializes all Java Collection into actionscript
> mx.collection.ArrayCollection, does mobile app based on Flex have
> ArrayCollection compiled in? Which is the best way to change this default
> behaviour please?
>
>
> Best,
>
> -Gary
>
>
>
>
>
> On Fri, May 30, 2014 at 12:02 PM, Gary Yang <fl...@gmail.com>
> wrote:
>
> > Right, I want to try GraniteDS because
> >
> > 1) Vector support is important!
> >
> > 2) BlazeDS is too old, 2011 code based on JDK5! No one can guarantee it
> > works with JDK8/Servlet3!!
> >
> >
> > But I am very sure BlazeDS can catch up very fast once development back
> on
> > track!
> >
> > -Gary
> >
> >
> > On Fri, May 30, 2014 at 11:50 AM, Christofer Dutz <
> > christofer.dutz@c-ware.de> wrote:
> >
> >> Or we will be able to finally start tweaking BlazeDS as soon as we have
> >> the parity release out the door ;-)
> >>
> >> Chris
> >>
> >> -----Ursprüngliche Nachricht-----
> >> Von: Gary Yang [mailto:flashflexpro@gmail.com]
> >> Gesendet: Freitag, 30. Mai 2014 17:14
> >> An: users@flex.apache.org
> >> Betreff: Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs.
> BlazeDS
> >> 4.0.0)
> >>
> >> Franck,
> >>
> >> Very impressive!
> >>
> >> I guess it is time to switch to GraniteDS.
> >>
> >> Thanks.
> >>
> >> -Gary
> >>
> >>
> >>
> >> On Fri, May 30, 2014 at 4:41 AM, Franck Wolff <fr...@gmail.com>
> wrote:
> >>
> >> > Gary,
> >> >
> >> > Just have a look at the link I gave you before:
> >> >
> >> >
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> >> > nchmark/amf/BenchmarkGraniteDSAmf.java
> >> > .
> >> > It doesn't run inside a servlet container, does it?
> >> >
> >> > F.
> >> >
> >> >
> >> > 2014-05-29 17:22 GMT+02:00 Gary Yang <fl...@gmail.com>:
> >> >
> >> > > Franck,
> >> > >
> >> > > Does GraniteDS have to run inside a servlet container? I only want
> >> > > to AMF serialization/deserialization function which has nothing to
> >> > > do with network, http or servlet.
> >> > >
> >> > > thanks.
> >> > >
> >> > > -Gary
> >> > >
> >> > >
> >> > > On Thu, May 29, 2014 at 7:44 AM, Franck Wolff <fr...@gmail.com>
> >> > wrote:
> >> > >
> >> > > > Gary,
> >> > > >
> >> > > > See the benchmark classes:
> >> > > >
> >> > > >
> >> > > >
> >> > >
> >> >
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> >> > nchmark/amf/BenchmarkBlazeDSAmf.java
> >> > > > vs.
> >> > > >
> >> > > >
> >> > >
> >> >
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> >> > nchmark/amf/BenchmarkGraniteDSAmf.java
> >> > > >
> >> > > > GraniteDS needs a bit more configuration, but is still very easy
> >> > > > to
> >> > use.
> >> > > >
> >> > > > BTW, about DTOs: you can have a look to our Converter/Reverter
> >> > > > feature, even if it isn't meant to be used this way in the first
> >> > > > place (see documentation
> >> > > >
> >> > > >
> >> > >
> >> >
> http://www.granitedataservices.com/public/docs/latest/docs/reference/f
> >> > lex/graniteds-refguide-flex.html#extensibility.customtypes
> >> > > > ).
> >> > > >
> >> > > > Let's say you have a bean MyBean on your server and you want to
> >> > serialize
> >> > > > MyBeanDTO instead (and vice-versa). You can easily write this kind
> >> > > > of
> >> > > > converter:
> >> > > >
> >> > > > public class MyBeanConverter extends Converter implements Reverter
> >> > > > {
> >> > > >
> >> > > >     public MyBeanConverter(Converters converters) {
> >> > > >         super(converters);
> >> > > >     }
> >> > > >
> >> > > >     // AMF3Deserialization (Converter)...
> >> > > >
> >> > > >     @Override
> >> > > >     protected boolean internalCanConvert(Object value, Type
> >> > targetType) {
> >> > > >     return (value instanceof MyBeanDTO);
> >> > > >     }
> >> > > >
> >> > > >     @Override
> >> > > >     protected Object internalConvert(Object value, Type
> targetType)
> >> {
> >> > > >     MyBean bean = new MyBean();
> >> > > >     MyBeanDTO dto = (MyBeanDTO)value;
> >> > > >     // copy properties from dto to bean...
> >> > > >         return bean;
> >> > > >     }
> >> > > >
> >> > > >     // AMF3Serialization (Reverter)...
> >> > > >
> >> > > >     public boolean canRevert(Object value) {
> >> > > >         return (value instanceof MyBean);
> >> > > >     }
> >> > > >
> >> > > >     public Object revert(Object value) {
> >> > > >     MyBeanDTO dto = new MyBeanDTO();
> >> > > >     MyBean bean = (MyBean)value;
> >> > > >     // copy properties from bean to dto...
> >> > > >         return dto;
> >> > > >     }
> >> > > > }
> >> > > >
> >> > > > Then, just plug this new converter (along with any others) in your
> >> > > > granite-config.xml:
> >> > > >
> >> > > > <granite-config>
> >> > > >   <converters>
> >> > > >     <converter type="path.to.MyBeanConverter" />
> >> > > >   </converters>
> >> > > > </granite-config>
> >> > > >
> >> > > > According to this configuration, all MyBean instances will be
> >> > serialized
> >> > > as
> >> > > > MyBeanDTOs and all MyBeanDTOs will be deserialized as MyBeans (you
> >> > don't
> >> > > > need to anything else, your services can return eg. a collection
> >> > > > of
> >> > > MyBeans
> >> > > > it will be serialized as a collection of MyBeanDTOs). Of course,
> >> > > > it can
> >> > > be
> >> > > > a bit restrictive if you want to have different DTOs classes for a
> >> > > > same bean class...
> >> > > >
> >> > > > Franck.
> >> > > >
> >> > > >
> >> > > > 2014-05-29 2:33 GMT+02:00 Gary Yang <fl...@gmail.com>:
> >> > > >
> >> > > > > Sounds great!
> >> > > > >
> >> > > > > Do you think it is possible that I can use the
> >> > > > > serialization/deserialization features as simple as using
> >> > > > > BlazeDS
> >> > like
> >> > > > > below?
> >> > > > >
> >> > > > >
> >> > > > > in pom.xml :
> >> > > > >
> >> > > > >         <dependency>
> >> > > > >             <groupId>org.springframework.flex</groupId>
> >> > > > >             <artifactId>spring-flex-core</artifactId>
> >> > > > >         </dependency>
> >> > > > >
> >> > > > > then in Java file:
> >> > > > >
> >> > > > >         ... ...
> >> > > > >
> >> > > > >         Amf3Output aOut= new Amf3Output(new
> >> SerializationContext());
> >> > > > >         aOut.setOutputStream( outStream );
> >> > > > >         aOut.writeObject(data);
> >> > > > >
> >> > > > >         ... ...
> >> > > > >
> >> > > > >         Amf3Input aIn = new Amf3Input( new
> SerializationContext()
> >> );
> >> > > > >         aIn.setInputStream( inputStream );
> >> > > > >         data = aIn.readObject();
> >> > > > >
> >> > > > > Thanks.
> >> > > > >
> >> > > > >
> >> > > > > - Gary
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > > On Wed, May 14, 2014 at 8:51 AM, Franck Wolff
> >> > > > > <fr...@gmail.com>
> >> > > > wrote:
> >> > > > >
> >> > > > > > Hi everybody,
> >> > > > > >
> >> > > > > > We have just published the benchmark results on the GraniteDS
> >> blog:
> >> > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds
> >> > -3-1-vs-blazeds-4-0
> >> > > > > > .
> >> > > > > >
> >> > > > > > Feedback would be very appreciated.
> >> > > > > >
> >> > > > > > Franck
> >> > > > > > @graniteds
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
> >
> >
>

Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Gary Yang <fl...@gmail.com>.
Hi Frank,

I just did a little test against GraniteDS, it can parse bytes into Java
Object very well even for strong typed vector array.

But I don't see GraniteDS can convert a Java Array into Actionscript
Vector, could you help me please?


I also took a look in org.granite.messaging.amf.io.AMF3Serializer, it
serializes all Java Collection into actionscript
mx.collection.ArrayCollection, does mobile app based on Flex have
ArrayCollection compiled in? Which is the best way to change this default
behaviour please?


Best,

-Gary





On Fri, May 30, 2014 at 12:02 PM, Gary Yang <fl...@gmail.com> wrote:

> Right, I want to try GraniteDS because
>
> 1) Vector support is important!
>
> 2) BlazeDS is too old, 2011 code based on JDK5! No one can guarantee it
> works with JDK8/Servlet3!!
>
>
> But I am very sure BlazeDS can catch up very fast once development back on
> track!
>
> -Gary
>
>
> On Fri, May 30, 2014 at 11:50 AM, Christofer Dutz <
> christofer.dutz@c-ware.de> wrote:
>
>> Or we will be able to finally start tweaking BlazeDS as soon as we have
>> the parity release out the door ;-)
>>
>> Chris
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Gary Yang [mailto:flashflexpro@gmail.com]
>> Gesendet: Freitag, 30. Mai 2014 17:14
>> An: users@flex.apache.org
>> Betreff: Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS
>> 4.0.0)
>>
>> Franck,
>>
>> Very impressive!
>>
>> I guess it is time to switch to GraniteDS.
>>
>> Thanks.
>>
>> -Gary
>>
>>
>>
>> On Fri, May 30, 2014 at 4:41 AM, Franck Wolff <fr...@gmail.com> wrote:
>>
>> > Gary,
>> >
>> > Just have a look at the link I gave you before:
>> >
>> > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
>> > nchmark/amf/BenchmarkGraniteDSAmf.java
>> > .
>> > It doesn't run inside a servlet container, does it?
>> >
>> > F.
>> >
>> >
>> > 2014-05-29 17:22 GMT+02:00 Gary Yang <fl...@gmail.com>:
>> >
>> > > Franck,
>> > >
>> > > Does GraniteDS have to run inside a servlet container? I only want
>> > > to AMF serialization/deserialization function which has nothing to
>> > > do with network, http or servlet.
>> > >
>> > > thanks.
>> > >
>> > > -Gary
>> > >
>> > >
>> > > On Thu, May 29, 2014 at 7:44 AM, Franck Wolff <fr...@gmail.com>
>> > wrote:
>> > >
>> > > > Gary,
>> > > >
>> > > > See the benchmark classes:
>> > > >
>> > > >
>> > > >
>> > >
>> > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
>> > nchmark/amf/BenchmarkBlazeDSAmf.java
>> > > > vs.
>> > > >
>> > > >
>> > >
>> > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
>> > nchmark/amf/BenchmarkGraniteDSAmf.java
>> > > >
>> > > > GraniteDS needs a bit more configuration, but is still very easy
>> > > > to
>> > use.
>> > > >
>> > > > BTW, about DTOs: you can have a look to our Converter/Reverter
>> > > > feature, even if it isn't meant to be used this way in the first
>> > > > place (see documentation
>> > > >
>> > > >
>> > >
>> > http://www.granitedataservices.com/public/docs/latest/docs/reference/f
>> > lex/graniteds-refguide-flex.html#extensibility.customtypes
>> > > > ).
>> > > >
>> > > > Let's say you have a bean MyBean on your server and you want to
>> > serialize
>> > > > MyBeanDTO instead (and vice-versa). You can easily write this kind
>> > > > of
>> > > > converter:
>> > > >
>> > > > public class MyBeanConverter extends Converter implements Reverter
>> > > > {
>> > > >
>> > > >     public MyBeanConverter(Converters converters) {
>> > > >         super(converters);
>> > > >     }
>> > > >
>> > > >     // AMF3Deserialization (Converter)...
>> > > >
>> > > >     @Override
>> > > >     protected boolean internalCanConvert(Object value, Type
>> > targetType) {
>> > > >     return (value instanceof MyBeanDTO);
>> > > >     }
>> > > >
>> > > >     @Override
>> > > >     protected Object internalConvert(Object value, Type targetType)
>> {
>> > > >     MyBean bean = new MyBean();
>> > > >     MyBeanDTO dto = (MyBeanDTO)value;
>> > > >     // copy properties from dto to bean...
>> > > >         return bean;
>> > > >     }
>> > > >
>> > > >     // AMF3Serialization (Reverter)...
>> > > >
>> > > >     public boolean canRevert(Object value) {
>> > > >         return (value instanceof MyBean);
>> > > >     }
>> > > >
>> > > >     public Object revert(Object value) {
>> > > >     MyBeanDTO dto = new MyBeanDTO();
>> > > >     MyBean bean = (MyBean)value;
>> > > >     // copy properties from bean to dto...
>> > > >         return dto;
>> > > >     }
>> > > > }
>> > > >
>> > > > Then, just plug this new converter (along with any others) in your
>> > > > granite-config.xml:
>> > > >
>> > > > <granite-config>
>> > > >   <converters>
>> > > >     <converter type="path.to.MyBeanConverter" />
>> > > >   </converters>
>> > > > </granite-config>
>> > > >
>> > > > According to this configuration, all MyBean instances will be
>> > serialized
>> > > as
>> > > > MyBeanDTOs and all MyBeanDTOs will be deserialized as MyBeans (you
>> > don't
>> > > > need to anything else, your services can return eg. a collection
>> > > > of
>> > > MyBeans
>> > > > it will be serialized as a collection of MyBeanDTOs). Of course,
>> > > > it can
>> > > be
>> > > > a bit restrictive if you want to have different DTOs classes for a
>> > > > same bean class...
>> > > >
>> > > > Franck.
>> > > >
>> > > >
>> > > > 2014-05-29 2:33 GMT+02:00 Gary Yang <fl...@gmail.com>:
>> > > >
>> > > > > Sounds great!
>> > > > >
>> > > > > Do you think it is possible that I can use the
>> > > > > serialization/deserialization features as simple as using
>> > > > > BlazeDS
>> > like
>> > > > > below?
>> > > > >
>> > > > >
>> > > > > in pom.xml :
>> > > > >
>> > > > >         <dependency>
>> > > > >             <groupId>org.springframework.flex</groupId>
>> > > > >             <artifactId>spring-flex-core</artifactId>
>> > > > >         </dependency>
>> > > > >
>> > > > > then in Java file:
>> > > > >
>> > > > >         ... ...
>> > > > >
>> > > > >         Amf3Output aOut= new Amf3Output(new
>> SerializationContext());
>> > > > >         aOut.setOutputStream( outStream );
>> > > > >         aOut.writeObject(data);
>> > > > >
>> > > > >         ... ...
>> > > > >
>> > > > >         Amf3Input aIn = new Amf3Input( new SerializationContext()
>> );
>> > > > >         aIn.setInputStream( inputStream );
>> > > > >         data = aIn.readObject();
>> > > > >
>> > > > > Thanks.
>> > > > >
>> > > > >
>> > > > > - Gary
>> > > > >
>> > > > >
>> > > > >
>> > > > > On Wed, May 14, 2014 at 8:51 AM, Franck Wolff
>> > > > > <fr...@gmail.com>
>> > > > wrote:
>> > > > >
>> > > > > > Hi everybody,
>> > > > > >
>> > > > > > We have just published the benchmark results on the GraniteDS
>> blog:
>> > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> > http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds
>> > -3-1-vs-blazeds-4-0
>> > > > > > .
>> > > > > >
>> > > > > > Feedback would be very appreciated.
>> > > > > >
>> > > > > > Franck
>> > > > > > @graniteds
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>
>
>

Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Gary Yang <fl...@gmail.com>.
Right, I want to try GraniteDS because

1) Vector support is important!

2) BlazeDS is too old, 2011 code based on JDK5! No one can guarantee it
works with JDK8/Servlet3!!


But I am very sure BlazeDS can catch up very fast once development back on
track!

-Gary


On Fri, May 30, 2014 at 11:50 AM, Christofer Dutz <christofer.dutz@c-ware.de
> wrote:

> Or we will be able to finally start tweaking BlazeDS as soon as we have
> the parity release out the door ;-)
>
> Chris
>
> -----Ursprüngliche Nachricht-----
> Von: Gary Yang [mailto:flashflexpro@gmail.com]
> Gesendet: Freitag, 30. Mai 2014 17:14
> An: users@flex.apache.org
> Betreff: Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS
> 4.0.0)
>
> Franck,
>
> Very impressive!
>
> I guess it is time to switch to GraniteDS.
>
> Thanks.
>
> -Gary
>
>
>
> On Fri, May 30, 2014 at 4:41 AM, Franck Wolff <fr...@gmail.com> wrote:
>
> > Gary,
> >
> > Just have a look at the link I gave you before:
> >
> > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> > nchmark/amf/BenchmarkGraniteDSAmf.java
> > .
> > It doesn't run inside a servlet container, does it?
> >
> > F.
> >
> >
> > 2014-05-29 17:22 GMT+02:00 Gary Yang <fl...@gmail.com>:
> >
> > > Franck,
> > >
> > > Does GraniteDS have to run inside a servlet container? I only want
> > > to AMF serialization/deserialization function which has nothing to
> > > do with network, http or servlet.
> > >
> > > thanks.
> > >
> > > -Gary
> > >
> > >
> > > On Thu, May 29, 2014 at 7:44 AM, Franck Wolff <fr...@gmail.com>
> > wrote:
> > >
> > > > Gary,
> > > >
> > > > See the benchmark classes:
> > > >
> > > >
> > > >
> > >
> > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> > nchmark/amf/BenchmarkBlazeDSAmf.java
> > > > vs.
> > > >
> > > >
> > >
> > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> > nchmark/amf/BenchmarkGraniteDSAmf.java
> > > >
> > > > GraniteDS needs a bit more configuration, but is still very easy
> > > > to
> > use.
> > > >
> > > > BTW, about DTOs: you can have a look to our Converter/Reverter
> > > > feature, even if it isn't meant to be used this way in the first
> > > > place (see documentation
> > > >
> > > >
> > >
> > http://www.granitedataservices.com/public/docs/latest/docs/reference/f
> > lex/graniteds-refguide-flex.html#extensibility.customtypes
> > > > ).
> > > >
> > > > Let's say you have a bean MyBean on your server and you want to
> > serialize
> > > > MyBeanDTO instead (and vice-versa). You can easily write this kind
> > > > of
> > > > converter:
> > > >
> > > > public class MyBeanConverter extends Converter implements Reverter
> > > > {
> > > >
> > > >     public MyBeanConverter(Converters converters) {
> > > >         super(converters);
> > > >     }
> > > >
> > > >     // AMF3Deserialization (Converter)...
> > > >
> > > >     @Override
> > > >     protected boolean internalCanConvert(Object value, Type
> > targetType) {
> > > >     return (value instanceof MyBeanDTO);
> > > >     }
> > > >
> > > >     @Override
> > > >     protected Object internalConvert(Object value, Type targetType) {
> > > >     MyBean bean = new MyBean();
> > > >     MyBeanDTO dto = (MyBeanDTO)value;
> > > >     // copy properties from dto to bean...
> > > >         return bean;
> > > >     }
> > > >
> > > >     // AMF3Serialization (Reverter)...
> > > >
> > > >     public boolean canRevert(Object value) {
> > > >         return (value instanceof MyBean);
> > > >     }
> > > >
> > > >     public Object revert(Object value) {
> > > >     MyBeanDTO dto = new MyBeanDTO();
> > > >     MyBean bean = (MyBean)value;
> > > >     // copy properties from bean to dto...
> > > >         return dto;
> > > >     }
> > > > }
> > > >
> > > > Then, just plug this new converter (along with any others) in your
> > > > granite-config.xml:
> > > >
> > > > <granite-config>
> > > >   <converters>
> > > >     <converter type="path.to.MyBeanConverter" />
> > > >   </converters>
> > > > </granite-config>
> > > >
> > > > According to this configuration, all MyBean instances will be
> > serialized
> > > as
> > > > MyBeanDTOs and all MyBeanDTOs will be deserialized as MyBeans (you
> > don't
> > > > need to anything else, your services can return eg. a collection
> > > > of
> > > MyBeans
> > > > it will be serialized as a collection of MyBeanDTOs). Of course,
> > > > it can
> > > be
> > > > a bit restrictive if you want to have different DTOs classes for a
> > > > same bean class...
> > > >
> > > > Franck.
> > > >
> > > >
> > > > 2014-05-29 2:33 GMT+02:00 Gary Yang <fl...@gmail.com>:
> > > >
> > > > > Sounds great!
> > > > >
> > > > > Do you think it is possible that I can use the
> > > > > serialization/deserialization features as simple as using
> > > > > BlazeDS
> > like
> > > > > below?
> > > > >
> > > > >
> > > > > in pom.xml :
> > > > >
> > > > >         <dependency>
> > > > >             <groupId>org.springframework.flex</groupId>
> > > > >             <artifactId>spring-flex-core</artifactId>
> > > > >         </dependency>
> > > > >
> > > > > then in Java file:
> > > > >
> > > > >         ... ...
> > > > >
> > > > >         Amf3Output aOut= new Amf3Output(new
> SerializationContext());
> > > > >         aOut.setOutputStream( outStream );
> > > > >         aOut.writeObject(data);
> > > > >
> > > > >         ... ...
> > > > >
> > > > >         Amf3Input aIn = new Amf3Input( new SerializationContext()
> );
> > > > >         aIn.setInputStream( inputStream );
> > > > >         data = aIn.readObject();
> > > > >
> > > > > Thanks.
> > > > >
> > > > >
> > > > > - Gary
> > > > >
> > > > >
> > > > >
> > > > > On Wed, May 14, 2014 at 8:51 AM, Franck Wolff
> > > > > <fr...@gmail.com>
> > > > wrote:
> > > > >
> > > > > > Hi everybody,
> > > > > >
> > > > > > We have just published the benchmark results on the GraniteDS
> blog:
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> > http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds
> > -3-1-vs-blazeds-4-0
> > > > > > .
> > > > > >
> > > > > > Feedback would be very appreciated.
> > > > > >
> > > > > > Franck
> > > > > > @graniteds
> > > > > >
> > > > >
> > > >
> > >
> >
>

AW: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Christofer Dutz <ch...@c-ware.de>.
Or we will be able to finally start tweaking BlazeDS as soon as we have the parity release out the door ;-)

Chris

-----Ursprüngliche Nachricht-----
Von: Gary Yang [mailto:flashflexpro@gmail.com] 
Gesendet: Freitag, 30. Mai 2014 17:14
An: users@flex.apache.org
Betreff: Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Franck,

Very impressive!

I guess it is time to switch to GraniteDS.

Thanks.

-Gary



On Fri, May 30, 2014 at 4:41 AM, Franck Wolff <fr...@gmail.com> wrote:

> Gary,
>
> Just have a look at the link I gave you before:
>
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> nchmark/amf/BenchmarkGraniteDSAmf.java
> .
> It doesn't run inside a servlet container, does it?
>
> F.
>
>
> 2014-05-29 17:22 GMT+02:00 Gary Yang <fl...@gmail.com>:
>
> > Franck,
> >
> > Does GraniteDS have to run inside a servlet container? I only want 
> > to AMF serialization/deserialization function which has nothing to 
> > do with network, http or servlet.
> >
> > thanks.
> >
> > -Gary
> >
> >
> > On Thu, May 29, 2014 at 7:44 AM, Franck Wolff <fr...@gmail.com>
> wrote:
> >
> > > Gary,
> > >
> > > See the benchmark classes:
> > >
> > >
> > >
> >
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> nchmark/amf/BenchmarkBlazeDSAmf.java
> > > vs.
> > >
> > >
> >
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/be
> nchmark/amf/BenchmarkGraniteDSAmf.java
> > >
> > > GraniteDS needs a bit more configuration, but is still very easy 
> > > to
> use.
> > >
> > > BTW, about DTOs: you can have a look to our Converter/Reverter 
> > > feature, even if it isn't meant to be used this way in the first 
> > > place (see documentation
> > >
> > >
> >
> http://www.granitedataservices.com/public/docs/latest/docs/reference/f
> lex/graniteds-refguide-flex.html#extensibility.customtypes
> > > ).
> > >
> > > Let's say you have a bean MyBean on your server and you want to
> serialize
> > > MyBeanDTO instead (and vice-versa). You can easily write this kind 
> > > of
> > > converter:
> > >
> > > public class MyBeanConverter extends Converter implements Reverter 
> > > {
> > >
> > >     public MyBeanConverter(Converters converters) {
> > >         super(converters);
> > >     }
> > >
> > >     // AMF3Deserialization (Converter)...
> > >
> > >     @Override
> > >     protected boolean internalCanConvert(Object value, Type
> targetType) {
> > >     return (value instanceof MyBeanDTO);
> > >     }
> > >
> > >     @Override
> > >     protected Object internalConvert(Object value, Type targetType) {
> > >     MyBean bean = new MyBean();
> > >     MyBeanDTO dto = (MyBeanDTO)value;
> > >     // copy properties from dto to bean...
> > >         return bean;
> > >     }
> > >
> > >     // AMF3Serialization (Reverter)...
> > >
> > >     public boolean canRevert(Object value) {
> > >         return (value instanceof MyBean);
> > >     }
> > >
> > >     public Object revert(Object value) {
> > >     MyBeanDTO dto = new MyBeanDTO();
> > >     MyBean bean = (MyBean)value;
> > >     // copy properties from bean to dto...
> > >         return dto;
> > >     }
> > > }
> > >
> > > Then, just plug this new converter (along with any others) in your
> > > granite-config.xml:
> > >
> > > <granite-config>
> > >   <converters>
> > >     <converter type="path.to.MyBeanConverter" />
> > >   </converters>
> > > </granite-config>
> > >
> > > According to this configuration, all MyBean instances will be
> serialized
> > as
> > > MyBeanDTOs and all MyBeanDTOs will be deserialized as MyBeans (you
> don't
> > > need to anything else, your services can return eg. a collection 
> > > of
> > MyBeans
> > > it will be serialized as a collection of MyBeanDTOs). Of course, 
> > > it can
> > be
> > > a bit restrictive if you want to have different DTOs classes for a 
> > > same bean class...
> > >
> > > Franck.
> > >
> > >
> > > 2014-05-29 2:33 GMT+02:00 Gary Yang <fl...@gmail.com>:
> > >
> > > > Sounds great!
> > > >
> > > > Do you think it is possible that I can use the 
> > > > serialization/deserialization features as simple as using 
> > > > BlazeDS
> like
> > > > below?
> > > >
> > > >
> > > > in pom.xml :
> > > >
> > > >         <dependency>
> > > >             <groupId>org.springframework.flex</groupId>
> > > >             <artifactId>spring-flex-core</artifactId>
> > > >         </dependency>
> > > >
> > > > then in Java file:
> > > >
> > > >         ... ...
> > > >
> > > >         Amf3Output aOut= new Amf3Output(new SerializationContext());
> > > >         aOut.setOutputStream( outStream );
> > > >         aOut.writeObject(data);
> > > >
> > > >         ... ...
> > > >
> > > >         Amf3Input aIn = new Amf3Input( new SerializationContext() );
> > > >         aIn.setInputStream( inputStream );
> > > >         data = aIn.readObject();
> > > >
> > > > Thanks.
> > > >
> > > >
> > > > - Gary
> > > >
> > > >
> > > >
> > > > On Wed, May 14, 2014 at 8:51 AM, Franck Wolff 
> > > > <fr...@gmail.com>
> > > wrote:
> > > >
> > > > > Hi everybody,
> > > > >
> > > > > We have just published the benchmark results on the GraniteDS blog:
> > > > >
> > > > >
> > > >
> > >
> >
> http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds
> -3-1-vs-blazeds-4-0
> > > > > .
> > > > >
> > > > > Feedback would be very appreciated.
> > > > >
> > > > > Franck
> > > > > @graniteds
> > > > >
> > > >
> > >
> >
>

Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Franck Wolff <fr...@gmail.com>.
You're very welcome ;)


2014-05-30 17:14 GMT+02:00 Gary Yang <fl...@gmail.com>:

> Franck,
>
> Very impressive!
>
> I guess it is time to switch to GraniteDS.
>
> Thanks.
>
> -Gary
>
>
>
> On Fri, May 30, 2014 at 4:41 AM, Franck Wolff <fr...@gmail.com> wrote:
>
> > Gary,
> >
> > Just have a look at the link I gave you before:
> >
> >
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkGraniteDSAmf.java
> > .
> > It doesn't run inside a servlet container, does it?
> >
> > F.
> >
> >
> > 2014-05-29 17:22 GMT+02:00 Gary Yang <fl...@gmail.com>:
> >
> > > Franck,
> > >
> > > Does GraniteDS have to run inside a servlet container? I only want to
> AMF
> > > serialization/deserialization function which has nothing to do with
> > > network, http or servlet.
> > >
> > > thanks.
> > >
> > > -Gary
> > >
> > >
> > > On Thu, May 29, 2014 at 7:44 AM, Franck Wolff <fr...@gmail.com>
> > wrote:
> > >
> > > > Gary,
> > > >
> > > > See the benchmark classes:
> > > >
> > > >
> > > >
> > >
> >
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkBlazeDSAmf.java
> > > > vs.
> > > >
> > > >
> > >
> >
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkGraniteDSAmf.java
> > > >
> > > > GraniteDS needs a bit more configuration, but is still very easy to
> > use.
> > > >
> > > > BTW, about DTOs: you can have a look to our Converter/Reverter
> feature,
> > > > even if it isn't meant to be used this way in the first place (see
> > > > documentation
> > > >
> > > >
> > >
> >
> http://www.granitedataservices.com/public/docs/latest/docs/reference/flex/graniteds-refguide-flex.html#extensibility.customtypes
> > > > ).
> > > >
> > > > Let's say you have a bean MyBean on your server and you want to
> > serialize
> > > > MyBeanDTO instead (and vice-versa). You can easily write this kind of
> > > > converter:
> > > >
> > > > public class MyBeanConverter extends Converter implements Reverter {
> > > >
> > > >     public MyBeanConverter(Converters converters) {
> > > >         super(converters);
> > > >     }
> > > >
> > > >     // AMF3Deserialization (Converter)...
> > > >
> > > >     @Override
> > > >     protected boolean internalCanConvert(Object value, Type
> > targetType) {
> > > >     return (value instanceof MyBeanDTO);
> > > >     }
> > > >
> > > >     @Override
> > > >     protected Object internalConvert(Object value, Type targetType) {
> > > >     MyBean bean = new MyBean();
> > > >     MyBeanDTO dto = (MyBeanDTO)value;
> > > >     // copy properties from dto to bean...
> > > >         return bean;
> > > >     }
> > > >
> > > >     // AMF3Serialization (Reverter)...
> > > >
> > > >     public boolean canRevert(Object value) {
> > > >         return (value instanceof MyBean);
> > > >     }
> > > >
> > > >     public Object revert(Object value) {
> > > >     MyBeanDTO dto = new MyBeanDTO();
> > > >     MyBean bean = (MyBean)value;
> > > >     // copy properties from bean to dto...
> > > >         return dto;
> > > >     }
> > > > }
> > > >
> > > > Then, just plug this new converter (along with any others) in your
> > > > granite-config.xml:
> > > >
> > > > <granite-config>
> > > >   <converters>
> > > >     <converter type="path.to.MyBeanConverter" />
> > > >   </converters>
> > > > </granite-config>
> > > >
> > > > According to this configuration, all MyBean instances will be
> > serialized
> > > as
> > > > MyBeanDTOs and all MyBeanDTOs will be deserialized as MyBeans (you
> > don't
> > > > need to anything else, your services can return eg. a collection of
> > > MyBeans
> > > > it will be serialized as a collection of MyBeanDTOs). Of course, it
> can
> > > be
> > > > a bit restrictive if you want to have different DTOs classes for a
> same
> > > > bean class...
> > > >
> > > > Franck.
> > > >
> > > >
> > > > 2014-05-29 2:33 GMT+02:00 Gary Yang <fl...@gmail.com>:
> > > >
> > > > > Sounds great!
> > > > >
> > > > > Do you think it is possible that I can use the
> > > > > serialization/deserialization features as simple as using BlazeDS
> > like
> > > > > below?
> > > > >
> > > > >
> > > > > in pom.xml :
> > > > >
> > > > >         <dependency>
> > > > >             <groupId>org.springframework.flex</groupId>
> > > > >             <artifactId>spring-flex-core</artifactId>
> > > > >         </dependency>
> > > > >
> > > > > then in Java file:
> > > > >
> > > > >         ... ...
> > > > >
> > > > >         Amf3Output aOut= new Amf3Output(new
> SerializationContext());
> > > > >         aOut.setOutputStream( outStream );
> > > > >         aOut.writeObject(data);
> > > > >
> > > > >         ... ...
> > > > >
> > > > >         Amf3Input aIn = new Amf3Input( new SerializationContext()
> );
> > > > >         aIn.setInputStream( inputStream );
> > > > >         data = aIn.readObject();
> > > > >
> > > > > Thanks.
> > > > >
> > > > >
> > > > > - Gary
> > > > >
> > > > >
> > > > >
> > > > > On Wed, May 14, 2014 at 8:51 AM, Franck Wolff <fr...@gmail.com>
> > > > wrote:
> > > > >
> > > > > > Hi everybody,
> > > > > >
> > > > > > We have just published the benchmark results on the GraniteDS
> blog:
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds-3-1-vs-blazeds-4-0
> > > > > > .
> > > > > >
> > > > > > Feedback would be very appreciated.
> > > > > >
> > > > > > Franck
> > > > > > @graniteds
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Gary Yang <fl...@gmail.com>.
Franck,

Very impressive!

I guess it is time to switch to GraniteDS.

Thanks.

-Gary



On Fri, May 30, 2014 at 4:41 AM, Franck Wolff <fr...@gmail.com> wrote:

> Gary,
>
> Just have a look at the link I gave you before:
>
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkGraniteDSAmf.java
> .
> It doesn't run inside a servlet container, does it?
>
> F.
>
>
> 2014-05-29 17:22 GMT+02:00 Gary Yang <fl...@gmail.com>:
>
> > Franck,
> >
> > Does GraniteDS have to run inside a servlet container? I only want to AMF
> > serialization/deserialization function which has nothing to do with
> > network, http or servlet.
> >
> > thanks.
> >
> > -Gary
> >
> >
> > On Thu, May 29, 2014 at 7:44 AM, Franck Wolff <fr...@gmail.com>
> wrote:
> >
> > > Gary,
> > >
> > > See the benchmark classes:
> > >
> > >
> > >
> >
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkBlazeDSAmf.java
> > > vs.
> > >
> > >
> >
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkGraniteDSAmf.java
> > >
> > > GraniteDS needs a bit more configuration, but is still very easy to
> use.
> > >
> > > BTW, about DTOs: you can have a look to our Converter/Reverter feature,
> > > even if it isn't meant to be used this way in the first place (see
> > > documentation
> > >
> > >
> >
> http://www.granitedataservices.com/public/docs/latest/docs/reference/flex/graniteds-refguide-flex.html#extensibility.customtypes
> > > ).
> > >
> > > Let's say you have a bean MyBean on your server and you want to
> serialize
> > > MyBeanDTO instead (and vice-versa). You can easily write this kind of
> > > converter:
> > >
> > > public class MyBeanConverter extends Converter implements Reverter {
> > >
> > >     public MyBeanConverter(Converters converters) {
> > >         super(converters);
> > >     }
> > >
> > >     // AMF3Deserialization (Converter)...
> > >
> > >     @Override
> > >     protected boolean internalCanConvert(Object value, Type
> targetType) {
> > >     return (value instanceof MyBeanDTO);
> > >     }
> > >
> > >     @Override
> > >     protected Object internalConvert(Object value, Type targetType) {
> > >     MyBean bean = new MyBean();
> > >     MyBeanDTO dto = (MyBeanDTO)value;
> > >     // copy properties from dto to bean...
> > >         return bean;
> > >     }
> > >
> > >     // AMF3Serialization (Reverter)...
> > >
> > >     public boolean canRevert(Object value) {
> > >         return (value instanceof MyBean);
> > >     }
> > >
> > >     public Object revert(Object value) {
> > >     MyBeanDTO dto = new MyBeanDTO();
> > >     MyBean bean = (MyBean)value;
> > >     // copy properties from bean to dto...
> > >         return dto;
> > >     }
> > > }
> > >
> > > Then, just plug this new converter (along with any others) in your
> > > granite-config.xml:
> > >
> > > <granite-config>
> > >   <converters>
> > >     <converter type="path.to.MyBeanConverter" />
> > >   </converters>
> > > </granite-config>
> > >
> > > According to this configuration, all MyBean instances will be
> serialized
> > as
> > > MyBeanDTOs and all MyBeanDTOs will be deserialized as MyBeans (you
> don't
> > > need to anything else, your services can return eg. a collection of
> > MyBeans
> > > it will be serialized as a collection of MyBeanDTOs). Of course, it can
> > be
> > > a bit restrictive if you want to have different DTOs classes for a same
> > > bean class...
> > >
> > > Franck.
> > >
> > >
> > > 2014-05-29 2:33 GMT+02:00 Gary Yang <fl...@gmail.com>:
> > >
> > > > Sounds great!
> > > >
> > > > Do you think it is possible that I can use the
> > > > serialization/deserialization features as simple as using BlazeDS
> like
> > > > below?
> > > >
> > > >
> > > > in pom.xml :
> > > >
> > > >         <dependency>
> > > >             <groupId>org.springframework.flex</groupId>
> > > >             <artifactId>spring-flex-core</artifactId>
> > > >         </dependency>
> > > >
> > > > then in Java file:
> > > >
> > > >         ... ...
> > > >
> > > >         Amf3Output aOut= new Amf3Output(new SerializationContext());
> > > >         aOut.setOutputStream( outStream );
> > > >         aOut.writeObject(data);
> > > >
> > > >         ... ...
> > > >
> > > >         Amf3Input aIn = new Amf3Input( new SerializationContext() );
> > > >         aIn.setInputStream( inputStream );
> > > >         data = aIn.readObject();
> > > >
> > > > Thanks.
> > > >
> > > >
> > > > - Gary
> > > >
> > > >
> > > >
> > > > On Wed, May 14, 2014 at 8:51 AM, Franck Wolff <fr...@gmail.com>
> > > wrote:
> > > >
> > > > > Hi everybody,
> > > > >
> > > > > We have just published the benchmark results on the GraniteDS blog:
> > > > >
> > > > >
> > > >
> > >
> >
> http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds-3-1-vs-blazeds-4-0
> > > > > .
> > > > >
> > > > > Feedback would be very appreciated.
> > > > >
> > > > > Franck
> > > > > @graniteds
> > > > >
> > > >
> > >
> >
>

Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Franck Wolff <fr...@gmail.com>.
Gary,

Just have a look at the link I gave you before:
https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkGraniteDSAmf.java.
It doesn't run inside a servlet container, does it?

F.


2014-05-29 17:22 GMT+02:00 Gary Yang <fl...@gmail.com>:

> Franck,
>
> Does GraniteDS have to run inside a servlet container? I only want to AMF
> serialization/deserialization function which has nothing to do with
> network, http or servlet.
>
> thanks.
>
> -Gary
>
>
> On Thu, May 29, 2014 at 7:44 AM, Franck Wolff <fr...@gmail.com> wrote:
>
> > Gary,
> >
> > See the benchmark classes:
> >
> >
> >
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkBlazeDSAmf.java
> > vs.
> >
> >
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkGraniteDSAmf.java
> >
> > GraniteDS needs a bit more configuration, but is still very easy to use.
> >
> > BTW, about DTOs: you can have a look to our Converter/Reverter feature,
> > even if it isn't meant to be used this way in the first place (see
> > documentation
> >
> >
> http://www.granitedataservices.com/public/docs/latest/docs/reference/flex/graniteds-refguide-flex.html#extensibility.customtypes
> > ).
> >
> > Let's say you have a bean MyBean on your server and you want to serialize
> > MyBeanDTO instead (and vice-versa). You can easily write this kind of
> > converter:
> >
> > public class MyBeanConverter extends Converter implements Reverter {
> >
> >     public MyBeanConverter(Converters converters) {
> >         super(converters);
> >     }
> >
> >     // AMF3Deserialization (Converter)...
> >
> >     @Override
> >     protected boolean internalCanConvert(Object value, Type targetType) {
> >     return (value instanceof MyBeanDTO);
> >     }
> >
> >     @Override
> >     protected Object internalConvert(Object value, Type targetType) {
> >     MyBean bean = new MyBean();
> >     MyBeanDTO dto = (MyBeanDTO)value;
> >     // copy properties from dto to bean...
> >         return bean;
> >     }
> >
> >     // AMF3Serialization (Reverter)...
> >
> >     public boolean canRevert(Object value) {
> >         return (value instanceof MyBean);
> >     }
> >
> >     public Object revert(Object value) {
> >     MyBeanDTO dto = new MyBeanDTO();
> >     MyBean bean = (MyBean)value;
> >     // copy properties from bean to dto...
> >         return dto;
> >     }
> > }
> >
> > Then, just plug this new converter (along with any others) in your
> > granite-config.xml:
> >
> > <granite-config>
> >   <converters>
> >     <converter type="path.to.MyBeanConverter" />
> >   </converters>
> > </granite-config>
> >
> > According to this configuration, all MyBean instances will be serialized
> as
> > MyBeanDTOs and all MyBeanDTOs will be deserialized as MyBeans (you don't
> > need to anything else, your services can return eg. a collection of
> MyBeans
> > it will be serialized as a collection of MyBeanDTOs). Of course, it can
> be
> > a bit restrictive if you want to have different DTOs classes for a same
> > bean class...
> >
> > Franck.
> >
> >
> > 2014-05-29 2:33 GMT+02:00 Gary Yang <fl...@gmail.com>:
> >
> > > Sounds great!
> > >
> > > Do you think it is possible that I can use the
> > > serialization/deserialization features as simple as using BlazeDS like
> > > below?
> > >
> > >
> > > in pom.xml :
> > >
> > >         <dependency>
> > >             <groupId>org.springframework.flex</groupId>
> > >             <artifactId>spring-flex-core</artifactId>
> > >         </dependency>
> > >
> > > then in Java file:
> > >
> > >         ... ...
> > >
> > >         Amf3Output aOut= new Amf3Output(new SerializationContext());
> > >         aOut.setOutputStream( outStream );
> > >         aOut.writeObject(data);
> > >
> > >         ... ...
> > >
> > >         Amf3Input aIn = new Amf3Input( new SerializationContext() );
> > >         aIn.setInputStream( inputStream );
> > >         data = aIn.readObject();
> > >
> > > Thanks.
> > >
> > >
> > > - Gary
> > >
> > >
> > >
> > > On Wed, May 14, 2014 at 8:51 AM, Franck Wolff <fr...@gmail.com>
> > wrote:
> > >
> > > > Hi everybody,
> > > >
> > > > We have just published the benchmark results on the GraniteDS blog:
> > > >
> > > >
> > >
> >
> http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds-3-1-vs-blazeds-4-0
> > > > .
> > > >
> > > > Feedback would be very appreciated.
> > > >
> > > > Franck
> > > > @graniteds
> > > >
> > >
> >
>

Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Gary Yang <fl...@gmail.com>.
Franck,

Does GraniteDS have to run inside a servlet container? I only want to AMF
serialization/deserialization function which has nothing to do with
network, http or servlet.

thanks.

-Gary


On Thu, May 29, 2014 at 7:44 AM, Franck Wolff <fr...@gmail.com> wrote:

> Gary,
>
> See the benchmark classes:
>
>
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkBlazeDSAmf.java
> vs.
>
> https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkGraniteDSAmf.java
>
> GraniteDS needs a bit more configuration, but is still very easy to use.
>
> BTW, about DTOs: you can have a look to our Converter/Reverter feature,
> even if it isn't meant to be used this way in the first place (see
> documentation
>
> http://www.granitedataservices.com/public/docs/latest/docs/reference/flex/graniteds-refguide-flex.html#extensibility.customtypes
> ).
>
> Let's say you have a bean MyBean on your server and you want to serialize
> MyBeanDTO instead (and vice-versa). You can easily write this kind of
> converter:
>
> public class MyBeanConverter extends Converter implements Reverter {
>
>     public MyBeanConverter(Converters converters) {
>         super(converters);
>     }
>
>     // AMF3Deserialization (Converter)...
>
>     @Override
>     protected boolean internalCanConvert(Object value, Type targetType) {
>     return (value instanceof MyBeanDTO);
>     }
>
>     @Override
>     protected Object internalConvert(Object value, Type targetType) {
>     MyBean bean = new MyBean();
>     MyBeanDTO dto = (MyBeanDTO)value;
>     // copy properties from dto to bean...
>         return bean;
>     }
>
>     // AMF3Serialization (Reverter)...
>
>     public boolean canRevert(Object value) {
>         return (value instanceof MyBean);
>     }
>
>     public Object revert(Object value) {
>     MyBeanDTO dto = new MyBeanDTO();
>     MyBean bean = (MyBean)value;
>     // copy properties from bean to dto...
>         return dto;
>     }
> }
>
> Then, just plug this new converter (along with any others) in your
> granite-config.xml:
>
> <granite-config>
>   <converters>
>     <converter type="path.to.MyBeanConverter" />
>   </converters>
> </granite-config>
>
> According to this configuration, all MyBean instances will be serialized as
> MyBeanDTOs and all MyBeanDTOs will be deserialized as MyBeans (you don't
> need to anything else, your services can return eg. a collection of MyBeans
> it will be serialized as a collection of MyBeanDTOs). Of course, it can be
> a bit restrictive if you want to have different DTOs classes for a same
> bean class...
>
> Franck.
>
>
> 2014-05-29 2:33 GMT+02:00 Gary Yang <fl...@gmail.com>:
>
> > Sounds great!
> >
> > Do you think it is possible that I can use the
> > serialization/deserialization features as simple as using BlazeDS like
> > below?
> >
> >
> > in pom.xml :
> >
> >         <dependency>
> >             <groupId>org.springframework.flex</groupId>
> >             <artifactId>spring-flex-core</artifactId>
> >         </dependency>
> >
> > then in Java file:
> >
> >         ... ...
> >
> >         Amf3Output aOut= new Amf3Output(new SerializationContext());
> >         aOut.setOutputStream( outStream );
> >         aOut.writeObject(data);
> >
> >         ... ...
> >
> >         Amf3Input aIn = new Amf3Input( new SerializationContext() );
> >         aIn.setInputStream( inputStream );
> >         data = aIn.readObject();
> >
> > Thanks.
> >
> >
> > - Gary
> >
> >
> >
> > On Wed, May 14, 2014 at 8:51 AM, Franck Wolff <fr...@gmail.com>
> wrote:
> >
> > > Hi everybody,
> > >
> > > We have just published the benchmark results on the GraniteDS blog:
> > >
> > >
> >
> http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds-3-1-vs-blazeds-4-0
> > > .
> > >
> > > Feedback would be very appreciated.
> > >
> > > Franck
> > > @graniteds
> > >
> >
>

Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Franck Wolff <fr...@gmail.com>.
Gary,

See the benchmark classes:

https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkBlazeDSAmf.java
vs.
https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkGraniteDSAmf.java

GraniteDS needs a bit more configuration, but is still very easy to use.

BTW, about DTOs: you can have a look to our Converter/Reverter feature,
even if it isn't meant to be used this way in the first place (see
documentation
http://www.granitedataservices.com/public/docs/latest/docs/reference/flex/graniteds-refguide-flex.html#extensibility.customtypes
).

Let's say you have a bean MyBean on your server and you want to serialize
MyBeanDTO instead (and vice-versa). You can easily write this kind of
converter:

public class MyBeanConverter extends Converter implements Reverter {

    public MyBeanConverter(Converters converters) {
        super(converters);
    }

    // AMF3Deserialization (Converter)...

    @Override
    protected boolean internalCanConvert(Object value, Type targetType) {
    return (value instanceof MyBeanDTO);
    }

    @Override
    protected Object internalConvert(Object value, Type targetType) {
    MyBean bean = new MyBean();
    MyBeanDTO dto = (MyBeanDTO)value;
    // copy properties from dto to bean...
        return bean;
    }

    // AMF3Serialization (Reverter)...

    public boolean canRevert(Object value) {
        return (value instanceof MyBean);
    }

    public Object revert(Object value) {
    MyBeanDTO dto = new MyBeanDTO();
    MyBean bean = (MyBean)value;
    // copy properties from bean to dto...
        return dto;
    }
}

Then, just plug this new converter (along with any others) in your
granite-config.xml:

<granite-config>
  <converters>
    <converter type="path.to.MyBeanConverter" />
  </converters>
</granite-config>

According to this configuration, all MyBean instances will be serialized as
MyBeanDTOs and all MyBeanDTOs will be deserialized as MyBeans (you don't
need to anything else, your services can return eg. a collection of MyBeans
it will be serialized as a collection of MyBeanDTOs). Of course, it can be
a bit restrictive if you want to have different DTOs classes for a same
bean class...

Franck.


2014-05-29 2:33 GMT+02:00 Gary Yang <fl...@gmail.com>:

> Sounds great!
>
> Do you think it is possible that I can use the
> serialization/deserialization features as simple as using BlazeDS like
> below?
>
>
> in pom.xml :
>
>         <dependency>
>             <groupId>org.springframework.flex</groupId>
>             <artifactId>spring-flex-core</artifactId>
>         </dependency>
>
> then in Java file:
>
>         ... ...
>
>         Amf3Output aOut= new Amf3Output(new SerializationContext());
>         aOut.setOutputStream( outStream );
>         aOut.writeObject(data);
>
>         ... ...
>
>         Amf3Input aIn = new Amf3Input( new SerializationContext() );
>         aIn.setInputStream( inputStream );
>         data = aIn.readObject();
>
> Thanks.
>
>
> - Gary
>
>
>
> On Wed, May 14, 2014 at 8:51 AM, Franck Wolff <fr...@gmail.com> wrote:
>
> > Hi everybody,
> >
> > We have just published the benchmark results on the GraniteDS blog:
> >
> >
> http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds-3-1-vs-blazeds-4-0
> > .
> >
> > Feedback would be very appreciated.
> >
> > Franck
> > @graniteds
> >
>

Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0)

Posted by Gary Yang <fl...@gmail.com>.
Sounds great!

Do you think it is possible that I can use the
serialization/deserialization features as simple as using BlazeDS like
below?


in pom.xml :

        <dependency>
            <groupId>org.springframework.flex</groupId>
            <artifactId>spring-flex-core</artifactId>
        </dependency>

then in Java file:

        ... ...

        Amf3Output aOut= new Amf3Output(new SerializationContext());
        aOut.setOutputStream( outStream );
        aOut.writeObject(data);

        ... ...

        Amf3Input aIn = new Amf3Input( new SerializationContext() );
        aIn.setInputStream( inputStream );
        data = aIn.readObject();

Thanks.


- Gary



On Wed, May 14, 2014 at 8:51 AM, Franck Wolff <fr...@gmail.com> wrote:

> Hi everybody,
>
> We have just published the benchmark results on the GraniteDS blog:
>
> http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds-3-1-vs-blazeds-4-0
> .
>
> Feedback would be very appreciated.
>
> Franck
> @graniteds
>