You're very welcome ;)
2014-05-30 17:14 GMT+02:00 Gary Yang <[email protected]>: > 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 <[email protected]> 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 <[email protected]>: > > > > > 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 <[email protected]> > > 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 <[email protected]>: > > > > > > > > > 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 <[email protected]> > > > > 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 > > > > > > > > > > > > > > > > > > > > >
