dblevins    2004/12/17 20:55:44

  Modified:    modules/core/src/java/org/openejb/server
                        ServiceAccessController.java
                        SimpleSocketService.java
  Added:       modules/core/src/java/org/openejb/server
                        StandardServiceStack.java
  Log:

  Added a StandardServiceStack which wraps the Deamon, Logger, AccessController,
  Pool and ServerService so that each is manageable as one unit.
  
  Added a new test to the HttpServerTest that uses the new StandardServiceStack
  
  Revision  Changes    Path
  1.5       +2 -2      
openejb/modules/core/src/java/org/openejb/server/ServiceAccessController.java
  
  Index: ServiceAccessController.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/server/ServiceAccessController.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ServiceAccessController.java      17 Dec 2004 05:54:22 -0000      1.4
  +++ ServiceAccessController.java      18 Dec 2004 01:55:43 -0000      1.5
  @@ -72,7 +72,7 @@
           this.next = next;
       }
   
  -    public ServiceAccessController(ServerService next, InetAddress[] 
allowedHosts) {
  +    public ServiceAccessController(String name, ServerService next, 
InetAddress[] allowedHosts) {
           this.next = next;
           this.allowHosts = allowedHosts;
       }
  
  
  
  1.12      +2 -2      
openejb/modules/core/src/java/org/openejb/server/SimpleSocketService.java
  
  Index: SimpleSocketService.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/server/SimpleSocketService.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SimpleSocketService.java  17 Dec 2004 06:12:27 -0000      1.11
  +++ SimpleSocketService.java  18 Dec 2004 01:55:43 -0000      1.12
  @@ -89,7 +89,7 @@
           String[] logOnFailure = new String[]{"HOST","NAME"};
   
           service = new ServicePool(name, service, threads, priority);
  -        service = new ServiceAccessController(service, onlyFrom);
  +        service = new ServiceAccessController(name, service, onlyFrom);
           service = new ServiceLogger(name, service, logOnSuccess, 
logOnFailure);
           server = service;
   
  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/server/StandardServiceStack.java
  
  Index: StandardServiceStack.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 2. Redistributions in binary form must reproduce the
   *    above copyright notice, this list of conditions and the
   *    following disclaimer in the documentation and/or other
   *    materials provided with the distribution.
   *
   * 3. The name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.org/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
   * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: StandardServiceStack.java,v 1.1 2004/12/18 01:55:43 dblevins Exp $
   */
  package org.openejb.server;
  
  import java.net.InetAddress;
  
  import org.apache.geronimo.gbean.GBeanLifecycle;
  import org.apache.geronimo.gbean.WaitingException;
  
  public class StandardServiceStack implements GBeanLifecycle {
  
      private String name;
  
      private ServiceDaemon daemon;
      private ServiceLogger logger;
      private ServiceAccessController hba;
      private ServicePool pool;
      private ServerService server;
  
      public StandardServiceStack(String name, int port, InetAddress address, 
InetAddress[] allowHosts, int threads, int priority, String[] logOnSuccess, 
String[] logOnFailure, ServerService server) {
          this.name = name;
          this.server = server;
  
          this.pool = new ServicePool(name, server, threads, priority);
          this.hba = new ServiceAccessController(name, pool, allowHosts);
          this.logger = new ServiceLogger(name, hba, logOnSuccess, 
logOnFailure);
          this.daemon = new ServiceDaemon(name, logger, address, port);
      }
  
      public InetAddress getAddress() {
          return daemon.getAddress();
      }
  
      public int getPort() {
          return daemon.getPort();
      }
  
      public String[] getLogOnSuccess() {
          return logger.getLogOnSuccess();
      }
  
      public String[] getLogOnFailure() {
          return logger.getLogOnFailure();
      }
  
      public InetAddress[] getAllowHosts() {
          return hba.getAllowHosts();
      }
  
      public void setAllowHosts(InetAddress[] allowHosts) {
          hba.setAllowHosts(allowHosts);
      }
  
      public int getThreads() {
          return pool.getThreads();
      }
  
      public int getPriority() {
          return pool.getPriority();
      }
  
      public void doStart() throws WaitingException, Exception {
          daemon.doStart();
      }
  
      public void doStop() throws WaitingException, Exception {
          daemon.doStop();
      }
  
      public void doFail() {
          daemon.doFail();
      }
  
  
  }
  
  
  

Reply via email to