summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingProviderFactory.java3
-rw-r--r--sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometInvoker.java2
-rw-r--r--sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometReferenceBindingProvider.java7
-rw-r--r--sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java17
-rw-r--r--sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServlet.java13
5 files changed, 11 insertions, 31 deletions
diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingProviderFactory.java b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingProviderFactory.java
index cc30fdd518..747ea4d78e 100644
--- a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingProviderFactory.java
+++ b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingProviderFactory.java
@@ -34,7 +34,6 @@ public class CometBindingProviderFactory implements BindingProviderFactory<Comet
private ServletHost servletHost;
public CometBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
- System.out.println("Entering CometBindingProviderFactory constructor...");
this.servletHost = ServletHostHelper.getServletHost(extensionPoints);
}
@@ -43,12 +42,10 @@ public class CometBindingProviderFactory implements BindingProviderFactory<Comet
}
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpoint) {
- System.out.println("Entering CometBindingProviderFactory#createReferenceBindingProvider...");
return new CometReferenceBindingProvider(endpoint);
}
public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
- System.out.println("Entering CometBindingProviderFactory#createServiceBindingProvider...");
return new CometServiceBindingProvider(endpoint, servletHost);
}
diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometInvoker.java b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometInvoker.java
index 5ca9583065..3b3f9beed3 100644
--- a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometInvoker.java
+++ b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometInvoker.java
@@ -30,13 +30,11 @@ public class CometInvoker implements Invoker {
protected EndpointReference endpoint;
public CometInvoker(Operation operation, EndpointReference endpoint) {
- System.out.println("Entering CometInvoker constructor...");
this.operation = operation;
this.endpoint = endpoint;
}
public Message invoke(Message msg) {
- System.out.println("Entering CometInvoker#invoke...");
return null;
}
diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometReferenceBindingProvider.java b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometReferenceBindingProvider.java
index 29f00f634a..091fc836be 100644
--- a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometReferenceBindingProvider.java
+++ b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometReferenceBindingProvider.java
@@ -25,35 +25,28 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-// TODO
public class CometReferenceBindingProvider implements ReferenceBindingProvider {
private EndpointReference endpoint;
public CometReferenceBindingProvider(EndpointReference endpoint) {
- System.out.println("Entering CometReferenceBindingProvider constructor...");
this.endpoint = endpoint;
}
public Invoker createInvoker(Operation operation) {
- System.out.println("Entering CometReferenceBindingProvider#createInvoker...");
return new CometInvoker(operation, endpoint);
}
public void start() {
- System.out.println("Entering CometReferenceBindingProvider#start...");
}
public void stop() {
- System.out.println("Entering CometReferenceBindingProvider#stop...");
}
public InterfaceContract getBindingInterfaceContract() {
- System.out.println("Entering CometReferenceBindingProvider#getInterfaceContract...");
return null;
}
public boolean supportsOneWayInvocation() {
- System.out.println("Entering CometReferenceBindingProvider#supportsOneWayInvocation...");
return true;
}
diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java
index 7081081a14..0077504296 100644
--- a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java
+++ b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java
@@ -30,34 +30,31 @@ import org.atmosphere.cpr.MeteorServlet;
public class CometServiceBindingProvider implements ServiceBindingProvider {
+ private static final String SERVLET_KEY = "org.atmosphere.servlet";
+ private static final String SERVLET_VALUE = "org.apache.tuscany.sca.binding.comet.runtime.CometServlet";
+
private RuntimeEndpoint endpoint;
private ServletHost servletHost;
public CometServiceBindingProvider(RuntimeEndpoint endpoint, ServletHost servletHost) {
- System.out.println("Entering CometServiceBindingProvider constructor...");
this.endpoint = endpoint;
this.servletHost = servletHost;
}
public void start() {
- System.out.println("Entering CometServiceBindingProvider#start...");
ComponentService service = endpoint.getService();
Interface serviceInterface = service.getInterfaceContract().getInterface();
for (Operation op : serviceInterface.getOperations()) {
MeteorServlet servlet = new MeteorServlet();
- servlet.addInitParameter("org.atmosphere.servlet", "org.apache.tuscany.sca.binding.comet.runtime.CometServlet");
- // TODO fix TuscanyServletFilter to use Servlets 3.0
- servlet.addInitParameter("org.atmosphere.useNative", "true");
+ servlet.addInitParameter(SERVLET_KEY, SERVLET_VALUE);
String path = endpoint.getBinding().getURI() + "/" + op.getName();
servletHost.addServletMapping(path, servlet);
- System.out.println("Adding attributes to servlet context...");
- servlet.getServletContext().setAttribute("org.apache.tuscany.sca.binding.comet.endpoint", endpoint);
- servlet.getServletContext().setAttribute("org.apache.tuscany.sca.binding.comet.operation", op);
+ servlet.getServletContext().setAttribute(CometServlet.ENDPOINT_KEY, endpoint);
+ servlet.getServletContext().setAttribute(CometServlet.OPERATION_KEY, op);
}
}
public void stop() {
- System.out.println("Entering CometServiceBindingProvider#stop...");
ComponentService service = endpoint.getService();
Interface serviceInterface = service.getInterfaceContract().getInterface();
for (Operation op : serviceInterface.getOperations()) {
@@ -67,12 +64,10 @@ public class CometServiceBindingProvider implements ServiceBindingProvider {
}
public InterfaceContract getBindingInterfaceContract() {
- System.out.println("Entering CometServiceBindingProvider#getBindingInterfaceContract...");
return null;
}
public boolean supportsOneWayInvocation() {
- System.out.println("Entering CometServiceBindingProvider#supportsOneWayInvocation...");
return true;
}
diff --git a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServlet.java b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServlet.java
index 9f4d56ef71..d199a77a68 100644
--- a/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServlet.java
+++ b/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServlet.java
@@ -40,6 +40,8 @@ import org.atmosphere.util.XSSHtmlFilter;
public class CometServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final String METEOR_KEY = "org.apache.tuscany.comet.meteor";
+ 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";
protected transient RuntimeEndpoint wire;
protected transient Operation operation;
@@ -47,7 +49,6 @@ public class CometServlet extends HttpServlet {
@Override
public void init(ServletConfig config) throws ServletException {
- System.out.println("Entering CometServlet#init...");
super.init(config);
filters = new LinkedList<BroadcastFilter>();
filters.add(new XSSHtmlFilter());
@@ -56,9 +57,8 @@ public class CometServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- System.out.println("Entering CometServlet#doGet...");
Meteor meteor = Meteor.build(req, SCOPE.REQUEST, filters, null);
- meteor.addListener(new EventsLogger());
+ // meteor.addListener(new EventsLogger());
req.getSession().setAttribute(METEOR_KEY, meteor);
resp.setContentType("text/html");
meteor.suspend(-1);
@@ -66,11 +66,8 @@ public class CometServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- System.out.println("Entering CometServlet#doPost...");
- System.out.println("Getting attributes from servlet context...");
- this.wire = (RuntimeEndpoint)getServletContext().getAttribute("org.apache.tuscany.sca.binding.comet.endpoint");
- this.operation = (Operation)getServletContext().getAttribute("org.apache.tuscany.sca.binding.comet.operation");
- System.out.println("Getting Meteor...");
+ this.wire = (RuntimeEndpoint)getServletContext().getAttribute(ENDPOINT_KEY);
+ this.operation = (Operation)getServletContext().getAttribute(OPERATION_KEY);
Meteor meteor = (Meteor)req.getSession().getAttribute(METEOR_KEY);
meteor.broadcast(invokeService(new Object[] {}));
}