From 35f81a620ea2d8423a49d8630bcef1d69027f444 Mon Sep 17 00:00:00 2001 From: antelder Date: Sat, 28 Mar 2009 09:44:15 +0000 Subject: Remove old m2 branch git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@759447 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tuscany/sca/binding/dwr/DWRInvoker.java | 93 ---------------------- 1 file changed, 93 deletions(-) delete mode 100644 branches/sca-java-2.0-M2/modules/binding-dwr-runtime/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvoker.java (limited to 'branches/sca-java-2.0-M2/modules/binding-dwr-runtime/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvoker.java') diff --git a/branches/sca-java-2.0-M2/modules/binding-dwr-runtime/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvoker.java b/branches/sca-java-2.0-M2/modules/binding-dwr-runtime/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvoker.java deleted file mode 100644 index 24e6dbbcd4..0000000000 --- a/branches/sca-java-2.0-M2/modules/binding-dwr-runtime/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvoker.java +++ /dev/null @@ -1,93 +0,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. - */ - -package org.apache.tuscany.sca.binding.dwr; - -import java.util.Collection; - -import org.apache.tuscany.sca.core.invocation.MessageImpl; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.directwebremoting.ScriptBuffer; -import org.directwebremoting.WebContext; -import org.directwebremoting.WebContextFactory; -import org.directwebremoting.proxy.dwr.Util; - -/** - * The invoker for a DWR Binding. - * - * @version $Rev$ $Date$ - */ -public class DWRInvoker implements Invoker { - - private String referenceFunction; - - public DWRInvoker(String referenceName, Operation operation) { - this.referenceFunction = referenceName + "." + operation.getName(); - } - - public Message invoke(Message requestMsg) { - - invoke((Object[])requestMsg.getBody()); - - // DWR references can not return anything - return new MessageImpl(); - } - - public void invoke(Object[] args) { - - // TODO: this only works if its the same thread as request - WebContext wctx = WebContextFactory.get(); - String currentPage = wctx.getCurrentPage(); - - // Get a DWR Util proxy for all the browsers on the current page: - Collection sessions = wctx.getScriptSessionsByPage(currentPage); - Util utilAll = new Util(sessions); - - ScriptBuffer referenceInvoke = getInvokeFragment(args, wctx); - - // add the reference call to the Util proxy which will cause DWR to - // asynchronously send it to be run on each active browser client - utilAll.addScript(referenceInvoke); - } - - /** - * Creates a fragment of JavaScript code to invoke the reference function - * Eg: ".(arg1, arg2,...);" - */ - protected ScriptBuffer getInvokeFragment(Object[] args, WebContext wctx) { - - ScriptBuffer sb = new ScriptBuffer(); - sb.appendScript(referenceFunction); - sb.appendScript("("); - if (args != null) { - for (int i = 0; i < args.length; i++) { - sb.appendData(args[i]); - if (i < (args.length - 1)) { - sb.appendScript(", "); - } - } - } - sb.appendScript(");"); - - return sb; - } - -} -- cgit v1.2.3