From 7cd4170d0b649adfa0f9fb5db9cfa16d4f5aa776 Mon Sep 17 00:00:00 2001 From: antelder Date: Mon, 10 Aug 2009 07:50:40 +0000 Subject: Start adding support for JSONP references. Doesn't work yet, still need to implement the http inovke bit using something like HttpClient git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@802681 13f79535-47bb-0310-9956-ffa450edef68 --- .../jsonp/runtime/JSONPBindingProviderFactory.java | 5 +- .../sca/binding/jsonp/runtime/JSONPInvoker.java | 90 ++++++++++++++++++++++ .../runtime/JSONPReferenceBindingProvider.java | 54 +++++++++++++ 3 files changed, 146 insertions(+), 3 deletions(-) create mode 100644 java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPInvoker.java create mode 100644 java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPReferenceBindingProvider.java (limited to 'java/sca/modules') diff --git a/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPBindingProviderFactory.java b/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPBindingProviderFactory.java index f686d9d771..90daedb647 100644 --- a/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPBindingProviderFactory.java +++ b/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPBindingProviderFactory.java @@ -47,9 +47,8 @@ public class JSONPBindingProviderFactory implements BindingProviderFactory c = new Object[0].getClass(); + Object[] args = (Object[])mapper.readValue(jsonRequest, c); + return args; + } + +} diff --git a/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPReferenceBindingProvider.java b/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPReferenceBindingProvider.java new file mode 100644 index 0000000000..3bb0c48861 --- /dev/null +++ b/java/sca/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPReferenceBindingProvider.java @@ -0,0 +1,54 @@ +/* + * 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.jsonp.runtime; + +import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.provider.ReferenceBindingProvider; + +public class JSONPReferenceBindingProvider implements ReferenceBindingProvider { + + private EndpointReference endpoint; + + public JSONPReferenceBindingProvider(EndpointReference endpoint) { + this.endpoint = endpoint; + } + public Invoker createInvoker(Operation operation) { + return new JSONPInvoker(operation, endpoint); + } + + public void start() { + } + + public void stop() { + } + + public InterfaceContract getBindingInterfaceContract() { + return null; + } + + public boolean supportsOneWayInvocation() { + return false; + } + +} -- cgit v1.2.3