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.2
Committed: Tue Nov 14 01:40:19 2000 UTC (23 years, 6 months ago) by tdb
Branch: MAIN
Changes since 1.1: +4 -2 lines
Log Message:
Modified so that it no longer needs to be run with `jaco'.

File Contents

# Content
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 * @version $Id: FilterManager.java,v 1.1 2000/11/13 20:40:40 tdb1 Exp $
15 */
16 class FilterManager {
17
18 //---FINAL ATTRIBUTES---
19
20 /**
21 * The current CVS revision of this class
22 */
23 public static final String REVISION = "$Revision: 1.1 $";
24
25 //---STATIC METHODS---
26
27 public static void main(String[] args) {
28 System.setProperty("org.omg.CORBA.ORBClass","jacorb.orb.ORB");
29 System.setProperty("org.omg.CORBA.ORBSingletonClass","jacorb.orb.ORBSingleton");
30
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 objRef = ncRef.resolve(ncRef.to_name("iscream.Configurator"));
50 Configurator configurator = ConfiguratorHelper.narrow(objRef);
51 objRef = ncRef.resolve(ncRef.to_name("iscream.Logger"));
52 Logger logger = LoggerHelper.narrow(objRef);
53
54 logger.write(toString, "coming up");
55
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 Configuration myConfig = configurator.getConfiguration("filterManager");
68
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 logger.write(toString, "configured");
87 logger.write(toString, "starting listener");
88
89 FilterManagerListener fml = new FilterManagerListener(logger, configurator, port);
90 fml.start();
91
92 logger.write(toString, "started");
93
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 }