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/UDPReader.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/filter/UDPReader.java (file contents):
Revision 1.21 by tdb, Wed Mar 20 13:05:50 2002 UTC vs.
Revision 1.23 by tdb, Sat May 18 18:16:02 2002 UTC

# Line 1 | Line 1
1 + /*
2 + * i-scream central monitoring system
3 + * Copyright (C) 2000-2002 i-scream
4 + *
5 + * This program is free software; you can redistribute it and/or
6 + * modify it under the terms of the GNU General Public License
7 + * as published by the Free Software Foundation; either version 2
8 + * of the License, or (at your option) any later version.
9 + *
10 + * This program is distributed in the hope that it will be useful,
11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 + * GNU General Public License for more details.
14 + *
15 + * You should have received a copy of the GNU General Public License
16 + * along with this program; if not, write to the Free Software
17 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 + */
19 +
20   //---PACKAGE DECLARATION---
21   package uk.org.iscream.cms.server.filter;
22  
# Line 57 | Line 76 | public class UDPReader extends Thread{
76       * over UDP.
77       */
78      public void run() {
79 <        // get our ACL from the configuration
80 <        ACL acl = null;
62 <        try {
63 <            String stringACL = ConfigurationProxy.getInstance().getProperty("Filter." + FilterMain.NAME, "Filter.UDPACL");
64 <            acl = new ACL(stringACL);
65 <        }
66 <        catch(PropertyNotFoundException e) {
67 <            _logger.write(toString(), Logger.WARNING, "No ACL found for UDPReader: " + e);
68 <        }
79 >        // setup an empty ACL defaulting to ALLOW
80 >        ACL acl = new ACL(ACL.ALLOW);
81          
82          // setup a Datagram socket
83          DatagramSocket socket = null;
84          try {
85 <            // use an ACLServerSocket if we have an ACL
74 <                        if(acl != null) {
75 <                            socket = new ACLDatagramSocket(acl, _port);
76 <                        }
77 <                        else {
78 <                socket = new DatagramSocket(_port);
79 <            }
85 >            socket = new ACLDatagramSocket(acl, _port);
86          }
87          catch (BindException e){
88              _logger.write(this.toString(), Logger.FATAL, "Could not start the UDPReader thread on port "+_port+" as this port was already in use.");
# Line 91 | Line 97 | public class UDPReader extends Thread{
97          
98          byte[] buf;
99          
100 +        ConfigurationProxy cp = ConfigurationProxy.getInstance();
101 +        String stringACL = "";
102 +        String newStringACL = "";
103 +        
104          // read UDP packets and queue them
105          boolean running = true;
106          while (running){
107 +            // get hold of the ACL in the configuration
108 +            try {
109 +                newStringACL = cp.getProperty("Filter." + FilterMain.NAME, "Filter.UDPACL");
110 +            }
111 +            catch(PropertyNotFoundException e) {
112 +                // if we can't find it, we'll just use a null ACL
113 +                newStringACL = "";
114 +                _logger.write(toString(), Logger.WARNING, "No ACL found for UDPReader, using empty ACL instead: " + e);
115 +            }
116 +            // check to see if the ACL has changed
117 +            if(!newStringACL.equals(stringACL)) {
118 +                _logger.write(toString(), Logger.SYSMSG, "Reloading Access Control List");
119 +                // clear the ACL
120 +                acl.clear();
121 +                // set the default to something sane
122 +                acl.setDefaultMode(ACL.ALLOW);
123 +                // add the new ACL (this may change the default)
124 +                acl.add(newStringACL);
125 +                stringACL = newStringACL;
126 +            }
127              try {
128                  
129                  // receive request and put it in the Queue              

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines