Author: lindner
Date: Thu Dec 16 01:32:31 2010
New Revision: 1049763
URL: http://svn.apache.org/viewvc?rev=1049763&view=rev
Log:
start of the rpc flash bridge
Added:
shindig/trunk/content/xpc.swf
shindig/trunk/features/src/main/flex/
shindig/trunk/features/src/main/flex/Main.as
Modified:
shindig/trunk/features/pom.xml
Added: shindig/trunk/content/xpc.swf
URL:
http://svn.apache.org/viewvc/shindig/trunk/content/xpc.swf?rev=1049763&view=auto
==============================================================================
Files shindig/trunk/content/xpc.swf (added) and shindig/trunk/content/xpc.swf
Thu Dec 16 01:32:31 2010 differ
Modified: shindig/trunk/features/pom.xml
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/pom.xml?rev=1049763&r1=1049762&r2=1049763&view=diff
==============================================================================
--- shindig/trunk/features/pom.xml (original)
+++ shindig/trunk/features/pom.xml Thu Dec 16 01:32:31 2010
@@ -224,8 +224,51 @@
</plugins>
</build>
+ <!--
+ Profile used for rebuilding the xpc.swf file
+ You will need to put a copy of mtasc in features/mtasc
+ It's available from http://www.mtasc.org/
+ -->
<profiles>
<profile>
+ <id>flashxpc</id>
+ <build>
+ <defaultGoal>exec:exec</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <executable>./mtasc/mtasc</executable>
+ <!--<workingDirectory>/tmp</workingDirectory>-->
+ <arguments>
+ <!-- -header 1:1:1 -v -main -version 8 -swf xpc.swf
src/main/flex/Main.as -->
+ <argument>-header</argument>
+ <argument>1:1:1</argument>
+ <argument>-v</argument>
+ <argument>-main</argument>
+ <argument>-version</argument>
+ <argument>8</argument>
+ <argument>-swf</argument>
+ <argument>../content/xpc.swf</argument>
+ <argument>src/main/flex/Main.as</argument>
+ </arguments>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+
+ <profile>
<id>reporting</id>
<build>
<plugins>
Added: shindig/trunk/features/src/main/flex/Main.as
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/flex/Main.as?rev=1049763&view=auto
==============================================================================
--- shindig/trunk/features/src/main/flex/Main.as (added)
+++ shindig/trunk/features/src/main/flex/Main.as Thu Dec 16 01:32:31 2010
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+import flash.external.ExternalInterface;
+import System.security;
+
+/**
+ * XPC Flash Based Transport
+ * Original design by [email protected] (Eduardo Vela)
+ */
+class Main {
+ private static var SINGLETON:Boolean = false;
+ public static function main(swfRoot:MovieClip):Void {
+ if (SINGLETON) return;
+ SINGLETON = true;
+
+ var origin:String;
+
+ if (_level0.origin == undefined){
+ origin = "http://*";
+ } else {
+ origin = _level0.origin;
+ }
+
+ var domain:String = origin.substr(origin.indexOf("//") + 2, origin.length);
+
+ if (origin.substr(0,5)==="http:") {
+ security.allowInsecureDomain(domain);
+ } else {
+ security.allowDomain(domain);
+ }
+
+ ExternalInterface.addCallback("setup", { }, function(this_channel:String,
role:String) {
+ if (this_channel.indexOf(":") > -1) {
+ return;
+ }
+
+ var other_role:String;
+
+ if (role == "INNER") {
+ other_role = "OUTER";
+ } else {
+ role = "OUTER";
+ other_role = "INNER";
+ }
+
+ var receiving_lc:LocalConnection = new LocalConnection();
+ var sending_lc:LocalConnection = new LocalConnection();
+ receiving_lc.receiveMessage = function(to:String, from:String,
channel:String, message:String) {
+ if ((to === "*" || to === origin) && channel === this_channel) {
+ ExternalInterface.call("gadgets.rpctx.flash.receiveMessage",
channel, message, from, to);
+ }
+ }
+
+ ExternalInterface.addCallback("sendMessage_"+this_channel, { },
function(message:String, to:String) {
+ if (!to) to = "*";
+ sending_lc.send(this_channel + "_" + other_role, "receiveMessage", to,
origin, this_channel, message);
+ } );
+ receiving_lc.connect(this_channel + "_" + role);
+ } );
+ ExternalInterface.call("ready");
+ }
+
+ public function Main() {
+ }
+}