Title: [2533] trunk/openejb3/server/openejb-http/src/main/java/org/openejb/server/httpd/HttpEjbServer.java: Ported from 1.x branch
Revision
2533
Author
dblevins
Date
2006-03-10 02:56:03 -0500 (Fri, 10 Mar 2006)

Log Message

Ported from 1.x branch

Added Paths


Diff

Added: trunk/openejb3/server/openejb-http/src/main/java/org/openejb/server/httpd/HttpEjbServer.java (2532 => 2533)

--- trunk/openejb3/server/openejb-http/src/main/java/org/openejb/server/httpd/HttpEjbServer.java	2006-03-10 03:07:00 UTC (rev 2532)
+++ trunk/openejb3/server/openejb-http/src/main/java/org/openejb/server/httpd/HttpEjbServer.java	2006-03-10 07:56:03 UTC (rev 2533)
@@ -0,0 +1,74 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed 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.openejb.server.httpd;
+
+import org.openejb.server.ServerService;
+import org.openejb.server.ServiceException;
+import org.openejb.server.ejbd.EjbServer;
+
+import java.util.Properties;
+import java.net.Socket;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class HttpEjbServer implements ServerService {
+
+    private HttpServer httpServer;
+    private String name;
+
+    public void init(Properties props) throws Exception {
+        name = props.getProperty("name");
+        EjbServer ejbServer = new EjbServer();
+        ServerServiceAdapter adapter = new ServerServiceAdapter(ejbServer);
+        httpServer = new HttpServer(adapter);
+        httpServer.init(props);
+        ejbServer.init(props);
+    }
+
+
+    public void service(Socket socket) throws ServiceException, IOException {
+        httpServer.service(socket);
+    }
+
+    public void service(InputStream in, OutputStream out) throws ServiceException, IOException {
+        httpServer.service(in, out);
+    }
+
+    public void start() throws ServiceException {
+        httpServer.start();
+    }
+
+    public void stop() throws ServiceException {
+        httpServer.stop();
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public int getPort() {
+        return httpServer.getPort();
+    }
+
+    public String getIP() {
+        return httpServer.getIP();
+    }
+}

Reply via email to