ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/filter/FilterMain.java
Revision: 1.15
Committed: Thu Nov 30 03:05:47 2000 UTC (23 years, 5 months ago) by ajm
Branch: MAIN
Branch point for: SERVER_PACKAGEBUILD
Changes since 1.14: +2 -5 lines
Log Message:
removed imports which are no longer needed due to use of ReferenceManager

File Contents

# User Rev Content
1 tdb 1.1 //---PACKAGE DECLARATION---
2 tdb 1.11 package uk.ac.ukc.iscream.filter;
3 tdb 1.1
4     //---IMPORTS---
5 ajm 1.14 import uk.ac.ukc.iscream.util.*;
6 tdb 1.1 import uk.ac.ukc.iscream.core.*;
7     import uk.ac.ukc.iscream.filter.*;
8    
9     /**
10     * A Filter Startup Class
11     *
12 ajm 1.13 * @author $Author: ajm4 $
13 ajm 1.15 * @version $Id: FilterMain.java,v 1.14 2000/11/30 02:38:09 ajm4 Exp $
14 tdb 1.1 */
15     class FilterMain {
16    
17     //---FINAL ATTRIBUTES---
18    
19     /**
20     * The current CVS revision of this class
21     */
22 ajm 1.15 public static final String REVISION = "$Revision: 1.14 $";
23 tdb 1.1
24     //---STATIC METHODS---
25    
26     public static void main(String[] args) {
27 ajm 1.13 // ***************************************
28     // VERY TEMPORARY - will find a better way
29 tdb 1.1 System.setProperty("org.omg.CORBA.ORBClass","jacorb.orb.ORB");
30     System.setProperty("org.omg.CORBA.ORBSingletonClass","jacorb.orb.ORBSingleton");
31 ajm 1.13 // ***************************************
32    
33 tdb 1.1 // get our name from the command line
34     String ourName = "";
35     if (args.length == 1) {
36     ourName = args[0];
37     }
38     else {
39     usage();
40     }
41    
42     // can't have a real toString() :)
43     String toString = "Filter{" + ourName + "}(" + REVISION.substring(11, REVISION.length() - 2) + ")";
44 ajm 1.13
45     ReferenceManager refman = ReferenceManager.init(null, ourName);
46 tdb 1.1
47 ajm 1.13 refman.getLogger().write(toString, Logger.SYSINIT, "coming up");
48 tdb 1.1
49 ajm 1.13 // configuration variables we require
50     int UDPListenPort = 0;
51     int TCPListenPort = 0;
52     String parentFilterName = null;
53    
54     Configuration config = refman.getCM().getConfiguration(refman.getName());
55     if (config == null) {
56     throw new RuntimeException ("CRITICAL:Unable to obtain configuration" +
57     " Advise you check the i-scream log for more information.");
58     } else {
59     try {
60     UDPListenPort = Integer.parseInt(config.getProperty("Filter.UDPListenPort"));
61     TCPListenPort = Integer.parseInt(config.getProperty("Filter.TCPListenPort"));
62     parentFilterName = config.getProperty("Filter.parentFilter");
63     } catch (org.omg.CORBA.MARSHAL e) {
64     refman.getLogger().write(toString, Logger.FATAL, "required config property not present");
65     throw new RuntimeException ("CRITICAL:Unable to obtain required configuration property" +
66     " Advise you check the i-scream log for more information.");
67    
68 tdb 1.2 }
69 tdb 1.1 }
70 ajm 1.13 refman.getLogger().write(toString, Logger.SYSINIT, "configured");
71     // get parent
72     Filter parentFilter = FilterHelper.narrow(refman.getCORBARef("iscream.Filter." + parentFilterName));
73    
74    
75    
76     // FilterServant start (for inbound child filter data)
77     refman.getLogger().write(toString, Logger.DEBUG, "starting Filter Child -> Parent link for upstream parent - " + parentFilterName);
78     FilterServant filterServant = new FilterServant(parentFilter, TCPListenPort, UDPListenPort);
79     refman.bindToOrb(filterServant, "iscream.Filter." + refman.getName());
80    
81     // UDL Reader start (for inbound host data)
82     refman.getLogger().write(toString, Logger.SYSINIT, "starting Filter UDP listener");
83     UDPReader udpReader = new UDPReader(UDPListenPort, parentFilter);
84     udpReader.start();
85    
86     // TCP Reader start (for heartbeats)
87     refman.getLogger().write(toString, Logger.SYSINIT, "starting Filter TCP listener");
88     TCPReader tcpReader = new TCPReader(TCPListenPort, parentFilter);
89     tcpReader.start();
90    
91     // start the POA off
92     // now we are running, we just need to serve
93     // so we ask the orb to block for us until it has finished
94     refman.activatePOA();
95     refman.getLogger().write(toString, Logger.SYSINIT, "started");
96     refman.getORB().run();
97 tdb 1.1 }
98    
99     /**
100     * A simple method to print the usage of this class.
101     * It never returns, but instead exits to the system
102     * with a value 1, to indicate the system did not start
103     * properly.
104     */
105     public static void usage() {
106 pjm2 1.7 System.out.println("USAGE: java FilterMain <name>");
107 tdb 1.1 System.out.println("WHERE <name>:");
108     System.out.println(" The unique identifier for the Filter in the system.");
109     System.exit(1);
110     }
111    
112     //---CONSTRUCTORS---
113    
114     //---PUBLIC METHODS---
115    
116     //---PRIVATE METHODS---
117    
118     //---ACCESSOR/MUTATOR METHODS---
119    
120     //---ATTRIBUTES---
121    
122     //---STATIC ATTRIBUTES---
123    
124 pjm2 1.4 }