ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/filtermanager/FilterManager.java
Revision: 1.4
Committed: Mon Nov 20 18:55:24 2000 UTC (23 years, 5 months ago) by tdb
Branch: MAIN
Changes since 1.3: +6 -6 lines
Log Message:
A lot of changes from Configurator to ConfigurationManager.

File Contents

# User Rev Content
1 tdb 1.1 //---PACKAGE DECLARATION---
2    
3     //---IMPORTS---
4     import uk.ac.ukc.iscream.core.*;
5     import uk.ac.ukc.iscream.filter.*;
6     import org.omg.CORBA.*;
7     import org.omg.CosNaming.*;
8     import org.omg.PortableServer.*;
9    
10     /**
11     * A FilterManager
12     *
13     * @author $Author: tdb1 $
14 tdb 1.4 * @version $Id: FilterManager.java,v 1.3 2000/11/16 18:14:05 tdb1 Exp $
15 tdb 1.1 */
16     class FilterManager {
17    
18     //---FINAL ATTRIBUTES---
19    
20     /**
21     * The current CVS revision of this class
22     */
23 tdb 1.4 public static final String REVISION = "$Revision: 1.3 $";
24 tdb 1.1
25     //---STATIC METHODS---
26    
27     public static void main(String[] args) {
28 tdb 1.2 System.setProperty("org.omg.CORBA.ORBClass","jacorb.orb.ORB");
29     System.setProperty("org.omg.CORBA.ORBSingletonClass","jacorb.orb.ORBSingleton");
30 tdb 1.1
31     // can't have a real toString() :)
32     String toString = "FilterManager(" + REVISION.substring(11, REVISION.length() - 2) + ")";
33    
34     try {
35     ORB orb = ORB.init(args, null);
36    
37     // something to hold objects
38     org.omg.CORBA.Object objRef = null;
39    
40     // get the Root POA
41     objRef = orb.resolve_initial_references("RootPOA");
42     POA poa = POAHelper.narrow(objRef);
43    
44     // get a hook to the name service
45     objRef = orb.resolve_initial_references("NameService");
46     NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
47    
48     // get a ref to the Configurator & the Logger
49 tdb 1.4 objRef = ncRef.resolve(ncRef.to_name("iscream.ConfigurationManager"));
50     ConfigurationManager configManager = ConfigurationManagerHelper.narrow(objRef);
51 tdb 1.1 objRef = ncRef.resolve(ncRef.to_name("iscream.Logger"));
52     Logger logger = LoggerHelper.narrow(objRef);
53    
54 tdb 1.3 logger.write(toString, Logger.SYSINIT, "coming up");
55 tdb 1.1
56     // create the filterManagerRef to our servant
57     //filterManagerRef = new FilterManagerServant;
58    
59     // register the servant with the name service
60     //objRef = poa.servant_to_reference(filterManagerRef);
61     //ncRef.bind(ncRef.to_name("iscream.FilterManager"), objRef);
62    
63     // start the POA off
64     poa.the_POAManager().activate();
65    
66     // get the config
67 tdb 1.4 Configuration myConfig = configManager.getConfiguration("filterManager");
68 tdb 1.1
69     // some place holders for the configuration
70     int port = 0;
71    
72     // did we?
73     if (myConfig == null) {
74     System.out.println("Failed: is it there?, can you read it?");
75     System.exit(1);
76     } else {
77    
78     // get the property
79     try {
80     port = new Integer(myConfig.getProperty("listenPort")).intValue();
81     } catch (org.omg.CORBA.MARSHAL e) {
82     System.out.println("Caught org.omg.CORBA.MARSHAL, must be a null we got back");
83     System.exit(1);
84     }
85     }
86 tdb 1.3 logger.write(toString, Logger.SYSINIT, "configured");
87     logger.write(toString, Logger.SYSINIT, "starting listener");
88 tdb 1.1
89 tdb 1.4 FilterManagerListener fml = new FilterManagerListener(logger, configManager, port);
90 tdb 1.1 fml.start();
91    
92 tdb 1.3 logger.write(toString, Logger.SYSINIT, "started");
93 tdb 1.1
94     } catch (Exception e) {
95     System.err.println("FILTER MANAGER ERROR: " + e);
96     e.printStackTrace(System.out);
97     }
98     }
99    
100     //---CONSTRUCTORS---
101    
102     //---PUBLIC METHODS---
103    
104     //---PRIVATE METHODS---
105    
106     //---ACCESSOR/MUTATOR METHODS---
107    
108     //---ATTRIBUTES---
109    
110     //---STATIC ATTRIBUTES---
111    
112     }