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; |
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 { |
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 |
|
} |
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"); |
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 |