publishGeotiff now support setting store and layer name
This commit is contained in:
parent
9493343f1b
commit
0b9f6eda5d
@ -700,7 +700,7 @@ public class GeoServerRESTPublisher {
|
|||||||
* @param coveragestore
|
* @param coveragestore
|
||||||
* Name of the coveragestore
|
* Name of the coveragestore
|
||||||
* @param file
|
* @param file
|
||||||
* zip file to upload
|
* file to upload
|
||||||
* @param configure
|
* @param configure
|
||||||
* Configure parameter. It may be null.
|
* Configure parameter. It may be null.
|
||||||
* @param params
|
* @param params
|
||||||
@ -752,9 +752,19 @@ public class GeoServerRESTPublisher {
|
|||||||
// === GEOTIFF
|
// === GEOTIFF
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple wrapper for {@link #publishGeoTIFF(String, String, String, File)}
|
||||||
|
*/
|
||||||
|
public boolean publishGeoTIFF(String workspace, String storeName,
|
||||||
|
File geotiff) throws FileNotFoundException {
|
||||||
|
return publishCoverage(workspace, storeName, "geotiff",
|
||||||
|
"image/geotiff", geotiff, ParameterConfigure.FIRST,
|
||||||
|
(NameValuePair[]) null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Publish a GeoTiff.
|
* Publish a GeoTiff.
|
||||||
*
|
* Simple wrapper for {@link #publishCoverage(String, String, String, String, File, ParameterConfigure, NameValuePair...)}
|
||||||
* <P>
|
* <P>
|
||||||
* This is the equivalent call with cUrl:
|
* This is the equivalent call with cUrl:
|
||||||
*
|
*
|
||||||
@ -765,13 +775,22 @@ public class GeoServerRESTPublisher {
|
|||||||
* }
|
* }
|
||||||
* </PRE>
|
* </PRE>
|
||||||
*
|
*
|
||||||
|
* @param workspace Workspace to use
|
||||||
|
* @param storeName Name of the coveragestore (if null the file name will be used)
|
||||||
|
* @param layerName the name of the coverage (if null the file name will be used)
|
||||||
|
* @param geotiff file to upload
|
||||||
* @return true if the operation completed successfully.
|
* @return true if the operation completed successfully.
|
||||||
|
* @throws FileNotFoundException if file does not exists
|
||||||
|
* @throws IllegalArgumentException if workspace or geotiff are null
|
||||||
*/
|
*/
|
||||||
public boolean publishGeoTIFF(String workspace, String storeName,
|
public boolean publishGeoTIFF(final String workspace, final String storeName, final String layerName,
|
||||||
File geotiff) throws FileNotFoundException {
|
final File geotiff) throws FileNotFoundException, IllegalArgumentException {
|
||||||
return publishCoverage(workspace, storeName, "geotiff",
|
if (workspace==null || geotiff==null)
|
||||||
|
throw new IllegalArgumentException("Unable to proceed, some arguments are null");
|
||||||
|
|
||||||
|
return publishCoverage(workspace, (storeName!=null)?storeName:FilenameUtils.getBaseName(geotiff.getAbsolutePath()), "geotiff",
|
||||||
"image/geotiff", geotiff, ParameterConfigure.FIRST,
|
"image/geotiff", geotiff, ParameterConfigure.FIRST,
|
||||||
(NameValuePair[]) null);
|
(layerName!=null)?new NameValuePair[]{new NameValuePair("coverageName", layerName)}:(NameValuePair[]) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -102,6 +102,10 @@ public class GeoserverRESTGeoTiffTest extends GeoserverRESTTest {
|
|||||||
|
|
||||||
assertNotNull("publish() failed", pub);
|
assertNotNull("publish() failed", pub);
|
||||||
|
|
||||||
|
pub = publisher.publishGeoTIFF(DEFAULT_WS, storeName+"another", "layername", geotiff);
|
||||||
|
|
||||||
|
assertNotNull("publish() failed", pub);
|
||||||
|
|
||||||
//delete
|
//delete
|
||||||
assertTrue("Unpublish() failed", publisher.removeCoverageStore(DEFAULT_WS, storeName,true));
|
assertTrue("Unpublish() failed", publisher.removeCoverageStore(DEFAULT_WS, storeName,true));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user