groups = DiscoveryGroupManagement.ALL_GROUPS;
} else {
instance.settings.put(GROUPS, Formatter.toArray(value));
groups = Formatter.toArray(value);
}
DiscoveryManagement dMgr =
instance.getServiceFinder().getDiscoveryManagement();
if(dMgr instanceof DiscoveryGroupManagement) {
try {
((DiscoveryGroupManagement)dMgr).setGroups(groups);
} catch(Throwable t) {
out.println("Exception setting groups : "+
t.getMessage());
}
}
} else if(token.equals(LOCATORS)) {
String locator = tok.nextToken();
DiscoveryManagement dMgr =
instance.getServiceFinder().getDiscoveryManagement();
if(dMgr instanceof DiscoveryLocatorManagement) {
if(locator.equalsIgnoreCase("null")) {
((DiscoveryLocatorManagement)dMgr).
setLocators(new LookupLocator[0]);
} else {
try {
((DiscoveryLocatorManagement)dMgr).
addLocators(new LookupLocator[]{
new LookupLocator(locator)});
} catch(MalformedURLException e) {
out.println("Bad locator format");
}
}
}
} else if(token.equals(SYS_PROPS)) {
String property = tok.nextToken();
StringTokenizer tok1 =
new StringTokenizer(property, "= ");
if(tok1.countTokens()<2)
return("Invalid system property definition "+
property);
String name = tok1.nextToken();
String value = tok1.nextToken();
Properties props =
(Properties)instance.settings.get(SYS_PROPS);
props.put(name, value);
System.setProperty(name, value);
instance.settings.put(SYS_PROPS, props);
} else if(token.equals(DISCOVERY_TIMEOUT)) {
String timeout = tok.nextToken();
try {
long l = Long.parseLong(timeout);
instance.settings.put(DISCOVERY_TIMEOUT, l);
} catch (NumberFormatException e) {
return("Invalid discovery-timeout "+timeout);
}
} else {
out.println("Invalid property "+token);
}
}
} else {
String[] groups = (String[])instance.settings.get(GROUPS);
if(groups == DiscoveryGroupManagement.ALL_GROUPS)
groups = new String[]{"ALL_GROUPS"};
buffer.append(GROUPS + "\t\t").append(Formatter.fromArray(groups));
buffer.append("\n");
DiscoveryManagement dMgr =
instance.getServiceFinder().getDiscoveryManagement();
LookupLocator[] locators = null;
if(dMgr instanceof DiscoveryLocatorManagement) {
locators =
((DiscoveryLocatorManagement)dMgr).getLocators();