Re: [3/8] git commit: [flex-asjs] [refs/heads/feature/amf] - ClassAliasBead for registering class aliases for AMF

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [3/8] git commit: [flex-asjs] [refs/heads/feature/amf] - ClassAliasBead for registering class aliases for AMF

Greg Dove
Hi Alex, I see you are working on amf.

Not sure if you noticed already or not, but just in case.... I did add
class alias support methods in the reflection package for both targets. I
tested this to work the same for swf and js. (for multiple aliases etc).
registerClassAlias
getAliasByClass
getClassByAlias

see flexUnitTests.reflection.ReflectionTesterTestAlias inside
manualtests/UnitTests




On Wed, Aug 23, 2017 at 3:20 PM, <[hidden email]> wrote:

> ClassAliasBead for registering class aliases for AMF
>
>
> Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
> Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/4c2b0cfb
> Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/4c2b0cfb
> Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/4c2b0cfb
>
> Branch: refs/heads/feature/amf
> Commit: 4c2b0cfb03256391af170324687c9293cc07d13a
> Parents: 909caf1
> Author: Alex Harui <[hidden email]>
> Authored: Tue Aug 22 18:09:16 2017 -0700
> Committer: Alex Harui <[hidden email]>
> Committed: Tue Aug 22 18:17:09 2017 -0700
>
> ----------------------------------------------------------------------
>  .../flex/org/apache/flex/core/ClassAliasBead.as | 91 ++++++++++++++++++++
>  .../Core/src/main/resources/basic-manifest.xml  |  1 +
>  2 files changed, 92 insertions(+)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 4c2b0cfb/frameworks/projects/Core/src/main/flex/org/apache/
> flex/core/ClassAliasBead.as
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ClassAliasBead.as
> b/frameworks/projects/Core/src/main/flex/org/apache/flex/
> core/ClassAliasBead.as
> new file mode 100644
> index 0000000..85ee702
> --- /dev/null
> +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/
> core/ClassAliasBead.as
> @@ -0,0 +1,91 @@
> +///////////////////////////////////////////////////////////
> /////////////////////
> +//
> +//  Licensed to the Apache Software Foundation (ASF) under one or more
> +//  contributor license agreements.  See the NOTICE file distributed with
> +//  this work for additional information regarding copyright ownership.
> +//  The ASF licenses this file to You under the Apache License, Version
> 2.0
> +//  (the "License"); you may not use this file except in compliance with
> +//  the License.  You may obtain a copy of the License at
> +//
> +//      http://www.apache.org/licenses/LICENSE-2.0
> +//
> +//  Unless required by applicable law or agreed to in writing, software
> +//  distributed under the License is distributed on an "AS IS" BASIS,
> +//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> +//  See the License for the specific language governing permissions and
> +//  limitations under the License.
> +//
> +///////////////////////////////////////////////////////////
> /////////////////////
> +package org.apache.flex.core
> +{
> +    COMPILE::SWF
> +    {
> +        import flash.net.registerClassAlias;
> +        import flash.utils.getDefinitionByName;
> +
> +        import org.apache.flex.events.Event;
> +        import org.apache.flex.events.IEventDispatcher;
> +        import org.apache.flex.events.ValueEvent;
> +    }
> +
> +    /**
> +     *  The ClassAliasBead class is the registers class
> +     *  aliases for serialization/deserialization.
> +     *  Place this bead in the strand of the Application.
> +     *  The compiler leaves information about class aliases
> +     *  on the Application's info object.
> +     *
> +     *  @langversion 3.0
> +     *  @playerversion Flash 10.2
> +     *  @playerversion AIR 2.6
> +     *  @productversion FlexJS 0.0
> +     */
> +       public class ClassAliasBead implements IBead
> +       {
> +        /**
> +         *  Constructor.
> +         *
> +         *  @langversion 3.0
> +         *  @playerversion Flash 10.2
> +         *  @playerversion AIR 2.6
> +         *  @productversion FlexJS 0.0
> +         */
> +               public function ClassAliasBead()
> +               {
> +               }
> +
> +        private var _strand:IStrand;
> +
> +        /**
> +         *  @copy org.apache.flex.core.IBead#strand
> +         *
> +         *  @flexjsignorecoercion org.apache.flex.core.IFlexInfo
> +         *  @flexjsignorecoercion Class
> +         *  @langversion 3.0
> +         *  @playerversion Flash 10.2
> +         *  @playerversion AIR 2.6
> +         *  @productversion FlexJS 0.0
> +         */
> +        public function set strand(value:IStrand):void
> +        {
> +            _strand = value;
> +            COMPILE::SWF
> +            {
> +                var app:IFlexInfo = value as IFlexInfo;
> +                var info:Object = app.info();
> +                var map:Object = info.remoteClassAliases;
> +                if (map)
> +                {
> +                    for (var cn:String in map)
> +                    {
> +                        var alias:String = map[cn];
> +                        var c:Class = getDefinitionByName(cn) as Class;
> +                        registerClassAlias(alias, c);
> +                    }
> +                }
> +            }
> +        }
> +
> +
> +    }
> +}
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 4c2b0cfb/frameworks/projects/Core/src/main/resources/basic-manifest.xml
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/Core/src/main/resources/basic-manifest.xml
> b/frameworks/projects/Core/src/main/resources/basic-manifest.xml
> index 007c691..ec18097 100644
> --- a/frameworks/projects/Core/src/main/resources/basic-manifest.xml
> +++ b/frameworks/projects/Core/src/main/resources/basic-manifest.xml
> @@ -31,6 +31,7 @@
>      <component id="SimpleStatesImpl" class="org.apache.flex.core.
> SimpleStatesImpl"/>
>      <component id="MXMLDragInitiator" class="org.apache.flex.core.MXMLDragInitiator"
> />
>      <component id="CallLaterBead" class="org.apache.flex.core.CallLaterBead"
> />
> +    <component id="ClassAliasBead" class="org.apache.flex.core.ClassAliasBead"
> />
>
>      <component id="BindableCSSStyles" class="org.apache.flex.core.
> BindableCSSStyles"/>
>      <component id="BindableCSSStylesWithFlex" class="org.apache.flex.core.
> BindableCSSStylesWithFlex"/>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [3/8] git commit: [flex-asjs] [refs/heads/feature/amf] - ClassAliasBead for registering class aliases for AMF

Alex Harui-2
Hi Greg,

Yeah, thanks for doing that.  I'm just trying to get things to run in
order to understand the pieces.  I assume we'll end up using your
cross-platform versions at some point.

-Alex

On 8/22/17, 9:09 PM, "Greg Dove" <[hidden email]> wrote:

>Hi Alex, I see you are working on amf.
>
>Not sure if you noticed already or not, but just in case.... I did add
>class alias support methods in the reflection package for both targets. I
>tested this to work the same for swf and js. (for multiple aliases etc).
>registerClassAlias
>getAliasByClass
>getClassByAlias
>
>see flexUnitTests.reflection.ReflectionTesterTestAlias inside
>manualtests/UnitTests
>
>
>
>
>On Wed, Aug 23, 2017 at 3:20 PM, <[hidden email]> wrote:
>
>> ClassAliasBead for registering class aliases for AMF
>>
>>
>> Project:
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Frepo&data=02%7C01%7C%7C22c8aa26d
>>c374c22082a08d4e9dcd5ee%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6363
>>90582072240028&sdata=v2froYAFLAye5qDkE2X5KMBdhjsfo50D3K6s85U7mfE%3D&reser
>>ved=0
>> Commit:
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fcommit%2F4c2b0cfb&data=02%7C01%7
>>C%7C22c8aa26dc374c22082a08d4e9dcd5ee%7Cfa7b1b5a7b34438794aed2c178decee1%7
>>C0%7C0%7C636390582072240028&sdata=uCA76SBh1q4N%2BGigJC3xbs2GsFd4L9KK%2Faf
>>kaX7YECQ%3D&reserved=0
>> Tree:
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Ftree%2F4c2b0cfb&data=02%7C01%7C%
>>7C22c8aa26dc374c22082a08d4e9dcd5ee%7Cfa7b1b5a7b34438794aed2c178decee1%7C0
>>%7C0%7C636390582072240028&sdata=qlS7bPXuC4ZIVApWpiMJiig6AyCMTw2XDmjMiozSa
>>D8%3D&reserved=0
>> Diff:
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fdiff%2F4c2b0cfb&data=02%7C01%7C%
>>7C22c8aa26dc374c22082a08d4e9dcd5ee%7Cfa7b1b5a7b34438794aed2c178decee1%7C0
>>%7C0%7C636390582072240028&sdata=uiGQunRnXmygUtU3dLUptCp0lf%2B2kG7TyTeaH9Y
>>AUdU%3D&reserved=0
>>
>> Branch: refs/heads/feature/amf
>> Commit: 4c2b0cfb03256391af170324687c9293cc07d13a
>> Parents: 909caf1
>> Author: Alex Harui <[hidden email]>
>> Authored: Tue Aug 22 18:09:16 2017 -0700
>> Committer: Alex Harui <[hidden email]>
>> Committed: Tue Aug 22 18:17:09 2017 -0700
>>
>> ----------------------------------------------------------------------
>>  .../flex/org/apache/flex/core/ClassAliasBead.as | 91
>>++++++++++++++++++++
>>  .../Core/src/main/resources/basic-manifest.xml  |  1 +
>>  2 files changed, 92 insertions(+)
>> ----------------------------------------------------------------------
>>
>>
>>
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F&data=02%7C01%7C%7C22c8aa
>>26dc374c22082a08d4e9dcd5ee%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6
>>36390582072240028&sdata=7KU9K16wlLa6XQPA2ElDvtamKuvxQNtNapbJULZANyg%3D&re
>>served=0
>> 4c2b0cfb/frameworks/projects/Core/src/main/flex/org/apache/
>> flex/core/ClassAliasBead.as
>> ----------------------------------------------------------------------
>> diff --git
>>a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ClassAliasB
>>ead.as
>> b/frameworks/projects/Core/src/main/flex/org/apache/flex/
>> core/ClassAliasBead.as
>> new file mode 100644
>> index 0000000..85ee702
>> --- /dev/null
>> +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/
>> core/ClassAliasBead.as
>> @@ -0,0 +1,91 @@
>> +///////////////////////////////////////////////////////////
>> /////////////////////
>> +//
>> +//  Licensed to the Apache Software Foundation (ASF) under one or more
>> +//  contributor license agreements.  See the NOTICE file distributed
>>with
>> +//  this work for additional information regarding copyright ownership.
>> +//  The ASF licenses this file to You under the Apache License, Version
>> 2.0
>> +//  (the "License"); you may not use this file except in compliance
>>with
>> +//  the License.  You may obtain a copy of the License at
>> +//
>> +//      
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apach
>>e.org%2Flicenses%2FLICENSE-2.0&data=02%7C01%7C%7C22c8aa26dc374c22082a08d4
>>e9dcd5ee%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636390582072240028&
>>sdata=SVt1XDALKef4c1svNwUfum1HliAyx08zVmAzc%2FhAUWA%3D&reserved=0
>> +//
>> +//  Unless required by applicable law or agreed to in writing, software
>> +//  distributed under the License is distributed on an "AS IS" BASIS,
>> +//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>> implied.
>> +//  See the License for the specific language governing permissions and
>> +//  limitations under the License.
>> +//
>> +///////////////////////////////////////////////////////////
>> /////////////////////
>> +package org.apache.flex.core
>> +{
>> +    COMPILE::SWF
>> +    {
>> +        import flash.net.registerClassAlias;
>> +        import flash.utils.getDefinitionByName;
>> +
>> +        import org.apache.flex.events.Event;
>> +        import org.apache.flex.events.IEventDispatcher;
>> +        import org.apache.flex.events.ValueEvent;
>> +    }
>> +
>> +    /**
>> +     *  The ClassAliasBead class is the registers class
>> +     *  aliases for serialization/deserialization.
>> +     *  Place this bead in the strand of the Application.
>> +     *  The compiler leaves information about class aliases
>> +     *  on the Application's info object.
>> +     *
>> +     *  @langversion 3.0
>> +     *  @playerversion Flash 10.2
>> +     *  @playerversion AIR 2.6
>> +     *  @productversion FlexJS 0.0
>> +     */
>> +       public class ClassAliasBead implements IBead
>> +       {
>> +        /**
>> +         *  Constructor.
>> +         *
>> +         *  @langversion 3.0
>> +         *  @playerversion Flash 10.2
>> +         *  @playerversion AIR 2.6
>> +         *  @productversion FlexJS 0.0
>> +         */
>> +               public function ClassAliasBead()
>> +               {
>> +               }
>> +
>> +        private var _strand:IStrand;
>> +
>> +        /**
>> +         *  @copy org.apache.flex.core.IBead#strand
>> +         *
>> +         *  @flexjsignorecoercion org.apache.flex.core.IFlexInfo
>> +         *  @flexjsignorecoercion Class
>> +         *  @langversion 3.0
>> +         *  @playerversion Flash 10.2
>> +         *  @playerversion AIR 2.6
>> +         *  @productversion FlexJS 0.0
>> +         */
>> +        public function set strand(value:IStrand):void
>> +        {
>> +            _strand = value;
>> +            COMPILE::SWF
>> +            {
>> +                var app:IFlexInfo = value as IFlexInfo;
>> +                var info:Object = app.info();
>> +                var map:Object = info.remoteClassAliases;
>> +                if (map)
>> +                {
>> +                    for (var cn:String in map)
>> +                    {
>> +                        var alias:String = map[cn];
>> +                        var c:Class = getDefinitionByName(cn) as Class;
>> +                        registerClassAlias(alias, c);
>> +                    }
>> +                }
>> +            }
>> +        }
>> +
>> +
>> +    }
>> +}
>>
>>
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F&data=02%7C01%7C%7C22c8aa
>>26dc374c22082a08d4e9dcd5ee%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6
>>36390582072240028&sdata=7KU9K16wlLa6XQPA2ElDvtamKuvxQNtNapbJULZANyg%3D&re
>>served=0
>> 4c2b0cfb/frameworks/projects/Core/src/main/resources/basic-manifest.xml
>> ----------------------------------------------------------------------
>> diff --git
>>a/frameworks/projects/Core/src/main/resources/basic-manifest.xml
>> b/frameworks/projects/Core/src/main/resources/basic-manifest.xml
>> index 007c691..ec18097 100644
>> --- a/frameworks/projects/Core/src/main/resources/basic-manifest.xml
>> +++ b/frameworks/projects/Core/src/main/resources/basic-manifest.xml
>> @@ -31,6 +31,7 @@
>>      <component id="SimpleStatesImpl" class="org.apache.flex.core.
>> SimpleStatesImpl"/>
>>      <component id="MXMLDragInitiator"
>>class="org.apache.flex.core.MXMLDragInitiator"
>> />
>>      <component id="CallLaterBead"
>>class="org.apache.flex.core.CallLaterBead"
>> />
>> +    <component id="ClassAliasBead"
>>class="org.apache.flex.core.ClassAliasBead"
>> />
>>
>>      <component id="BindableCSSStyles" class="org.apache.flex.core.
>> BindableCSSStyles"/>
>>      <component id="BindableCSSStylesWithFlex"
>>class="org.apache.flex.core.
>> BindableCSSStylesWithFlex"/>
>>
>>