1 |
|
//---PACKAGE DECLARATION--- |
2 |
< |
package uk.ac.ukc.iscream.filtermanager; |
2 |
> |
package uk.org.iscream.cms.server.filtermanager; |
3 |
|
|
4 |
|
//---IMPORTS--- |
5 |
< |
import uk.ac.ukc.iscream.core.*; |
6 |
< |
import uk.ac.ukc.iscream.componentmanager.*; |
7 |
< |
import uk.ac.ukc.iscream.filter.*; |
8 |
< |
import uk.ac.ukc.iscream.util.*; |
5 |
> |
import uk.org.iscream.cms.server.core.*; |
6 |
> |
import uk.org.iscream.cms.server.componentmanager.*; |
7 |
> |
import uk.org.iscream.cms.server.filter.*; |
8 |
> |
import uk.org.iscream.cms.server.util.*; |
9 |
|
import java.net.*; |
10 |
|
import java.io.*; |
11 |
|
|
52 |
|
* and then passing them off to other processes to deal with. |
53 |
|
*/ |
54 |
|
public void run(){ |
55 |
+ |
// get our ACL from the configuration |
56 |
+ |
ACL acl = null; |
57 |
+ |
try { |
58 |
+ |
String stringACL = ConfigurationProxy.getInstance().getProperty("FilterManager." + FilterManager.NAME, "FilterManager.ACL"); |
59 |
+ |
acl = new ACL(stringACL); |
60 |
+ |
} |
61 |
+ |
catch(PropertyNotFoundException e) { |
62 |
+ |
_logger.write(toString(), Logger.WARNING, "No ACL found for FilterManager: " + e); |
63 |
+ |
} |
64 |
+ |
|
65 |
|
ServerSocket listenSocket=null; |
66 |
|
// We use this boolean so we can break out of the while loop if we want |
67 |
|
boolean run = true; |
68 |
|
try{ |
69 |
|
// Work out the port we want |
70 |
< |
int listenPort = Integer.parseInt(ConfigurationProxy.getInstance().getProperty("FilterManager", "FilterManager.listenPort")); |
70 |
> |
int listenPort = Integer.parseInt(ConfigurationProxy.getInstance().getProperty("FilterManager." + FilterManager.NAME, "FilterManager.listenPort")); |
71 |
|
// Setup the ServerSocket so that clients can connect |
72 |
< |
listenSocket = new ServerSocket(listenPort); |
72 |
> |
// use an ACLServerSocket if we have an ACL |
73 |
> |
if(acl != null) { |
74 |
> |
listenSocket = new ACLServerSocket(acl, listenPort); |
75 |
> |
} |
76 |
> |
else { |
77 |
> |
listenSocket = new ServerSocket(listenPort); |
78 |
> |
} |
79 |
|
_logger.write(toString(), Logger.SYSMSG, "Server listening on " |
80 |
|
+InetAddress.getLocalHost().getHostName() |
81 |
|
+"/"+InetAddress.getLocalHost().getHostAddress() |
132 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
133 |
|
* method to provide clean logging (every class should have this). |
134 |
|
* |
135 |
< |
* This uses the uk.ac.ukc.iscream.util.NameFormat class |
135 |
> |
* This uses the uk.org.iscream.cms.server.util.NameFormat class |
136 |
|
* to format the toString() |
137 |
|
* |
138 |
|
* @return the name of this class and its CVS revision |