View Javadoc

1   /**********************************************************************
2    * InJvmProcessorFactory.java
3    * created on 22.05.2007 by netseeker
4    * $Id: InJvmProcessorFactory.java,v 1.3 2007/11/17 10:57:03 netseeker Exp $
5    * $Log: InJvmProcessorFactory.java,v $
6    * Revision 1.3  2007/11/17 10:57:03  netseeker
7    * *** empty log message ***
8    *
9    * Revision 1.2  2007/05/27 22:13:09  netseeker
10   * *** empty log message ***
11   *
12   * Revision 1.1  2007/05/22 22:50:45  netseeker
13   * added In-JVM processing mode, fixed a minor bug within the serverside detection of ADAPTER_STRATEGY_DIRECT.
14   *
15   *
16   * ====================================================================
17   *
18   *  Copyright 2005-2006 netseeker aka Michael Manske
19   *
20   *  Licensed under the Apache License, Version 2.0 (the "License");
21   *  you may not use this file except in compliance with the License.
22   *  You may obtain a copy of the License at
23   *
24   *      http://www.apache.org/licenses/LICENSE-2.0
25   *
26   *  Unless required by applicable law or agreed to in writing, software
27   *  distributed under the License is distributed on an "AS IS" BASIS,
28   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29   *  See the License for the specific language governing permissions and
30   *  limitations under the License.
31   * ====================================================================
32   *
33   * This file is part of the EJOE framework.
34   * For more information on the author, please see
35   * <http://www.manskes.de/>.
36   *
37   *********************************************************************/
38  package de.netseeker.ejoe.core;
39  
40  import de.netseeker.ejoe.ConnectionHeader;
41  import de.netseeker.ejoe.EJServer;
42  
43  /***
44   * A simple factory using the EJServerRegistry to look up an existing local
45   * (within the same JVM) EJServer for the given client connection header.
46   * It produces instances of InJvmProcessor, which are able to communicate
47   * directly with the ServerHandler of the found local EJServer and can be used by EJClient
48   * instead of a socket connection.
49   * @author netseeker
50   * @since 0.3.9.3
51   */
52  public abstract class InJvmProcessorFactory
53  {
54      /***
55       * @param server
56       * @param clientHeader
57       * @return
58       */
59      public static InJvmProcessor createProcessor(ConnectionHeader clientHeader)
60      {
61          EJServerRegistry registry = EJServerRegistry.getInstance();
62          EJServer server = registry.lookup();
63          return new InJvmProcessor(server.getServerInfo(), clientHeader);
64      }
65  }