This commit is contained in:
Fabio Sinibaldi 2013-04-09 15:20:57 +00:00
parent 10e640fa5f
commit 9c2d3b1410
3 changed files with 41 additions and 14 deletions

View File

@ -45,6 +45,7 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>

View File

@ -78,7 +78,13 @@ public class GISInterface {
}
//******************* Create logic
/**
* @see it.geosolutions.geoserver.rest.GeoServerRESTPublisher#publishGeoTIFF(String, String, String, File, String, ProjectionPolicy, String, double[])
*
* @param geoNetworkMeta
* @param config
* @return
*/
public PublishResponse addGeoTIFF(String workspace, String storeName, String coverageName,
File geotiff,String srs,
ProjectionPolicy policy,String defaultStyle, double[] bbox,
@ -91,6 +97,7 @@ public class GISInterface {
logger.debug("Using "+desc);
publisher=getGeoServerManager(desc.getUrl(), desc.getUser(), desc.getPassword()).getPublisher();
publishResult=publisher.publishGeoTIFF(workspace, storeName, coverageName, geotiff, srs, policy, defaultStyle, bbox);
// publisher.publish
if(publishResult){
toReturn.setDataOperationResult(Report.OperationState.COMPLETE);
ArrayList<String> distributionUris=new ArrayList<String>();
@ -131,7 +138,10 @@ public class GISInterface {
// ********************* DELETE Logic
/**
* @see it.geosolutions.geoserver.rest.GeoServerRESTPublisher#removeDatastore(String, String, boolean)
*
*/
public DeleteReport deleteStore(String workspace,String storeName,Long metadataUUID){
DeleteReport toReturn=new DeleteReport();
GeoServerRESTPublisher publisher=null;

View File

@ -1,9 +1,12 @@
package org.gcube.spatial.data.gis;
import it.geosolutions.geonetwork.util.GNInsertConfiguration;
import it.geosolutions.geoserver.rest.GeoServerRESTReader;
import it.geosolutions.geoserver.rest.decoder.RESTWorkspaceList.RESTShortWorkspace;
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
import java.io.File;
import java.util.Iterator;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.spatial.data.gis.model.Costants;
@ -22,18 +25,31 @@ public class PublishTest {
public static void main(String[] args) throws Exception {
ScopeProvider.instance.set(defaultScope);
GISInterface gisInterface=GISInterface.get();
String geoTiffPath = "/home/fabio/Downloads/aquamaps-lprognathodesfalcifer20121207161043540cet.geotiff";
File geoTiff=new File(geoTiffPath);
String workspace="aquamaps";
String storeName=geoTiff.getName()+"_store";
String coverageName="";
String srs="EPSG:4326";
ProjectionPolicy policy=ProjectionPolicy.REPROJECT_TO_DECLARED;
String defaultStyle="raster";
double[] bbox=Costants.WORLD_BOUNDING_BOX;
Metadata theMeta=new DefaultMetadata();
GNInsertConfiguration config=new GNInsertConfiguration("view-group", "datasets", "_none_", true);
gisInterface.addGeoTIFF(workspace, storeName, coverageName, geoTiff, srs, policy, defaultStyle, bbox, theMeta, config);
GeoServerRESTReader reader=gisInterface.getGeoServerReader(ResearchMethod.MOSTUNLOAD, false);
System.out.println("***************Workspaces : ");
Iterator<RESTShortWorkspace> it=reader.getWorkspaces().iterator();
while(it.hasNext()){
RESTShortWorkspace work=it.next();
System.out.println(work.getName());
}
// String geoTiffPath = "/home/fabio/Downloads/aquamaps-lprognathodesfalcifer20121207161043540cet.geotiff";
// File geoTiff=new File(geoTiffPath);
// String workspace="aquamaps";
// String storeName=geoTiff.getName()+"_store";
// String coverageName="";
// String srs="EPSG:4326";
// ProjectionPolicy policy=ProjectionPolicy.REPROJECT_TO_DECLARED;
// String defaultStyle="raster";
// double[] bbox=Costants.WORLD_BOUNDING_BOX;
// Metadata theMeta=new DefaultMetadata();
// GNInsertConfiguration config=new GNInsertConfiguration("view-group", "datasets", "_none_", true);
// gisInterface.addGeoTIFF(workspace, storeName, coverageName, geoTiff, srs, policy, defaultStyle, bbox, theMeta, config);
}
}