summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java')
-rw-r--r--sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java85
1 files changed, 56 insertions, 29 deletions
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 1d295d9b4d..8be122d1b8 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
@@ -28,41 +28,68 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+/**
+ * Provider for services having comet binding specified in the scdl.
+ */
public class CometServiceBindingProvider implements ServiceBindingProvider {
- private RuntimeEndpoint endpoint;
- private ServletHost servletHost;
+ /**
+ * Service's endpoint.
+ */
+ private RuntimeEndpoint endpoint;
+
+ /**
+ * The underlying servlet host.
+ */
+ private ServletHost servletHost;
- public CometServiceBindingProvider(RuntimeEndpoint endpoint, ServletHost servletHost) {
- this.endpoint = endpoint;
- this.servletHost = servletHost;
- }
+ /**
+ * Constructor.
+ *
+ * @param endpoint
+ * the given endpoint
+ * @param servletHost
+ * the given servlet host
+ */
+ public CometServiceBindingProvider(RuntimeEndpoint endpoint,
+ ServletHost servletHost) {
+ this.endpoint = endpoint;
+ this.servletHost = servletHost;
+ }
- public void start() {
- ComponentService service = endpoint.getService();
- Interface serviceInterface = service.getInterfaceContract().getInterface();
- JavascriptGenerator.generateServiceProxy(service);
- for (Operation operation : serviceInterface.getOperations()) {
- JavascriptGenerator.generateMethodProxy(service, operation);
- ServletFactory.registerServlet(servletHost, endpoint, operation);
- }
- }
+ /**
+ * This method is used to start the provider.
+ */
+ public void start() {
+ ComponentService service = endpoint.getService();
+ Interface serviceInterface = service.getInterfaceContract()
+ .getInterface();
+ JavascriptGenerator.generateServiceProxy(service);
+ for (Operation operation : serviceInterface.getOperations()) {
+ JavascriptGenerator.generateMethodProxy(service, operation);
+ ServletFactory.registerServlet(servletHost, endpoint, operation);
+ }
+ }
- public void stop() {
- ComponentService service = endpoint.getService();
- Interface serviceInterface = service.getInterfaceContract().getInterface();
- for (Operation op : serviceInterface.getOperations()) {
- String path = service.getName() + "/" + op.getName();
- servletHost.removeServletMapping(path);
- }
- }
+ /**
+ * This method is used to stop the provider.
+ */
+ public void stop() {
+ ComponentService service = endpoint.getService();
+ Interface serviceInterface = service.getInterfaceContract()
+ .getInterface();
+ for (Operation op : serviceInterface.getOperations()) {
+ String path = service.getName() + "/" + op.getName();
+ servletHost.removeServletMapping(path);
+ }
+ }
- public InterfaceContract getBindingInterfaceContract() {
- return null;
- }
+ public InterfaceContract getBindingInterfaceContract() {
+ return null;
+ }
- public boolean supportsOneWayInvocation() {
- return true;
- }
+ public boolean supportsOneWayInvocation() {
+ return true;
+ }
}