summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java')
-rw-r--r--branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBinding.java38
-rw-r--r--branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingBuilder.java56
-rw-r--r--branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingLoader.java57
-rw-r--r--branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCEntryPointServlet.java71
-rw-r--r--branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCService.java56
-rw-r--r--branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/ScriptGetterServlet.java52
6 files changed, 0 insertions, 330 deletions
diff --git a/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBinding.java b/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBinding.java
deleted file mode 100644
index 101bfde6c2..0000000000
--- a/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBinding.java
+++ /dev/null
@@ -1,38 +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.binding.jsonrpc;
-
-import org.apache.tuscany.spi.model.Binding;
-
-/**
- * Represents a binding to an RMI service.
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCBinding extends Binding {
- private String uri;
-
- public String getURI() {
- return uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-}
diff --git a/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingBuilder.java b/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingBuilder.java
deleted file mode 100644
index 85654f1104..0000000000
--- a/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingBuilder.java
+++ /dev/null
@@ -1,56 +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.binding.jsonrpc;
-
-import org.apache.tuscany.spi.annotation.Autowire;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.component.Service;
-import org.apache.tuscany.spi.deployer.DeploymentContext;
-import org.apache.tuscany.spi.extension.BindingBuilderExtension;
-import org.apache.tuscany.spi.host.ServletHost;
-import org.apache.tuscany.spi.model.BoundServiceDefinition;
-
-/**
- * Builds a Service for JSON-RPC binding.
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCBindingBuilder extends BindingBuilderExtension<JSONRPCBinding> {
-
- private ServletHost servletHost;
-
- @Autowire()
- public void setServletHost(ServletHost servletHost) {
- this.servletHost = servletHost;
- }
-
- protected Class<JSONRPCBinding> getBindingType() {
- return JSONRPCBinding.class;
- }
-
- @SuppressWarnings("unchecked")
- public Service build(CompositeComponent parent,
- BoundServiceDefinition<JSONRPCBinding> serviceDefinition,
- DeploymentContext deploymentContext) {
- Class<?> interfaze = serviceDefinition.getServiceContract().getInterfaceClass();
-
- return new JSONRPCService(serviceDefinition.getName(), interfaze, parent, wireService, servletHost);
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingLoader.java b/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingLoader.java
deleted file mode 100644
index 9f2a35d912..0000000000
--- a/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingLoader.java
+++ /dev/null
@@ -1,57 +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.binding.jsonrpc;
-
-import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.spi.annotation.Autowire;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.deployer.DeploymentContext;
-import org.apache.tuscany.spi.extension.LoaderExtension;
-import org.apache.tuscany.spi.loader.LoaderException;
-import org.apache.tuscany.spi.loader.LoaderRegistry;
-import org.osoa.sca.annotations.Scope;
-
-/**
- * Loader for handling <binding.jsonrpc> elements.
- *
- * @version $Rev$ $Date$
- */
-@Scope("MODULE")
-public class JSONRPCBindingLoader extends LoaderExtension<JSONRPCBinding> {
- public static final QName BINDING_JSON = new QName(XML_NAMESPACE_1_0, "binding.jsonrpc");
-
- public JSONRPCBindingLoader(@Autowire
- LoaderRegistry registry) {
- super(registry);
- }
-
- public QName getXMLType() {
- return BINDING_JSON;
- }
-
- public JSONRPCBinding load(CompositeComponent parent, XMLStreamReader reader, DeploymentContext deploymentContext) throws XMLStreamException,
- LoaderException {
-
- return new JSONRPCBinding();
- }
-}
diff --git a/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCEntryPointServlet.java b/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCEntryPointServlet.java
deleted file mode 100644
index c7afc4742e..0000000000
--- a/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCEntryPointServlet.java
+++ /dev/null
@@ -1,71 +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.binding.jsonrpc;
-
-import java.io.IOException;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import com.metaparadigm.jsonrpc.JSONRPCBridge;
-import com.metaparadigm.jsonrpc.JSONRPCServlet;
-
-/**
- *
- *
- */
-public class JSONRPCEntryPointServlet extends JSONRPCServlet {
- private static final long serialVersionUID = 1L;
-
- String serviceName;
-
- Object serviceInstance;
-
- public JSONRPCEntryPointServlet(String serviceName, Object serviceInstance) {
- this.serviceName = serviceName;
- this.serviceInstance = serviceInstance;
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.metaparadigm.jsonrpc.JSONRPCServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
- */
- @Override
- public void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ClassCastException {
-
- /*
- * Create a new bridge for every request to aviod all the problems with JSON-RPC-Java storing the bridge in the session
- */
- HttpSession session = request.getSession();
- try {
-
- JSONRPCBridge jsonrpcBridge = new JSONRPCBridge();
- jsonrpcBridge.registerObject(serviceName, serviceInstance);
- session.setAttribute("JSONRPCBridge", jsonrpcBridge);
-
- super.service(request, response);
-
- } finally {
- session.removeAttribute("JSONRPCBridge");
- }
- }
-}
diff --git a/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCService.java b/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCService.java
deleted file mode 100644
index 58d1d087ac..0000000000
--- a/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCService.java
+++ /dev/null
@@ -1,56 +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.binding.jsonrpc;
-
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.extension.ServiceExtension;
-import org.apache.tuscany.spi.host.ServletHost;
-import org.apache.tuscany.spi.wire.WireService;
-import org.osoa.sca.annotations.Destroy;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JSONRPCService extends ServiceExtension {
- private ServletHost servletHost;
-
- public JSONRPCService(String theName, Class<?> interfaze, CompositeComponent parent, WireService wireService, ServletHost servletHost) {
-
- super(theName, interfaze, parent, wireService);
-
- this.servletHost = servletHost;
- }
-
- public void start() {
- super.start();
-
- JSONRPCEntryPointServlet servlet = new JSONRPCEntryPointServlet(getName(), this.getServiceInstance());
- servletHost.registerMapping("/" + getName(), servlet);
- servletHost.registerMapping("/SCA/scripts", new ScriptGetterServlet());
- }
-
- @Destroy
- public void stop() {
- servletHost.unregisterMapping("/" + getName());
- servletHost.unregisterMapping("/SCA/scripts");
-
- super.stop();
- }
-
-}
diff --git a/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/ScriptGetterServlet.java b/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/ScriptGetterServlet.java
deleted file mode 100644
index 8f8a96df20..0000000000
--- a/branches/sca-java-M2/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/ScriptGetterServlet.java
+++ /dev/null
@@ -1,52 +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.binding.jsonrpc;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-public class ScriptGetterServlet extends HttpServlet {
-
- private static final long serialVersionUID = 1L;
-
- // private static final String SCA_INIT_JS = "SCA = new JSONRpcClient(\"services/HelloWorldService\");";
-
- public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
- URL url = getClass().getResource("jsonrpc.js");
- InputStream is = url.openStream();
- writeToStream(response, is);
-
- // writeToStream(response, new ByteArrayInputStream(SCA_INIT_JS.getBytes()));
- }
-
- private void writeToStream(HttpServletResponse response, InputStream is) throws IOException {
- ServletOutputStream os = response.getOutputStream();
- int i;
- while ((i = is.read()) != -1) { // NOPMD
- os.write(i);
- }
- }
-
-}