summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main')
-rw-r--r--sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/META-INF/MANIFEST.MF3
-rw-r--r--sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingHandler.java49
-rw-r--r--sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingProviderFactory.java52
-rw-r--r--sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometInvoker.java41
-rw-r--r--sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometReferenceBindingProvider.java53
-rw-r--r--sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java74
-rw-r--r--sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/EventsLogger.java67
-rw-r--r--sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/FileResource.java66
-rw-r--r--sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory20
9 files changed, 0 insertions, 425 deletions
diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/META-INF/MANIFEST.MF b/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/META-INF/MANIFEST.MF
deleted file mode 100644
index 5e9495128c..0000000000
--- a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Class-Path:
-
diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingHandler.java b/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingHandler.java
deleted file mode 100644
index d31b1332a7..0000000000
--- a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingHandler.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.apache.tuscany.sca.binding.comet.runtime;
-
-import java.lang.reflect.InvocationTargetException;
-
-import javax.servlet.ServletContext;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
-import org.atmosphere.annotation.Broadcast;
-import org.atmosphere.cpr.Broadcaster;
-import org.atmosphere.cpr.DefaultBroadcaster;
-import org.atmosphere.jersey.Broadcastable;
-import org.atmosphere.jersey.SuspendResponse;
-
-import com.sun.jersey.spi.container.servlet.PerSession;
-
-@Produces("text/html;charset=ISO-8859-1")
-@PerSession
-public class CometBindingHandler {
-
- private Broadcaster broadcaster = new DefaultBroadcaster();
- public static final String ENDPOINT_KEY = "org.apache.tuscany.sca.binding.comet.endpoint";
- public static final String OPERATION_KEY = "org.apache.tuscany.sca.binding.comet.operation";
-
- @Context
- private ServletContext sc;
-
- @GET
- public SuspendResponse<String> register() {
- System.out.println("Register method: " + sc);
- return new SuspendResponse.SuspendResponseBuilder<String>().broadcaster(broadcaster).outputComments(true)
- .addListener(new EventsLogger()).build();
- }
-
- @POST
- @Broadcast
- public Broadcastable publish() throws InvocationTargetException {
- System.out.println("Publish method: " + sc);
- RuntimeEndpoint wire = (RuntimeEndpoint)sc.getAttribute(ENDPOINT_KEY);
- Operation operation = (Operation)sc.getAttribute(OPERATION_KEY);
- Object response = wire.invoke(operation, new Object[] {});
- return new Broadcastable(response.toString(), "", broadcaster);
- }
-
-}
diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingProviderFactory.java b/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingProviderFactory.java
deleted file mode 100644
index 747ea4d78e..0000000000
--- a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingProviderFactory.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.sca.binding.comet.runtime;
-
-import org.apache.tuscany.sca.binding.comet.CometBinding;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostHelper;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
-import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-
-public class CometBindingProviderFactory implements BindingProviderFactory<CometBinding> {
-
- private ServletHost servletHost;
-
- public CometBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
- this.servletHost = ServletHostHelper.getServletHost(extensionPoints);
- }
-
- public Class<CometBinding> getModelType() {
- return CometBinding.class;
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpoint) {
- return new CometReferenceBindingProvider(endpoint);
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
- return new CometServiceBindingProvider(endpoint, servletHost);
- }
-
-}
diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometInvoker.java b/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometInvoker.java
deleted file mode 100644
index 3b3f9beed3..0000000000
--- a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometInvoker.java
+++ /dev/null
@@ -1,41 +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.comet.runtime;
-
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-
-public class CometInvoker implements Invoker {
-
- protected Operation operation;
- protected EndpointReference endpoint;
-
- public CometInvoker(Operation operation, EndpointReference endpoint) {
- this.operation = operation;
- this.endpoint = endpoint;
- }
-
- public Message invoke(Message msg) {
- return null;
- }
-
-}
diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometReferenceBindingProvider.java b/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometReferenceBindingProvider.java
deleted file mode 100644
index 091fc836be..0000000000
--- a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometReferenceBindingProvider.java
+++ /dev/null
@@ -1,53 +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.comet.runtime;
-
-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 CometReferenceBindingProvider implements ReferenceBindingProvider {
-
- private EndpointReference endpoint;
-
- public CometReferenceBindingProvider(EndpointReference endpoint) {
- this.endpoint = endpoint;
- }
- public Invoker createInvoker(Operation operation) {
- return new CometInvoker(operation, endpoint);
- }
-
- public void start() {
- }
-
- public void stop() {
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return null;
- }
-
- public boolean supportsOneWayInvocation() {
- return true;
- }
-
-}
diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java b/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java
deleted file mode 100644
index cd19be9dce..0000000000
--- a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java
+++ /dev/null
@@ -1,74 +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.comet.runtime;
-
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
-import org.atmosphere.cpr.AtmosphereServlet;
-
-public class CometServiceBindingProvider implements ServiceBindingProvider {
-
- private static final String PACKAGE_KEY = "com.sun.jersey.config.property.packages";
- private static final String PACKAGE_VALUE = "org.apache.tuscany.sca.binding.comet.runtime";
-
- private RuntimeEndpoint endpoint;
- private ServletHost servletHost;
-
- public CometServiceBindingProvider(RuntimeEndpoint endpoint, ServletHost servletHost) {
- this.endpoint = endpoint;
- this.servletHost = servletHost;
- }
-
- public void start() {
- ComponentService service = endpoint.getService();
- Interface serviceInterface = service.getInterfaceContract().getInterface();
- for (Operation op : serviceInterface.getOperations()) {
- AtmosphereServlet servlet = new AtmosphereServlet();
- servlet.addInitParameter(PACKAGE_KEY, PACKAGE_VALUE);
- String path = endpoint.getBinding().getURI() + "/" + op.getName();
- servletHost.addServletMapping(path, servlet);
- servlet.getServletContext().setAttribute(CometBindingHandler.ENDPOINT_KEY, endpoint);
- servlet.getServletContext().setAttribute(CometBindingHandler.OPERATION_KEY, op);
- }
- }
-
- public void stop() {
- ComponentService service = endpoint.getService();
- Interface serviceInterface = service.getInterfaceContract().getInterface();
- for (Operation op : serviceInterface.getOperations()) {
- String path = endpoint.getBinding().getURI() + "/" + op.getName();
- servletHost.removeServletMapping(path);
- }
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return null;
- }
-
- public boolean supportsOneWayInvocation() {
- return true;
- }
-
-}
diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/EventsLogger.java b/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/EventsLogger.java
deleted file mode 100644
index 934f5ef907..0000000000
--- a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/EventsLogger.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License"). You
- * may not use this file except in compliance with the License. You can obtain
- * a copy of the License at https://jersey.dev.java.net/CDDL+GPL.html
- * or jersey/legal/LICENSE.txt. See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at jersey/legal/LICENSE.txt.
- * Sun designates this particular file as subject to the "Classpath" exception
- * as provided by Sun in the GPL Version 2 section of the License file that
- * accompanied this code. If applicable, add the following below the License
- * Header, with the fields enclosed by brackets [] replaced by your own
- * identifying information: "Portions Copyrighted [year]
- * [name of copyright owner]"
- *
- * Contributor(s):
- *
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license." If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above. However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-package org.apache.tuscany.sca.binding.comet.runtime;
-
-import org.atmosphere.cpr.AtmosphereResourceEvent;
-import org.atmosphere.cpr.AtmosphereResourceEventListener;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-public class EventsLogger implements AtmosphereResourceEventListener {
-
- public EventsLogger() {
- }
-
- public void onSuspend(final AtmosphereResourceEvent<HttpServletRequest, HttpServletResponse> event) {
- System.out.println("onSuspend: " + event.getResource().getRequest().getRemoteAddr()
- + event.getResource().getRequest().getRemotePort());
- }
-
- public void onResume(AtmosphereResourceEvent<HttpServletRequest, HttpServletResponse> event) {
- System.out.println("onResume: " + event.getResource().getRequest().getRemoteAddr());
- }
-
- public void onDisconnect(AtmosphereResourceEvent<HttpServletRequest, HttpServletResponse> event) {
- System.out.println("onDisconnect: " + event.getResource().getRequest().getRemoteAddr()
- + event.getResource().getRequest().getRemotePort());
- }
-
- public void onBroadcast(AtmosphereResourceEvent<HttpServletRequest, HttpServletResponse> event) {
- System.out.println("onBroadcast: " + event.getMessage());
- }
-}
diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/FileResource.java b/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/FileResource.java
deleted file mode 100644
index 5cb663fc6f..0000000000
--- a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/FileResource.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License"). You
- * may not use this file except in compliance with the License. You can obtain
- * a copy of the License at https://jersey.dev.java.net/CDDL+GPL.html
- * or jersey/legal/LICENSE.txt. See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at jersey/legal/LICENSE.txt.
- * Sun designates this particular file as subject to the "Classpath" exception
- * as provided by Sun in the GPL Version 2 section of the License file that
- * accompanied this code. If applicable, add the following below the License
- * Header, with the fields enclosed by brackets [] replaced by your own
- * identifying information: "Portions Copyrighted [year]
- * [name of copyright owner]"
- *
- * Contributor(s):
- *
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license." If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above. However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-package org.apache.tuscany.sca.binding.comet.runtime;
-
-import java.io.InputStream;
-
-import javax.servlet.ServletContext;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.PathSegment;
-
-@Path("/")
-@Produces("text/html")
-public class FileResource {
-
- @Context
- private ServletContext sc;
-
- @Path("/js/{id}")
- @GET
- public InputStream getJQuery(@PathParam("id") PathSegment ps) {
- return sc.getResourceAsStream("/js/" + ps.getPath());
- }
-
- @GET
- public InputStream getIndex() {
- return sc.getResourceAsStream("/index.html");
- }
-}
diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
deleted file mode 100644
index cb6db39c4e..0000000000
--- a/sca-java-2.x/contrib/modules/binding-comet-runtime-alternate/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ /dev/null
@@ -1,20 +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.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.comet.runtime.CometBindingProviderFactory;model=org.apache.tuscany.sca.binding.comet.CometBinding
-