ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/core/ConfigurationServant.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/core/ConfigurationServant.java (file contents):
Revision 1.12 by ajm, Tue Nov 21 21:58:52 2000 UTC vs.
Revision 1.22 by tdb, Tue May 21 16:47:17 2002 UTC

# Line 1 | Line 1
1 + /*
2 + * i-scream central monitoring system
3 + * http://www.i-scream.org.uk
4 + * Copyright (C) 2000-2002 i-scream
5 + *
6 + * This program is free software; you can redistribute it and/or
7 + * modify it under the terms of the GNU General Public License
8 + * as published by the Free Software Foundation; either version 2
9 + * of the License, or (at your option) any later version.
10 + *
11 + * This program is distributed in the hope that it will be useful,
12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 + * GNU General Public License for more details.
15 + *
16 + * You should have received a copy of the GNU General Public License
17 + * along with this program; if not, write to the Free Software
18 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 + */
20 +
21   //---PACKAGE DECLARATION---
22 + package uk.org.iscream.cms.server.core;
23  
24   //---IMPORTS---
25 < import uk.ac.ukc.iscream.core.*;
26 < import java.util.*;
27 < import java.io.*;
25 > import uk.org.iscream.cms.server.util.*;
26 > import uk.org.iscream.cms.server.componentmanager.*;
27 > import java.util.Properties;
28 > import java.util.Date;
29   import java.text.DateFormat;
30  
31   /**
# Line 44 | Line 66 | class ConfigurationServant extends ConfigurationPOA {
66       * @param lastModified the most recent last modified value for the file list
67       * @param logRef a reference to the logger system
68       */
69 <    ConfigurationServant(Properties properties, String fileList, long lastModified, Logger logRef) {
69 >    ConfigurationServant(Properties properties, String fileList, long lastModified) {
70          // assign local variables
71          _properties = properties;
72          _lastModified = lastModified;
73          _fileList = fileList;
74 <        _logRef = logRef;
53 <        _logRef.write(this.toString(), Logger.SYSINIT, "created");
74 >        _logger.write(toString(), Logger.SYSINIT, "created");
75          String date = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(new Date(getLastModified()));
76 <        _logRef.write(this.toString(), Logger.SYSMSG, "last modified - " + date);
77 <        _logRef.write(this.toString(), Logger.DEBUG, "file list - " + _fileList);
76 >        _logger.write(toString(), Logger.SYSMSG, "last modified - " + date);
77 >        _logger.write(toString(), Logger.DEBUG, "file list - " + _fileList);
78      }
79  
80   //---PUBLIC METHODS---
# Line 73 | Line 94 | class ConfigurationServant extends ConfigurationPOA {
94       * Overrides the {@link java.lang.Object#toString() Object.toString()}
95       * method to provide clean logging (every class should have this).
96       *
97 +     * This uses the uk.org.iscream.cms.server.util.FormatName class
98 +     * to format the toString()
99 +     *
100       * @return the name of this class and its CVS revision
101       */
102      public String toString() {
103 <        return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")";
103 >        return FormatName.getName(
104 >            _name,
105 >            getClass().getName(),
106 >            REVISION);
107      }
108 +    
109 +    /**
110 +     * Unhooks this Configuration object from the ORB
111 +     */
112 +    public void disconnect() {
113 +        try {
114 +            byte[] oid = _refman.getRootPOA().servant_to_id(this);
115 +            _refman.getRootPOA().deactivate_object(oid);
116 +        } catch(Exception e) {
117 +            _logger.write(this.toString(), Logger.ERROR, "disconnect failed: "+e);
118 +        }
119 +    }
120 +        
121  
122   //---PRIVATE METHODS---
123  
# Line 87 | Line 127 | class ConfigurationServant extends ConfigurationPOA {
127       * is destroyed
128       */
129      protected void finalize() throws Throwable {
130 <        _logRef.write(this.toString(), Logger.DEBUG, "finalized (ick, us english!)");
130 >        _logger.write(this.toString(), Logger.DEBUG, "finalized");
131      }
132  
133   //---ACCESSOR/MUTATOR METHODS---
# Line 120 | Line 160 | class ConfigurationServant extends ConfigurationPOA {
160      private Properties _properties = new Properties();
161  
162      /**
163 <     * Reference to a Logger
163 >     * This holds a reference to the
164 >     * system logger that is being used.
165       */
166 <    private Logger _logRef;
166 >    private Logger _logger = ReferenceManager.getInstance().getLogger();
167  
168      /**
169 +     * A reference to the reference manager in use
170 +     */
171 +    private ReferenceManager _refman = ReferenceManager.getInstance();
172 +    
173 +    /**
174 +     * This is the friendly identifier of the
175 +     * component this class is running in.
176 +     * eg, a Filter may be called "filter1",
177 +     * If this class does not have an owning
178 +     * component,  a name from the configuration
179 +     * can be placed here.  This name could also
180 +     * be changed to null for utility classes.
181 +     */
182 +    private String _name = Core.NAME;
183 +
184 +    /**
185       * The date stamp of the configuration file
186       * this object is using
187       */
188      private long _lastModified;
132    
189      
190      /**
191       * The list of files that were used to build this configuration

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines