1 17 package org.openejb.server.httpd; 18 19 import org.openejb.server.ServerService; 20 import org.openejb.server.ServiceException; 21 import org.openejb.server.ejbd.EjbServer; 22 23 import java.util.Properties ; 24 import java.net.Socket ; 25 import java.io.IOException ; 26 import java.io.InputStream ; 27 import java.io.OutputStream ; 28 29 32 public class HttpEjbServer implements ServerService { 33 34 private HttpServer httpServer; 35 private String name; 36 37 public void init(Properties props) throws Exception { 38 name = props.getProperty("name"); 39 EjbServer ejbServer = new EjbServer(); 40 ServerServiceAdapter adapter = new ServerServiceAdapter(ejbServer); 41 httpServer = new HttpServer(adapter); 42 httpServer.init(props); 43 ejbServer.init(props); 44 } 45 46 47 public void service(Socket socket) throws ServiceException, IOException { 48 httpServer.service(socket); 49 } 50 51 public void service(InputStream in, OutputStream out) throws ServiceException, IOException { 52 httpServer.service(in, out); 53 } 54 55 public void start() throws ServiceException { 56 httpServer.start(); 57 } 58 59 public void stop() throws ServiceException { 60 httpServer.stop(); 61 } 62 63 public String getName() { 64 return name; 65 } 66 67 public int getPort() { 68 return httpServer.getPort(); 69 } 70 71 public String getIP() { 72 return httpServer.getIP(); 73 } 74 } 75 | Popular Tags |