Source code for /engineering/autohit-2003/src/autohit/server/SystemContext.javaOriginal file SystemContext.java
   1 /**
   2  * AUTOHIT 2003
   3  * Copyright Erich P Gatejen (c) 1989,1997,2003,2004
   4  * 
   5  * This program is free software; you can redistribute it and/or modify 
   6  * it under the terms of the GNU General Public License as published by 
   7  * the Free Software Foundation; either version 2 of the License, or (at
   8  * your option) any later version.
   9  * This program is distributed in the hope that it will be useful, but
  10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12  * more details.
  13  * 
  14  * You should have received a copy of the GNU General Public License along
  15  * with this program; if not, write to the Free Software Foundation, Inc.,
  16  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17  *
  18  * Additional license information can be found in the documentation.
  19  * @author Erich P Gatejen
  20  */
  21 package autohit.server;
  22 
  23 import org.apache.commons.collections.ExtendedProperties;
  24 
  25 import autohit.common.AutohitBasicLogManager;
  26 import autohit.common.AutohitLogInjectorWrapper;
  27 import autohit.common.channels.Injector;
  28 import autohit.creator.compiler.XmlCompiler;
  29 import autohit.universe.Universe;
  30 import autohit.vm.VMLoader;
  31 import autohit.server.command.CommandRegistry;
  32 
  33 /**
  34  * A system context interface.  A context contains the cummulative knowledge
  35  * of a system.  It will return references to various subsystems.  All the
  36  * subsystems should be thread safe, though only the core and universe provide
  37  * methods and services specifically intended for IPC communication.
  38  * <p><pre>
  39  * Each will have references to:
  40  *  - A system properties set
  41  *  - A universe factory
  42  *  - A default universe
  43  *  - A root logger and log manager
  44  *  - A uninitialized Kernel
  45  *  - A uninitialized root loader
  46  *  - An invoker properties set
  47  * </pre>
  48  *
  49  * @author Erich P. Gatejen
  50  * @version 1.0
  51  * <i>Version History</i>
  52  * <code>EPG - Initial - 25Apr03 
  53  * EPG - Add the invoker properties - 30Jul03</code>
  54  */
  55 public interface SystemContext {
  56 
  57 	/**
  58 	 * Initialize using a set of properties.  It will destroy any
  59 	 * previous context.  It will build the components as specified
  60 	 * in the passed properties.
  61 	 * @param props properties set
  62 	 */
  63 	public void init(ExtendedProperties props) throws Exception;
  64 
  65 	/**
  66 	 *  Load properties.  It will only overwrite duplicate properties.
  67 	 *  It will not change services/components build during an init()!
  68 	 * @param props properties set
  69 	 */
  70 	public void loadProperties(ExtendedProperties props) throws Exception;
  71 
  72 	/**
  73 	 *  Get the default universe.  Return null if not available.
  74 	 * @return Universe service interface
  75 	 */
  76 	public Universe getUniverse();
  77 
  78 	/**
  79 	 *  Get a universe service by handle.  Return null if not available.
  80 	 *  What a handle means is determined by the implemementing class.
  81 	 * @param handle handle to the universe
  82 	 * @return Universe service interface
  83 	 */
  84 	public Universe getUniverse(String handle);
  85 
  86 	/**
  87 	 *  Get the XML compiler.  Return null if not available.
  88 	 * @return XmlCompiler base class
  89 	 */
  90 	public XmlCompiler getCompiler();
  91 
  92 	/**
  93 	 *  Get a reference to a generic, root log injector
  94 	 * @return XmlCompiler base class
  95 	 */
  96 	public AutohitLogInjectorWrapper getRootLogger();
  97 
  98 	/**
  99 	 *  Get event dispatcher injector
 100 	 * @return Injector reference
 101 	 */
 102 	public Injector getEventDispatcher();
 103 
 104 	/**
 105 	 *  Get log manager
 106 	 * @return reference to the main log manager
 107 	 */
 108 	public AutohitBasicLogManager getLogManager();
 109 
 110 	/**
 111 	 *  Get properties set.  Return null if not available.
 112 	 * @return reference to the properties set
 113 	 */
 114 	public ExtendedProperties getPropertiesSet();
 115 
 116 	/**
 117 	 *  Get the Kernel
 118 	 * @return reference to the kernel
 119 	 */
 120 	public Kernel getKernel();
 121 
 122 	/**
 123 	 *  Get the VM Loader
 124 	 * @return reference to the kernel
 125 	 */
 126 	public VMLoader getLoader();
 127 
 128 	/**
 129 	 *  Get the command registry.  It is up to the implimentor as how to do this.  It is not cached.
 130 	 * @return a command registry instance
 131 	 */
 132 	public CommandRegistry getCommandRegistry();
 133 
 134 	/**
 135 	 *  Unique number
 136 	 * @return an integer number unique (at least) to this Context
 137 	 */
 138 	public int uniqueInteger();
 139 
 140 	/**
 141 	 *  Get debugging state
 142 	 * @return true if debugging active
 143 	 */
 144 	public boolean debuggingState();
 145 	
 146 	/**
 147 	 * Get a reference to the invoker properties set.   Generally, only
 148 	 * invokers should add anything to the set.  It should be safe for anyone
 149 	 * to read from it.  It is up to the invoker to maintain its contents.
 150 	 * @return reference to the invoker properties set
 151 	 */
 152 	public ExtendedProperties getInvokerProperties();
 153 
 154 }