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
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/core/Core.java (file contents):
Revision 1.11 by tdb, Fri Nov 17 16:25:18 2000 UTC vs.
Revision 1.15 by tdb, Tue Nov 21 15:08:42 2000 UTC

# Line 90 | Line 90 | class Core {
90              objRef = orb.resolve_initial_references("NameService");
91              NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
92              
93 +            // check we got it
94 +            if (ncRef == null) {
95 +                throw new Exception("Unable to locate CORBA Naming Service for configured ORB!");
96 +            }
97 +            
98              // start and bind each server in turn
99              
100 <            // work out the verbosity setting & which logger to use
96 <            int verbosity = Integer.parseInt(System.getProperty("uk.ac.ukc.iscream.Verbosity", defaultVerbosity));
100 >            // work out which logger to use
101              String whichLogger = System.getProperty("uk.ac.ukc.iscream.LoggerClass", defaultLogger);
102 <            String loggerParams = System.getProperty("uk.ac.ukc.iscream.LoggerClassParams");
102 >          
103 >            // construct the relevant LoggerImpl
104 >            LoggerImpl loggerImplRef = (LoggerImpl) ClassLoader.getSystemClassLoader().loadClass(whichLogger).newInstance();
105              
106 <            Logger logRef = null;
107 <            // create the logger (either Screen or File), and bind it
108 <            if(whichLogger.equals("ScreenLogger")){
109 <                ScreenLoggerServant loggerRef = new ScreenLoggerServant(verbosity);
104 <                objRef = poa.servant_to_reference(loggerRef);
105 <                ncRef.bind(ncRef.to_name("iscream.Logger"), objRef);
106 <                logRef = LoggerHelper.narrow(objRef);
107 <            }
108 <            else if(whichLogger.equals("FileLogger")){
109 <                FileLoggerServant loggerRef = new FileLoggerServant(loggerParams, verbosity);
110 <                objRef = poa.servant_to_reference(loggerRef);
111 <                ncRef.bind(ncRef.to_name("iscream.Logger"), objRef);
112 <                logRef = LoggerHelper.narrow(objRef);
113 <            }
114 <            else {
115 <                //need to deal with this
116 <            }
106 >            // setup and bind the LoggerServant
107 >            LoggerServant loggerRef = new LoggerServant(loggerImplRef);
108 >            objRef = poa.servant_to_reference(loggerRef);
109 >            ncRef.bind(ncRef.to_name("iscream.Logger"), objRef);
110              
111 <            // and advertise it to the naming context
112 <            //objRef = poa.servant_to_reference(loggerRef);
113 <            //ncRef.bind(ncRef.to_name("iscream.Logger"), objRef);
121 <            
122 <            // get a ref to the logger servant as a Logger reference
123 <            //Logger logRef = LoggerHelper.narrow(objRef);
124 <            
111 >            // get a reference to the servant as a Logger
112 >            Logger logRef = LoggerHelper.narrow(objRef);
113 >
114              // create the Configurator
115 <            String configLocation = System.getProperty("uk.ac.ukc.iscream.ConfigurationLocation", defaultConfigPath);
127 <            ConfiguratorServant configuratorRef = new ConfiguratorServant(configLocation, poa, logRef);
115 >            ConfigurationManagerServant configManRef = new ConfigurationManagerServant(poa, logRef);
116              
117              // and advertise it to the naming context
118 <            objRef = poa.servant_to_reference(configuratorRef);
119 <            ncRef.bind(ncRef.to_name("iscream.Configurator"), objRef);
118 >            objRef = poa.servant_to_reference(configManRef);
119 >            ncRef.bind(ncRef.to_name("iscream.ConfigurationManager"), objRef);
120              
121              // start the POA off
122              poa.the_POAManager().activate();
# Line 144 | Line 132 | class Core {
132              
133              // there is already another CORE of the same name registered
134              if ( e instanceof org.omg.CosNaming.NamingContextPackage.AlreadyBound) {
135 <                System.err.println("ERROR: Another I-Scream CORE is already registered under the same name.");
135 >                System.err.println("CORE ERROR: Another I-Scream CORE is already registered under the same name.");
136              
137              // otherwise we don't know what happened
138 <            // so print the error and do a stack trace
138 >            // so print the error and do a stack trace if debug is enabled
139              } else {
140 <                System.err.println("CORE ERROR: " + e);
141 <                e.printStackTrace(System.out);
140 >                System.err.println("CORE ERROR: " + e.getMessage());
141 >                if (Integer.parseInt(System.getProperty("uk.ac.ukc.iscream.Verbosity")) == Logger.DEBUG) {
142 >                    System.err.println("*** DEBUG ENABLED - printing stack trace ***");
143 >                    e.printStackTrace(System.out);
144 >                }
145              }
146          }
147      }
# Line 162 | Line 153 | class Core {
153       * properly.
154       */
155      public static void usage() {
156 <        System.out.println("USAGE: java Core.java <option>");
156 >        System.out.println("USAGE: java Core <option>");
157          System.out.println("WHERE <option>:");
158          System.out.println("      -l <filename> - the location of initial system properties");
159          System.out.println("      -h            - this help screen");
# Line 180 | Line 171 | class Core {
171   //---ATTRIBUTES---
172      
173   //---STATIC ATTRIBUTES---
174 <
184 <    /**
185 <     * Default verbosity setting, to be used when one is
186 <     * not provided in the configuration.
187 <     */
188 <    private static final String defaultVerbosity = "3";
189 <    
174 >  
175      /**
176       * Default logger, to be used when one is not provided
177       * in the configuration.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines