charset = Charset.forName(getCharacterEncoding());
}
catch (Exception e) {
}
if (charset == null) {
errors.add(new ValidationError("Character encoding '" + getCharacterEncoding() + "' is not available on this system", new String[]{"characterEncoding"}, this));
}
}
// check content dbs
Iterator<ContentDatabase> contentDBs = getContentDatabases().iterator();
Set<String> uniqueKeys = new HashSet<String>();
while (contentDBs.hasNext()) {
ContentDatabase cDB = contentDBs.next();
checkReferences(errors, cDB);
if (uniqueKeys.contains(cDB.getKey())) {
errors.add(new ValidationError("Duplicate dbkey '" + cDB.getKey() + "'.", new String[]{"contentDatabases"}, this));
} else {
uniqueKeys.add(cDB.getKey());
}
}
// check for duplicate domain uids / names
Iterator<Domain> domains = getDomains().iterator();
Set<String> uids = new HashSet<String>();
Set<String> names = new HashSet<String>();
while (domains.hasNext()) {
Domain domain = domains.next();
if (uids.contains(domain.getUid())) {
errors.add(new ValidationError("Duplicate domain uid '" + domain.getUid() + "'.", new String[]{"domains"}, this));
} else {
uids.add(domain.getUid());
}
if (names.contains(domain.getName())) {
errors.add(new ValidationError("Duplicate domain name '" + domain.getName() + "'.", new String[]{"domains"}, this));
} else {
names.add(domain.getName());
}
}
// check for duplicate dbserver uids
Iterator<DatabaseServer> dbservers = getDatabaseServers().iterator();
uids = new HashSet<String>();
while (dbservers.hasNext()) {
DatabaseServer dbServer = dbservers.next();
if (uids.contains(dbServer.getUid())) {
errors.add(new ValidationError("Duplicate database server uid '" + dbServer.getUid() + "'.", new String[]{"databaseServers"}, this));
} else {
uids.add(dbServer.getUid());
}
}
// check share uniqueness
Iterator<Share> shares = getShares().iterator();
Set<String> uniqueNames = new HashSet<String>();
while (shares.hasNext()) {
Share share = shares.next();
String shareKey = share.getImplClassName() + "//" + share.getName();
if (uniqueNames.contains(shareKey)) {
errors.add(new ValidationError("Duplicate share name '" + share.getName() + "' of type '" + share.getImplClassName() + "'", new String[]{"shares"}, this));
} else {
uniqueNames.add(shareKey);
}
}