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

Comparing projects/cms/source/server/uk/org/iscream/cms/server/filtermanager/HostListener.java (file contents):
Revision 1.9 by tdb, Tue May 29 17:02:35 2001 UTC vs.
Revision 1.12 by tdb, Thu Mar 21 13:01:22 2002 UTC

# Line 52 | Line 52 | class HostListener extends Thread {
52           * and then passing them off to other processes to deal with.
53           */
54      public void run(){
55 +        // setup an empty ACL defaulting to ALLOW
56 +        ACL acl = new ACL(ACL.ALLOW);
57 +        
58          ServerSocket listenSocket=null;
59                  // We use this boolean so we can break out of the while loop if we want
60          boolean run = true;
61          try{
62              // Work out the port we want
63 <            int listenPort = Integer.parseInt(ConfigurationProxy.getInstance().getProperty("FilterManager", "FilterManager.listenPort"));
63 >            int listenPort = Integer.parseInt(ConfigurationProxy.getInstance().getProperty("FilterManager." + FilterManager.NAME, "FilterManager.listenPort"));
64                          // Setup the ServerSocket so that clients can connect
65 <            listenSocket = new ServerSocket(listenPort);
65 >                        listenSocket = new ACLServerSocket(acl, listenPort);
66              _logger.write(toString(), Logger.SYSMSG, "Server listening on "
67                                                                                  +InetAddress.getLocalHost().getHostName()
68                                                                                  +"/"+InetAddress.getLocalHost().getHostAddress()
# Line 84 | Line 87 | class HostListener extends Thread {
87          }
88  
89                  // Loop round constantly until we decide to stop
90 +                ConfigurationProxy cp = ConfigurationProxy.getInstance();
91 +        String stringACL = "";
92 +        String newStringACL = "";
93          while(run){
94 +            // get hold of the ACL in the configuration
95 +            try {
96 +                newStringACL = cp.getProperty("FilterManager." + FilterManager.NAME, "FilterManager.ACL");
97 +            }
98 +            catch(PropertyNotFoundException e) {
99 +                // if we can't find it, we'll just use a null ACL
100 +                newStringACL = "";
101 +                _logger.write(toString(), Logger.WARNING, "No ACL found for FilterManager, using empty ACL instead: " + e);
102 +            }
103 +            // check to see if the ACL has changed
104 +            if(!newStringACL.equals(stringACL)) {
105 +                _logger.write(toString(), Logger.SYSMSG, "Reloading Access Control List");
106 +                // clear the ACL
107 +                acl.clear();
108 +                // set the default to something sane
109 +                acl.setDefaultMode(ACL.ALLOW);
110 +                // add the new ACL (this may change the default)
111 +                acl.add(newStringACL);
112 +                stringACL = newStringACL;
113 +            }
114              Socket hostSocket=null;
115              try{
116                  _logger.write(toString(), Logger.SYSMSG, "Waiting for Connection");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines