adding wms publishing

This commit is contained in:
draktina 2015-09-14 12:28:11 +01:00
parent 764c3d3f91
commit bb0498055e
2 changed files with 57 additions and 27 deletions

View File

@ -2040,6 +2040,63 @@ public class GeoServerRESTPublisher {
}
}
/**
* Removes the wms layer.
* <P>
* You may also want to {@link #removeDatastore(String, String) remove the datastore}.
*
* @return true if the operation completed successfully.
*/
public boolean unpublishWmsLayer(String workspace, String storename, String layerName) {
try {
final String fqLayerName;
// this null check is here only for backward compatibility.
// workspace
// shall be mandatory.
if (workspace == null) {
fqLayerName = layerName;
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("Null workspace while configuring layer : " + layerName
+ " -- This behavior is deprecated.");
}
} else {
fqLayerName = workspace + ":" + layerName;
}
// delete related layer
URL deleteLayerUrl = new URL(restURL + "/rest/layers/" + fqLayerName);
boolean layerDeleted = HTTPUtils
.delete(deleteLayerUrl.toExternalForm(), gsuser, gspass);
if (!layerDeleted) {
LOGGER.warn("Could not delete layer '" + fqLayerName + "'");
return false;
}
// delete the wms layer
URL deleteFtUrl = new URL(restURL + "/rest/workspaces/" + workspace + "/wmsstores/"
+ storename + "/wmslayers/" + layerName);
boolean ftDeleted = HTTPUtils.delete(deleteFtUrl.toExternalForm(), gsuser, gspass);
if (!ftDeleted) {
LOGGER.warn("Could not delete wms layer " + workspace + ":" + storename + "/"
+ layerName + ", but layer was deleted.");
} else {
LOGGER.info("Wms layer successfully deleted " + workspace + ":" + storename + "/"
+ layerName);
}
return ftDeleted;
// the store is still there: should we delete it?
} catch (MalformedURLException ex) {
if (LOGGER.isErrorEnabled())
LOGGER.error(ex.getLocalizedMessage(), ex);
return false;
}
}
/**
* Removes the featuretype and the associated layer.
* <P>

View File

@ -42,33 +42,6 @@ public class GSWMSLayerEncoder extends GSResourceEncoder {
super.setMetadata(key, dimensionInfo);
}
/**
* Add a VirtualTable (SQL View feature type)
*
* @param virtualtable
*/
protected void addMetadataVirtualTable(
final GSVirtualTableEncoder virtualtable) {
super.addMetadata("JDBC_VIRTUAL_TABLE", virtualtable);
}
/**
* Set a VirtualTable (SQL View feature type)
*
* @param virtualtable
*/
public void setMetadataVirtualTable(final GSVirtualTableEncoder virtualtable) {
super.setMetadata("JDBC_VIRTUAL_TABLE", virtualtable);
}
/**
* Deletes the VirtualTable metadata
*
* @return true if deleted, false otherwise
*/
public boolean delMetadataVirtualTable(){
return super.delMetadata("JDB_VIRTUAL_TABLE");
}
/**
* delete a keyword from the list