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

Comparing projects/cms/source/server/uk/org/iscream/cms/server/filter/FilterMain.java (file contents):
Revision 1.1 by tdb, Tue Nov 21 21:06:07 2000 UTC vs.
Revision 1.10 by tdb, Mon Nov 27 21:46:25 2000 UTC

# Line 62 | Line 62 | class FilterMain {
62              objRef = ncRef.resolve(ncRef.to_name("iscream.Logger"));
63              Logger logger = LoggerHelper.narrow(objRef);
64              
65            //objRef = ncRef.resolve(ncRef.to_name("iscream.FilterManager"));
66            //FilterManager filterManager = FilterManagerHelper.narrow(objRef);
67            
65              logger.write(toString, Logger.SYSINIT, "coming up");
66              
67              
# Line 75 | Line 72 | class FilterMain {
72              Configuration myConfig = configManager.getConfiguration(ourName);
73              
74              // read some config here
75 +            int UDPport = 0;
76 +            int TCPport = 0;
77 +            String parentFilterName = null;
78 +  
79 +            // did we?
80 +            if (myConfig == null) {
81 +                System.out.println("Failed: is it there?, can you read it?");
82 +                System.exit(1);
83 +            } else {
84 +              
85 +                // get the property
86 +                try {
87 +                    //QUERY HERE.... ???
88 +                    UDPport = new Integer(myConfig.getProperty("Filter.UDPlistenPort")).intValue();
89 +                    TCPport = new Integer(myConfig.getProperty("Filter.TCPlistenPort")).intValue();
90 +                    parentFilterName = myConfig.getProperty("Filter.parentFilter");
91 +                } catch (org.omg.CORBA.MARSHAL e) {
92 +                    System.out.println("Caught org.omg.CORBA.MARSHAL, must be a null we got back");
93 +                    //System.exit(1);
94 +                }
95 +            }
96              
97              logger.write(toString, Logger.SYSINIT, "configured");
98              
99              // **** END COMMENT
100              
101 +            // **** INITIAL FILTER MANAGER COMMUNICATIONS HERE
102 +            
103 +            // get a root (CHANGE to use FilterManager)
104 +            objRef = ncRef.resolve(ncRef.to_name("iscream.Filter." + parentFilterName));
105 +            Filter parentFilter = FilterHelper.narrow(objRef);
106 +
107              // SETUP our Servant
108              
109              // create the FilterServant
110 <            FilterServant filterServant = new FilterServant(logger, ourName);
111 <            
110 >            FilterServant filterServant = new FilterServant(logger, parentFilter, ourName, new Integer(TCPport).toString() , new Integer(UDPport).toString());
111 >
112 >            // register ourselves
113 >
114              // and advertise it to the naming context
115              objRef = poa.servant_to_reference(filterServant);
116              ncRef.bind(ncRef.to_name("iscream.Filter."+ourName), objRef);
117 +
118 +            // **** END COMMENT
119              
120              // END SETUP
121              
122 +
123              /**************************************************************
95            */logger.write(toString, Logger.SYSINIT, "starting Filter UDP listener");/*
124                Here would be an ideal place to start another thread to do
125                the listening part of the Filter. Ideally it should just be
126                created and then run(). It may be necessary to pass some of
# Line 111 | Line 139 | class FilterMain {
139                        - our "identifier" name
140              
141              **************************************************************/
142 <            
143 <            // **** INITIAL FILTER MANAGER COMMUNICATIONS HERE
144 <            
145 <            // get a root (CHANGE to use FilterManager)
146 <            objRef = ncRef.resolve(ncRef.to_name("iscream.Filter.root1"));
147 <            Filter root = FilterHelper.narrow(objRef);
148 <            
149 <            // register ourselves
150 <            
151 <            // **** END COMMENT
152 <            
142 >                                    
143 >            logger.write(toString, Logger.SYSINIT, "starting Filter UDP listener");
144 >            UDPReader udpReader = new UDPReader(UDPport, parentFilter, logger);
145 >            udpReader.start();
146 >            logger.write(toString, Logger.SYSINIT, "Filter UDP listener started");
147 >
148 >            logger.write(toString, Logger.SYSINIT, "starting Filter TCP listener");
149 >            TCPReader tcpReader = new TCPReader(logger, configManager, TCPport, parentFilter);
150 >            tcpReader.start();
151 >            logger.write(toString, Logger.SYSINIT, "Filter TCP listener started");
152 >
153              // TEST
154 <            root.receiveXML("test via Root1");
154 >            //parentFilter.receiveXML("<?xml version=\"1.0\" encoding=\"ISO8859-1\"?><packet><test>This is just a debugging test, we ("+ourName+") are live on UDPport: "+UDPport+"</test></packet>");
155              
156              // start the POA off
157              poa.the_POAManager().activate();
# Line 147 | Line 175 | class FilterMain {
175       * properly.
176       */
177      public static void usage() {
178 <        System.out.println("USAGE: java Filter <name>");
178 >        System.out.println("USAGE: java FilterMain <name>");
179          System.out.println("WHERE <name>:");
180          System.out.println("      The unique identifier for the Filter in the system.");
181          System.exit(1);
# Line 165 | Line 193 | class FilterMain {
193  
194   //---STATIC ATTRIBUTES---
195  
196 < }            
196 > }            

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines