1 |
|
//---PACKAGE DECLARATION--- |
2 |
< |
package uk.ac.ukc.iscream.core; |
2 |
> |
package uk.org.iscream.core; |
3 |
|
|
4 |
|
//---IMPORTS--- |
5 |
< |
import uk.ac.ukc.iscream.util.*; |
6 |
< |
import uk.ac.ukc.iscream.componentmanager.*; |
5 |
> |
import uk.org.iscream.util.*; |
6 |
> |
import uk.org.iscream.componentmanager.*; |
7 |
|
import java.net.InetAddress; |
8 |
|
import java.net.UnknownHostException; |
9 |
|
import java.util.*; |
47 |
|
*/ |
48 |
|
ConfigurationManagerServant() { |
49 |
|
// assign some local variables |
50 |
< |
_configPath = System.getProperty("uk.ac.ukc.iscream.ConfigurationLocation"); |
51 |
< |
_systemConfigFile = System.getProperty("uk.ac.ukc.iscream.SystemConfigurationFile"); |
50 |
> |
_configPath = System.getProperty("uk.org.iscream.ConfigurationLocation"); |
51 |
> |
_systemConfigFile = System.getProperty("uk.org.iscream.SystemConfigurationFile"); |
52 |
|
|
53 |
|
// load the system config |
54 |
|
loadSystemConfig(); |
92 |
|
} |
93 |
|
|
94 |
|
// search config for group membership |
95 |
< |
LinkedList groups = getGroupMembership(source); |
95 |
> |
// and obain a list of groups by name |
96 |
> |
LinkedList nameGroups = getGroupMembership(source); |
97 |
> |
// add the hosts individual config to the start of the list |
98 |
> |
nameGroups.addFirst(source); |
99 |
|
|
100 |
+ |
// this list will be used to compile the groupings |
101 |
+ |
LinkedList groups = new LinkedList(); |
102 |
+ |
|
103 |
|
// if we are dealing with a Host.<hostname> request, then we also |
104 |
|
// want to look for ip address details, as configuration entries may relate to it |
105 |
|
// if we can't resolve it, we don't look. |
106 |
+ |
LinkedList ipGroups = null; |
107 |
|
if (source.startsWith("Host.")) { |
108 |
|
// hostname is after Host. |
109 |
|
String hostname = source.substring(5); |
110 |
|
try { |
111 |
|
String ip = "Host." + InetAddress.getByName(hostname).getHostAddress(); |
112 |
< |
LinkedList ipGroups = getGroupMembership(ip); |
113 |
< |
groups.addFirst(ip); |
112 |
> |
ipGroups = getGroupMembership(ip); |
113 |
> |
ipGroups.addFirst(ip); |
114 |
> |
// add to our list of groups |
115 |
|
groups.addAll(ipGroups); |
116 |
|
} catch (UnknownHostException e) { |
117 |
|
_logger.write(toString(), Logger.ERROR, "could not resolve hostname - " + hostname); |
118 |
|
} |
119 |
|
} |
120 |
+ |
|
121 |
+ |
// add the rest of the groups to the end |
122 |
+ |
groups.addAll(nameGroups); |
123 |
|
|
113 |
– |
// add the hosts individual config to the start of the list |
114 |
– |
groups.addFirst(source); |
115 |
– |
|
124 |
|
Iterator i = groups.iterator(); |
125 |
|
String fileList = ""; |
126 |
|
while (i.hasNext()) { |
189 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
190 |
|
* method to provide clean logging (every class should have this). |
191 |
|
* |
192 |
< |
* This uses the uk.ac.ukc.iscream.util.FormatName class |
192 |
> |
* This uses the uk.org.iscream.util.FormatName class |
193 |
|
* to format the toString() |
194 |
|
* |
195 |
|
* @return the name of this class and its CVS revision |