added reload support

This commit is contained in:
ccancellieri 2011-09-28 17:36:48 +02:00
parent ee61857f6c
commit 9a811e56b3
2 changed files with 47 additions and 6 deletions

View File

@ -680,14 +680,21 @@ public class GeoServerRESTPublisher {
}
}
public boolean reload() {
String sUrl = restURL + "/rest/reload";
String result = HTTPUtils.post(sUrl, "", "text/plain", gsuser, gspass);
return result != null;
}
public boolean removeLayerGroup(String name) {
try {
URL deleteUrl = new URL(restURL + "/rest/layergroups/" + name);
boolean deleted = HTTPUtils.delete(deleteUrl.toExternalForm(), gsuser, gspass);
if (!deleted) {
LOGGER.warn("Could not delete layergroup " + name);
LOGGER.warn("Could not delete layergroup " + name);
} else {
LOGGER.info("Layergroup successfully deleted: " + name);
if (LOGGER.isInfoEnabled())
LOGGER.info("Layergroup successfully deleted: " + name);
}
return deleted;

View File

@ -73,18 +73,52 @@ public class NestedElementEncoder extends XmlElement {
super(listName);
}
public void add(String key, String value) {
public void set(final String key, final String value) {
final Element entryElem = new Element("entry");
if (key != null) {
entryElem.setAttribute("key", key);
}
entryElem.setText(value);
final Element el = contains(entryElem);
if (el != null) {
addContent(entryElem);
}
}
public void set(final String key, final Element value) {
final Element entryElem = new Element("entry");
if (key != null) {
entryElem.setAttribute("key", key);
}
entryElem.addContent(value);
final Element el = contains(entryElem);
if (el != null) {
addContent(entryElem);
} else {
if (remove(el))
addContent(entryElem);
}
}
public void add(final String key, final String value) {
final Element entryElem = new Element("entry");
if (key != null)
entryElem.setAttribute("key", key);
entryElem.setText(value);
this.addContent(entryElem);
}
public void add(String key, Element value) {
public void add(final String key, final Element value) {
final Element entryElem = new Element("entry");
if (key != null)
entryElem.setAttribute("key", key);