ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/clientinterface/TCPClientListener.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/clientinterface/TCPClientListener.java (file contents):
Revision 1.12 by tdb, Wed Mar 14 23:25:29 2001 UTC vs.
Revision 1.15 by tdb, Thu Mar 21 13:01:21 2002 UTC

# Line 1 | Line 1
1   //---PACKAGE DECLARATION---
2 < package uk.org.iscream.clientinterface;
2 > package uk.org.iscream.cms.server.clientinterface;
3  
4   //---IMPORTS---
5 < import uk.org.iscream.util.*;
6 < import uk.org.iscream.core.*;
7 < import uk.org.iscream.componentmanager.*;
5 > import uk.org.iscream.cms.server.util.*;
6 > import uk.org.iscream.cms.server.core.*;
7 > import uk.org.iscream.cms.server.componentmanager.*;
8   import java.io.IOException;
9   import java.net.Socket;
10   import java.net.ServerSocket;
# Line 56 | Line 56 | class TCPClientListener extends Thread {
56           * and then passing them off to handler processes to deal with.
57           */
58      public void run(){
59 +        // setup an empty ACL defaulting to ALLOW
60 +        ACL acl = new ACL(ACL.ALLOW);
61 +        
62          // get our port
63          int portNum;
64          try {
# Line 74 | Line 77 | class TCPClientListener extends Thread {
77          boolean run = true;
78          try{
79                          // Setup the ServerSocket so that clients can connect
80 <            listenPort = new ServerSocket(portNum);
80 >                        listenPort = new ACLServerSocket(acl, portNum);
81          }
82          catch(IOException e){
83          }
# Line 90 | Line 93 | class TCPClientListener extends Thread {
93                                                                                  +"port "+listenPort.getLocalPort());
94                  }
95                  // Loop round constantly until we decide to stop
96 +                ConfigurationProxy cp = ConfigurationProxy.getInstance();
97 +        String stringACL = "";
98 +        String newStringACL = "";
99          while(run){
100 +            // get hold of the ACL in the configuration
101 +            try {
102 +                newStringACL = cp.getProperty("ClientInterface", "ClientInterface.TCPControlChannelACL");
103 +            }
104 +            catch(PropertyNotFoundException e) {
105 +                // if we can't find it, we'll just use a null ACL
106 +                newStringACL = "";
107 +                _logger.write(toString(), Logger.WARNING, "No ACL found for ClientInterface (control channel listener), using empty ACL instead: " + e);
108 +            }
109 +            // check to see if the ACL has changed
110 +            if(!newStringACL.equals(stringACL)) {
111 +                _logger.write(toString(), Logger.SYSMSG, "Reloading Access Control List");
112 +                // clear the ACL
113 +                acl.clear();
114 +                // set the default to something sane
115 +                acl.setDefaultMode(ACL.ALLOW);
116 +                // add the new ACL (this may change the default)
117 +                acl.add(newStringACL);
118 +                stringACL = newStringACL;
119 +            }
120              Socket hostSocket=null;
121              try{
122                  _logger.write(toString(), Logger.SYSMSG, "Waiting for Connection");
# Line 121 | Line 147 | class TCPClientListener extends Thread {
147       * Overrides the {@link java.lang.Object#toString() Object.toString()}
148       * method to provide clean logging (every class should have this).
149       *
150 <     * This uses the uk.org.iscream.util.NameFormat class
150 >     * This uses the uk.org.iscream.cms.server.util.NameFormat class
151       * to format the toString()
152       *
153       * @return the name of this class and its CVS revision

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines