You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2019/03/10 06:10:35 UTC

[royale-asjs] branch develop updated: [Examples] Got the royale (non-mx) RemoteObject example working. CompressedRemoteObject is not working yet. See SampleAmfWebApp/README.txt for instructions for client variations. Jewel-only version at this point. There is a Basic (RemoteObjectAMFTestBasic) version as well.. which seems to need a lot more attention. tbc

This is an automated email from the ASF dual-hosted git repository.

gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 1d7918a  [Examples] Got the royale (non-mx) RemoteObject example working. CompressedRemoteObject is not working yet. See SampleAmfWebApp/README.txt for instructions for client variations. Jewel-only version at this point. There is a Basic (RemoteObjectAMFTestBasic) version as well.. which seems to need a lot more attention. tbc
1d7918a is described below

commit 1d7918a0083b27f743d1b9a7fa5c57db0243c989
Author: greg-dove <gr...@gmail.com>
AuthorDate: Sun Mar 10 19:10:11 2019 +1300

    [Examples] Got the royale (non-mx) RemoteObject example working. CompressedRemoteObject is not working yet.
    See SampleAmfWebApp/README.txt for instructions for client variations.
    Jewel-only version at this point. There is a Basic (RemoteObjectAMFTestBasic) version as well.. which seems to need a lot more attention. tbc
---
 examples/amf/SampleAmfWebApp/README.txt            |  20 ++-
 examples/amf/SampleAmfWebApp/pom-royale-basic.xml  | 154 ++++++++++++++++++++
 examples/amf/SampleAmfWebApp/pom-royale-jewel.xml  | 155 +++++++++++++++++++++
 .../RemoteObjectAMFTest/src/main/royale/App.mxml   |  30 ++--
 .../main/royale/valueObjects/ClientValueObject.as  |  12 +-
 .../src/main/royale/valueObjects/Product.as        |  31 +++--
 6 files changed, 374 insertions(+), 28 deletions(-)

diff --git a/examples/amf/SampleAmfWebApp/README.txt b/examples/amf/SampleAmfWebApp/README.txt
index 5c38129..37c1e7e 100644
--- a/examples/amf/SampleAmfWebApp/README.txt
+++ b/examples/amf/SampleAmfWebApp/README.txt
@@ -35,7 +35,7 @@ Is the Apache Royale Client that uses RemoteObject to communicate with the backe
 SampleAmfWebApp: (server implementation)
 Is a Java WebApp that uses Apache Flex BlazeDS to expose some data and objects through an AMF endpoint. Direct Link to this project
 
-To run this example localy you can follow this steps. 
+To run this example localy you can follow this steps.
 Note: At this time some parts of the example only can be build with maven, we'll be providing at some time ANT build, but this is not priority. If you're interested in ANT build you can submit a PR)
 
 1. Build RemoteObjectAMFTest with maven using "mvn clean install". This generates the Apache Royale client.
@@ -47,3 +47,21 @@ Note: At this time some parts of the example only can be build with maven, we'll
 3. Launch SampleAmfWebApp in the embedded Jetty web server with "java -jar target/SampleAmfWebApp-0.9.6-SNAPSHOT-exec.war". You should be in root SampleAmfWebApp folder. Notice: that SNAPSHOT number is just an example and can be different
 
 4. In a browser launch "http://localhost:8080" and try the examples.
+
+To test the above with alternate client implementations, follow the the same process, but change steps 1 & 2 as follows:
+
+For non-mx use of Royale RemoteObject, and Jewel components, amend instructions for 1 & 2 above:
+
+1. Build RemoteObjectAMFTest with maven using "mvn clean install". This generates the Apache Royale client.
+(this one is in the examples/royale folder)
+
+2. instead of  "mvn clean install" for SampleAmfWebApp, use mvn -f pom-royale-jewel.xml clean install
+
+
+@todo (this is not working yet):
+For non-mx use of Royale RemoteObject, and Basic components, amend instructions for 1 & 2 above:
+
+1. Build RemoteObjectAMFTestBasic with maven using "mvn clean install". This generates the Apache Royale client.
+(this one is in the examples/royale folder)
+
+2. instead of  "mvn clean install" for SampleAmfWebApp, use mvn -f pom-royale-basic.xml clean install
diff --git a/examples/amf/SampleAmfWebApp/pom-royale-basic.xml b/examples/amf/SampleAmfWebApp/pom-royale-basic.xml
new file mode 100644
index 0000000..61be27f
--- /dev/null
+++ b/examples/amf/SampleAmfWebApp/pom-royale-basic.xml
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  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.
+
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.royale.examples</groupId>
+    <artifactId>examples-amf-webapps</artifactId>
+    <version>0.9.6-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>SampleAmfWebApp</artifactId>
+  <version>0.9.6-SNAPSHOT</version>
+  <packaging>war</packaging>
+
+  <name>Apache Royale: Examples: AMF Web Apps: SampleAmfWebApp</name>
+
+  <properties>
+    <java.version>1.7</java.version>
+  </properties>
+
+  <build>
+    <sourceDirectory>src/main/java</sourceDirectory>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.5.1</version>
+        <configuration>
+          <source>${java.version}</source>
+          <target>${java.version}</target>
+        </configuration>
+      </plugin>
+
+      <!-- Make Spring-Boot build an executable war -->
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>1.3.3.RELEASE</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>repackage</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <classifier>exec</classifier>
+        </configuration>
+      </plugin>
+      <!--
+          We are building a servlet 3.0 application we don't
+          need a web.xml, so we have to disable a check on the
+          plugin.
+      -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <configuration>
+          <failOnMissingWebXml>false</failOnMissingWebXml>
+          <overlays>
+            <overlay>
+              <groupId>org.apache.royale.examples</groupId>
+               <artifactId>RemoteObjectAMFTestBasic</artifactId>
+              <targetPath>public</targetPath>
+            </overlay>
+          </overlays>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.1</version>
+        <executions>
+          <execution>
+            <phase>install</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <tasks>
+                <echo>To run, use:</echo>
+                <echo>java -jar target/${project.artifactId}-${project.version}-exec.war</echo>
+              </tasks>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <!-- Test create javadocs -->
+      <!-- <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-javadoc-plugin</artifactId>
+          <version>2.9</version>
+          <configuration>
+              <noqualifier>all</noqualifier>
+              <reportOutputDirectory>${basedir}/javadoc</reportOutputDirectory>
+              <destDir>javadoc</destDir>
+          </configuration>
+          <executions>
+            <execution>
+                <id>attach-javadocs</id>
+                <phase>install</phase>
+                <goals>
+                  <goal>javadoc</goal>
+                </goals>
+              </execution>
+          </executions>
+      </plugin>  -->
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+      <version>4.3.2.RELEASE</version>
+    </dependency>
+
+    <!--
+        This will pull in and configure the servlet engine as
+        well as the BlazeDS server.
+    -->
+    <dependency>
+      <groupId>org.apache.flex.blazeds</groupId>
+      <artifactId>blazeds-spring-boot-starter</artifactId>
+      <version>4.7.3</version>
+    </dependency>
+
+     <dependency>
+      <groupId>org.apache.royale.examples</groupId>
+      <artifactId>RemoteObjectAMFTestBasic</artifactId>
+      <version>0.9.6-SNAPSHOT</version>
+      <type>war</type>
+    </dependency>
+
+  </dependencies>
+
+</project>
diff --git a/examples/amf/SampleAmfWebApp/pom-royale-jewel.xml b/examples/amf/SampleAmfWebApp/pom-royale-jewel.xml
new file mode 100644
index 0000000..5e95e40
--- /dev/null
+++ b/examples/amf/SampleAmfWebApp/pom-royale-jewel.xml
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  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.
+
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.royale.examples</groupId>
+    <artifactId>examples-amf-webapps</artifactId>
+    <version>0.9.6-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>SampleAmfWebApp</artifactId>
+  <version>0.9.6-SNAPSHOT</version>
+  <packaging>war</packaging>
+
+  <name>Apache Royale: Examples: AMF Web Apps: SampleAmfWebApp</name>
+
+  <properties>
+    <java.version>1.7</java.version>
+  </properties>
+
+  <build>
+    <sourceDirectory>src/main/java</sourceDirectory>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.5.1</version>
+        <configuration>
+          <source>${java.version}</source>
+          <target>${java.version}</target>
+        </configuration>
+      </plugin>
+
+      <!-- Make Spring-Boot build an executable war -->
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>1.3.3.RELEASE</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>repackage</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <classifier>exec</classifier>
+        </configuration>
+      </plugin>
+      <!--
+          We are building a servlet 3.0 application we don't
+          need a web.xml, so we have to disable a check on the
+          plugin.
+      -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <configuration>
+          <failOnMissingWebXml>false</failOnMissingWebXml>
+          <overlays>
+            <overlay>
+              <groupId>org.apache.royale.examples</groupId>
+               <artifactId>RemoteObjectAMFTest</artifactId>
+              <targetPath>public</targetPath>
+            </overlay>
+          </overlays>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.1</version>
+        <executions>
+          <execution>
+            <phase>install</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <tasks>
+                <echo>To run, use:</echo>
+                <echo>java -jar target/${project.artifactId}-${project.version}-exec.war</echo>
+              </tasks>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <!-- Test create javadocs -->
+      <!-- <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-javadoc-plugin</artifactId>
+          <version>2.9</version>
+          <configuration>
+              <noqualifier>all</noqualifier>
+              <reportOutputDirectory>${basedir}/javadoc</reportOutputDirectory>
+              <destDir>javadoc</destDir>
+          </configuration>
+          <executions>
+            <execution>
+                <id>attach-javadocs</id>
+                <phase>install</phase>
+                <goals>
+                  <goal>javadoc</goal>
+                </goals>
+              </execution>
+          </executions>
+      </plugin>  -->
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+      <version>4.3.2.RELEASE</version>
+    </dependency>
+
+    <!--
+        This will pull in and configure the servlet engine as
+        well as the BlazeDS server.
+    -->
+    <dependency>
+      <groupId>org.apache.flex.blazeds</groupId>
+      <artifactId>blazeds-spring-boot-starter</artifactId>
+      <version>4.7.3</version>
+    </dependency>
+
+     <dependency>
+      <groupId>org.apache.royale.examples</groupId>
+      <artifactId>RemoteObjectAMFTest</artifactId>
+      <version>0.9.6-SNAPSHOT</version>
+      <type>war</type>
+    </dependency>
+
+
+  </dependencies>
+
+</project>
diff --git a/examples/royale/RemoteObjectAMFTest/src/main/royale/App.mxml b/examples/royale/RemoteObjectAMFTest/src/main/royale/App.mxml
index 86c3a4d..9c0216a 100644
--- a/examples/royale/RemoteObjectAMFTest/src/main/royale/App.mxml
+++ b/examples/royale/RemoteObjectAMFTest/src/main/royale/App.mxml
@@ -21,19 +21,27 @@ limitations under the License.
                xmlns:js="library://ns.apache.org/royale/basic"
                xmlns:j="library://ns.apache.org/royale/jewel"
                xmlns:html="library://ns.apache.org/royale/html"
+               initialize="onInitialize(event)"
                xmlns:local="*">
 
     <fx:Style source="../../main/resources/styles.css"/>
 
     <fx:Script>
 		<![CDATA[
-			import org.apache.royale.net.events.FaultEvent;
+            import org.apache.royale.events.Event;
+            import org.apache.royale.net.events.FaultEvent;
 			import org.apache.royale.net.events.ResultEvent;
             import valueObjects.ClientValueObject;
             import valueObjects.Product;
             import valueObjects.Zone;
             import org.apache.royale.collections.ArrayList;
             import org.apache.royale.net.remoting.messages.RoyaleClient;
+            import org.apache.royale.reflection.registerClassAlias;
+
+            private function onInitialize(event:Event):void{
+                //treat ArrayCollection locally as royale ArrayList
+                registerClassAlias("flex.messaging.io.ArrayCollection", ArrayList);
+            }
 
             protected function sendName():void
 			{
@@ -44,7 +52,7 @@ limitations under the License.
 			{
                 simpleService.send("echo", [nameSimple_txt.text]);
 			}
-			
+
 			private function onResult(evt:ResultEvent):void
 			{
 				trace("[Client:" + RoyaleClient.getInstance().id + "] Result= " + evt.data);
@@ -67,7 +75,7 @@ limitations under the License.
                     var index:int;
                     for(index = 0; index < len; index++)
                     {
-                        zone = product.zones[index];
+                        zone = product.zones.getItemAt(index) as Zone;
                         received3.text += "[" + zone.id + ", " + zone.name + "], ";
                     }
 
@@ -76,7 +84,7 @@ limitations under the License.
                     len = product.flavors.length;
                     for(index = 0; index < len; index++)
                     {
-                        received3.text += "[" + product.flavors[index] + "], ";
+                        received3.text += "[" + product.flavors.getItemAt(index) + "], ";
                     }
                 } else
               	{
@@ -84,7 +92,7 @@ limitations under the License.
                     list.dataProvider = arr;
 				}
 			}
-			
+
             private function onResultSimple(evt:ResultEvent):void
 			{
 				if (evt.data is String)
@@ -97,7 +105,7 @@ limitations under the License.
 				for(var key:String in evt["message"])
 				{
 					var element:Object = evt["message"][key];
-					trace(key + ", " + element);					
+					trace(key + ", " + element);
 				}
 				//trace("Fault = " + evt.message);
 			}
@@ -111,7 +119,7 @@ limitations under the License.
 			{
                 service.send("getSomeZone", []);
 			}
-            
+
             protected function getSomeProduct():void
 			{
                 service.send("getSomeProduct", []);
@@ -122,7 +130,7 @@ limitations under the License.
                 var vo:ClientValueObject = list.selectedItem as ClientValueObject;
                 received2.text = "Selected: " + vo.id;
             }
-			
+
             protected function getSomeCompressedProduct():void
 			{
                 compressedService.send("getSomeCompressedProduct", []);
@@ -187,11 +195,11 @@ limitations under the License.
 
             <j:Card width="400">
                 <j:Button text="Get Array of ValueObjects" emphasis="emphasized" click="getVOs()" width="100%"/>
-                <j:List id="list" labelField="id" width="100%" height="200" 
+                <j:List id="list" labelField="id" width="100%" height="200"
                             change="reportChange()"/>
                 <j:Label id="received2" text="Selected:"/>
             </j:Card>
-            
+
             <j:Card width="400">
                 <j:Button text="Get Some Product" emphasis="primary" click="getSomeProduct()"/>
                 <j:Button text="Get Some Compressed Product" emphasis="emphasized" click="getSomeCompressedProduct()"/>
@@ -200,5 +208,5 @@ limitations under the License.
 
         </j:View>
     </j:initialView>
-    
+
 </j:Application>
diff --git a/examples/royale/RemoteObjectAMFTest/src/main/royale/valueObjects/ClientValueObject.as b/examples/royale/RemoteObjectAMFTest/src/main/royale/valueObjects/ClientValueObject.as
index 002e74b..796cd51 100644
--- a/examples/royale/RemoteObjectAMFTest/src/main/royale/valueObjects/ClientValueObject.as
+++ b/examples/royale/RemoteObjectAMFTest/src/main/royale/valueObjects/ClientValueObject.as
@@ -25,17 +25,21 @@ package valueObjects
 		{
 		}
 
-		private var _id:String;
+		private var _id:int;
 
-        public function get id():String
+        public function get id():int
         {
             return _id;
         }
-        
-        public function set id(value:String):void
+
+        public function set id(value:int):void
         {
             _id = value;
         }
+		
+		public function toString():String{
+			return 'clientside representation (ClientValueObject) ' + id;
+		}
 
 	}
 }
diff --git a/examples/royale/RemoteObjectAMFTest/src/main/royale/valueObjects/Product.as b/examples/royale/RemoteObjectAMFTest/src/main/royale/valueObjects/Product.as
index ce296c2..1613af6 100644
--- a/examples/royale/RemoteObjectAMFTest/src/main/royale/valueObjects/Product.as
+++ b/examples/royale/RemoteObjectAMFTest/src/main/royale/valueObjects/Product.as
@@ -18,6 +18,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 package valueObjects
 {
+  import org.apache.royale.collections.ArrayList;
+    
     [RemoteClass(alias="org.apache.royale.amfsamples.valueobjects.Product")]
 	public class Product
 	{
@@ -27,11 +29,12 @@ package valueObjects
 
 		private var _name:String;
 
+        [Bindable("__NoChangeEvent__")]
         public function get name():String
         {
             return _name;
         }
-        
+
         public function set name(value:String):void
         {
             _name = value;
@@ -39,11 +42,12 @@ package valueObjects
 
         private var _description:String;
 
+        [Bindable("__NoChangeEvent__")]
         public function get description():String
         {
             return _description;
         }
-        
+
         public function set description(value:String):void
         {
             _description = value;
@@ -51,37 +55,40 @@ package valueObjects
 
         private var _taxonomy:Taxonomy;
 
+        [Bindable("__NoChangeEvent__")]
         public function get taxonomy():Taxonomy
         {
             return _taxonomy;
         }
-        
+
         public function set taxonomy(value:Taxonomy):void
         {
             _taxonomy = value;
         }
 
-        // collection of zones (Zone), we can use Array and ArrayList
-        private var _zones:Array;
+        // collection of zones (Zone), we can use ArrayList
+        private var _zones:ArrayList;
 
-        public function get zones():Array
+        [Bindable("__NoChangeEvent__")]
+        public function get zones():ArrayList
         {
             return _zones;
         }
-        
-        public function set zones(value:Array):void
+
+        public function set zones(value:ArrayList):void
         {
             _zones = value;
         }
 
-        private var _flavors:Array = null;
+        private var _flavors:ArrayList = null;
 
-        public function get flavors():Array
+        [Bindable("__NoChangeEvent__")]
+        public function get flavors():ArrayList
         {
             return _flavors;
         }
-        
-        public function set flavors(value:Array):void
+
+        public function set flavors(value:ArrayList):void
         {
             _flavors = value;
         }