You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by fm...@apache.org on 2010/08/24 15:08:56 UTC

svn commit: r988521 - in /tuscany/sca-java-2.x/contrib: modules/binding-comet-runtime/ modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/ modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/...

Author: fmoga
Date: Tue Aug 24 13:08:55 2010
New Revision: 988521

URL: http://svn.apache.org/viewvc?rev=988521&view=rev
Log:
Enforced coding standards and formatting.

Added:
    tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/CometTestCase.java
      - copied, changed from r985951, tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/CometTestCase.java
Modified:
    tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/pom.xml
    tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingProviderFactory.java
    tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometInvoker.java
    tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometReferenceBindingProvider.java
    tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java
    tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/ServletFactory.java
    tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/handler/CometBindingHandler.java
    tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/javascript/JavascriptGenerator.java
    tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/javascript/JavascriptResource.java
    tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/StockService.java
    tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/StockServiceImpl.java
    tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/CometBinding.java
    tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/CometBindingFactory.java
    tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/impl/CometBindingFactoryImpl.java
    tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/impl/CometBindingImpl.java
    tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/Helper.java
    tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/PrecipitationService.java
    tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/PrecipitationServiceImpl.java
    tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/TemperatureHumidityServiceImpl.java
    tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/model/Location.java
    tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/model/Response.java

Modified: tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/pom.xml?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/pom.xml (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/pom.xml Tue Aug 24 13:08:55 2010
@@ -77,10 +77,20 @@
 			<scope>test</scope>
 		</dependency>
 		<dependency>
+			<groupId>org.apache.tuscany.sca</groupId>
+			<artifactId>tuscany-contribution</artifactId>
+			<version>2.0-SNAPSHOT</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
 			<groupId>com.google.code.gson</groupId>
 			<artifactId>gson</artifactId>
 			<version>1.4</version>
-			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>javax</groupId>
+			<artifactId>javaee-web-api</artifactId>
+			<version>6.0</version>
 		</dependency>
 	</dependencies>
 

Modified: tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingProviderFactory.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingProviderFactory.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometBindingProviderFactory.java Tue Aug 24 13:08:55 2010
@@ -37,31 +37,36 @@ public class CometBindingProviderFactory
     /**
      * Underlying servlet host. Injected by constructor.
      */
-    private ServletHost servletHost;
+    private final ServletHost servletHost;
 
     /**
      * Constructor.
      */
-    public CometBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+    public CometBindingProviderFactory(final ExtensionPointRegistry extensionPoints) {
         this.servletHost = ServletHostHelper.getServletHost(extensionPoints);
     }
 
+    @Override
     public Class<CometBinding> getModelType() {
         return CometBinding.class;
     }
 
     /**
-     * Creates a provider for a reference that has comet binding specified in the scdl.
+     * Creates a provider for a reference that has comet binding specified in
+     * the scdl.
      */
-    public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpoint) {
+    @Override
+    public ReferenceBindingProvider createReferenceBindingProvider(final RuntimeEndpointReference endpoint) {
         return new CometReferenceBindingProvider(endpoint);
     }
 
     /**
-     * Creates a provider for a service that has comet binding specified in the scdl.
+     * Creates a provider for a service that has comet binding specified in the
+     * scdl.
      */
-    public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
-        return new CometServiceBindingProvider(endpoint, servletHost);
+    @Override
+    public ServiceBindingProvider createServiceBindingProvider(final RuntimeEndpoint endpoint) {
+        return new CometServiceBindingProvider(endpoint, this.servletHost);
     }
 
 }

Modified: tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometInvoker.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometInvoker.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometInvoker.java Tue Aug 24 13:08:55 2010
@@ -30,10 +30,23 @@ import org.apache.tuscany.sca.invocation
  */
 public class CometInvoker implements Invoker {
 
+    /**
+     * The invoked operation.
+     */
     protected Operation operation;
+
+    /**
+     * The endpoint to which the operation belongs.
+     */
     protected EndpointReference endpoint;
 
-    public CometInvoker(Operation operation, EndpointReference endpoint) {
+    /**
+     * Default constructor.
+     * 
+     * @param operation the operation
+     * @param endpoint the endpoint
+     */
+    public CometInvoker(final Operation operation, final EndpointReference endpoint) {
         this.operation = operation;
         this.endpoint = endpoint;
     }
@@ -41,7 +54,8 @@ public class CometInvoker implements Inv
     /**
      * No behavior.
      */
-    public Message invoke(Message msg) {
+    @Override
+    public Message invoke(final Message msg) {
         return null;
     }
 

Modified: tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometReferenceBindingProvider.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometReferenceBindingProvider.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometReferenceBindingProvider.java Tue Aug 24 13:08:55 2010
@@ -26,37 +26,45 @@ import org.apache.tuscany.sca.invocation
 import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
 
 /**
- * Provider for references that have comet binding specified in the scdl.
- * Not used as comet binding references would occur in client browser's Javascript.
+ * Provider for references that have comet binding specified in the scdl. Not
+ * used as comet binding references would occur in client browser's Javascript.
  */
 public class CometReferenceBindingProvider implements ReferenceBindingProvider {
 
-    private EndpointReference endpoint;
+    /**
+     * Endpoint for which the binding provider is created.
+     */
+    private final EndpointReference endpoint;
 
-    public CometReferenceBindingProvider(EndpointReference endpoint) {
+    public CometReferenceBindingProvider(final EndpointReference endpoint) {
         this.endpoint = endpoint;
     }
-    
-    public Invoker createInvoker(Operation operation) {
-        return new CometInvoker(operation, endpoint);
+
+    @Override
+    public Invoker createInvoker(final Operation operation) {
+        return new CometInvoker(operation, this.endpoint);
     }
 
     /**
      * No behavior.
      */
+    @Override
     public void start() {
     }
 
     /**
      * No behavior.
      */
+    @Override
     public void stop() {
     }
 
+    @Override
     public InterfaceContract getBindingInterfaceContract() {
         return null;
     }
 
+    @Override
     public boolean supportsOneWayInvocation() {
         return true;
     }

Modified: tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometServiceBindingProvider.java Tue Aug 24 13:08:55 2010
@@ -33,63 +33,62 @@ import org.apache.tuscany.sca.runtime.Ru
  */
 public class CometServiceBindingProvider implements ServiceBindingProvider {
 
-	/**
-	 * Service's endpoint.
-	 */
-	private RuntimeEndpoint endpoint;
-
-	/**
-	 * The underlying servlet host.
-	 */
-	private 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;
-	}
-
-	/**
-	 * 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);
-		}
-	}
-
-	/**
-	 * 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 boolean supportsOneWayInvocation() {
-		return true;
-	}
+    /**
+     * Service's endpoint.
+     */
+    private final RuntimeEndpoint endpoint;
+
+    /**
+     * The underlying servlet host.
+     */
+    private final ServletHost servletHost;
+
+    /**
+     * Constructor.
+     * 
+     * @param endpoint the given endpoint
+     * @param servletHost the given servlet host
+     */
+    public CometServiceBindingProvider(final RuntimeEndpoint endpoint, final ServletHost servletHost) {
+        this.endpoint = endpoint;
+        this.servletHost = servletHost;
+    }
+
+    /**
+     * This method is used to start the provider.
+     */
+    @Override
+    public void start() {
+        final ComponentService service = this.endpoint.getService();
+        final Interface serviceInterface = service.getInterfaceContract().getInterface();
+        JavascriptGenerator.generateServiceProxy(service);
+        for (final Operation operation : serviceInterface.getOperations()) {
+            JavascriptGenerator.generateMethodProxy(service, operation);
+            ServletFactory.registerServlet(this.servletHost, this.endpoint, operation);
+        }
+    }
+
+    /**
+     * This method is used to stop the provider.
+     */
+    @Override
+    public void stop() {
+        final ComponentService service = this.endpoint.getService();
+        final Interface serviceInterface = service.getInterfaceContract().getInterface();
+        for (final Operation op : serviceInterface.getOperations()) {
+            final String path = service.getName() + "/" + op.getName();
+            this.servletHost.removeServletMapping(path);
+        }
+    }
+
+    @Override
+    public InterfaceContract getBindingInterfaceContract() {
+        return null;
+    }
+
+    @Override
+    public boolean supportsOneWayInvocation() {
+        return true;
+    }
 
 }

Modified: tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/ServletFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/ServletFactory.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/ServletFactory.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/ServletFactory.java Tue Aug 24 13:08:55 2010
@@ -29,112 +29,113 @@ import org.atmosphere.cpr.AtmosphereServ
 
 /**
  * This class is used to create two servlets: one exposing all the comet
- * services, the other one exposing the javascript toolkit.
- * 
- * Exposing all comet services through a single servlet is needed as the
- * browsers are undergone by the two http connection limit so all comet services
- * should send their responses via the same http connection to the same client.
- * 
- * Dispatching to the corresponding endpoint and operation is done internally
- * using Jersey RESTful Web Services integration with the AtmosphereServlet.
- * 
- * The Javascript toolkit servlet is unique as it is not tied to any of the
- * services - it offers a global API.
+ * services, the other one exposing the javascript toolkit. Exposing all comet
+ * services through a single servlet is needed as the browsers are undergone by
+ * the two http connection limit so all comet services should send their
+ * responses via the same http connection to the same client. Dispatching to the
+ * corresponding endpoint and operation is done internally using Jersey RESTful
+ * Web Services integration with the AtmosphereServlet. The Javascript toolkit
+ * servlet is unique as it is not tied to any of the services - it offers a
+ * global API.
  */
-public class ServletFactory {
+public final class ServletFactory {
 
-	/**
-	 * Init-param key for the AtmosphereServlet defining where to look for
-	 * Jersey classes.
-	 */
-	private static final String PACKAGE_KEY = "com.sun.jersey.config.property.packages";
-
-	/**
-	 * Package of the class handling dispatching to endpoints.
-	 */
-	private static final String PACKAGE_VALUE = "org.apache.tuscany.sca.binding.comet.runtime.handler";
-
-	/**
-	 * Package of the class handling Javascript toolkit retrieval.
-	 */
-	private static final String JS_PACKAGE_VALUE = "org.apache.tuscany.sca.binding.comet.runtime.javascript";
-
-	/**
-	 * Property in the ServletContext where endpoints are added incrementally as
-	 * the Tuscany runtime calls the CometServiceBindingProvider for each comet
-	 * service.
-	 */
-	public static final String ENDPOINTS_KEY = "org.apache.tuscany.sca.binding.comet.endpoints";
-
-	/**
-	 * Property in the ServletContext where operations are added incrementally
-	 * as the CometServiceBindingProvider is calling the registerServlet method
-	 * for each comet service method.
-	 */
-	public static final String OPERATIONS_KEY = "org.apache.tuscany.sca.binding.comet.operations";
-
-	/**
-	 * Path where services will be exposed.
-	 */
-	public static final String PATH = "/tuscany-comet/*";
-
-	/**
-	 * Path where Javascript toolkit will be exposed.
-	 */
-	public static final String JS_PATH = "/org.apache.tuscany.sca.cometComponentContext.js/*";
-
-	/**
-	 * The servlet that is exposing the comet services.
-	 */
-	private static AtmosphereServlet cometServlet = null;
-
-	/**
-	 * The servlet that is exposing the Javascript toolkit.
-	 */
-	private static AtmosphereServlet javascriptServlet = null;
-
-	/**
-	 * Method called by CometServiceBindingProvider for each endpoint operation
-	 * in order to create the two servlets and keep track of all the endpoints
-	 * and their operations.
-	 * 
-	 * @param servletHost
-	 *            the underlying servlet host
-	 * @param endpoint
-	 *            the endpoint
-	 * @param operation
-	 *            the operation
-	 */
-	public static synchronized void registerServlet(ServletHost servletHost,
-			RuntimeEndpoint endpoint, Operation operation) {
-		if (cometServlet == null) {
-			cometServlet = new AtmosphereServlet();
-			cometServlet.addInitParameter(PACKAGE_KEY, PACKAGE_VALUE);
-			servletHost.addServletMapping(PATH, cometServlet);
-			// store operations and corresponding endpoint in the ServletContext
-			// so that they can be retrieved from inside the web service methods
-			Map<String, RuntimeEndpoint> endpoints = new HashMap<String, RuntimeEndpoint>();
-			cometServlet.getServletContext().setAttribute(ENDPOINTS_KEY,
-					endpoints);
-			Map<String, Operation> operations = new HashMap<String, Operation>();
-			cometServlet.getServletContext().setAttribute(OPERATIONS_KEY,
-					operations);
-		}
-		// add current operation to ServletContext
-		String url = "/" + endpoint.getService().getName() + "/"
-				+ operation.getName();
-		Map<String, RuntimeEndpoint> endpoints = (Map<String, RuntimeEndpoint>) cometServlet
-				.getServletContext().getAttribute(ENDPOINTS_KEY);
-		endpoints.put(url, endpoint);
-		Map<String, Operation> operations = (Map<String, Operation>) cometServlet
-				.getServletContext().getAttribute(OPERATIONS_KEY);
-		operations.put(url, operation);
-
-		if (javascriptServlet == null) {
-			javascriptServlet = new AtmosphereServlet();
-			javascriptServlet.addInitParameter(PACKAGE_KEY, JS_PACKAGE_VALUE);
-			servletHost.addServletMapping(JS_PATH, javascriptServlet);
-		}
-	}
+    /**
+     * Init-param key for the AtmosphereServlet defining where to look for
+     * Jersey classes.
+     */
+    private static final String PACKAGE_KEY = "com.sun.jersey.config.property.packages";
+
+    /**
+     * Package of the class handling dispatching to endpoints.
+     */
+    private static final String PACKAGE_VALUE = "org.apache.tuscany.sca.binding.comet.runtime.handler";
+
+    /**
+     * Package of the class handling Javascript toolkit retrieval.
+     */
+    private static final String JS_PACKAGE_VALUE = "org.apache.tuscany.sca.binding.comet.runtime.javascript";
+
+    /**
+     * Property in the ServletContext where endpoints are added incrementally as
+     * the Tuscany runtime calls the CometServiceBindingProvider for each comet
+     * service.
+     */
+    public static final String ENDPOINTS_KEY = "org.apache.tuscany.sca.binding.comet.endpoints";
+
+    /**
+     * Property in the ServletContext where operations are added incrementally
+     * as the CometServiceBindingProvider is calling the registerServlet method
+     * for each comet service method.
+     */
+    public static final String OPERATIONS_KEY = "org.apache.tuscany.sca.binding.comet.operations";
+
+    /**
+     * Path where services will be exposed.
+     */
+    public static final String PATH = "/tuscany-comet/*";
+
+    /**
+     * Path where Javascript toolkit will be exposed.
+     */
+    public static final String JS_PATH = "/org.apache.tuscany.sca.cometComponentContext.js/*";
+
+    /**
+     * The servlet that is exposing the comet services.
+     */
+    private static AtmosphereServlet cometServlet = null;
+
+    /**
+     * The servlet that is exposing the Javascript toolkit.
+     */
+    private static AtmosphereServlet javascriptServlet = null;
+
+    /**
+     * Private constructor for the singleton class.
+     */
+    private ServletFactory() {
+    }
+
+    /**
+     * Method called by CometServiceBindingProvider for each endpoint operation
+     * in order to create the two servlets and keep track of all the endpoints
+     * and their operations.
+     * 
+     * @param servletHost the underlying servlet host
+     * @param endpoint the endpoint
+     * @param operation the operation
+     */
+    public static synchronized void registerServlet(final ServletHost servletHost,
+                                                    final RuntimeEndpoint endpoint,
+                                                    final Operation operation) {
+        if (ServletFactory.cometServlet == null) {
+            ServletFactory.cometServlet = new AtmosphereServlet();
+            ServletFactory.cometServlet.addInitParameter(ServletFactory.PACKAGE_KEY, ServletFactory.PACKAGE_VALUE);
+            servletHost.addServletMapping(ServletFactory.PATH, ServletFactory.cometServlet);
+            // store operations and corresponding endpoint in the ServletContext
+            // so that they can be retrieved from inside the web service methods
+            final Map<String, RuntimeEndpoint> endpoints = new HashMap<String, RuntimeEndpoint>();
+            ServletFactory.cometServlet.getServletContext().setAttribute(ServletFactory.ENDPOINTS_KEY, endpoints);
+            final Map<String, Operation> operations = new HashMap<String, Operation>();
+            ServletFactory.cometServlet.getServletContext().setAttribute(ServletFactory.OPERATIONS_KEY, operations);
+        }
+        // add current operation to ServletContext
+        final String url = "/" + endpoint.getService().getName() + "/" + operation.getName();
+        final Map<String, RuntimeEndpoint> endpoints =
+            (Map<String, RuntimeEndpoint>)ServletFactory.cometServlet.getServletContext()
+                .getAttribute(ServletFactory.ENDPOINTS_KEY);
+        endpoints.put(url, endpoint);
+        final Map<String, Operation> operations =
+            (Map<String, Operation>)ServletFactory.cometServlet.getServletContext()
+                .getAttribute(ServletFactory.OPERATIONS_KEY);
+        operations.put(url, operation);
+
+        if (ServletFactory.javascriptServlet == null) {
+            ServletFactory.javascriptServlet = new AtmosphereServlet();
+            ServletFactory.javascriptServlet.addInitParameter(ServletFactory.PACKAGE_KEY,
+                                                              ServletFactory.JS_PACKAGE_VALUE);
+            servletHost.addServletMapping(ServletFactory.JS_PATH, ServletFactory.javascriptServlet);
+        }
+    }
 
 }

Modified: tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/handler/CometBindingHandler.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/handler/CometBindingHandler.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/handler/CometBindingHandler.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/handler/CometBindingHandler.java Tue Aug 24 13:08:55 2010
@@ -54,127 +54,121 @@ import com.sun.jersey.spi.container.serv
 @PerSession
 public class CometBindingHandler {
 
-	/**
-	 * The object used to suspend the response and send async responses back to
-	 * client.
-	 */
-	private Broadcaster broadcaster;
-
-	/**
-	 * The service endpoints corresponding to each operation.
-	 */
-	private Map<String, RuntimeEndpoint> endpoints;
-
-	/**
-	 * The comet operations.
-	 */
-	private Map<String, Operation> operations;
-
-	/**
-	 * JSON converter.
-	 */
-	private Gson gson;
-
-	@Context
-	private ServletContext sc;
-
-	/**
-	 * Method called at comet connect time. This suspends the response and keeps
-	 * the connection opened.
-	 * 
-	 * @return the suspended response
-	 */
-	@GET
-	public SuspendResponse<String> connect() {
-		broadcaster = new DefaultBroadcaster();
-		endpoints = (Map<String, RuntimeEndpoint>) sc
-				.getAttribute(ServletFactory.ENDPOINTS_KEY);
-		operations = (Map<String, Operation>) sc
-				.getAttribute(ServletFactory.OPERATIONS_KEY);
-		gson = new Gson();
-		return new SuspendResponse.SuspendResponseBuilder<String>()
-				.broadcaster(broadcaster).outputComments(true).build();
-	}
-
-	/**
-	 * Method called on service calls.
-	 * 
-	 * @param service
-	 *            service called
-	 * @param method
-	 *            operation called
-	 * @param callbackMethod
-	 *            the callback method from Javascript
-	 * @param jsonData
-	 *            arguments for the method sent as JSON array
-	 * @return object used by the Broadcaster to send response through the
-	 *         persisted connection
-	 * @throws InvocationTargetException
-	 *             if problems occur at service invocation
-	 */
-	@POST
-	@Path("/{service}/{method}")
-	@Broadcast
-	public Broadcastable callAndRespond(@PathParam("service") String service,
-			@PathParam("method") String method,
-			@FormParam("callback") String callbackMethod,
-			@FormParam("params") String jsonData)
-			throws InvocationTargetException {
-		String url = "/" + service + "/" + method;
-		RuntimeEndpoint wire = endpoints.get(url);
-		Operation operation = operations.get(url);
-		Object[] args = new Object[operation.getInputType().getLogical().size()];
-		String[] json = parseArray(jsonData);
-		int index = 0;
-		// convert each argument to the corresponding class
-		for (DataType<?> dataType : operation.getInputType().getLogical()) {
-			args[index] = gson.fromJson(json[index], dataType.getPhysical());
-			index++;
-		}
-		// invoke the service operation
-		Object response = wire.invoke(operation, args);
-		return new Broadcastable(callbackMethod + "($.secureEvalJSON('"
-				+ gson.toJson(response) + "'))", "", broadcaster);
-	}
-
-	/**
-	 * Parse the JSON array containing the arguments for the method call in
-	 * order to avoid converting JSON to Object[]. Converting each object
-	 * separately to it's corresponding type avoids type mismatch problems at
-	 * service invocation.
-	 * 
-	 * @param jsonArray
-	 *            the JSON array
-	 * @return an array of JSON formatted objects
-	 */
-	private String[] parseArray(String jsonArray) {
-		List<String> objects = new ArrayList<String>();
-		int bracketNum = 0;
-		int parNum = 0;
-		int startPos = 1;
-		for (int i = 0; i < jsonArray.length(); i++) {
-			switch (jsonArray.charAt(i)) {
-			case '{':
-				bracketNum++;
-				break;
-			case '}':
-				bracketNum--;
-				break;
-			case '[':
-				parNum++;
-				break;
-			case ']':
-				parNum--;
-				break;
-			case ',':
-				if (bracketNum == 0 && parNum == 1) {
-					objects.add(jsonArray.substring(startPos, i));
-					startPos = i + 1;
-				}
-			}
-		}
-		// add last object
-		objects.add(jsonArray.substring(startPos, jsonArray.length() - 1));
-		return objects.toArray(new String[] {});
-	}
+    /**
+     * The object used to suspend the response and send async responses back to
+     * client.
+     */
+    private Broadcaster broadcaster;
+
+    /**
+     * The service endpoints corresponding to each operation.
+     */
+    private Map<String, RuntimeEndpoint> endpoints;
+
+    /**
+     * The comet operations.
+     */
+    private Map<String, Operation> operations;
+
+    /**
+     * JSON converter.
+     */
+    private Gson gson;
+
+    /**
+     * The underlying servlet context.
+     */
+    @Context
+    private ServletContext sc;
+
+    /**
+     * Method called at comet connect time. This suspends the response and keeps
+     * the connection opened.
+     * 
+     * @return the suspended response
+     */
+    @GET
+    public SuspendResponse<String> connect() {
+        this.broadcaster = new DefaultBroadcaster();
+        this.endpoints = (Map<String, RuntimeEndpoint>)this.sc.getAttribute(ServletFactory.ENDPOINTS_KEY);
+        this.operations = (Map<String, Operation>)this.sc.getAttribute(ServletFactory.OPERATIONS_KEY);
+        this.gson = new Gson();
+        return new SuspendResponse.SuspendResponseBuilder<String>().broadcaster(this.broadcaster).outputComments(true)
+            .build();
+    }
+
+    /**
+     * Method called on service calls.
+     * 
+     * @param service service called
+     * @param method operation called
+     * @param callbackMethod the callback method from Javascript
+     * @param jsonData arguments for the method sent as JSON array
+     * @return object used by the Broadcaster to send response through the
+     *         persisted connection
+     * @throws InvocationTargetException if problems occur at service invocation
+     */
+    @POST
+    @Path("/{service}/{method}")
+    @Broadcast
+    public Broadcastable callAndRespond(@PathParam("service") final String service,
+                                        @PathParam("method") final String method,
+                                        @FormParam("callback") final String callbackMethod,
+                                        @FormParam("params") final String jsonData) throws InvocationTargetException {
+        final String url = "/" + service + "/" + method;
+        final RuntimeEndpoint wire = this.endpoints.get(url);
+        final Operation operation = this.operations.get(url);
+        final Object[] args = new Object[operation.getInputType().getLogical().size()];
+        final String[] json = this.parseArray(jsonData);
+        int index = 0;
+        // convert each argument to the corresponding class
+        for (final DataType<?> dataType : operation.getInputType().getLogical()) {
+            args[index] = this.gson.fromJson(json[index], dataType.getPhysical());
+            index++;
+        }
+        // invoke the service operation
+        final Object response = wire.invoke(operation, args);
+        return new Broadcastable(callbackMethod + "($.secureEvalJSON('" + this.gson.toJson(response) + "'))", "",
+                                 this.broadcaster);
+    }
+
+    /**
+     * Parse the JSON array containing the arguments for the method call in
+     * order to avoid converting JSON to Object[]. Converting each object
+     * separately to it's corresponding type avoids type mismatch problems at
+     * service invocation.
+     * 
+     * @param jsonArray the JSON array
+     * @return an array of JSON formatted objects
+     */
+    private String[] parseArray(final String jsonArray) {
+        final List<String> objects = new ArrayList<String>();
+        int bracketNum = 0;
+        int parNum = 0;
+        int startPos = 1;
+        for (int i = 0; i < jsonArray.length(); i++) {
+            switch (jsonArray.charAt(i)) {
+                case '{':
+                    bracketNum++;
+                    break;
+                case '}':
+                    bracketNum--;
+                    break;
+                case '[':
+                    parNum++;
+                    break;
+                case ']':
+                    parNum--;
+                    break;
+                case ',':
+                    if ((bracketNum == 0) && (parNum == 1)) {
+                        objects.add(jsonArray.substring(startPos, i));
+                        startPos = i + 1;
+                    }
+            }
+        }
+        // add last object
+        objects.add(jsonArray.substring(startPos, jsonArray.length() - 1));
+        return objects.toArray(new String[] {});
+    }
 }

Modified: tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/javascript/JavascriptGenerator.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/javascript/JavascriptGenerator.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/javascript/JavascriptGenerator.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/javascript/JavascriptGenerator.java Tue Aug 24 13:08:55 2010
@@ -27,72 +27,81 @@ import org.apache.tuscany.sca.interfaced
  */
 public class JavascriptGenerator {
 
-	/**
-	 * Namespace for the Tuscany Comet Javascript toolkit.
-	 */
-	public static final String JS_NAMESPACE = "SCA";
-
-	/**
-	 * Name for the SCA component context.
-	 */
-	private static final String COMPONENT_CONTEXT = "this.CometComponentContext";
-
-	/**
-	 * Name for the object performing comet specific tasks.
-	 */
-	private static final String TUSCANY_COMET = "SCA.TuscanyComet";
-
-	/**
-	 * Generated Javascript.
-	 */
-	private static StringBuffer javascript = new StringBuffer();
-
-	/**
-	 * Getter for the generated Javascript.
-	 * 
-	 * @return the generated Javascript
-	 */
-	public static StringBuffer getJavascript() {
-		return javascript;
-	}
-
-	/**
-	 * Generates the proxy for a service.
-	 * 
-	 * @param service
-	 *            the service for which generation is performed
-	 */
-	public static void generateServiceProxy(ComponentService service) {
-		javascript.append(COMPONENT_CONTEXT + "." + service.getName()
-				+ " = new Object();\n");
-	}
-
-	/**
-	 * Generates the method inside the service proxy for the specified
-	 * operation.
-	 * 
-	 * @param service
-	 *            the service containing the operation
-	 * @param operation
-	 *            the operation
-	 */
-	public static void generateMethodProxy(ComponentService service,
-			Operation operation) {
-		javascript.append(COMPONENT_CONTEXT + "." + service.getName() + "."
-				+ operation.getName() + " = function(");
-		for (int i = 0; i < operation.getInputType().getLogical().size(); i++) {
-			javascript.append("p" + i + ", ");
-		}
-		javascript.append("callbackMethod) {\n");
-		// send method argumets as JSON array
-		javascript.append("  var params = [];\n");
-		for (int i = 0; i < operation.getInputType().getLogical().size(); i++) {
-			javascript.append("  params.push(p" + i + ");\n");
-		}
-		javascript.append("  " + TUSCANY_COMET + ".callAsync('"
-				+ service.getName() + "/" + operation.getName()
-				+ "', $.toJSON(params), callbackMethod);\n");
-		javascript.append("}\n");
-	}
+    /**
+     * Namespace for the Tuscany Comet Javascript toolkit.
+     */
+    public static final String JS_NAMESPACE = "SCA";
+
+    /**
+     * Name for the SCA component context.
+     */
+    private static final String COMPONENT_CONTEXT = "this.CometComponentContext";
+
+    /**
+     * Name for the object performing comet specific tasks.
+     */
+    private static final String TUSCANY_COMET = "SCA.TuscanyComet";
+
+    /**
+     * Generated Javascript.
+     */
+    private static StringBuffer javascript = new StringBuffer();
+
+    /**
+     * Default constructor for utility class.
+     */
+    private JavascriptGenerator() {
+    }
+
+    /**
+     * Getter for the generated Javascript.
+     * 
+     * @return the generated Javascript
+     */
+    public static StringBuffer getJavascript() {
+        return JavascriptGenerator.javascript;
+    }
+
+    /**
+     * Generates the proxy for a service.
+     * 
+     * @param service the service for which generation is performed
+     */
+    public static void generateServiceProxy(final ComponentService service) {
+        JavascriptGenerator.javascript.append(JavascriptGenerator.COMPONENT_CONTEXT + "."
+            + service.getName()
+            + " = new Object();\n");
+    }
+
+    /**
+     * Generates the method inside the service proxy for the specified
+     * operation.
+     * 
+     * @param service the service containing the operation
+     * @param operation the operation
+     */
+    public static void generateMethodProxy(final ComponentService service, final Operation operation) {
+        JavascriptGenerator.javascript.append(JavascriptGenerator.COMPONENT_CONTEXT + "."
+            + service.getName()
+            + "."
+            + operation.getName()
+            + " = function(");
+        for (int i = 0; i < operation.getInputType().getLogical().size(); i++) {
+            JavascriptGenerator.javascript.append("p" + i + ", ");
+        }
+        JavascriptGenerator.javascript.append("callbackMethod) {\n");
+        // send method argumets as JSON array
+        JavascriptGenerator.javascript.append("  var params = [];\n");
+        for (int i = 0; i < operation.getInputType().getLogical().size(); i++) {
+            JavascriptGenerator.javascript.append("  params.push(p" + i + ");\n");
+        }
+        JavascriptGenerator.javascript.append("  " + JavascriptGenerator.TUSCANY_COMET
+            + ".callAsync('"
+            + service.getName()
+            + "/"
+            + operation.getName()
+            + "', $.toJSON(params), callbackMethod);\n");
+        JavascriptGenerator.javascript.append("}\n");
+    }
 
 }

Modified: tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/javascript/JavascriptResource.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/javascript/JavascriptResource.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/javascript/JavascriptResource.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/javascript/JavascriptResource.java Tue Aug 24 13:08:55 2010
@@ -28,15 +28,15 @@ import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 
 /**
- * Class serving the calls performed to retrieve the Javascript toolkit. 
+ * Class serving the calls performed to retrieve the Javascript toolkit.
  */
 @Path("/")
 @Produces("text/javascript")
 public class JavascriptResource {
 
-	/**
-	 * Dependencies for the Tuscany Comet Javascript API.
-	 */
+    /**
+     * Dependencies for the Tuscany Comet Javascript API.
+     */
     private static final String[] DEPENDENCIES = {"/jquery-1.4.2.min.js", "/jquery.atmosphere.js",
                                                   "/jquery.json-2.2.min.js", "/cometComponentContext.js"};
 
@@ -47,19 +47,19 @@ public class JavascriptResource {
      */
     @GET
     public InputStream getJavascript() {
-    	// add namespace for embedded libraries
+        // add namespace for embedded libraries
         InputStream stream =
             new ByteArrayInputStream(("var " + JavascriptGenerator.JS_NAMESPACE + " = new function() {\n").getBytes());
         // add dependencies in the specified order
-        for (String dependency : DEPENDENCIES) {
+        for (final String dependency : JavascriptResource.DEPENDENCIES) {
             if (stream == null) {
-                stream = getClass().getResourceAsStream(dependency);
+                stream = this.getClass().getResourceAsStream(dependency);
             } else {
-                stream = new SequenceInputStream(stream, getClass().getResourceAsStream(dependency));
+                stream = new SequenceInputStream(stream, this.getClass().getResourceAsStream(dependency));
             }
         }
         // add generated proxies
-        String generatedJs = JavascriptGenerator.getJavascript().toString() + "\n}";
+        final String generatedJs = JavascriptGenerator.getJavascript().toString() + "\n}";
         return new SequenceInputStream(stream, new ByteArrayInputStream(generatedJs.getBytes()));
     }
 }

Copied: tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/CometTestCase.java (from r985951, tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/CometTestCase.java)
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/CometTestCase.java?p2=tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/CometTestCase.java&p1=tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/CometTestCase.java&r1=985951&r2=988521&rev=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/CometTestCase.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/CometTestCase.java Tue Aug 24 13:08:55 2010
@@ -19,6 +19,7 @@
 
 package org.apache.tuscany.sca.test;
 
+import junit.framework.Assert;
 import junit.framework.TestCase;
 
 import org.apache.tuscany.sca.node.Contribution;
@@ -31,24 +32,22 @@ import org.apache.tuscany.sca.node.NodeF
  */
 public class CometTestCase extends TestCase {
 
-	/**
-	 * Test consisting in starting up a node containing services exposed via the
-	 * comet binding.
-	 */
-	public void testComet() {
-		try {
-			String location = ContributionLocationHelper
-					.getContributionLocation("test.composite");
-			Node node = NodeFactory.newInstance().createNode("test.composite",
-					new Contribution("c1", location));
-			node.start();
-			// System.out.println("Press any key to stop the node.");
-			// System.in.read();
-			node.stop();
-		} catch (Exception e) {
-			e.printStackTrace();
-			fail();
-		}
-	}
+    /**
+     * Test consisting in starting up a node containing services exposed via the
+     * comet binding.
+     */
+    public void testComet() {
+        try {
+            final String location = ContributionLocationHelper.getContributionLocation("test.composite");
+            final Node node = NodeFactory.newInstance().createNode("test.composite", new Contribution("c1", location));
+            node.start();
+            // System.out.println("Press any key to stop the node.");
+            // System.in.read();
+            node.stop();
+        } catch (final Exception e) {
+            e.printStackTrace();
+            Assert.fail();
+        }
+    }
 
 }

Modified: tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/StockService.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/StockService.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/StockService.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/StockService.java Tue Aug 24 13:08:55 2010
@@ -22,7 +22,7 @@ import org.oasisopen.sca.annotation.Remo
 
 @Remotable
 public interface StockService {
-    
+
     String getQuotes();
 
 }

Modified: tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/StockServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/StockServiceImpl.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/StockServiceImpl.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet-runtime/src/test/java/org/apache/tuscany/sca/test/StockServiceImpl.java Tue Aug 24 13:08:55 2010
@@ -28,12 +28,12 @@ import org.oasisopen.sca.annotation.Serv
 public class StockServiceImpl implements StockService {
 
     public static final int MAX_VALUE = 1000;
-    private Random random = new Random(new Date().getTime());
+    private final Random random = new Random(new Date().getTime());
 
     @Override
     public String getQuotes() {
-        Double value = Math.abs(random.nextDouble() * random.nextInt(MAX_VALUE));
+        final Double value = Math.abs(this.random.nextDouble() * this.random.nextInt(StockServiceImpl.MAX_VALUE));
         return "ASF" + "#" + Double.valueOf(new DecimalFormat("#.##").format(value));
     }
-    
+
 }

Modified: tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/CometBinding.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/CometBinding.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/CometBinding.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/CometBinding.java Tue Aug 24 13:08:55 2010
@@ -21,13 +21,14 @@ package org.apache.tuscany.sca.binding.c
 
 import javax.xml.namespace.QName;
 
+import org.apache.tuscany.sca.assembly.Base;
 import org.apache.tuscany.sca.assembly.Binding;
 
 /**
- * Comet Binding model
+ * Comet Binding model.
  */
 public interface CometBinding extends Binding {
 
-    QName TYPE = new QName(SCA11_TUSCANY_NS, "binding.comet");
+    QName TYPE = new QName(Base.SCA11_TUSCANY_NS, "binding.comet");
 
 }

Modified: tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/CometBindingFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/CometBindingFactory.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/CometBindingFactory.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/CometBindingFactory.java Tue Aug 24 13:08:55 2010
@@ -20,13 +20,13 @@
 package org.apache.tuscany.sca.binding.comet;
 
 /**
- * Factory to create CometBinding instances
+ * Factory to create CometBinding instances.
  */
 public interface CometBindingFactory {
 
     /**
-     * Create CometBinding model
+     * Create CometBinding model.
      */
     CometBinding createCometBinding();
-    
+
 }

Modified: tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/impl/CometBindingFactoryImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/impl/CometBindingFactoryImpl.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/impl/CometBindingFactoryImpl.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/impl/CometBindingFactoryImpl.java Tue Aug 24 13:08:55 2010
@@ -23,7 +23,7 @@ import org.apache.tuscany.sca.binding.co
 import org.apache.tuscany.sca.binding.comet.CometBindingFactory;
 
 /**
- * Factory implementation to create JSONP Models
+ * Factory implementation to create Comet models.
  */
 public class CometBindingFactoryImpl implements CometBindingFactory {
 

Modified: tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/impl/CometBindingImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/impl/CometBindingImpl.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/impl/CometBindingImpl.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-comet/src/main/java/org/apache/tuscany/sca/binding/comet/impl/CometBindingImpl.java Tue Aug 24 13:08:55 2010
@@ -32,56 +32,70 @@ public class CometBindingImpl implements
     private String name;
     private String uri;
 
+    @Override
     public String getName() {
-        return name;
+        return this.name;
     }
 
+    @Override
     public String getURI() {
-        return uri;
+        return this.uri;
     }
 
-    public void setURI(String uri) {
+    @Override
+    public void setURI(final String uri) {
         this.uri = uri;
     }
 
-    public void setName(String name) {
+    @Override
+    public void setName(final String name) {
         this.name = name;
     }
 
+    @Override
     public Object clone() throws CloneNotSupportedException {
         return super.clone();
     }
 
+    @Override
     public boolean isUnresolved() {
         return false;
     }
 
-    public void setUnresolved(boolean unresolved) {
+    @Override
+    public void setUnresolved(final boolean unresolved) {
     }
 
+    @Override
     public QName getType() {
-        return TYPE;
+        return CometBinding.TYPE;
     }
-    
+
+    @Override
     public WireFormat getRequestWireFormat() {
         return null;
     }
-    
-    public void setRequestWireFormat(WireFormat wireFormat) {  
+
+    @Override
+    public void setRequestWireFormat(final WireFormat wireFormat) {
     }
-    
+
+    @Override
     public WireFormat getResponseWireFormat() {
         return null;
     }
-    
-    public void setResponseWireFormat(WireFormat wireFormat) {
+
+    @Override
+    public void setResponseWireFormat(final WireFormat wireFormat) {
     }
-    
+
+    @Override
     public OperationSelector getOperationSelector() {
         return null;
     }
-    
-    public void setOperationSelector(OperationSelector operationSelector) {
-    }    
+
+    @Override
+    public void setOperationSelector(final OperationSelector operationSelector) {
+    }
 
 }

Modified: tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/Helper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/Helper.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/Helper.java (original)
+++ tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/Helper.java Tue Aug 24 13:08:55 2010
@@ -22,10 +22,13 @@ package org.apache.tuscany.sca.sample.co
 import java.util.Date;
 import java.util.Random;
 
-public class Helper {
+public final class Helper {
 
-    public static int randomInt(int max) {
+    public static int randomInt(final int max) {
         return (new Random(new Date().getTime()).nextInt(100));
     }
 
+    private Helper() {
+    }
+
 }

Modified: tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/PrecipitationService.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/PrecipitationService.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/PrecipitationService.java (original)
+++ tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/PrecipitationService.java Tue Aug 24 13:08:55 2010
@@ -27,5 +27,5 @@ import org.oasisopen.sca.annotation.Remo
 public interface PrecipitationService {
 
     Response getPrecipitation(Location location);
-    
+
 }

Modified: tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/PrecipitationServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/PrecipitationServiceImpl.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/PrecipitationServiceImpl.java (original)
+++ tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/PrecipitationServiceImpl.java Tue Aug 24 13:08:55 2010
@@ -29,8 +29,8 @@ import org.oasisopen.sca.annotation.Serv
 public class PrecipitationServiceImpl implements PrecipitationService {
 
     @Override
-    public Response getPrecipitation(Location location) {
-        Response response = new Response();
+    public Response getPrecipitation(final Location location) {
+        final Response response = new Response();
         response.setDate(new Date());
         response.setData(Helper.randomInt(100) + "%");
         return response;

Modified: tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/TemperatureHumidityServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/TemperatureHumidityServiceImpl.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/TemperatureHumidityServiceImpl.java (original)
+++ tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/TemperatureHumidityServiceImpl.java Tue Aug 24 13:08:55 2010
@@ -29,18 +29,18 @@ import org.oasisopen.sca.annotation.Serv
 public class TemperatureHumidityServiceImpl implements TemperatureService, HumidityService {
 
     @Override
-    public Response getHumidity(Location location) {
-        Response response = new Response();
+    public Response getHumidity(final Location location) {
+        final Response response = new Response();
         response.setDate(new Date());
         response.setData(Helper.randomInt(90) + "%");
         return response;
     }
 
     @Override
-    public Response getTemperature(Location location, int scale) {
-        Response response = new Response();
+    public Response getTemperature(final Location location, final int scale) {
+        final Response response = new Response();
         response.setDate(new Date());
-        String data = "" + Helper.randomInt(scale == CELSIUS ? 40 : 150);
+        final String data = "" + Helper.randomInt(scale == TemperatureService.CELSIUS ? 40 : 150);
         response.setData(data);
         return response;
     }

Modified: tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/model/Location.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/model/Location.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/model/Location.java (original)
+++ tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/model/Location.java Tue Aug 24 13:08:55 2010
@@ -25,18 +25,18 @@ public class Location {
     private String country;
 
     public String getCity() {
-        return city;
+        return this.city;
     }
 
-    public void setCity(String city) {
+    public void setCity(final String city) {
         this.city = city;
     }
 
     public String getCountry() {
-        return country;
+        return this.country;
     }
 
-    public void setCountry(String country) {
+    public void setCountry(final String country) {
         this.country = country;
     }
 

Modified: tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/model/Response.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/model/Response.java?rev=988521&r1=988520&r2=988521&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/model/Response.java (original)
+++ tuscany/sca-java-2.x/contrib/samples/comet-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/model/Response.java Tue Aug 24 13:08:55 2010
@@ -27,18 +27,18 @@ public class Response {
     private String data;
 
     public Date getDate() {
-        return date;
+        return this.date;
     }
 
-    public void setDate(Date date) {
+    public void setDate(final Date date) {
         this.date = date;
     }
 
     public String getData() {
-        return data;
+        return this.data;
     }
 
-    public void setData(String data) {
+    public void setData(final String data) {
         this.data = data;
     }