tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmar...@apache.org
Subject svn commit: r411404 - in /incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty: pom.xml src/main/java/org/apache/tuscany/service/jetty/JettyServiceImpl.java src/main/java/org/apache/tuscany/service/jetty/TransportMonitor.java
Date Sat, 03 Jun 2006 08:20:01 GMT
Author: jmarino
Date: Sat Jun  3 01:20:01 2006
New Revision: 411404

URL: http://svn.apache.org/viewvc?rev=411404&view=rev
Log:
skeleton service

Modified:
    incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty/pom.xml
    incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyServiceImpl.java
    incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/TransportMonitor.java

Modified: incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty/pom.xml?rev=411404&r1=411403&r2=411404&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty/pom.xml (original)
+++ incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty/pom.xml Sat Jun 
3 01:20:01 2006
@@ -25,14 +25,14 @@
     <name>Tuscany Jetty HTTP Service</name>
     <description>Tuscany Jetty HTTP Service</description>
     <version>SNAPSHOT</version>
-<!--	 
+   <!-- <repositories>
 	 <repository>
 		<id>mortbay-release-repo</id>
 		<name>MortBay Release Repo</name>
 		<url>http://jetty.mortbay.org/maven2/release</url>	
 	 </repository>
+    </repositories>
 -->
-
     <dependencies>
         <dependency>
             <groupId>org.apache.tuscany</groupId>

Modified: incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyServiceImpl.java?rev=411404&r1=411403&r2=411404&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyServiceImpl.java
(original)
+++ incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyServiceImpl.java
Sat Jun  3 01:20:01 2006
@@ -1,16 +1,22 @@
 package org.apache.tuscany.service.jetty;
 
+import javax.resource.spi.work.WorkManager;
+import javax.resource.spi.work.Work;
+import javax.resource.spi.work.WorkException;
 import javax.servlet.Servlet;
 
+import org.apache.tuscany.spi.annotation.Autowire;
 import org.apache.tuscany.spi.annotation.Monitor;
 import org.apache.tuscany.spi.host.ServletHost;
 import org.osoa.sca.annotations.Destroy;
 import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
 import org.osoa.sca.annotations.Scope;
 import org.osoa.sca.annotations.Service;
-import org.osoa.sca.annotations.Property;
 
 /**
+ * Implements an HTTP transport service using Jetty
+ *
  * @version $$Rev$$ $$Date$$
  */
 @Scope("MODULE")
@@ -18,6 +24,8 @@
 public class JettyServiceImpl implements JettyService {
 
     private TransportMonitor monitor;
+    private WorkManager workManager;
+
     private int port = 8080;
 
     @Monitor
@@ -25,6 +33,11 @@
         this.monitor = monitor;
     }
 
+    @Autowire
+    public void setWorkManager(WorkManager workManager) {
+        this.workManager = workManager;
+    }
+
     @Property
     public void setPort(int port) {
         this.port = port;
@@ -32,6 +45,42 @@
 
     @Init
     public void init() {
+
+//        Server server = new Server();
+//
+//        BoundedThreadPool threadPool = new BoundedThreadPool();
+//        threadPool.setMaxThreads(100);
+//        server.setThreadPool(threadPool);
+//
+//        Connector connector=new SelectChannelConnector();
+//        connector.setPort(port);
+//        server.setConnectors(new Connector[]{connector});
+//
+//        HandlerCollection handlers = new HandlerCollection();
+//        ContextHandlerCollection contexts = new ContextHandlerCollection();
+//        RequestLogHandler requestLogHandler = new RequestLogHandler();
+//        handlers.setHandlers(new Handler[]{contexts,new DefaultHandler(),requestLogHandler});
+//        server.setHandler(handlers);
+//
+//        // TODO add javadoc context to contexts
+//
+//        WebAppContext.addWebApplications(server, "./webapps", "org/mortbay/jetty/webapp/webdefault.xml",
true, false);
+//
+//        HashUserRealm userRealm = new HashUserRealm();
+//        userRealm.setName("Test Realm");
+//        userRealm.setConfig("./etc/realm.properties");
+//        server.setUserRealms(new UserRealm[]{userRealm});
+//
+//        NCSARequestLog requestLog = new NCSARequestLog("./logs/jetty-yyyy-mm-dd.log");
+//        requestLog.setExtended(false);
+//        requestLogHandler.setRequestLog(requestLog);
+//
+//        server.setStopAtShutdown(true);
+//        server.setSendServerVersion(true);
+//
+//        server.start();
+//        server.join();
+
         monitor.started(port);
     }
 
@@ -46,6 +95,52 @@
 
     public void unregisterMapping(String string) {
 
+    }
+
+    private class TuscanyThreadPool { //implements ThreadPool{
+
+        public boolean dispatch(Runnable job){
+            try {
+                workManager.doWork(new TuscanyWork(job));
+            } catch (WorkException e) {
+                //FIXME
+                monitor.requestHandleError(e);
+            }
+            return true;
+        }
+
+        public void join() throws InterruptedException {
+            throw new UnsupportedOperationException();
+        }
+
+        public int getThreads() {
+            throw new UnsupportedOperationException();
+        }
+
+        public int getIdleThreads() {
+            throw new UnsupportedOperationException();
+        }
+
+        public boolean isLowOnThreads() {
+            throw new UnsupportedOperationException();
+        }
+
+    }
+
+    private class TuscanyWork implements Work{
+
+        Runnable job;
+
+        public TuscanyWork(Runnable job) {
+            this.job = job;
+        }
+
+        public void release() {
+        }
+
+        public void run() {
+            job.run();
+        }
     }
 
 }

Modified: incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/TransportMonitor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/TransportMonitor.java?rev=411404&r1=411403&r2=411404&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/TransportMonitor.java
(original)
+++ incubator/tuscany/sandbox/jboynes/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/TransportMonitor.java
Sat Jun  3 01:20:01 2006
@@ -13,4 +13,5 @@
 
     void shutdownError(int port, Exception e);
 
+    void requestHandleError(Exception e);
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message