public void addSettings(String workspace, GeoServer geoServer) {
WorkspaceInfo ws = workspace != null ?
geoServer.getCatalog().getWorkspaceByName(workspace) : null;
GeoServerInfo global = geoServer.getGlobal();
SettingsInfo settings = ws != null ? geoServer.getSettings(ws) : global.getSettings();
if (settings == null) {
settings = geoServer.getFactory().createSettings();
}
settings.setWorkspace(ws);
settings.getContact().setContactPerson("Andrea Aime");
settings.setNumDecimals(8);
settings.setOnlineResource("http://geoserver.org");
settings.setVerbose(false);
settings.setVerboseExceptions(false);
settings.setLocalWorkspaceIncludesPrefix(false);
if (ws != null) {
if (settings.getId() != null) {
geoServer.save(settings);
}
else {
geoServer.add(settings);
}