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/Core.java
Revision: 1.20
Committed: Tue Dec 12 19:56:08 2000 UTC (23 years, 5 months ago) by ajm
Branch: MAIN
Changes since 1.19: +4 -5 lines
Log Message:
fixed a few typos

File Contents

# User Rev Content
1 tdb 1.13 //---PACKAGE DECLARATION---
2 ajm 1.16 package uk.ac.ukc.iscream.core;
3 tdb 1.13
4     //---IMPORTS---
5 ajm 1.18 import uk.ac.ukc.iscream.util.*;
6 tdb 1.13
7     /**
8     * The main class for the CORE of the I-Scream system.
9 ajm 1.18 * This class is the component for CORE I-Scream services
10     * namely the Logger and the ConfigurationManager.
11     * It registers and starts them, at which point it essentially
12 tdb 1.13 * finishs its role and the started services continue to
13     * serve requests from the I-Scream system.
14     *
15 ajm 1.17 * @author $Author: ajm4 $
16 ajm 1.20 * @version $Id: Core.java,v 1.19 2000/12/12 19:16:01 ajm4 Exp $
17 tdb 1.13 */
18 ajm 1.17 public class Core implements uk.ac.ukc.iscream.util.Component {
19 tdb 1.13
20     //---FINAL ATTRIBUTES---
21    
22     /**
23     * The current CVS revision of this class
24     */
25 ajm 1.20 public static final String REVISION = "$Revision: 1.19 $";
26 tdb 1.13
27     /**
28 ajm 1.20 * The friendly name for this component, used by
29 ajm 1.18 * all related classes.
30 tdb 1.13 */
31 ajm 1.19 public static final String NAME = "Core";
32 tdb 1.13
33     //---STATIC METHODS---
34    
35 ajm 1.17 //---CONSTRUCTORS---
36    
37     //---PUBLIC METHODS---
38    
39 tdb 1.13 /**
40 ajm 1.18 * This method starts the CORE
41 tdb 1.13 * Currently the args are passed direct to the ORB,
42     * so any ORB paramaters could go there.
43     *
44     */
45 ajm 1.18 public void start() throws ComponentStartException {
46 ajm 1.17 // start and bind each server in turn
47    
48     // work out which logger to use
49     String whichLogger = System.getProperty("uk.ac.ukc.iscream.LoggerClass");
50     String loggerPackage = System.getProperty("uk.ac.ukc.iscream.LoggerPackage");
51    
52     // construct the relevant LoggerImpl
53     LoggerImpl loggerImplRef = null;
54 tdb 1.13 try {
55 ajm 1.17 loggerImplRef = (LoggerImpl) ClassLoader.getSystemClassLoader().loadClass(loggerPackage + "." + whichLogger).newInstance();
56 tdb 1.13 } catch (Exception e) {
57 ajm 1.18 // if anything goes wrong we throw a failed start exception
58     throw new ComponentStartException("unable to load logging class");
59 tdb 1.13 }
60 ajm 1.19
61 ajm 1.17 // setup and bind the LoggerServant
62     LoggerServant loggerRef = new LoggerServant(loggerImplRef);
63     _refman.bindToOrb(loggerRef, "iscream.Logger");
64 tdb 1.13
65 ajm 1.17 // get a reference to the servant as a Logger
66     _logger = _refman.getLogger();
67 tdb 1.13
68 ajm 1.17 // create the Configurator
69 ajm 1.18 ConfigurationManagerServant configManRef = new ConfigurationManagerServant();
70 ajm 1.17
71     // and advertise it to the naming context
72     _refman.bindToOrb(configManRef, "iscream.ConfigurationManager");
73    
74 ajm 1.18 _logger.write(toString(), Logger.SYSINIT, "started");
75     }
76    
77     /**
78     * Overrides the {@link java.lang.Object#toString() Object.toString()}
79     * method to provide clean logging (every class should have this).
80     *
81     * This uses the uk.ac.ukc.iscream.util.NameFormat class
82     * to format the toString()
83     *
84     * @return the name of this class and its CVS revision
85     */
86     public String toString() {
87     return FormatName.getName(
88     _name,
89 ajm 1.20 getClass().getName(),
90 ajm 1.18 REVISION);
91 tdb 1.13 }
92    
93     //---PRIVATE METHODS---
94    
95     //---ACCESSOR/MUTATOR METHODS---
96    
97     //---ATTRIBUTES---
98 ajm 1.18
99     /**
100     * This is the friendly identifier of the
101     * component this class is running in.
102     * eg, a Filter may be called "filter1",
103     * If this class does not have an owning
104     * component, a name from the configuration
105     * can be placed here. This name could also
106     * be changed to null for utility classes.
107     */
108     private String _name = Core.NAME;
109    
110     /**
111     * This holds a reference to the
112     * system logger that is being used.
113     */
114     private Logger _logger;
115    
116     /**
117     * A reference to the reference manager in use
118     */
119     private ReferenceManager _refman = ReferenceManager.getInstance();
120 tdb 1.13
121     //---STATIC ATTRIBUTES---
122    
123     }