You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by zh...@apache.org on 2008/01/23 05:48:37 UTC

svn commit: r614421 - in /incubator/shindig/trunk/features: features.txt rpc/ rpc/feature.xml rpc/rpc.js

Author: zhen
Date: Tue Jan 22 20:48:36 2008
New Revision: 614421

URL: http://svn.apache.org/viewvc?rev=614421&view=rev
Log:
Added interface for the gadget remote procedure call library under "gadgets.rpc.*".


Added:
    incubator/shindig/trunk/features/rpc/
    incubator/shindig/trunk/features/rpc/feature.xml
    incubator/shindig/trunk/features/rpc/rpc.js
Modified:
    incubator/shindig/trunk/features/features.txt

Modified: incubator/shindig/trunk/features/features.txt
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/features.txt?rev=614421&r1=614420&r2=614421&view=diff
==============================================================================
--- incubator/shindig/trunk/features/features.txt (original)
+++ incubator/shindig/trunk/features/features.txt Tue Jan 22 20:48:36 2008
@@ -4,6 +4,7 @@
 features/dynamic-height/feature.xml
 features/flash/feature.xml
 features/ifpc/feature.xml
+features/rpc/feature.xml
 features/opensocial-reference/feature.xml
 features/opensocial-samplecontainer/feature.xml
 features/setprefs/feature.xml

Added: incubator/shindig/trunk/features/rpc/feature.xml
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/rpc/feature.xml?rev=614421&view=auto
==============================================================================
--- incubator/shindig/trunk/features/rpc/feature.xml (added)
+++ incubator/shindig/trunk/features/rpc/feature.xml Tue Jan 22 20:48:36 2008
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!--
+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.
+-->
+<feature>
+  <name>rpc</name>
+  <gadget>
+    <script src="rpc.js"/>
+  </gadget>
+</feature>

Added: incubator/shindig/trunk/features/rpc/rpc.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/rpc/rpc.js?rev=614421&view=auto
==============================================================================
--- incubator/shindig/trunk/features/rpc/rpc.js (added)
+++ incubator/shindig/trunk/features/rpc/rpc.js Tue Jan 22 20:48:36 2008
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+/**
+ * @fileoverview Remote procedure call library for gadget-to-container,
+ * container-to-gadget, and gadget-to-gadget communication.
+ */
+
+var gadgets = gadgets || {};
+
+gadgets.rpc = function() {
+  return {
+    /**
+     * Registers an RPC service.
+     * @param {string} serviceName Service name to register.
+     * @param {Function} handler Service handler.
+     */
+    register: function(serviceName, handler) {
+      // TODO
+    },
+
+    /**
+     * Unregisters an RPC service.
+     * @param {string} serviceName Service name to unregister.
+     */
+    unregister: function(serviceName) {
+      // TODO
+    },
+
+    /**
+     * Registers a default service handler to processes all unknown
+     * RPC calls which fail silently by default.
+     * @param {Function} handler Service handler.
+     */
+    registerDefault: function(handler) {
+      // TODO
+    },
+
+    /**
+     * Unregisters the default service handler. Future unknown RPC
+     * calls will fail silently.
+     */
+    unregisterDefault: function() {
+      // TODO
+    },
+
+    /**
+     * Calls an RPC service.
+     * @param {string} targetId Id of the RPC service provider.
+     *                          Empty if calling the parent container.
+     * @param {string} serviceName Service name to call.
+     * @param {Function|null} callback Callback function (if any) to process
+     *                                 the return value of the RPC request.
+     * @param {*} var_args Parameters for the RPC request.
+     */
+    call: function(targetId, serviceName, callback, var_args) {
+      // TODO
+    }
+  };
+}();
+