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.21
Committed: Thu Jan 18 23:09:56 2001 UTC (23 years, 4 months ago) by tdb
Branch: MAIN
Changes since 1.20: +3 -2 lines
Log Message:
Changes to reflect move of Component, ComponentStartException, and the
ReferenceManager from util to componentmanager.

File Contents

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