summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/trunk
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-12-17 09:42:21 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-12-17 09:42:21 +0000
commite13607f223506e348c39651202beac9278d29917 (patch)
tree091ec175529d3043f3d8a1d24045de2f435ccf89 /sca-java-1.x/trunk
parentd70cc9331666aa39f88bd15149b918c9cd21d02b (diff)
Fix another Hudson build issue, this time with OpenAjax - don't faf about trying do download it with Ant just check the .js file into svn with the rest of the sample source
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@891603 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/trunk')
-rw-r--r--sca-java-1.x/trunk/tutorials/store/store-mashup/build-openajax.xml86
-rw-r--r--sca-java-1.x/trunk/tutorials/store/store-mashup/openajax/OpenAjax.js193
-rw-r--r--sca-java-1.x/trunk/tutorials/store/store-mashup/pom.xml58
3 files changed, 193 insertions, 144 deletions
diff --git a/sca-java-1.x/trunk/tutorials/store/store-mashup/build-openajax.xml b/sca-java-1.x/trunk/tutorials/store/store-mashup/build-openajax.xml
deleted file mode 100644
index 4668dedc1d..0000000000
--- a/sca-java-1.x/trunk/tutorials/store/store-mashup/build-openajax.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?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 name="OpenAjaxZipInstaller">
-
- <property name="openajax.version" value="1.0_build117_v1.0"/>
- <property name="unpack.location" value="${basedir}/openajax"/>
-
- <target name="check-openajax-installed">
- <condition property="already.installed" >
- <available file="${localRepository}/openajax/openajax/${openajax.version}/openajax-${openajax.version}.zip"/>
- </condition>
- <condition property="maven.suffix" value="">
- <os family="unix"/>
- </condition>
- <condition property="maven.suffix" value=".bat">
- <os family="windows"/>
- </condition>
- </target>
-
-
- <target name="check-openajax-unpacked">
- <condition property="already.unpacked" >
- <available file="${unpack.location}"/>
- </condition>
- </target>
-
- <target name="install-openajax" depends="check-openajax-installed" unless="already.installed">
- <mkdir dir="${basedir}/target/openajax-download/"/>
- <get src="http://downloads.sourceforge.net/openajaxallianc/OpenAjaxHub${openajax.version}.zip"
- dest="${basedir}/target/openajax-download/openajax-${openajax.version}.zip"
- verbose="true"
- usetimestamp="true"/>
- <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
- <arg line="install:install-file -DgroupId=openajax -DartifactId=openajax -Dversion=${openajax.version} -Dpackaging=zip -DgeneratePom=true -Dfile=${basedir}/target/openajax-download/openajax-${openajax.version}.zip"/>
- </exec>
- </target>
-
- <target name="install-openajax-nomaven" depends="check-openajax-installed" unless="already.installed">
- <mkdir dir="${basedir}/target/openajax-download/"/>
- <get src="http://downloads.sourceforge.net/openajaxallianc/OpenAjaxHub${openajax.version}.zip"
- dest="${basedir}/target/openajax-download/openajax-${openajax.version}.zip"
- verbose="true"
- usetimestamp="true"/>
- <copy file="${basedir}/target/openajax-download/openajax-${openajax.version}.zip"
- tofile="${localRepository}/openajax/openajax/${openajax.version}/openajax-${openajax.version}.zip"/>
- </target>
-
-
- <target name="unpack-openajax-files" depends="check-openajax-installed, check-openajax-unpacked" unless="already.unpacked">
- <fail message="openajax zip file not installed in local repository: ${localRepository}" unless="already.installed"/>
- <mkdir dir="${basedir}/target/openajax-unpack-temp/"/>
- <unzip src="${localRepository}/openajax/openajax/${openajax.version}/openajax-${openajax.version}.zip"
- dest="${basedir}/target/openajax-unpack-temp/"
- overwrite="false">
- <patternset>
- <include name="OpenAjaxHub${openajax.version}/release/**"/>
- </patternset>
- </unzip>
- <move file="${basedir}/target/openajax-unpack-temp/OpenAjaxHub${openajax.version}/release"
- tofile="${unpack.location}"
- verbose="true"/>
- <delete dir="${basedir}/target/openajax-unpack-temp/"/>
- </target>
-
-
- <target name="clean-openajax-files">
- <delete dir="${unpack.location}"/>
- </target>
-</project>
diff --git a/sca-java-1.x/trunk/tutorials/store/store-mashup/openajax/OpenAjax.js b/sca-java-1.x/trunk/tutorials/store/store-mashup/openajax/OpenAjax.js
new file mode 100644
index 0000000000..e1a855d1c0
--- /dev/null
+++ b/sca-java-1.x/trunk/tutorials/store/store-mashup/openajax/OpenAjax.js
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * OpenAjax.js
+ *
+ * Reference implementation of the OpenAjax Hub, as specified by OpenAjax Alliance.
+ * Specification is under development at:
+ *
+ * http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification
+ *
+ * Copyright 2006-2008 OpenAjax Alliance
+ *
+ * Licensed 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.
+ *
+ ******************************************************************************/
+
+// prevent re-definition of the OpenAjax object
+if(!window["OpenAjax"]){
+ OpenAjax = new function(){
+ var t = true;
+ var f = false;
+ var g = window;
+ var libs;
+ var ooh = "org.openajax.hub.";
+
+ var h = {};
+ this.hub = h;
+ h.implementer = "http://openajax.org";
+ h.implVersion = "1.0";
+ h.specVersion = "1.0";
+ h.implExtraData = {};
+ var libs = {};
+ h.libraries = libs;
+
+ h.registerLibrary = function(prefix, nsURL, version, extra){
+ libs[prefix] = {
+ prefix: prefix,
+ namespaceURI: nsURL,
+ version: version,
+ extraData: extra
+ };
+ this.publish(ooh+"registerLibrary", libs[prefix]);
+ }
+ h.unregisterLibrary = function(prefix){
+ this.publish(ooh+"unregisterLibrary", libs[prefix]);
+ delete libs[prefix];
+ }
+
+ h._subscriptions = { c:{}, s:[] };
+ h._cleanup = [];
+ h._subIndex = 0;
+ h._pubDepth = 0;
+
+ h.subscribe = function(name, callback, scope, subscriberData, filter)
+ {
+ if(!scope){
+ scope = window;
+ }
+ var handle = name + "." + this._subIndex;
+ var sub = { scope: scope, cb: callback, fcb: filter, data: subscriberData, sid: this._subIndex++, hdl: handle };
+ var path = name.split(".");
+ this._subscribe(this._subscriptions, path, 0, sub);
+ return handle;
+ }
+
+ h.publish = function(name, message)
+ {
+ var path = name.split(".");
+ this._pubDepth++;
+ this._publish(this._subscriptions, path, 0, name, message);
+ this._pubDepth--;
+ if((this._cleanup.length > 0) && (this._pubDepth == 0)) {
+ for(var i = 0; i < this._cleanup.length; i++)
+ this.unsubscribe(this._cleanup[i].hdl);
+ delete(this._cleanup);
+ this._cleanup = [];
+ }
+ }
+
+ h.unsubscribe = function(sub)
+ {
+ var path = sub.split(".");
+ var sid = path.pop();
+ this._unsubscribe(this._subscriptions, path, 0, sid);
+ }
+
+ h._subscribe = function(tree, path, index, sub)
+ {
+ var token = path[index];
+ if(index == path.length)
+ tree.s.push(sub);
+ else {
+ if(typeof tree.c == "undefined")
+ tree.c = {};
+ if(typeof tree.c[token] == "undefined") {
+ tree.c[token] = { c: {}, s: [] };
+ this._subscribe(tree.c[token], path, index + 1, sub);
+ }
+ else
+ this._subscribe( tree.c[token], path, index + 1, sub);
+ }
+ }
+
+ h._publish = function(tree, path, index, name, msg) {
+ if(typeof tree != "undefined") {
+ var node;
+ if(index == path.length) {
+ node = tree;
+ } else {
+ this._publish(tree.c[path[index]], path, index + 1, name, msg);
+ this._publish(tree.c["*"], path, index + 1, name, msg);
+ node = tree.c["**"];
+ }
+ if(typeof node != "undefined") {
+ var callbacks = node.s;
+ var max = callbacks.length;
+ for(var i = 0; i < max; i++) {
+ if(callbacks[i].cb) {
+ var sc = callbacks[i].scope;
+ var cb = callbacks[i].cb;
+ var fcb = callbacks[i].fcb;
+ var d = callbacks[i].data;
+ if(typeof cb == "string"){
+ // get a function object
+ cb = sc[cb];
+ }
+ if(typeof fcb == "string"){
+ // get a function object
+ fcb = sc[fcb];
+ }
+ if((!fcb) ||
+ (fcb.call(sc, name, msg, d))) {
+ cb.call(sc, name, msg, d);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ h._unsubscribe = function(tree, path, index, sid) {
+ if(typeof tree != "undefined") {
+ if(index < path.length) {
+ var childNode = tree.c[path[index]];
+ this._unsubscribe(childNode, path, index + 1, sid);
+ if(childNode.s.length == 0) {
+ for(var x in childNode.c)
+ return;
+ delete tree.c[path[index]];
+ }
+ return;
+ }
+ else {
+ var callbacks = tree.s;
+ var max = callbacks.length;
+ for(var i = 0; i < max; i++)
+ if(sid == callbacks[i].sid) {
+ if(this._pubDepth > 0) {
+ callbacks[i].cb = null;
+ this._cleanup.push(callbacks[i]);
+ }
+ else
+ callbacks.splice(i, 1);
+ return;
+ }
+ }
+ }
+ }
+ // The following function is provided for automatic testing purposes.
+ // It is not expected to be deployed in run-time OpenAjax Hub implementations.
+ h.reinit = function()
+ {
+ for (var lib in OpenAjax.hub.libraries) {
+ delete OpenAjax.hub.libraries[lib];
+ }
+ OpenAjax.hub.registerLibrary("OpenAjax", "http://openajax.org/hub", "1.0", {});
+
+ delete OpenAjax._subscriptions;
+ OpenAjax._subscriptions = {c:{},s:[]};
+ delete OpenAjax._cleanup;
+ OpenAjax._cleanup = [];
+ OpenAjax._subIndex = 0;
+ OpenAjax._pubDepth = 0;
+ }
+ };
+ // Register the OpenAjax Hub itself as a library.
+ OpenAjax.hub.registerLibrary("OpenAjax", "http://openajax.org/hub", "1.0", {});
+
+}
diff --git a/sca-java-1.x/trunk/tutorials/store/store-mashup/pom.xml b/sca-java-1.x/trunk/tutorials/store/store-mashup/pom.xml
index 9cb33913c5..e936f0a9e3 100644
--- a/sca-java-1.x/trunk/tutorials/store/store-mashup/pom.xml
+++ b/sca-java-1.x/trunk/tutorials/store/store-mashup/pom.xml
@@ -75,64 +75,6 @@
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <dependencies>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant-trax</artifactId>
- <version>1.6.5</version>
- </dependency>
- </dependencies>
-
- <executions>
- <execution>
- <id>install-openajax</id>
- <phase>validate</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <ant antfile="./build-openajax.xml" target="install-openajax">
- <property name="localRepository" value="${settings.localRepository}"/>
- </ant>
- </tasks>
- </configuration>
- </execution>
- <execution>
- <id>copy-openajax-files</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <ant antfile="./build-openajax.xml" target="unpack-openajax-files">
- <property name="localRepository" value="${settings.localRepository}"/>
- <property name="artifactId" value="${artifactId}"/>
- </ant>
- </tasks>
- </configuration>
- </execution>
- <execution>
- <id>clean-openajax-files</id>
- <phase>clean</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <ant antfile="./build-openajax.xml" target="clean-openajax-files">
- <property name="localRepository" value="${settings.localRepository}"/>
- <property name="artifactId" value="${artifactId}"/>
- </ant>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>