You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Jesse Ward-Karet <jw...@tanium.com> on 2013/08/29 21:30:28 UTC

Automatically register class aliases

I'm trying to figure out how to automatically register class aliases for all our value objects. Let me explain:

We use Flash Builder's WSDL Data Service utility to generate ActionScript value objects and the supporting service classes.

We've found that the web service code that deserializes XML back into value objects is incredibly slow and locks up our UI at various times. To get around this, we are playing with putting the web service into an action script worker that shares the value object class definitions with our main project.

To make this work, we need to call registerClassAlias('valueObject.modelClass', modelClass) for every class that we want to pass back and forth between the worker and host.

This seems to work well enough, put from a code maintenance point of view, it's a pain because we have many classes that need to cross this boundary. I don't want to have to remember to go back and add class registration on either side of the serialization/deserialization boundary every time we regenerate classes based on the WSDL (which changes frequently). I'm also hesitant to manually add a class registration to the value object classes because I'm sure there will be times we will forget to do it for new value objects.

Any suggestions how we can automate this process?

And please, we are not able to make major architectural changes, so answers that tell me about BlazeDS or switching to JSON, etc are not useful.

Thanks!
Jesse




Re: Automatically register class aliases

Posted by Cosma Colanicchia <co...@gmail.com>.
[RemoteClass] does register class alias automatically, but then you have to
make sure you have a reference to every class (you had it implicitly
calling registerClassAlias), otherwise it won't be picked up by the
compiler and won't be there at runtime (that is worse than the risk of
forgetting them in your registering classes, IMO).

You can use a compiler directive -include-libraries to force inclusion of
all these classes (and thus alias registration), if you move all of these
"stub/vo" classes in a dedicated library (that is probably not a bad idea
itself).




2013/8/29 Alex Harui <ah...@adobe.com>

> It's been a long time since I was in this code and I didn't get to know it
> that well, but I thought that the generated valueobject classes had
> [RemoteClass] metadata on the class or its internal base class.
>
> If not, maybe there's a pattern you can use to stick [RemoteClass]
> metadata in the valueobject classes.
>
> BTW, I was last in this code to create a lazy decoder so that objects get
> decoded only when actually used.  No sense decoding every row if you only
> are going to show the first 12.  Of course, that assumes you don't need to
> compute the sum on every row.
>
> -Alex
>
>
> On 8/29/13 12:30 PM, "Jesse Ward-Karet" <jw...@tanium.com> wrote:
>
> >I'm trying to figure out how to automatically register class aliases for
> >all our value objects. Let me explain:
> >
> >We use Flash Builder's WSDL Data Service utility to generate ActionScript
> >value objects and the supporting service classes.
> >
> >We've found that the web service code that deserializes XML back into
> >value objects is incredibly slow and locks up our UI at various times. To
> >get around this, we are playing with putting the web service into an
> >action script worker that shares the value object class definitions with
> >our main project.
> >
> >To make this work, we need to call
> >registerClassAlias('valueObject.modelClass', modelClass) for every class
> >that we want to pass back and forth between the worker and host.
> >
> >This seems to work well enough, put from a code maintenance point of
> >view, it's a pain because we have many classes that need to cross this
> >boundary. I don't want to have to remember to go back and add class
> >registration on either side of the serialization/deserialization boundary
> >every time we regenerate classes based on the WSDL (which changes
> >frequently). I'm also hesitant to manually add a class registration to
> >the value object classes because I'm sure there will be times we will
> >forget to do it for new value objects.
> >
> >Any suggestions how we can automate this process?
> >
> >And please, we are not able to make major architectural changes, so
> >answers that tell me about BlazeDS or switching to JSON, etc are not
> >useful.
> >
> >Thanks!
> >Jesse
> >
> >
> >
>
>

Re: Automatically register class aliases

Posted by Alex Harui <ah...@adobe.com>.
It's been a long time since I was in this code and I didn't get to know it
that well, but I thought that the generated valueobject classes had
[RemoteClass] metadata on the class or its internal base class.

If not, maybe there's a pattern you can use to stick [RemoteClass]
metadata in the valueobject classes.

BTW, I was last in this code to create a lazy decoder so that objects get
decoded only when actually used.  No sense decoding every row if you only
are going to show the first 12.  Of course, that assumes you don't need to
compute the sum on every row.

-Alex


On 8/29/13 12:30 PM, "Jesse Ward-Karet" <jw...@tanium.com> wrote:

>I'm trying to figure out how to automatically register class aliases for
>all our value objects. Let me explain:
>
>We use Flash Builder's WSDL Data Service utility to generate ActionScript
>value objects and the supporting service classes.
>
>We've found that the web service code that deserializes XML back into
>value objects is incredibly slow and locks up our UI at various times. To
>get around this, we are playing with putting the web service into an
>action script worker that shares the value object class definitions with
>our main project.
>
>To make this work, we need to call
>registerClassAlias('valueObject.modelClass', modelClass) for every class
>that we want to pass back and forth between the worker and host.
>
>This seems to work well enough, put from a code maintenance point of
>view, it's a pain because we have many classes that need to cross this
>boundary. I don't want to have to remember to go back and add class
>registration on either side of the serialization/deserialization boundary
>every time we regenerate classes based on the WSDL (which changes
>frequently). I'm also hesitant to manually add a class registration to
>the value object classes because I'm sure there will be times we will
>forget to do it for new value objects.
>
>Any suggestions how we can automate this process?
>
>And please, we are not able to make major architectural changes, so
>answers that tell me about BlazeDS or switching to JSON, etc are not
>useful.
>
>Thanks!
>Jesse
>
>
>