--- projects/cms/source/server/uk/org/iscream/cms/server/filtermanager/HostInit.java 2000/12/07 00:02:17 1.11 +++ projects/cms/source/server/uk/org/iscream/cms/server/filtermanager/HostInit.java 2000/12/12 19:17:02 1.12 @@ -10,9 +10,11 @@ import java.io.*; /** * Handles setting up a host. + * This class provides a host with appropriate configuration + * and a reference to a Filter to which it should pass data. * - * @author $Author: tdb $ - * @version $Id: HostInit.java,v 1.11 2000/12/07 00:02:17 tdb Exp $ + * @author $Author: ajm $ + * @version $Id: HostInit.java,v 1.12 2000/12/12 19:17:02 ajm Exp $ */ class HostInit extends Thread { @@ -21,7 +23,7 @@ class HostInit extends Thread { /** * The current CVS revision of this class */ - public final String REVISION = "$Revision: 1.11 $"; + public final String REVISION = "$Revision: 1.12 $"; //---STATIC METHODS--- @@ -138,7 +140,7 @@ class HostInit extends Thread { } } catch (Exception e) { - _logger.write(toString(), Logger.ERROR, "ERROR: " + e.getMessage()); + _logger.write(toString(), Logger.ERROR, "ERROR - " + e.getMessage()); } _socketOut.flush(); @@ -157,12 +159,16 @@ class HostInit extends Thread { * Overrides the {@link java.lang.Object#toString() Object.toString()} * method to provide clean logging (every class should have this). * + * This uses the uk.ac.ukc.iscream.util.NameFormat class + * to format the toString() + * * @return the name of this class and its CVS revision */ public String toString() { - return this.getClass().getName() + "{" + _socket.getInetAddress().getHostName() - + "}(" + REVISION.substring(11, REVISION.length() - 2) + ")"; - + return FormatName.getName( + _name, + this.getClass().getName(), + REVISION); } //---PRIVATE METHODS--- @@ -172,18 +178,41 @@ class HostInit extends Thread { //---ATTRIBUTES--- /** - * A reference to the logger the system is using + * This holds a reference to the + * system logger that is being used. */ - Logger _logger = ReferenceManager.getInstance().getLogger(); + private Logger _logger = ReferenceManager.getInstance().getLogger(); /** * A reference to the Configuration Manager the system is using */ - ConfigurationManager _configManager = ReferenceManager.getInstance().getCM(); + private ConfigurationManager _configManager = ReferenceManager.getInstance().getCM(); - Socket _socket; - BufferedReader _socketIn; - PrintWriter _socketOut; + /** + * This is the friendly identifier of the + * component this class is running in. + * eg, a Filter may be called "filter1", + * If this class does not have an owning + * component, a name from the configuration + * can be placed here. This name could also + * be changed to null for utility classes. + */ + private String _name = FilterManager.NAME; + + /** + * The socket this class uses + */ + private Socket _socket; + + /** + * Used for the input stream of this socket + */ + private BufferedReader _socketIn; + + /** + * Used for the output stream of this socket + */ + private PrintWriter _socketOut; //---STATIC ATTRIBUTES---