*/
@SuppressWarnings("unchecked")
public synchronized void updated(String pid, Dictionary dict) throws ConfigurationException {
String name = (String) dict.get(RepositoryConstants.REPOSITORY_NAME);
if ((name == null) || "".equals(name)) {
throw new ConfigurationException(RepositoryConstants.REPOSITORY_NAME, "Repository name has to be specified.");
}
String customer = (String) dict.get(RepositoryConstants.REPOSITORY_CUSTOMER);
if ((customer == null) || "".equals(customer)) {
throw new ConfigurationException(RepositoryConstants.REPOSITORY_CUSTOMER, "Repository customer has to be specified.");
}
String master = (String) dict.get(RepositoryConstants.REPOSITORY_MASTER);
if (!("false".equalsIgnoreCase(master.trim()) || "true".equalsIgnoreCase(master.trim()))) {
throw new ConfigurationException(RepositoryConstants.REPOSITORY_MASTER, "Have to specify whether the repository is the master or a slave.");
}
boolean isMaster = Boolean.parseBoolean(master);
String initialContents = (String) dict.get(RepositoryConstants.REPOSITORY_INITIAL_CONTENT);
if (m_prefs == null) {
m_prefs = m_prefsService.getSystemPreferences();
}
String[] nodes;
try {
nodes = m_prefs.childrenNames();
}
catch (BackingStoreException e) {
throw new ConfigurationException("none", "Internal error while validating configuration.");
}
for (int i = 0; i < nodes.length; i++) {
Preferences node = m_prefs.node(nodes[i]);
if (name.equalsIgnoreCase(node.get(RepositoryConstants.REPOSITORY_NAME, "")) && name.equalsIgnoreCase(node.get(RepositoryConstants.REPOSITORY_CUSTOMER, ""))) {
throw new ConfigurationException("name and customer", "Name and customer combination already exists");
}
}
Preferences node = m_prefs.node(pid);
node.put(RepositoryConstants.REPOSITORY_NAME, name);