Source code for /engineering/autohit-2003/src/autohit/common/channels/Channel.javaOriginal file Channel.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.common.channels;
  22 import java.util.Enumeration;
  23 
  24 /**
  25  * Channel interface
  26  * 
  27  * @author Erich P. Gatejen
  28  * @version 1.0 <i>Version History</i>
  29  * <code>EPG - Initial - 25Apr03</code>
  30  */
  31 public interface Channel {
  32 
  33 	/**
  34 	 * Constants */
  35 	public final static String BAD_RECEIPT = "bad";
  36 
  37 	/**
  38 	 * Register an injector
  39 	 * 
  40 	 * @param name
  41 	 *           reference
  42 	 * @param i
  43 	 *           An injector
  44 	 * @see autohit.common.channels.Injector
  45 	 */
  46 	public void register(String name, Injector i) throws ChannelException;
  47 
  48 	/**
  49 	 * Register a drain
  50 	 * 
  51 	 * @param name
  52 	 *           reference
  53 	 * @param d
  54 	 *           A drain
  55 	 * @see autohit.common.channels.Drain
  56 	 */
  57 	public void register(String name, Drain d) throws ChannelException;
  58 
  59 	/**
  60 	 * Get a drain by name
  61 	 * 
  62 	 * @param name
  63 	 *           Name reference to the drain
  64 	 * @return Drain reference or null if not found
  65 	 * @see autohit.common.channels.Drain
  66 	 */
  67 	public Drain getDrain(String name) throws ChannelException;
  68 
  69 	/**
  70 	 * Get an injector by name
  71 	 * 
  72 	 * @param name
  73 	 *           Name reference to the injector
  74 	 * @return Injector reference or null if not found
  75 	 * @see autohit.common.channels.Drain
  76 	 */
  77 	public Injector getInjector(String name) throws ChannelException;
  78 
  79 	/**
  80 	 * Enumerate injectors
  81 	 * 
  82 	 * @return an enumeration of injectors
  83 	 * @see autohit.common.channels.Injector
  84 	 */
  85 	public Enumeration enumInjector() throws ChannelException;
  86 
  87 	/**
  88 	 * Remove an injector
  89 	 * 
  90 	 * @param name
  91 	 *           reference
  92 	 * @see autohit.common.channels.Injector
  93 	 */
  94 	public void removeInjector(String name) throws ChannelException;
  95 
  96 	/**
  97 	 * Remove a drain
  98 	 * 
  99 	 * @param name
 100 	 *           reference
 101 	 * @see autohit.common.channels.Drain
 102 	 */
 103 	public void removeDrain(String name) throws ChannelException;
 104 
 105 	/**
 106 	 * Typically called by an injector
 107 	 * 
 108 	 * @param a
 109 	 *           An item
 110 	 */
 111 	public Receipt inject(Atom a) throws ChannelException;
 112 
 113 	/**
 114 	 * Request level for named Drain
 115 	 * 
 116 	 * @param name
 117 	 *           Drain's name
 118 	 * @param level
 119 	 *           the level as specifies in an Atom
 120 	 * @see autohit.common.channels.Atom
 121 	 */
 122 	public Receipt requestLevel(String name, int level) throws ChannelException;
 123 
 124 	/**
 125 	 * Remove level for named Drain
 126 	 * 
 127 	 * @param name
 128 	 *           Drain's name
 129 	 * @param level
 130 	 *           the level as specifies in an Atom
 131 	 * @see autohit.common.channels.Atom
 132 	 */
 133 	public Receipt removeLevel(String name, int level) throws ChannelException;
 134 
 135 	/**
 136 	 * Request type
 137 	 * 
 138 	 * @param name
 139 	 *           Drain's name
 140 	 * @param type
 141 	 *           the type as specified in Atom
 142 	 * @see autohit.common.channels.Atom
 143 	 */
 144 	public Receipt requestType(String name, int type) throws ChannelException;
 145 	;
 146 
 147 	/**
 148 	 * Request type
 149 	 * 
 150 	 * @param name
 151 	 *           Drain's name
 152 	 * @param type
 153 	 *           the type as specified in Atom
 154 	 * @see autohit.common.channels.Atom
 155 	 */
 156 	public Receipt removeType(String name, int type) throws ChannelException;
 157 
 158 	/**
 159 	 * Set exclusive
 160 	 * 
 161 	 * @param name
 162 	 *           Drain's name
 163 	 */
 164 	public Receipt setExclusive(String name) throws ChannelException;
 165 
 166 	/**
 167 	 * Remove exclusive
 168 	 * 
 169 	 * @param name
 170 	 *           Drain's name
 171 	 */
 172 	public Receipt removeExclusive(String name) throws ChannelException;
 173 
 174 }