91 |
|
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); |
92 |
|
|
93 |
|
// start and bind each server in turn |
94 |
< |
|
95 |
< |
// create the logger (either Screen or File) |
96 |
< |
ScreenLoggerServant loggerRef = new ScreenLoggerServant(Integer.parseInt(System.getProperty("uk.ac.ukc.iscream.Verbosity"))); |
97 |
< |
//FileLoggerServant loggerRef = new FileLoggerServant("core.log"); |
98 |
< |
// and advertise it to the naming context |
94 |
> |
|
95 |
> |
// work out which logger to use |
96 |
> |
String whichLogger = System.getProperty("uk.ac.ukc.iscream.LoggerClass", defaultLogger); |
97 |
> |
|
98 |
> |
// construct the relevant LoggerImpl |
99 |
> |
LoggerImpl loggerImplRef = (LoggerImpl) ClassLoader.getSystemClassLoader().loadClass(whichLogger).newInstance(); |
100 |
> |
|
101 |
> |
// setup and bind the LoggerServant |
102 |
> |
LoggerServant loggerRef = new LoggerServant(loggerImplRef); |
103 |
|
objRef = poa.servant_to_reference(loggerRef); |
104 |
|
ncRef.bind(ncRef.to_name("iscream.Logger"), objRef); |
105 |
|
|
106 |
< |
// get a ref to the logger servant as a Logger reference |
106 |
> |
// get a reference to the servant as a Logger |
107 |
|
Logger logRef = LoggerHelper.narrow(objRef); |
108 |
< |
|
108 |
> |
|
109 |
> |
|
110 |
> |
|
111 |
|
// create the Configurator |
112 |
< |
ConfiguratorServant configuratorRef = new ConfiguratorServant(System.getProperty("uk.ac.ukc.iscream.ConfigurationLocation"), poa, logRef); |
112 |
> |
String configLocation = System.getProperty("uk.ac.ukc.iscream.ConfigurationLocation", defaultConfigPath); |
113 |
> |
ConfigurationManagerServant configManRef = new ConfigurationManagerServant(poa, logRef); |
114 |
|
|
115 |
|
// and advertise it to the naming context |
116 |
< |
objRef = poa.servant_to_reference(configuratorRef); |
117 |
< |
ncRef.bind(ncRef.to_name("iscream.Configurator"), objRef); |
116 |
> |
objRef = poa.servant_to_reference(configManRef); |
117 |
> |
ncRef.bind(ncRef.to_name("iscream.ConfigurationManager"), objRef); |
118 |
|
|
119 |
|
// start the POA off |
120 |
|
poa.the_POAManager().activate(); |
164 |
|
//---ACCESSOR/MUTATOR METHODS--- |
165 |
|
|
166 |
|
//---ATTRIBUTES--- |
167 |
< |
|
167 |
> |
|
168 |
|
//---STATIC ATTRIBUTES--- |
169 |
+ |
|
170 |
+ |
/** |
171 |
+ |
* Default logger, to be used when one is not provided |
172 |
+ |
* in the configuration. |
173 |
+ |
*/ |
174 |
+ |
private static final String defaultLogger = "ScreenLogger"; |
175 |
+ |
|
176 |
+ |
/** |
177 |
+ |
* Default configPath, to be used when one is not provided |
178 |
+ |
* in the configuration. |
179 |
+ |
*/ |
180 |
+ |
private static final String defaultConfigPath = "."; |
181 |
|
|
182 |
|
} |