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.13 by ajm, Wed Nov 29 21:27:08 2000 UTC vs.
Revision 1.21 by tdb, Sat May 18 18:16:01 2002 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines