git-svn-id: http://svn.research-infrastructures.eu/d4science/gcube/trunk/spatial-data/geonetwork@83421 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
407d44e90a
commit
eee48aaaec
|
@ -94,7 +94,7 @@
|
|||
</gmd:CI_ResponsibleParty>
|
||||
</gmd:contact>
|
||||
<gmd:dateStamp>
|
||||
<gco:DateTime>2013-09-11T15:17:52.287+02:00</gco:DateTime>
|
||||
<gco:DateTime>2013-09-18T15:39:23.645+02:00</gco:DateTime>
|
||||
</gmd:dateStamp>
|
||||
<gmd:spatialRepresentationInfo>
|
||||
<gmd:MD_VectorSpatialRepresentation>
|
||||
|
@ -123,7 +123,7 @@
|
|||
<gmd:date>
|
||||
<gmd:CI_Date>
|
||||
<gmd:date>
|
||||
<gco:DateTime>2013-09-11T15:17:52.266+02:00</gco:DateTime>
|
||||
<gco:DateTime>2013-09-18T15:39:23.563+02:00</gco:DateTime>
|
||||
</gmd:date>
|
||||
<gmd:dateType>
|
||||
<gmd:CI_DateTypeCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="creation" codeSpace="eng">Creation</gmd:CI_DateTypeCode>
|
||||
|
@ -256,39 +256,39 @@
|
|||
<gmd:onLine>
|
||||
<gmd:CI_OnlineResource>
|
||||
<gmd:linkage>
|
||||
<gmd:URL>http://geoserver-dev.d4science.org/geoserver/wms?service=wms&version=1.1.0&request=GetMap&layers=TrueMarble.16km.2700x1350&styles=raster&bbox=-180.0,-90.0,180.0,90.0&width=676&height=330&srs=EPSG:4326&crs=EPSG:4326&format=application/openlayers</gmd:URL>
|
||||
<gmd:URL>http://geoserver-dev.d4science.org/geoserver/wms?service=wms&version=1.1.0&request=GetMap&layers=aquamaps:TrueMarble.16km.2700x1350&styles=raster&bbox=-180.0,-90.0,180.0,90.0&width=676&height=330&srs=EPSG:4326&crs=EPSG:4326&format=application/openlayers</gmd:URL>
|
||||
</gmd:linkage>
|
||||
<gmd:protocol>
|
||||
<gco:CharacterString>OGC:WMS-1.3.0-http-get-map</gco:CharacterString>
|
||||
</gmd:protocol>
|
||||
<gmd:name>
|
||||
<gco:CharacterString>TrueMarble.16km.2700x1350</gco:CharacterString>
|
||||
<gco:CharacterString>aquamaps:TrueMarble.16km.2700x1350</gco:CharacterString>
|
||||
</gmd:name>
|
||||
</gmd:CI_OnlineResource>
|
||||
</gmd:onLine>
|
||||
<gmd:onLine>
|
||||
<gmd:CI_OnlineResource>
|
||||
<gmd:linkage>
|
||||
<gmd:URL>http://geoserver-dev.d4science.org/geoserver/ows?service=wfs&version=1.0.0&request=GetFeature&typeName=TrueMarble.16km.2700x1350&format=json</gmd:URL>
|
||||
<gmd:URL>http://geoserver-dev.d4science.org/geoserver/ows?service=wfs&version=1.0.0&request=GetFeature&typeName=aquamaps:TrueMarble.16km.2700x1350&format=json</gmd:URL>
|
||||
</gmd:linkage>
|
||||
<gmd:protocol>
|
||||
<gco:CharacterString>OGC:WFS-1.0.0-http-get-feature</gco:CharacterString>
|
||||
</gmd:protocol>
|
||||
<gmd:name>
|
||||
<gco:CharacterString>TrueMarble.16km.2700x1350</gco:CharacterString>
|
||||
<gco:CharacterString>aquamaps:TrueMarble.16km.2700x1350</gco:CharacterString>
|
||||
</gmd:name>
|
||||
</gmd:CI_OnlineResource>
|
||||
</gmd:onLine>
|
||||
<gmd:onLine>
|
||||
<gmd:CI_OnlineResource>
|
||||
<gmd:linkage>
|
||||
<gmd:URL>http://geoserver-dev.d4science.org/geoserver/wcs?service=wcs&version=1.0.0&request=GetCoverage&coverage=TrueMarble.16km.2700x1350&CRS=EPSG:4326&bbox=-180.0,-90.0,180.0,90.0&width=676&height=330&format=geotiff</gmd:URL>
|
||||
<gmd:URL>http://geoserver-dev.d4science.org/geoserver/wcs?service=wcs&version=1.0.0&request=GetCoverage&coverage=aquamaps:TrueMarble.16km.2700x1350&CRS=EPSG:4326&bbox=-180.0,-90.0,180.0,90.0&width=676&height=330&format=geotiff</gmd:URL>
|
||||
</gmd:linkage>
|
||||
<gmd:protocol>
|
||||
<gco:CharacterString>WWW:LINK-1.0-http--link</gco:CharacterString>
|
||||
</gmd:protocol>
|
||||
<gmd:name>
|
||||
<gco:CharacterString>TrueMarble.16km.2700x1350</gco:CharacterString>
|
||||
<gco:CharacterString>aquamaps:TrueMarble.16km.2700x1350</gco:CharacterString>
|
||||
</gmd:name>
|
||||
</gmd:CI_OnlineResource>
|
||||
</gmd:onLine>
|
||||
|
|
14
pom.xml
14
pom.xml
|
@ -58,12 +58,7 @@
|
|||
<artifactId>ic-client</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT]</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>aquamapsservice-cl</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-utils-encryption</artifactId>
|
||||
|
@ -79,7 +74,12 @@
|
|||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.6.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
<version>1.4.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
|
|
@ -1,393 +0,0 @@
|
|||
package org.gcube.spatial.data.geonetwork.test;
|
||||
|
||||
import it.geosolutions.geonetwork.util.GNInsertConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.gcube.application.aquamaps.aquamapsservice.stubs.datamodel.enhanced.Field;
|
||||
import org.gcube.application.aquamaps.aquamapsservice.stubs.datamodel.fields.HspenFields;
|
||||
import org.gcube.application.aquamaps.aquamapsservice.stubs.datamodel.types.FieldType;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.spatial.data.geonetwork.GeoNetwork;
|
||||
import org.gcube.spatial.data.geonetwork.GeoNetworkPublisher;
|
||||
import org.geotoolkit.metadata.iso.DefaultIdentifier;
|
||||
import org.geotoolkit.metadata.iso.DefaultMetadata;
|
||||
import org.geotoolkit.metadata.iso.citation.DefaultCitation;
|
||||
import org.geotoolkit.metadata.iso.citation.DefaultCitationDate;
|
||||
import org.geotoolkit.metadata.iso.citation.DefaultContact;
|
||||
import org.geotoolkit.metadata.iso.citation.DefaultOnlineResource;
|
||||
import org.geotoolkit.metadata.iso.citation.DefaultResponsibleParty;
|
||||
import org.geotoolkit.metadata.iso.constraint.DefaultLegalConstraints;
|
||||
import org.geotoolkit.metadata.iso.distribution.DefaultDigitalTransferOptions;
|
||||
import org.geotoolkit.metadata.iso.distribution.DefaultDistribution;
|
||||
import org.geotoolkit.metadata.iso.distribution.DefaultFormat;
|
||||
import org.geotoolkit.metadata.iso.extent.DefaultExtent;
|
||||
import org.geotoolkit.metadata.iso.identification.DefaultBrowseGraphic;
|
||||
import org.geotoolkit.metadata.iso.identification.DefaultDataIdentification;
|
||||
import org.geotoolkit.metadata.iso.identification.DefaultKeywords;
|
||||
import org.geotoolkit.metadata.iso.lineage.DefaultAlgorithm;
|
||||
import org.geotoolkit.metadata.iso.lineage.DefaultLineage;
|
||||
import org.geotoolkit.metadata.iso.lineage.DefaultNominalResolution;
|
||||
import org.geotoolkit.metadata.iso.lineage.DefaultProcessStep;
|
||||
import org.geotoolkit.metadata.iso.lineage.DefaultProcessing;
|
||||
import org.geotoolkit.metadata.iso.lineage.DefaultSource;
|
||||
import org.geotoolkit.metadata.iso.maintenance.DefaultMaintenanceInformation;
|
||||
import org.geotoolkit.metadata.iso.quality.DefaultDataQuality;
|
||||
import org.geotoolkit.metadata.iso.quality.DefaultScope;
|
||||
import org.geotoolkit.metadata.iso.spatial.DefaultGeometricObjects;
|
||||
import org.geotoolkit.metadata.iso.spatial.DefaultVectorSpatialRepresentation;
|
||||
import org.geotoolkit.util.DefaultInternationalString;
|
||||
import org.geotoolkit.xml.XML;
|
||||
import org.opengis.metadata.Metadata;
|
||||
import org.opengis.metadata.citation.DateType;
|
||||
import org.opengis.metadata.citation.PresentationForm;
|
||||
import org.opengis.metadata.citation.Role;
|
||||
import org.opengis.metadata.constraint.Restriction;
|
||||
import org.opengis.metadata.identification.KeywordType;
|
||||
import org.opengis.metadata.identification.TopicCategory;
|
||||
import org.opengis.metadata.maintenance.MaintenanceFrequency;
|
||||
import org.opengis.metadata.maintenance.ScopeCode;
|
||||
import org.opengis.metadata.spatial.GeometricObjectType;
|
||||
import org.opengis.metadata.spatial.TopologyLevel;
|
||||
|
||||
public class AMMetaCreation {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param args
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// ref http://www.fao.org/geonetwork/srv/en/csw?service=CSW&request=GetRecordById&Version=2.0.2&elementSetName=full&outputSchema=http://www.isotc211.org/2005/gmd&id=74f6864c-3e3e-4cd8-a2ea-188337dc6334
|
||||
|
||||
|
||||
private static final String devVRE_Group="5";
|
||||
private static final String devsec_Group="6";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
Metadata meta=generateMeta();
|
||||
|
||||
|
||||
FileUtils.writeStringToFile(new File("summary.txt"), meta.toString());
|
||||
|
||||
System.out.println("wrote summary.txt");
|
||||
|
||||
FileUtils.writeStringToFile(new File("meta.xml"), XML.marshal(meta));
|
||||
System.out.println("wrote meta.xml");
|
||||
|
||||
System.out.println("Trying to publish...");
|
||||
|
||||
ScopeProvider.instance.set("/gcube/devsec");
|
||||
GeoNetworkPublisher publisher=GeoNetwork.get();
|
||||
|
||||
GNInsertConfiguration config=new GNInsertConfiguration(devVRE_Group, "datasets", "_none_", true);
|
||||
long id=publisher.insertMetadata(config, meta);
|
||||
System.out.println("Published ID : "+id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static Metadata generateMeta() throws URISyntaxException{
|
||||
// ***************************** CONSTANT VALUES
|
||||
String algorithmDescription="Kaschner, K., J. S. Ready, E. Agbayani, J. Rius, K. Kesner-Reyes, P. D. Eastwood, A. B. South, "+
|
||||
"S. O. Kullander, T. Rees, C. H. Close, R. Watson, D. Pauly, and R. Froese. 2008 AquaMaps: "+
|
||||
"Predicted range maps for aquatic species. World wide web electronic publication, www.aquamaps.org, Version 10/2008.";
|
||||
|
||||
String[] algorithmsAuthors=new String[]{
|
||||
"Kaschner, K.",
|
||||
"J. S. Ready",
|
||||
"E. Agbayani",
|
||||
"J. Rius",
|
||||
"K. Kesner-Reyes",
|
||||
"P. D. Eastwood",
|
||||
"A. B. South",
|
||||
"S. O. Kullander",
|
||||
"T. Rees",
|
||||
"C. H. Close",
|
||||
"R. Watson",
|
||||
"D. Pauly",
|
||||
"R. Froese"
|
||||
};
|
||||
|
||||
String algorithmCitationTitle="AquaMaps : Predicted range maps for aquatic species. World wide web electronic publication";
|
||||
|
||||
String algorithmEdition="Version 10/2008";
|
||||
|
||||
String algorithmContact = "www.aquamaps.org";
|
||||
|
||||
|
||||
|
||||
// PROJECT CITATION
|
||||
|
||||
String project="iMarine";
|
||||
String projectLink="http://www.i-marine.eu";
|
||||
String projectContact="https://support.d4science.research-infrastructures.eu/";
|
||||
|
||||
// MAP CONSTANTS
|
||||
|
||||
String abstractField=" Map, generated by gCube AquaMaps Suite.";
|
||||
String purpose="To serve and protect";
|
||||
|
||||
// ALGORITHM CITATION
|
||||
|
||||
|
||||
|
||||
//******************************* MAP VALUES
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String user="test.user";
|
||||
Integer geometryCount=100;
|
||||
String title="MyDistributionMap";
|
||||
|
||||
Date creationDate=new Date(System.currentTimeMillis());
|
||||
Date publishDate=new Date(System.currentTimeMillis());
|
||||
Date revisionDate=new Date(System.currentTimeMillis());
|
||||
|
||||
|
||||
List<String> layerUris=new ArrayList<String>();
|
||||
layerUris.add("http://geoserver2.d4science.research-infrastructures.eu/geoserver/aquamaps/wms?service=WMS&version=1.1.0&request=GetMap&layers=aquamaps:lphotoblepharonpalpebratum20121207161220677cet&styles=&bbox=-180.0,-85.5,180.0,90.0&width=676&height=330&srs=EPSG:4326&format=application/openlayers");
|
||||
layerUris.add("http://geoserver2.d4science.research-infrastructures.eu/geoserver/aquamaps/wms/kml?layers=aquamaps:lphotoblepharonpalpebratum20121207161220677cet");
|
||||
layerUris.add("http://geoserver2.d4science.research-infrastructures.eu/geoserver/aquamaps/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=aquamaps:lphotoblepharonpalpebratum20121207161220677cet&maxFeatures=50&outputFormat=GML2");
|
||||
|
||||
List<String> staticImgs=new ArrayList<String>();
|
||||
staticImgs.add("http://aquamaps.research-infrastructures.eu/80/Animalia/Chordata/Actinopterygii/Tetraodontiformes/Balistidae/Fis-53544/Earth.jpg");
|
||||
staticImgs.add("http://aquamaps.research-infrastructures.eu/80/Animalia/Chordata/Actinopterygii/Tetraodontiformes/Balistidae/Fis-53544/Continent_View__Africa.jpg");
|
||||
staticImgs.add("http://aquamaps.research-infrastructures.eu/80/Animalia/Chordata/Actinopterygii/Tetraodontiformes/Balistidae/Fis-53544/Continent_View__Asia.jpg");
|
||||
staticImgs.add("http://aquamaps.research-infrastructures.eu/80/Animalia/Chordata/Actinopterygii/Tetraodontiformes/Balistidae/Fis-53544/Continent_View__Australia.jpg");
|
||||
staticImgs.add("http://aquamaps.research-infrastructures.eu/80/Animalia/Chordata/Actinopterygii/Tetraodontiformes/Balistidae/Fis-53544/Continent_View__Europa.jpg");
|
||||
staticImgs.add("http://aquamaps.research-infrastructures.eu/80/Animalia/Chordata/Actinopterygii/Tetraodontiformes/Balistidae/Fis-53544/Continent_View__North_America.jpg");
|
||||
staticImgs.add("http://aquamaps.research-infrastructures.eu/80/Animalia/Chordata/Actinopterygii/Tetraodontiformes/Balistidae/Fis-53544/Continent_View__South_America.jpg");
|
||||
staticImgs.add("http://aquamaps.research-infrastructures.eu/80/Animalia/Chordata/Actinopterygii/Tetraodontiformes/Balistidae/Fis-53544/Ocean_View__Atlantic.jpg");
|
||||
staticImgs.add("http://aquamaps.research-infrastructures.eu/80/Animalia/Chordata/Actinopterygii/Tetraodontiformes/Balistidae/Fis-53544/Ocean_View__Indian.jpg");
|
||||
staticImgs.add("http://aquamaps.research-infrastructures.eu/80/Animalia/Chordata/Actinopterygii/Tetraodontiformes/Balistidae/Fis-53544/Pole_View__Artic.jpg");
|
||||
staticImgs.add("http://aquamaps.research-infrastructures.eu/80/Animalia/Chordata/Actinopterygii/Tetraodontiformes/Balistidae/Fis-53544/Ocean_View__North_Atlantic.jpg");
|
||||
staticImgs.add("http://aquamaps.research-infrastructures.eu/80/Animalia/Chordata/Actinopterygii/Tetraodontiformes/Balistidae/Fis-53544/Ocean_View__Pacific.jpg");
|
||||
staticImgs.add("http://aquamaps.research-infrastructures.eu/80/Animalia/Chordata/Actinopterygii/Tetraodontiformes/Balistidae/Fis-53544/Pole_View__Antarctic.jpg");
|
||||
staticImgs.add("http://aquamaps.research-infrastructures.eu/80/Animalia/Chordata/Actinopterygii/Tetraodontiformes/Balistidae/Fis-53544/Ocean_View__South_Atlantic.jpg");
|
||||
|
||||
HashMap<KeywordType,HashSet<String>> descriptiveKeyWords=new HashMap<KeywordType, HashSet<String>>();
|
||||
HashSet<String> keySet=new HashSet<String>();
|
||||
keySet.add("species distribution");
|
||||
keySet.add(project);
|
||||
keySet.add("AquaMaps");
|
||||
descriptiveKeyWords.put(KeywordType.THEME, keySet);
|
||||
|
||||
|
||||
SpeciesCustomization custom=new SpeciesCustomization();
|
||||
custom.setSpeciesId("FIS-124978");
|
||||
custom.getCustomValues().add(new Field(HspenFields.depthmax+"","10.2",FieldType.DOUBLE));
|
||||
|
||||
|
||||
String sourceTitle="Default HSPEC";
|
||||
String sourceDescription="Suitable 2050 Default HSPEC";
|
||||
Date sourceGenerationDate=new Date(System.currentTimeMillis());
|
||||
String sourceTableName="asdfkjg23476450asdjkt0";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//*************** Responsible Party : author
|
||||
DefaultResponsibleParty party=new DefaultResponsibleParty();
|
||||
party.setIndividualName(user);
|
||||
party.setOrganisationName(new DefaultInternationalString(project));
|
||||
party.setRole(Role.AUTHOR);
|
||||
|
||||
//*************** Responsible Party : provider -> iMarine
|
||||
|
||||
DefaultResponsibleParty provider=new DefaultResponsibleParty();
|
||||
provider.setOrganisationName(new DefaultInternationalString(project));
|
||||
provider.setRole(Role.RESOURCE_PROVIDER);
|
||||
DefaultContact providerContact=new DefaultContact();
|
||||
providerContact.setOnlineResource(new DefaultOnlineResource (new URI(projectLink)));
|
||||
provider.setContactInfo(providerContact);
|
||||
|
||||
//*************** Identification
|
||||
DefaultDataIdentification ident=new DefaultDataIdentification();
|
||||
ident.getLanguages().add(Locale.ENGLISH);
|
||||
|
||||
|
||||
DefaultCitation citation=new DefaultCitation();
|
||||
citation.setTitle(new DefaultInternationalString(title));
|
||||
|
||||
citation.getDates().add(new DefaultCitationDate(creationDate, DateType.CREATION));
|
||||
citation.getDates().add(new DefaultCitationDate(publishDate, DateType.PUBLICATION));
|
||||
citation.getDates().add(new DefaultCitationDate(revisionDate, DateType.REVISION));
|
||||
|
||||
citation.getPresentationForms().add(PresentationForm.MAP_DIGITAL);
|
||||
|
||||
|
||||
ident.setCitation(citation);
|
||||
ident.setAbstract(new DefaultInternationalString(abstractField));
|
||||
ident.setPurpose(new DefaultInternationalString(purpose));
|
||||
|
||||
ident.getResourceMaintenances().add(new DefaultMaintenanceInformation(MaintenanceFrequency.AS_NEEDED));
|
||||
|
||||
|
||||
|
||||
for(Entry<KeywordType,HashSet<String>> entry:descriptiveKeyWords.entrySet()){
|
||||
DefaultKeywords keywords=new DefaultKeywords();
|
||||
for(String key:entry.getValue())keywords.getKeywords().add(new DefaultInternationalString(key));
|
||||
keywords.setType(entry.getKey());
|
||||
|
||||
//TODO define how to get thesaurus
|
||||
|
||||
DefaultCitation thesaurus=new DefaultCitation();
|
||||
thesaurus.setTitle(new DefaultInternationalString("General"));
|
||||
thesaurus.getAlternateTitles().add(new DefaultInternationalString("GENERAL"));
|
||||
thesaurus.getDates().add(new DefaultCitationDate(new Date(), DateType.CREATION));
|
||||
thesaurus.setOtherCitationDetails(new DefaultInternationalString("This is a description of the thesaurus"));
|
||||
|
||||
keywords.setThesaurusName(thesaurus);
|
||||
ident.getDescriptiveKeywords().add(keywords);
|
||||
}
|
||||
|
||||
ident.getTopicCategories().add(TopicCategory.BIOTA);
|
||||
|
||||
|
||||
ident.getExtents().add(DefaultExtent.WORLD);
|
||||
|
||||
//Spatial Rapresentation Info
|
||||
DefaultGeometricObjects geoObjs=new DefaultGeometricObjects();
|
||||
geoObjs.setGeometricObjectType(GeometricObjectType.SURFACE);
|
||||
geoObjs.setGeometricObjectCount(geometryCount);
|
||||
|
||||
DefaultVectorSpatialRepresentation spatial=new DefaultVectorSpatialRepresentation();
|
||||
spatial.setTopologyLevel(TopologyLevel.GEOMETRY_ONLY);
|
||||
spatial.getGeometricObjects().add(geoObjs);
|
||||
|
||||
|
||||
|
||||
// DistributionInfo
|
||||
DefaultDistribution distribution=new DefaultDistribution();
|
||||
|
||||
DefaultDigitalTransferOptions transferOptions=new DefaultDigitalTransferOptions();
|
||||
for(String uri:layerUris)transferOptions.getOnLines().add(new DefaultOnlineResource(new URI(uri)));
|
||||
distribution.getTransferOptions().add(transferOptions);
|
||||
|
||||
DefaultFormat format1 = new DefaultFormat();
|
||||
format1.setName(new DefaultInternationalString("WMS"));
|
||||
format1.setVersion(new DefaultInternationalString("1.1.0"));
|
||||
DefaultFormat format2 = new DefaultFormat();
|
||||
format2.setName(new DefaultInternationalString("WFS"));
|
||||
format2.setVersion(new DefaultInternationalString("1.1.0"));
|
||||
DefaultFormat format3 = new DefaultFormat();
|
||||
format3.setName(new DefaultInternationalString("WCS"));
|
||||
format3.setVersion(new DefaultInternationalString("1.0.0"));
|
||||
|
||||
DefaultFormat format4 = new DefaultFormat();
|
||||
format4.setName(new DefaultInternationalString("JPG"));
|
||||
format4.setVersion(new DefaultInternationalString("ISO/IEC 10918-1"));
|
||||
|
||||
distribution.setDistributionFormats(new ArrayList<DefaultFormat>(Arrays.asList(format1, format2, format3,format4)));
|
||||
|
||||
for(String uri:staticImgs)
|
||||
ident.getGraphicOverviews().add(new DefaultBrowseGraphic(new URI(uri)));
|
||||
|
||||
//MetadataConstraints
|
||||
|
||||
DefaultLegalConstraints constraints=new DefaultLegalConstraints();
|
||||
constraints.getUseLimitations().add(new DefaultInternationalString("CC-BY-SA"));
|
||||
constraints.getAccessConstraints().add(Restriction.LICENSE);
|
||||
constraints.getUseConstraints().add(Restriction.LICENSE);
|
||||
|
||||
|
||||
//QUALITY
|
||||
|
||||
// DefaultDataQuality citationQuality=new DefaultDataQuality();
|
||||
// DefaultLineage citationLineage=new DefaultLineage();
|
||||
// citationLineage.setStatement(new DefaultInternationalString(CITATION));
|
||||
// citationQuality.setLineage(citationLineage);
|
||||
// citationQuality.setScope(new DefaultScope(ScopeCode.MODEL));
|
||||
//
|
||||
|
||||
|
||||
DefaultDataQuality processQuality=new DefaultDataQuality();
|
||||
DefaultLineage processLineage=new DefaultLineage();
|
||||
|
||||
|
||||
DefaultSource source=new DefaultSource();
|
||||
DefaultNominalResolution resolution=new DefaultNominalResolution();
|
||||
resolution.setGroundResolution(0.5d);
|
||||
resolution.setScanningResolution(0.5d);
|
||||
source.getSourceExtents().add(DefaultExtent.WORLD);
|
||||
|
||||
|
||||
DefaultCitation sourceCitation=new DefaultCitation();
|
||||
sourceCitation.setTitle(new DefaultInternationalString(sourceTitle));
|
||||
sourceCitation.getDates().add(new DefaultCitationDate(sourceGenerationDate, DateType.CREATION));
|
||||
sourceCitation.getIdentifiers().add(new DefaultIdentifier(sourceTableName));
|
||||
source.setSourceCitation(sourceCitation);
|
||||
|
||||
|
||||
|
||||
|
||||
DefaultProcessStep processStep=new DefaultProcessStep();
|
||||
processStep.setDescription(new DefaultInternationalString("AquaMaps Ecological Niche Modelling"));
|
||||
DefaultProcessing processing=new DefaultProcessing();
|
||||
DefaultAlgorithm algorithm=new DefaultAlgorithm();
|
||||
algorithm.setDescription(new DefaultInternationalString(algorithmDescription));
|
||||
processing.setRunTimeParameters(new DefaultInternationalString(custom.toXML()));
|
||||
processing.getAlgorithms().add(algorithm);
|
||||
|
||||
|
||||
//Commented advanced algorithm citation
|
||||
// DefaultCitation algorithmDoc=new DefaultCitation();
|
||||
// algorithmDoc.setTitle(new DefaultInternationalString(algorithmCitationTitle));
|
||||
// for(String author:algorithmsAuthors){
|
||||
// DefaultResponsibleParty algorithmAuthor=new DefaultResponsibleParty();
|
||||
// algorithmAuthor.setIndividualName(author);
|
||||
// algorithmDoc.getCitedResponsibleParties().add(algorithmAuthor);
|
||||
// }
|
||||
//
|
||||
// algorithmDoc.setOtherCitationDetails(new DefaultInternationalString(algorithmContact));
|
||||
// algorithmDoc.setEdition(new DefaultInternationalString (algorithmEdition));
|
||||
//
|
||||
// processing.getDocumentations().add(algorithmDoc);
|
||||
|
||||
|
||||
// processing.getAlgorithms().add(algorithm);
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
processLineage.getProcessSteps().add(processStep);
|
||||
processLineage.getSources().add(source);
|
||||
processQuality.setLineage(processLineage);
|
||||
processQuality.setScope(new DefaultScope(ScopeCode.DATASET));
|
||||
|
||||
|
||||
//*************** The Meta Object
|
||||
DefaultMetadata meta=new DefaultMetadata(party, new Date(System.currentTimeMillis()), ident);
|
||||
meta.getContacts().add(provider);
|
||||
meta.getSpatialRepresentationInfo().add(spatial);
|
||||
meta.setDistributionInfo(distribution);
|
||||
meta.getMetadataConstraints().add(constraints);
|
||||
meta.getDataQualityInfo().add(processQuality);
|
||||
meta.setLanguage(Locale.ENGLISH);
|
||||
meta.getHierarchyLevels().add(ScopeCode.DATASET);
|
||||
|
||||
return meta;
|
||||
}
|
||||
}
|
|
@ -14,12 +14,13 @@ import org.gcube.spatial.data.geonetwork.GeoNetworkPublisher;
|
|||
import org.gcube.spatial.data.geonetwork.GeoNetworkReader;
|
||||
import org.gcube.spatial.data.geonetwork.LoginLevel;
|
||||
import org.gcube.spatial.data.geonetwork.configuration.ConfigurationManager;
|
||||
import org.geotoolkit.xml.XML;
|
||||
import org.opengis.metadata.Metadata;
|
||||
|
||||
public class LoginTest {
|
||||
|
||||
|
||||
private static final String defaultScope="/gcube/devsec";
|
||||
private static final String defaultScope="/gcube/devsec/devVRE";
|
||||
// private static final String defaultScope="/d4science.research-infrastructures.eu/gCubeApps";
|
||||
|
||||
/**
|
||||
|
@ -42,7 +43,13 @@ public class LoginTest {
|
|||
|
||||
checkLevelsCount();
|
||||
|
||||
// getMetaById("5a68c6a4-916b-4789-8442-ee3a4aac14d5", LoginLevel.DEFAULT);
|
||||
|
||||
String uuid="a42c2a8a-62ad-4b11-8cf5-13864de1a569";
|
||||
System.out.println("********************************************* GET BY UUID : "+uuid);
|
||||
XML.marshal(getMetaByUUID(uuid, LoginLevel.DEFAULT),System.out);
|
||||
// long id=50002;
|
||||
// System.out.println("********************************************* GET BY ID : "+id);
|
||||
// XML.marshal(getMetaById(id, LoginLevel.DEFAULT),System.out);
|
||||
|
||||
}
|
||||
|
||||
|
@ -92,7 +99,13 @@ public class LoginTest {
|
|||
}
|
||||
|
||||
|
||||
public static Metadata getMetaById(String id, LoginLevel level) throws Exception{
|
||||
public static Metadata getMetaByUUID(String id, LoginLevel level) throws Exception{
|
||||
GeoNetworkReader reader=GeoNetwork.get();
|
||||
reader.login(level);
|
||||
return reader.getById(id);
|
||||
}
|
||||
|
||||
public static Metadata getMetaById(long id, LoginLevel level) throws Exception{
|
||||
GeoNetworkReader reader=GeoNetwork.get();
|
||||
reader.login(level);
|
||||
return reader.getById(id);
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
package org.gcube.spatial.data.geonetwork.test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.aquamaps.aquamapsservice.stubs.datamodel.enhanced.Field;
|
||||
import org.gcube.application.aquamaps.aquamapsservice.stubs.datamodel.xstream.AquaMapsXStream;
|
||||
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
import com.thoughtworks.xstream.annotations.XStreamImplicit;
|
||||
|
||||
@XStreamAlias("SpeciesCustomization")
|
||||
public class SpeciesCustomization {
|
||||
|
||||
private static XStream xstream=AquaMapsXStream.getXMLInstance();
|
||||
|
||||
static{
|
||||
xstream.processAnnotations(SpeciesCustomization.class);
|
||||
}
|
||||
public SpeciesCustomization(String speciesId, List<Field> customValues) {
|
||||
super();
|
||||
this.speciesId = speciesId;
|
||||
this.customValues = customValues;
|
||||
}
|
||||
public SpeciesCustomization() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@XStreamAsAttribute
|
||||
private String speciesId;
|
||||
@XStreamImplicit
|
||||
private List<Field> customValues=new ArrayList<Field>();
|
||||
/**
|
||||
* @return the speciesId
|
||||
*/
|
||||
public String getSpeciesId() {
|
||||
return speciesId;
|
||||
}
|
||||
/**
|
||||
* @param speciesId the speciesId to set
|
||||
*/
|
||||
public void setSpeciesId(String speciesId) {
|
||||
this.speciesId = speciesId;
|
||||
}
|
||||
/**
|
||||
* @return the customValues
|
||||
*/
|
||||
public List<Field> getCustomValues() {
|
||||
return customValues;
|
||||
}
|
||||
/**
|
||||
* @param customValues the customValues to set
|
||||
*/
|
||||
public void setCustomValues(List<Field> customValues) {
|
||||
this.customValues = customValues;
|
||||
}
|
||||
|
||||
public String toXML(){
|
||||
return xstream.toXML(this);
|
||||
}
|
||||
}
|
|
@ -41,11 +41,11 @@ public class TrueMarbleMeta {
|
|||
gMeta.addTopicCategory(TopicCategory.ENVIRONMENT);
|
||||
Metadata meta=gMeta.getMetadata();
|
||||
|
||||
((DefaultMetadata)meta).setDistributionInfo(ISOMetadataFactory.getDistributionByLayer("TrueMarble.16km.2700x1350", "http://geoserver-dev.d4science.org/geoserver", "raster", "-180.0,-90.0,180.0,90.0", gMeta.getConfig()));
|
||||
((DefaultMetadata)meta).setDistributionInfo(ISOMetadataFactory.getDistributionByLayer("aquamaps:TrueMarble.16km.2700x1350", "http://geoserver-dev.d4science.org/geoserver", "raster", "-180.0,-90.0,180.0,90.0", gMeta.getConfig()));
|
||||
XML.marshal(meta, new File("TrueMarble.xml"));
|
||||
|
||||
GeoNetworkPublisher publisher=GeoNetwork.get();
|
||||
publisher.login(LoginLevel.DEFAULT);
|
||||
// GeoNetworkPublisher publisher=GeoNetwork.get();
|
||||
// publisher.login(LoginLevel.DEFAULT);
|
||||
// System.out.println("Inserted meta with id : "+publisher.insertMetadata(meta));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue