Initial import.

git-svn-id: http://svn.research-infrastructures.eu/d4science/gcube/trunk/spatial-data/geonetwork@100691 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Fabio Sinibaldi 2014-10-15 09:30:24 +00:00
parent 8cd0742009
commit e7d4cef87e
42 changed files with 0 additions and 3574 deletions

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gis-interface</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -1,6 +0,0 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -1,5 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6

View File

@ -1,4 +0,0 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=false
version=1

View File

@ -1,312 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<gmd:MD_Metadata xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gml="http://www.opengis.net/gml" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:fra="http://www.cnig.gouv.fr/2005/fra">
<gmd:fileIdentifier>
<gco:CharacterString>a42c2a8a-62ad-4b11-8cf5-13864de1a569</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:language>
<gmd:LanguageCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/ML_gmxCodelists.xml#LanguageCode" codeListValue="eng">English</gmd:LanguageCode>
</gmd:language>
<gmd:characterSet>
<gmd:MD_CharacterSetCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#MD_CharacterSetCode" codeListValue="utf8">UTF-8</gmd:MD_CharacterSetCode>
</gmd:characterSet>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="eng">Dataset</gmd:MD_ScopeCode>
</gmd:hierarchyLevel>
<gmd:contact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>fabio.sinibaldi</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>iMarine Consortium</gco:CharacterString>
</gmd:organisationName>
<gmd:role>
<gmd:CI_RoleCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="author">Author</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>
<gmd:contact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>iMarine.eu</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>iMarine Consortium</gco:CharacterString>
</gmd:organisationName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<gco:CharacterString>info@i-marine.eu</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
<gmd:onlineResource>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>http://www.i-marine.eu</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>WWW:LINK-1.0-http--link</gco:CharacterString>
</gmd:protocol>
</gmd:CI_OnlineResource>
</gmd:onlineResource>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="distributor">Distributor</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>
<gmd:contact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>iMarine Consortium Technical Support</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>iMarine Consortium</gco:CharacterString>
</gmd:organisationName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:address>
<gmd:CI_Address>
<gmd:electronicMailAddress>
<gco:CharacterString>support@i-marine.eu</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
<gmd:onlineResource>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>http://www.i-marine.eu</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>WWW:LINK-1.0-http--link</gco:CharacterString>
</gmd:protocol>
</gmd:CI_OnlineResource>
</gmd:onlineResource>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="resourceProvider">Resource provider</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>
<gmd:dateStamp>
<gco:DateTime>2013-09-18T15:39:23.645+02:00</gco:DateTime>
</gmd:dateStamp>
<gmd:spatialRepresentationInfo>
<gmd:MD_VectorSpatialRepresentation>
<gmd:topologyLevel>
<gmd:MD_TopologyLevelCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#MD_TopologyLevelCode" codeListValue="geometryOnly">Geometry only</gmd:MD_TopologyLevelCode>
</gmd:topologyLevel>
<gmd:geometricObjects>
<gmd:MD_GeometricObjects>
<gmd:geometricObjectType>
<gmd:MD_GeometricObjectTypeCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#MD_GeometricObjectTypeCode" codeListValue="surface">Surface</gmd:MD_GeometricObjectTypeCode>
</gmd:geometricObjectType>
<gmd:geometricObjectCount>
<gco:Integer>0</gco:Integer>
</gmd:geometricObjectCount>
</gmd:MD_GeometricObjects>
</gmd:geometricObjects>
</gmd:MD_VectorSpatialRepresentation>
</gmd:spatialRepresentationInfo>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>TrueMarble</gco:CharacterString>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<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>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
<gmd:presentationForm>
<gmd:CI_PresentationFormCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#CI_PresentationFormCode" codeListValue="imageDigital">Image digital</gmd:CI_PresentationFormCode>
</gmd:presentationForm>
</gmd:CI_Citation>
</gmd:citation>
<gmd:abstract>
<gco:CharacterString>This layer is used as a base layer for GIS VIewer widget</gco:CharacterString>
</gmd:abstract>
<gmd:purpose>
<gco:CharacterString>This layer is used as a base layer for GIS VIewer widget</gco:CharacterString>
</gmd:purpose>
<gmd:credit>
<gco:CharacterString>This layer has been produced by iMarine (www.i-marine.eu). iMarine (283644) is funded by the European Commission under Framework Programme 7</gco:CharacterString>
</gmd:credit>
<gmd:resourceMaintenance>
<gmd:MD_MaintenanceInformation>
<gmd:maintenanceAndUpdateFrequency>
<gmd:MD_MaintenanceFrequencyCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#MD_MaintenanceFrequencyCode" codeListValue="asNeeded">As needed</gmd:MD_MaintenanceFrequencyCode>
</gmd:maintenanceAndUpdateFrequency>
</gmd:MD_MaintenanceInformation>
</gmd:resourceMaintenance>
<gmd:descriptiveKeywords>
<gmd:MD_Keywords>
<gmd:keyword>
<gco:CharacterString>True Marble</gco:CharacterString>
</gmd:keyword>
<gmd:keyword>
<gco:CharacterString>iMarine Consortium</gco:CharacterString>
</gmd:keyword>
<gmd:type>
<gmd:MD_KeywordTypeCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#MD_KeywordTypeCode" codeListValue="theme">Theme</gmd:MD_KeywordTypeCode>
</gmd:type>
<gmd:thesaurusName>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>General</gco:CharacterString>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:DateTime>2013-07-04T14:09:55.783+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>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</gmd:CI_Citation>
</gmd:thesaurusName>
</gmd:MD_Keywords>
</gmd:descriptiveKeywords>
<gmd:spatialResolution>
<gmd:MD_Resolution>
<gmd:distance>
<gco:Distance uom="http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='m'])">0.5</gco:Distance>
</gmd:distance>
</gmd:MD_Resolution>
</gmd:spatialResolution>
<gmd:language>
<gmd:LanguageCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/ML_gmxCodelists.xml#LanguageCode" codeListValue="eng">English</gmd:LanguageCode>
</gmd:language>
<gmd:topicCategory>
<gmd:MD_TopicCategoryCode>environment</gmd:MD_TopicCategoryCode>
</gmd:topicCategory>
<gmd:extent>
<gmd:EX_Extent>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:extentTypeCode>
<gco:Boolean>true</gco:Boolean>
</gmd:extentTypeCode>
<gmd:westBoundLongitude>
<gco:Decimal>-180.0</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:eastBoundLongitude>
<gco:Decimal>180.0</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>-90.0</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>90.0</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
</gmd:EX_Extent>
</gmd:extent>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
<gmd:distributionInfo>
<gmd:MD_Distribution>
<gmd:distributionFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>WMS</gco:CharacterString>
</gmd:name>
<gmd:version>
<gco:CharacterString>1.1.0</gco:CharacterString>
</gmd:version>
</gmd:MD_Format>
</gmd:distributionFormat>
<gmd:distributionFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>WFS</gco:CharacterString>
</gmd:name>
<gmd:version>
<gco:CharacterString>1.1.0</gco:CharacterString>
</gmd:version>
</gmd:MD_Format>
</gmd:distributionFormat>
<gmd:distributionFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>WCS</gco:CharacterString>
</gmd:name>
<gmd:version>
<gco:CharacterString>1.0.0</gco:CharacterString>
</gmd:version>
</gmd:MD_Format>
</gmd:distributionFormat>
<gmd:transferOptions>
<gmd:MD_DigitalTransferOptions>
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>http://geoserver-dev.d4science.org/geoserver/wms?service=wms&amp;version=1.1.0&amp;request=GetMap&amp;layers=aquamaps:TrueMarble.16km.2700x1350&amp;styles=raster&amp;bbox=-180.0,-90.0,180.0,90.0&amp;width=676&amp;height=330&amp;srs=EPSG:4326&amp;crs=EPSG:4326&amp;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>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&amp;version=1.0.0&amp;request=GetFeature&amp;typeName=aquamaps:TrueMarble.16km.2700x1350&amp;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>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&amp;version=1.0.0&amp;request=GetCoverage&amp;coverage=aquamaps:TrueMarble.16km.2700x1350&amp;CRS=EPSG:4326&amp;bbox=-180.0,-90.0,180.0,90.0&amp;width=676&amp;height=330&amp;format=geotiff</gmd:URL>
</gmd:linkage>
<gmd:protocol>
<gco:CharacterString>WWW:LINK-1.0-http--link</gco:CharacterString>
</gmd:protocol>
<gmd:name>
<gco:CharacterString>aquamaps:TrueMarble.16km.2700x1350</gco:CharacterString>
</gmd:name>
</gmd:CI_OnlineResource>
</gmd:onLine>
</gmd:MD_DigitalTransferOptions>
</gmd:transferOptions>
</gmd:MD_Distribution>
</gmd:distributionInfo>
<gmd:metadataConstraints>
<gmd:MD_LegalConstraints>
<gmd:useLimitation>
<gco:CharacterString>CC-BY-SA</gco:CharacterString>
</gmd:useLimitation>
<gmd:accessConstraints>
<gmd:MD_RestrictionCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#MD_RestrictionCode" codeListValue="license">License</gmd:MD_RestrictionCode>
</gmd:accessConstraints>
<gmd:useConstraints>
<gmd:MD_RestrictionCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#MD_RestrictionCode" codeListValue="license">License</gmd:MD_RestrictionCode>
</gmd:useConstraints>
</gmd:MD_LegalConstraints>
</gmd:metadataConstraints>
</gmd:MD_Metadata>

View File

@ -1 +0,0 @@
Used as library to communicate with Geonetwork

View File

@ -1,6 +0,0 @@
gCube System - License
------------------------------------------------------------
The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
The software and documentation is provided by its authors/distributors "as is" and no expressed or
implied warranty is given for its use, quality or fitness for a particular case.

View File

@ -1,2 +0,0 @@
* Sinibaldi Fabio (fabio.sinibaldi@isti.cnr.it), CNR Pisa,
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".

View File

@ -1,46 +0,0 @@
The gCube System - MetadataManager
------------------------------------------------------------
This work has been partially supported by the following European projects: iMarine (FP7-INFRASTRUCTURES-2011-2), and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil).
Authors
-------
* Sinibaldi Fabio (fabio.sinibaldi@isti.cnr.it), CNR Pisa,
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".
Version and Release Date
------------------------
v. 1.0.0 (2013-03-01)
* Geonetwwork interaction
Description
-----------
Geonetwork communication layer
Download information
--------------------
Source code is available from SVN:
http://svn.d4science.research-infrastructures.eu/gcube/trunk/spatial-data/geonetwork
Documentation
-------------
Documentation is available on-line from the Projects Documentation Wiki:
https://technical.wiki.d4science.research-infrastructures.eu/documentation/index.php
Licensing
---------
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.

View File

@ -1,6 +0,0 @@
<ReleaseNotes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xsd/changelog.xsd">
<Changeset component="org.gcube.spatial-data.geonetowrk.1-0-0" date="2013-03-01">
<Change>First Release</Change>
</Changeset>
</ReleaseNotes>

View File

@ -1,42 +0,0 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>servicearchive</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>/</baseDirectory>
<fileSets>
<fileSet>
<directory>${distroDirectory}</directory>
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>README</include>
<include>LICENSE</include>
<include>INSTALL</include>
<include>MAINTAINERS</include>
<include>changelog.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
</fileSets>
<files>
<file>
<source>${distroDirectory}/profile.xml</source>
<outputDirectory>/</outputDirectory>
<filtered>true</filtered>
</file>
<file>
<source>target/${build.finalName}.jar</source>
<outputDirectory>/${artifactId}</outputDirectory>
</file>
<file>
<source>${distroDirectory}/svnpath.txt</source>
<outputDirectory>/${artifactId}</outputDirectory>
<filtered>true</filtered>
</file>
</files>
</assembly>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID />
<Type>Service</Type>
<Profile>
<Description>${description}</Description>
<Class>SpatialData</Class>
<Name>${artifactId}</Name>
<Version>1.0.0</Version>
<Packages>
<Software>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<MavenCoordinates>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
</MavenCoordinates>
<Files>
<File>${build.finalName}.jar</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

View File

@ -1 +0,0 @@
${scm.url}

149
pom.xml
View File

@ -1,149 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.0.0</version>
</parent>
<groupId>org.gcube.spatial.data</groupId>
<artifactId>geonetwork</artifactId>
<version>2.0.0-SNAPSHOT</version>
<name>geonetwork</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<geotools.version>8.0-M4</geotools.version>
<distroDirectory>distro</distroDirectory>
</properties>
<scm>
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/spatial-data/${project.artifactId}</connection>
<developerConnection>scm:svn:https://svn.d4science.research-infrastructures.eu/gcube/trunk/spatial-data/${project.artifactId}</developerConnection>
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/spatial-data/${project.artifactId}</url>
</scm>
<dependencies>
<dependency>
<groupId>it.geosolutions</groupId>
<artifactId>geonetwork-manager</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.geotoolkit</groupId>
<artifactId>geotk-metadata</artifactId>
<version>3.20-geoapi-3.0</version>
</dependency>
<dependency>
<groupId>org.w3c</groupId>
<artifactId>dom</artifactId>
<version>2.3.0-jaxb-1.0.6</version>
</dependency>
<dependency>
<groupId>org.geotoolkit</groupId>
<artifactId>geotk-referencing</artifactId>
<version>3.20-geoapi-3.0</version>
</dependency>
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT]</version>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-utils-encryption</artifactId>
<version>[1.0.2-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.resources</groupId>
<artifactId>registry-publisher</artifactId>
<version>[1.1.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.5</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>GeoSolutions</id>
<url>http://maven.research-infrastructures.eu:8081/nexus/content/repositories/geo-solutions/</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-profile</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target</outputDirectory>
<resources>
<resource>
<directory>${distroDirectory}</directory>
<filtering>true</filtering>
<includes>
<include>profile.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>servicearchive</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,189 +0,0 @@
package org.gcube.spatial.data.geonetwork;
import it.geosolutions.geonetwork.GNClient;
import it.geosolutions.geonetwork.exception.GNLibException;
import it.geosolutions.geonetwork.exception.GNServerException;
import it.geosolutions.geonetwork.util.GNInsertConfiguration;
import it.geosolutions.geonetwork.util.GNPrivConfiguration;
import it.geosolutions.geonetwork.util.GNSearchRequest;
import it.geosolutions.geonetwork.util.GNSearchResponse;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import javax.xml.bind.JAXBException;
import org.gcube.spatial.data.geonetwork.configuration.AuthorizationException;
import org.gcube.spatial.data.geonetwork.configuration.Configuration;
import org.gcube.spatial.data.geonetwork.configuration.ConfigurationManager;
import org.geotoolkit.xml.XML;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
import org.opengis.metadata.Metadata;
public class GeoNetwork implements GeoNetworkPublisher {
private static XMLOutputter out = new XMLOutputter(Format.getPrettyFormat());
public static GeoNetworkPublisher get() throws Exception{
return new GeoNetwork(ConfigurationManager.get());
}
public static GeoNetworkPublisher get(Configuration config){
return new GeoNetwork(config);
}
private Configuration config;
private GeoNetwork(Configuration config){
this.config=config;
}
@Override
public Configuration getConfiguration(){
return config;
}
//************** READ ONLY METHODS, LOGIN OPTIONAL
@Override
public void login(LoginLevel lvl) throws AuthorizationException {
GNClient client=getClient();
if(config.getGeoNetworkUsers().containsKey(lvl)&&config.getGeoNetworkPasswords().containsKey(lvl)){
if(!client.login(config.getGeoNetworkUsers().get(lvl), config.getGeoNetworkPasswords().get(lvl)))throw new AuthorizationException();
}else throw new AuthorizationException("Login level "+lvl+" not found");
}
/* (non-Javadoc)
* @see org.gcube.spatial.data.geonetwork.GeoNetworkReader#query(it.geosolutions.geonetwork.util.GNSearchRequest)
*/
@Override
public GNSearchResponse query(GNSearchRequest request) throws GNLibException, GNServerException{
return getClient().search(request);
}
/* (non-Javadoc)
* @see org.gcube.spatial.data.geonetwork.GeoNetworkReader#query(java.io.File)
*/
@Override
public GNSearchResponse query(File fileRequest) throws GNLibException, GNServerException{
return getClient().search(fileRequest);
}
/* (non-Javadoc)
* @see org.gcube.spatial.data.geonetwork.GeoNetworkReader#getById(long)
*/
@Override
public Metadata getById(long id) throws GNLibException, GNServerException, JAXBException{
String xml=out.outputString(getClient().get(id));
return (Metadata) XML.unmarshal(xml);
}
/* (non-Javadoc)
* @see org.gcube.spatial.data.geonetwork.GeoNetworkReader#getById(java.lang.String)
*/
@Override
public Metadata getById(String UUID) throws GNLibException, GNServerException, JAXBException{
return (Metadata) XML.unmarshal(getByIdAsRawString(UUID));
}
@Override
public String getByIdAsRawString(String UUID) throws GNLibException,
GNServerException, JAXBException {
return out.outputString(getClient().get(UUID));
}
//************** WRITE METHODS, LOGIN REQUIRED
/* (non-Javadoc)
* @see org.gcube.spatial.data.geonetwork.GeoNetworkReader#setPrivileges(long, it.geosolutions.geonetwork.util.GNPrivConfiguration)
*/
@Override
public void setPrivileges(long metadataId,GNPrivConfiguration cfg) throws GNLibException, GNServerException{
GNClient client=getClient();
client.setPrivileges(metadataId, cfg);
}
/* (non-Javadoc)
* @see org.gcube.spatial.data.geonetwork.GeoNetworkReader#insertMetadata(it.geosolutions.geonetwork.util.GNInsertConfiguration, java.io.File)
*/
@Override
public long insertMetadata(GNInsertConfiguration configuration,File metadataFile) throws GNLibException, GNServerException{
GNClient client=getClient();
return client.insertMetadata(configuration, metadataFile);
}
/* (non-Javadoc)
* @see org.gcube.spatial.data.geonetwork.GeoNetworkReader#insertMetadata(it.geosolutions.geonetwork.util.GNInsertConfiguration, org.opengis.metadata.Metadata)
*/
@Override
public long insertMetadata(GNInsertConfiguration configuration,Metadata meta) throws GNLibException, GNServerException, IOException, JAXBException{
return insertMetadata(configuration, meta2File(meta));
}
/* (non-Javadoc)
* @see org.gcube.spatial.data.geonetwork.GeoNetworkReader#insertMetadata(java.io.File)
*/
@Override
public long insertMetadata(File requestFile) throws GNLibException, GNServerException{
GNClient client=getClient();
return client.insertRequest(requestFile);
}
/* (non-Javadoc)
* @see org.gcube.spatial.data.geonetwork.GeoNetworkReader#insertMetadata(org.opengis.metadata.Metadata)
*/
@Override
public long insertMetadata(Metadata meta) throws GNLibException, GNServerException, IOException, JAXBException{
return insertMetadata(meta2File(meta));
}
/* (non-Javadoc)
* @see org.gcube.spatial.data.geonetwork.GeoNetworkReader#updateMetadata(long, java.io.File)
*/
@Override
public void updateMetadata(long id,File metadataFile) throws GNLibException, GNServerException{
GNClient client=getClient();
client.updateMetadata(id, metadataFile);
}
/* (non-Javadoc)
* @see org.gcube.spatial.data.geonetwork.GeoNetworkReader#updateMetadata(long, org.opengis.metadata.Metadata)
*/
@Override
public void updateMetadata(long id,Metadata meta) throws GNLibException, GNServerException, IOException, JAXBException{
updateMetadata(id, meta2File(meta));
}
/* (non-Javadoc)
* @see org.gcube.spatial.data.geonetwork.GeoNetworkReader#deleteMetadata(long)
*/
@Override
public void deleteMetadata(long id) throws GNLibException, GNServerException{
GNClient client=getClient();
client.deleteMetadata(id);
}
//************* PRIVATE
private GNClient theClient=null;
private synchronized GNClient getClient(){
if(theClient==null)
theClient = new GNClient(config.getGeoNetworkEndpoint());
return theClient;
}
private static File meta2File(Metadata meta) throws IOException, JAXBException{
File temp=File.createTempFile("meta", ".xml");
FileWriter writer=new FileWriter(temp);
writer.write(XML.marshal(meta));
writer.close();
return temp;
}
}

View File

@ -1,44 +0,0 @@
package org.gcube.spatial.data.geonetwork;
import it.geosolutions.geonetwork.exception.GNLibException;
import it.geosolutions.geonetwork.exception.GNServerException;
import it.geosolutions.geonetwork.util.GNInsertConfiguration;
import it.geosolutions.geonetwork.util.GNPrivConfiguration;
import java.io.File;
import java.io.IOException;
import javax.xml.bind.JAXBException;
import org.gcube.spatial.data.geonetwork.configuration.AuthorizationException;
import org.opengis.metadata.Metadata;
public interface GeoNetworkPublisher extends GeoNetworkReader {
public void setPrivileges(long metadataId, GNPrivConfiguration cfg)
throws GNLibException, GNServerException;
public long insertMetadata(GNInsertConfiguration configuration,
File metadataFile) throws GNLibException, GNServerException;
public long insertMetadata(GNInsertConfiguration configuration,
Metadata meta) throws GNLibException, GNServerException,
IOException, JAXBException;
public long insertMetadata(File requestFile) throws GNLibException,
GNServerException;
public long insertMetadata(Metadata meta) throws GNLibException,
GNServerException, IOException,
JAXBException;
public void updateMetadata(long id, File metadataFile)
throws GNLibException, GNServerException;
public void updateMetadata(long id, Metadata meta) throws GNLibException,
GNServerException, IOException,
JAXBException;
public void deleteMetadata(long id) throws GNLibException,
GNServerException;
}

View File

@ -1,36 +0,0 @@
package org.gcube.spatial.data.geonetwork;
import it.geosolutions.geonetwork.exception.GNLibException;
import it.geosolutions.geonetwork.exception.GNServerException;
import it.geosolutions.geonetwork.util.GNSearchRequest;
import it.geosolutions.geonetwork.util.GNSearchResponse;
import java.io.File;
import javax.xml.bind.JAXBException;
import org.gcube.spatial.data.geonetwork.configuration.AuthorizationException;
import org.gcube.spatial.data.geonetwork.configuration.Configuration;
import org.opengis.metadata.Metadata;
public interface GeoNetworkReader {
public GNSearchResponse query(GNSearchRequest request)
throws GNLibException, GNServerException;
public GNSearchResponse query(File fileRequest) throws GNLibException,
GNServerException;
public Metadata getById(long id) throws GNLibException, GNServerException,
JAXBException;
public Metadata getById(String UUID) throws GNLibException,
GNServerException, JAXBException;
public String getByIdAsRawString(String UUID) throws GNLibException,
GNServerException, JAXBException;
public Configuration getConfiguration();
public void login(LoginLevel level)throws AuthorizationException;
}

View File

@ -1,7 +0,0 @@
package org.gcube.spatial.data.geonetwork;
public enum LoginLevel {
DEFAULT,SCOPE,PRIVATE
}

View File

@ -1,32 +0,0 @@
package org.gcube.spatial.data.geonetwork.configuration;
public class AuthorizationException extends Exception{
/**
*
*/
private static final long serialVersionUID = -8639478879076898891L;
public AuthorizationException() {
super();
// TODO Auto-generated constructor stub
}
public AuthorizationException(String arg0, Throwable arg1) {
super(arg0, arg1);
// TODO Auto-generated constructor stub
}
public AuthorizationException(String arg0) {
super(arg0);
// TODO Auto-generated constructor stub
}
public AuthorizationException(Throwable arg0) {
super(arg0);
// TODO Auto-generated constructor stub
}
}

View File

@ -1,13 +0,0 @@
package org.gcube.spatial.data.geonetwork.configuration;
import java.util.Map;
import org.gcube.spatial.data.geonetwork.LoginLevel;
public interface Configuration {
public String getGeoNetworkEndpoint();
public Map<LoginLevel,String> getGeoNetworkUsers();
public Map<LoginLevel,String> getGeoNetworkPasswords();
public int getScopeGroup();
}

View File

@ -1,13 +0,0 @@
package org.gcube.spatial.data.geonetwork.configuration;
public class ConfigurationManager {
private static Class<? extends Configuration> configClass=DefaultConfiguration.class;
public static synchronized Configuration get() throws Exception{
return configClass.newInstance();
}
public static void setConfiguration(Class<? extends Configuration> configuration){configClass=configuration;}
}

View File

@ -1,127 +0,0 @@
package org.gcube.spatial.data.geonetwork.configuration;
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.gcube.common.resources.gcore.ServiceEndpoint;
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
import org.gcube.common.resources.gcore.ServiceEndpoint.Property;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.utils.encryption.StringEncrypter;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.gcube.spatial.data.geonetwork.LoginLevel;
import org.gcube.spatial.data.geonetwork.utils.RuntimeParameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DefaultConfiguration implements Configuration {
private static final Logger logger = LoggerFactory.getLogger(DefaultConfiguration.class);
private String url;
private Map<LoginLevel, String> users=new HashMap<LoginLevel, String>();
private Map<LoginLevel, String> pwds=new HashMap<LoginLevel, String>();
private int group;
public DefaultConfiguration() throws Exception{
Properties props=new RuntimeParameters().getProps();
SimpleQuery query = queryFor(ServiceEndpoint.class);
query.addCondition("$resource/Profile/Category/text() eq '"+props.getProperty("geonetwork.category")+"'")
.addCondition("$resource/Profile/Platform/Name/text() eq '"+props.getProperty("geonetwork.platform.name")+"'")
.setResult("$resource/Profile/AccessPoint");
DiscoveryClient<AccessPoint> client = clientFor(AccessPoint.class);
List<AccessPoint> accesspoints = client.submit(query);
String endpointName=props.getProperty("geonetwork.endpoint.name");
String masterProperty=props.getProperty("geonetwork.master");
String scopeName=ScopeProvider.instance.get().substring(ScopeProvider.instance.get().lastIndexOf('/')+1);
String scopeUser=scopeName+props.getProperty("geonetwork.scopeuser.password.suffix");
String privateUser=scopeName+props.getProperty("geonetwork.privateuser.password.suffix");
String scopeGroup=scopeName+props.getProperty("geonetwork.scopegroup.id");
boolean found=false;
for (AccessPoint point : accesspoints) {
if(point.name().equals(endpointName)){
Map<String, Property> properties=point.propertyMap();
if(properties.containsKey(masterProperty)&&Boolean.parseBoolean(properties.get(masterProperty).value())){
url=point.address();
users.put(LoginLevel.DEFAULT, point.username());
pwds.put(LoginLevel.DEFAULT,decrypt(point.password()));
if(properties.containsKey(privateUser)){
users.put(LoginLevel.PRIVATE, privateUser);
pwds.put(LoginLevel.PRIVATE, decrypt(properties.get(privateUser).value()));
}
if(properties.containsKey(scopeUser)){
users.put(LoginLevel.SCOPE, scopeUser);
pwds.put(LoginLevel.SCOPE, decrypt(properties.get(scopeUser).value()));
}
if(properties.containsKey(scopeGroup))
group=Integer.parseInt(properties.get(scopeGroup).value());
found=true;
break;
// users=point.username();
// pwds=StringEncrypter.getEncrypter().decrypt(point.password());
}
}
}
if(!found) throw new Exception("No Resource found under current scope "+ScopeProvider.instance.get());
}
@Override
public String getGeoNetworkEndpoint() {
return url;
}
@Override
public Map<LoginLevel, String> getGeoNetworkPasswords() {
return pwds;
}
@Override
public Map<LoginLevel, String> getGeoNetworkUsers() {
return users;
}
@Override
public int getScopeGroup() {
return group;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("DefaultConfiguration [url=");
builder.append(url);
builder.append(", users=");
builder.append(users);
builder.append(", pwds=");
builder.append(pwds);
builder.append("]");
return builder.toString();
}
private static final String decrypt(String toDecrypt) throws Exception{
return StringEncrypter.getEncrypter().decrypt(toDecrypt);
}
}

View File

@ -1,447 +0,0 @@
package org.gcube.spatial.data.geonetwork.iso;
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.Properties;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.gcube.common.resources.gcore.GenericResource;
import org.gcube.informationsystem.publisher.RegistryPublisher;
import org.gcube.informationsystem.publisher.RegistryPublisherFactory;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.gcube.spatial.data.geonetwork.utils.RuntimeParameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.annotations.XStreamAlias;
@XStreamAlias("EnvironmentConfiguration")
public class EnvironmentConfiguration implements Cloneable{
private static final Logger logger = LoggerFactory.getLogger(EnvironmentConfiguration.class);
private static EnvironmentConfiguration current=null;
private static long lastUpdate=0;
private static TransformerFactory tf = TransformerFactory.newInstance();
private static Transformer transformer;
private static XStream xstream=new XStream();
private static Properties props;
static {
try{
transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.INDENT, "no");
}catch(Exception e){
logger.error("Unable to initialize transformer ",e);
}
try{
props=new RuntimeParameters().getProps();
}catch(IOException e){
logger.error("Unable to read properties file ",e);
}
xstream.processAnnotations(EnvironmentConfiguration.class);
xstream.processAnnotations(Thesaurus.class);
}
public static synchronized EnvironmentConfiguration getConfiguration() throws Exception{
if(System.currentTimeMillis()-lastUpdate>Long.parseLong(props.getProperty("metadataConfiguration.ttl")))
current=getFromIS();
return current;
}
private static EnvironmentConfiguration getFromIS() throws Exception{
SimpleQuery query = queryFor(GenericResource.class);
query.addCondition("$resource/Profile/SecondaryType/text() eq '"+props.getProperty("genericResource.SecondaryType")+"'").
addCondition("$resource/Profile/Name/text() eq '"+props.getProperty("genericResource.Name")+"'");
DiscoveryClient<GenericResource> client = clientFor(GenericResource.class);
for(GenericResource resource : client.submit(query)){
try{
// parse body as a XML serialization of a Computational Infrastructure
StringWriter writer = new StringWriter();
transformer.transform(new DOMSource(resource.profile().body()), new StreamResult(writer));
String theXML=writer.getBuffer().toString();
// String theXML = writer.getBuffer().toString().replaceAll("\n|\r", "");
EnvironmentConfiguration config=(EnvironmentConfiguration) xstream.fromXML(theXML.substring(5,theXML.length()-6));
return config;
}catch(Exception e){
logger.warn("Unable to parse resource [ID :"+resource.id()+"]",e);
}
}
throw new Exception("No Configuration Found");
}
private static GenericResource publishResource(EnvironmentConfiguration config) throws SAXException, IOException, ParserConfigurationException{
Element toAppend=DocumentBuilderFactory
.newInstance()
.newDocumentBuilder()
.parse(new ByteArrayInputStream(config.toXML().getBytes()))
.getDocumentElement();
GenericResource toPublish=new GenericResource();
Document document= toPublish.newProfile().description("Common configuration for ISO Metadata publishing")
.name(props.getProperty("genericResource.Name"))
.type(props.getProperty("genericResource.SecondaryType")).newBody().getOwnerDocument();
toPublish.profile().body().appendChild(document.importNode(toAppend, true));
RegistryPublisher rp=RegistryPublisherFactory.create();
toPublish=rp.create(toPublish);
return toPublish;
}
//**************Instance values
private String wmsProtocolDeclaration;
private String wfsProtocolDeclaration;
private String wcsProtocolDeclaration;
private String httpProtocolDeclaration;
private String defaultCRS;
//*** Project
private String projectName;
private String projectCitation;
//*** Common ResponsibleParties
private String distributorIndividualName;
private String distributorOrganisationName;
private String distributorEMail;
private String distributorSite;
private String providerIndividualName;
private String providerOrganisationName;
private String providerEMail;
private String providerSite;
private String license;
//**** Thesauri
private HashMap<String,Thesaurus> thesauri=new HashMap<String, Thesaurus>();
public EnvironmentConfiguration() {
// TODO Auto-generated constructor stub
}
/**
* @return the wmsProtocolDeclaration
*/
public String getWmsProtocolDeclaration() {
return wmsProtocolDeclaration;
}
/**
* @param wmsProtocolDeclaration the wmsProtocolDeclaration to set
*/
public void setWmsProtocolDeclaration(String wmsProtocolDeclaration) {
this.wmsProtocolDeclaration = wmsProtocolDeclaration;
}
/**
* @return the wfsProtocolDeclaration
*/
public String getWfsProtocolDeclaration() {
return wfsProtocolDeclaration;
}
/**
* @param wfsProtocolDeclaration the wfsProtocolDeclaration to set
*/
public void setWfsProtocolDeclaration(String wfsProtocolDeclaration) {
this.wfsProtocolDeclaration = wfsProtocolDeclaration;
}
/**
* @return the wcsProtocolDeclaration
*/
public String getWcsProtocolDeclaration() {
return wcsProtocolDeclaration;
}
/**
* @param wcsProtocolDeclaration the wcsProtocolDeclaration to set
*/
public void setWcsProtocolDeclaration(String wcsProtocolDeclaration) {
this.wcsProtocolDeclaration = wcsProtocolDeclaration;
}
/**
* @return the httpProtocolDeclaration
*/
public String getHttpProtocolDeclaration() {
return httpProtocolDeclaration;
}
/**
* @param httpProtocolDeclaration the httpProtocolDeclaration to set
*/
public void setHttpProtocolDeclaration(String httpProtocolDeclaration) {
this.httpProtocolDeclaration = httpProtocolDeclaration;
}
/**
* @return the defaultCRS
*/
public String getDefaultCRS() {
return defaultCRS;
}
/**
* @param defaultCRS the defaultCRS to set
*/
public void setDefaultCRS(String defaultCRS) {
this.defaultCRS = defaultCRS;
}
/**
* @return the projectName
*/
public String getProjectName() {
return projectName;
}
/**
* @param projectName the projectName to set
*/
public void setProjectName(String projectName) {
this.projectName = projectName;
}
/**
* @return the projectCitation
*/
public String getProjectCitation() {
return projectCitation;
}
/**
* @param projectCitation the projectCitation to set
*/
public void setProjectCitation(String projectCitation) {
this.projectCitation = projectCitation;
}
/**
* @return the distributorIndividualName
*/
public String getDistributorIndividualName() {
return distributorIndividualName;
}
/**
* @param distributorIndividualName the distributorIndividualName to set
*/
public void setDistributorIndividualName(String distributorIndividualName) {
this.distributorIndividualName = distributorIndividualName;
}
/**
* @return the distributorOrganisationName
*/
public String getDistributorOrganisationName() {
return distributorOrganisationName;
}
/**
* @param distributorOrganisationName the distributorOrganisationName to set
*/
public void setDistributorOrganisationName(String distributorOrganisationName) {
this.distributorOrganisationName = distributorOrganisationName;
}
/**
* @return the distributorEMail
*/
public String getDistributorEMail() {
return distributorEMail;
}
/**
* @param distributorEMail the distributorEMail to set
*/
public void setDistributorEMail(String distributorEMail) {
this.distributorEMail = distributorEMail;
}
/**
* @return the distributorSite
*/
public String getDistributorSite() {
return distributorSite;
}
/**
* @param distributorSite the distributorSite to set
*/
public void setDistributorSite(String distributorSite) {
this.distributorSite = distributorSite;
}
/**
* @return the providerIndividualName
*/
public String getProviderIndividualName() {
return providerIndividualName;
}
/**
* @param providerIndividualName the providerIndividualName to set
*/
public void setProviderIndividualName(String providerIndividualName) {
this.providerIndividualName = providerIndividualName;
}
/**
* @return the providerOrganisationName
*/
public String getProviderOrganisationName() {
return providerOrganisationName;
}
/**
* @param providerOrganisationName the providerOrganisationName to set
*/
public void setProviderOrganisationName(String providerOrganisationName) {
this.providerOrganisationName = providerOrganisationName;
}
/**
* @return the providerEMail
*/
public String getProviderEMail() {
return providerEMail;
}
/**
* @param providerEMail the providerEMail to set
*/
public void setProviderEMail(String providerEMail) {
this.providerEMail = providerEMail;
}
/**
* @return the providerSite
*/
public String getProviderSite() {
return providerSite;
}
/**
* @param providerSite the providerSite to set
*/
public void setProviderSite(String providerSite) {
this.providerSite = providerSite;
}
/**
* @return the license
*/
public String getLicense() {
return license;
}
/**
* @param license the license to set
*/
public void setLicense(String license) {
this.license = license;
}
/**
* @return the thesauri
*/
public HashMap<String, Thesaurus> getThesauri() {
return thesauri;
}
/**
* @param thesauri the thesauri to set
*/
public void setThesauri(HashMap<String, Thesaurus> thesauri) {
this.thesauri = thesauri;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("EnvironmentConfiguration [wmsProtocolDeclaration=");
builder.append(wmsProtocolDeclaration);
builder.append(", wfsProtocolDeclaration=");
builder.append(wfsProtocolDeclaration);
builder.append(", wcsProtocolDeclaration=");
builder.append(wcsProtocolDeclaration);
builder.append(", httpProtocolDeclaration=");
builder.append(httpProtocolDeclaration);
builder.append(", defaultCRS=");
builder.append(defaultCRS);
builder.append(", projectName=");
builder.append(projectName);
builder.append(", projectCitation=");
builder.append(projectCitation);
builder.append(", distributorIndividualName=");
builder.append(distributorIndividualName);
builder.append(", distributorOrganisationName=");
builder.append(distributorOrganisationName);
builder.append(", distributorEMail=");
builder.append(distributorEMail);
builder.append(", distributorSite=");
builder.append(distributorSite);
builder.append(", providerIndividualName=");
builder.append(providerIndividualName);
builder.append(", providerOrganisationName=");
builder.append(providerOrganisationName);
builder.append(", providerEMail=");
builder.append(providerEMail);
builder.append(", providerSite=");
builder.append(providerSite);
builder.append(", license=");
builder.append(license);
builder.append(", thesauri=");
builder.append(thesauri);
builder.append("]");
return builder.toString();
}
public String toXML(){
return xstream.toXML(this);
}
/**
* Publish @this as a gCube Generic Resource in the current scope
*
* @return the published Generic Resource
* @throws ParserConfigurationException
* @throws IOException
* @throws SAXException
*/
public GenericResource publish() throws SAXException, IOException, ParserConfigurationException{
return publishResource(this);
}
}

View File

@ -1,366 +0,0 @@
package org.gcube.spatial.data.geonetwork.iso;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import org.gcube.spatial.data.geonetwork.utils.StringValidator;
import org.geotoolkit.metadata.iso.extent.DefaultExtent;
import org.opengis.metadata.Metadata;
import org.opengis.metadata.citation.PresentationForm;
import org.opengis.metadata.identification.TopicCategory;
import org.opengis.metadata.spatial.GeometricObjectType;
import org.opengis.metadata.spatial.TopologyLevel;
public class GcubeISOMetadata {
private EnvironmentConfiguration config;
private String user=null;
//Identification
private String title=null;
private Date creationDate=null;
private PresentationForm presentationForm=null;
private String abstractField=null;
private String purpose=null;
private ArrayList<String> credits=new ArrayList<String>();
private HashMap<Thesaurus,HashSet<String>> descriptiveKeywords=new HashMap<Thesaurus, HashSet<String>>();
private ArrayList<TopicCategory> topicCategories=new ArrayList<TopicCategory>();
private DefaultExtent extent=(DefaultExtent) DefaultExtent.WORLD;
//Spatial Representation
private GeometricObjectType geometricObjectType=GeometricObjectType.SURFACE;
private int geometryCount=0;
private TopologyLevel topologyLevel=TopologyLevel.GEOMETRY_ONLY;
private double resolution=0.5d;
private ArrayList<String> graphicOverviewsURI=new ArrayList<String>();
public GcubeISOMetadata() throws Exception {
config=EnvironmentConfiguration.getConfiguration();
credits.add(config.getProjectCitation());
addKeyword(config.getProjectName(), config.getThesauri().get("General"));
}
protected void checkConstraints()throws MissingInformationException{
if(!StringValidator.isValidateString(getUser())) throw new MissingInformationException("Field user is mandatory");
if(!StringValidator.isValidateString(getTitle())) throw new MissingInformationException("Field title is mandatory");
if(getCreationDate()==null)throw new MissingInformationException("Field creationDate is mandatory");
if(getPresentationForm()==null) throw new MissingInformationException("Field presentationForm is mandatory");
if(!StringValidator.isValidateString(getAbstractField())) throw new MissingInformationException("Field abstractField is mandatory");
if(!StringValidator.isValidateString(getPurpose())) throw new MissingInformationException("Field purpose is mandatory");
if(getTopicCategories().size()==0) throw new MissingInformationException("At least one topic category is required");
if(getExtent()==null) throw new MissingInformationException("Field Extent is mandatory");
if(getGeometricObjectType()==null)throw new MissingInformationException("Field geometricObjectType is mandatory");
if(getTopologyLevel()==null)throw new MissingInformationException("Field topology level is mandatory");
if(getCredits().size()==0) throw new MissingInformationException("At least one credits is needed");
if(getDescriptiveKeywords().isEmpty())throw new MissingInformationException("Missing Descriptive keywords");
}
public Metadata getMetadata() throws URISyntaxException, MissingInformationException{
checkConstraints();
return ISOMetadataFactory.generateMeta(this);
}
/**
* @return the user
*/
public String getUser() {
return user;
}
/**
* @param user the user to set
*/
public void setUser(String user) {
this.user = user;
}
/**
* @return the title
*/
public String getTitle() {
return title;
}
/**
* @param title the title to set
*/
public void setTitle(String title) {
this.title = title;
}
/**
* @return the creationDate
*/
public Date getCreationDate() {
return creationDate;
}
/**
* @param creationDate the creationDate to set
*/
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
/**
* @return the presentationForm
*/
public PresentationForm getPresentationForm() {
return presentationForm;
}
/**
* @param presentationForm the presentationForm to set
*/
public void setPresentationForm(PresentationForm presentationForm) {
this.presentationForm = presentationForm;
}
/**
* @return the abstractField
*/
public String getAbstractField() {
return abstractField;
}
/**
* @param abstractField the abstractField to set
*/
public void setAbstractField(String abstractField) {
this.abstractField = abstractField;
}
/**
* @return the extent
*/
public DefaultExtent getExtent() {
return extent;
}
/**
* @param extent the extent to set [Default is WORLD]
*/
public void setExtent(DefaultExtent extent) {
this.extent = extent;
}
/**
* @return the geometricObjectType
*/
public GeometricObjectType getGeometricObjectType() {
return geometricObjectType;
}
/**
* @param geometricObjectType the geometricObjectType to set [Default is SURFACE]
*/
public void setGeometricObjectType(GeometricObjectType geometricObjectType) {
this.geometricObjectType = geometricObjectType;
}
/**
* @return the geometryCount
*/
public int getGeometryCount() {
return geometryCount;
}
/**
* @param geometryCount the geometryCount to set [Default is 0]
*/
public void setGeometryCount(int geometryCount) {
this.geometryCount = geometryCount;
}
/**
* @return the config
*/
public EnvironmentConfiguration getConfig() {
return config;
}
/**
* @return the credits
*/
public ArrayList<String> getCredits() {
return (ArrayList<String>) credits.clone();
}
/**
* Adds credits to the metadata
*
* @param toAddCredits
*/
public void addCredits(String toAddCredits){
credits.add(toAddCredits);
}
/**
* @return the descriptiveKeywords
*/
public HashMap<Thesaurus, HashSet<String>> getDescriptiveKeywords() {
return (HashMap<Thesaurus, HashSet<String>>) descriptiveKeywords.clone();
}
/**
* Adds descriptive keywords to the metadata
*
* @param keyword
* @param thesaurus
*/
public synchronized void addKeyword(String keyword,Thesaurus thesaurus){
if(!descriptiveKeywords.containsKey(thesaurus)) descriptiveKeywords.put(thesaurus, new HashSet<String>());
descriptiveKeywords.get(thesaurus).add(keyword);
}
/**
* @return the topicCategories
*/
public ArrayList<TopicCategory> getTopicCategories() {
return (ArrayList<TopicCategory>) topicCategories.clone();
}
/**
* Adds a Topic Category to the metadata
*
* @param toAdd
*/
public void addTopicCategory(TopicCategory toAdd){
topicCategories.add(toAdd);
}
/**
* @return the graphicOverviewsURI
*/
public ArrayList<String> getGraphicOverviewsURI() {
return (ArrayList<String>) graphicOverviewsURI.clone();
}
/**
* Adds a graphic overview uri to the metadata
*
* @param uri
*/
public void addGraphicOverview(String uri){
graphicOverviewsURI.add(uri);
}
/**
* @return the purpose
*/
public String getPurpose() {
return purpose;
}
/**
* @param purpose the purpose to set
*/
public void setPurpose(String purpose) {
this.purpose = purpose;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GcubeISOMetadata [config=");
builder.append(config);
builder.append(", user=");
builder.append(user);
builder.append(", title=");
builder.append(title);
builder.append(", creationDate=");
builder.append(creationDate);
builder.append(", presentationForm=");
builder.append(presentationForm);
builder.append(", abstractField=");
builder.append(abstractField);
builder.append(", credits=");
builder.append(credits);
builder.append(", descriptiveKeywords=");
builder.append(descriptiveKeywords);
builder.append(", topicCategories=");
builder.append(topicCategories);
builder.append(", extent=");
builder.append(extent);
builder.append(", geometricObjectType=");
builder.append(geometricObjectType);
builder.append(", geometryCount=");
builder.append(geometryCount);
builder.append(", graphicOverviewsURI=");
builder.append(graphicOverviewsURI);
builder.append("]");
return builder.toString();
}
/**
*
* @return the current Topology Level
*/
public TopologyLevel getTopologyLevel() {
return topologyLevel;
}
/**
*
* @param topologyLevel the Topology level to set [Default is GEOMETRY_ONLY]
*/
public void setTopologyLevel(TopologyLevel topologyLevel) {
this.topologyLevel = topologyLevel;
}
/**
*
* @return the current layer resolution
*/
public double getResolution() {
return resolution;
}
/**
*
*
* @param resoulution The resolution to be set [Default is 0.5]
*/
public void setResolution(double resoulution) {
this.resolution = resoulution;
}
}

View File

@ -1,305 +0,0 @@
package org.gcube.spatial.data.geonetwork.iso;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map.Entry;
import java.util.UUID;
import org.geotoolkit.metadata.iso.DefaultMetadata;
import org.geotoolkit.metadata.iso.citation.DefaultAddress;
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.identification.DefaultBrowseGraphic;
import org.geotoolkit.metadata.iso.identification.DefaultDataIdentification;
import org.geotoolkit.metadata.iso.identification.DefaultKeywords;
import org.geotoolkit.metadata.iso.identification.DefaultResolution;
import org.geotoolkit.metadata.iso.maintenance.DefaultMaintenanceInformation;
import org.geotoolkit.metadata.iso.spatial.DefaultGeometricObjects;
import org.geotoolkit.metadata.iso.spatial.DefaultVectorSpatialRepresentation;
import org.geotoolkit.util.DefaultInternationalString;
import org.opengis.metadata.Metadata;
import org.opengis.metadata.citation.DateType;
import org.opengis.metadata.citation.Role;
import org.opengis.metadata.constraint.Restriction;
import org.opengis.metadata.identification.CharacterSet;
import org.opengis.metadata.maintenance.MaintenanceFrequency;
import org.opengis.metadata.maintenance.ScopeCode;
public class ISOMetadataFactory {
public static Metadata generateMeta(GcubeISOMetadata params) throws URISyntaxException{
//*************** Responsible Party : author
DefaultResponsibleParty author=new DefaultResponsibleParty();
author.setIndividualName(params.getUser());
author.setOrganisationName(new DefaultInternationalString(params.getConfig().getProjectName()));
author.setRole(Role.AUTHOR);
//*************** Responsible Party : provider -> iMarine
DefaultResponsibleParty distributor=new DefaultResponsibleParty();
distributor.setIndividualName(params.getConfig().getDistributorIndividualName());
distributor.setOrganisationName(new DefaultInternationalString(params.getConfig().getProjectName()));
distributor.setRole(Role.DISTRIBUTOR);
DefaultContact distributorContact=new DefaultContact();
DefaultAddress distributorAddress=new DefaultAddress();
distributorAddress.getElectronicMailAddresses().add(params.getConfig().getDistributorEMail());
distributorContact.setAddress(distributorAddress);
DefaultOnlineResource distributorOnline=new DefaultOnlineResource (new URI(params.getConfig().getDistributorSite()));
distributorOnline.setProtocol(params.getConfig().getHttpProtocolDeclaration());
distributorContact.setOnlineResource(distributorOnline);
distributor.setContactInfo(distributorContact);
DefaultResponsibleParty provider=new DefaultResponsibleParty();
provider.setIndividualName(params.getConfig().getProviderIndividualName());
provider.setOrganisationName(new DefaultInternationalString(params.getConfig().getProjectName()));
provider.setRole(Role.RESOURCE_PROVIDER);
DefaultContact providerContact=new DefaultContact();
DefaultAddress providerAddress=new DefaultAddress();
providerAddress.getElectronicMailAddresses().add(params.getConfig().getProviderEMail());
providerContact.setAddress(providerAddress);
DefaultOnlineResource providerOnline=new DefaultOnlineResource (new URI(params.getConfig().getProviderSite()));
providerOnline.setProtocol(params.getConfig().getHttpProtocolDeclaration());
providerContact.setOnlineResource(providerOnline);
provider.setContactInfo(providerContact);
//*************** Identification
DefaultDataIdentification ident=new DefaultDataIdentification();
ident.getLanguages().add(Locale.ENGLISH);
DefaultCitation citation=new DefaultCitation();
citation.setTitle(new DefaultInternationalString(params.getTitle()));
citation.getDates().add(new DefaultCitationDate(params.getCreationDate(), DateType.CREATION));
citation.getPresentationForms().add(params.getPresentationForm());
ident.setCitation(citation);
ident.setAbstract(new DefaultInternationalString(params.getAbstractField()));
ident.setPurpose(new DefaultInternationalString(params.getPurpose()));
ident.getCredits().addAll(params.getCredits());
ident.getResourceMaintenances().add(new DefaultMaintenanceInformation(MaintenanceFrequency.AS_NEEDED));
for(Entry<Thesaurus,HashSet<String>> entry:params.getDescriptiveKeywords().entrySet()){
DefaultKeywords keywords=new DefaultKeywords();
for(String key:entry.getValue())keywords.getKeywords().add(new DefaultInternationalString(key));
keywords.setType(entry.getKey().getType());
DefaultCitation thesaurus=new DefaultCitation();
thesaurus.setTitle(new DefaultInternationalString(entry.getKey().getTitle()));
thesaurus.getDates().add(new DefaultCitationDate(entry.getKey().getCitationDate(), DateType.CREATION));
if(entry.getKey().isAuthored()){
thesaurus.setOtherCitationDetails(new DefaultInternationalString(entry.getKey().getCitationDescription()));
DefaultResponsibleParty thesaurusParty=new DefaultResponsibleParty();
thesaurusParty.setIndividualName(entry.getKey().getTitle());
thesaurusParty.setOrganisationName(new DefaultInternationalString(entry.getKey().getCitationOrganization()));
thesaurusParty.setRole(Role.POINT_OF_CONTACT);
DefaultContact thesaurusContact=new DefaultContact();
thesaurusContact.setOnlineResource(new DefaultOnlineResource(new URI(entry.getKey().getCitationUri())));
thesaurusParty.setContactInfo(thesaurusContact);
thesaurus.getCitedResponsibleParties().add(thesaurusParty);
}
keywords.setThesaurusName(thesaurus);
ident.getDescriptiveKeywords().add(keywords);
}
ident.getTopicCategories().addAll(params.getTopicCategories());
ident.getExtents().add(params.getExtent());
//Spatial Rapresentation Info
DefaultGeometricObjects geoObjs=new DefaultGeometricObjects();
geoObjs.setGeometricObjectType(params.getGeometricObjectType());
geoObjs.setGeometricObjectCount(params.getGeometryCount());
DefaultVectorSpatialRepresentation spatial=new DefaultVectorSpatialRepresentation();
spatial.setTopologyLevel(params.getTopologyLevel());
spatial.getGeometricObjects().add(geoObjs);
DefaultResolution layerResolution=new DefaultResolution();
layerResolution.setDistance(params.getResolution());
ident.getSpatialResolutions().add(layerResolution);
// DistributionInfo
//TODO this part should be inserted by publishing logic
for(String uri:params.getGraphicOverviewsURI()){
DefaultBrowseGraphic graph=new DefaultBrowseGraphic(new URI(uri));
ident.getGraphicOverviews().add(graph);
}
//MetadataConstraints
DefaultLegalConstraints constraints=new DefaultLegalConstraints();
constraints.getUseLimitations().add(new DefaultInternationalString(params.getConfig().getLicense()));
constraints.getAccessConstraints().add(Restriction.LICENSE);
constraints.getUseConstraints().add(Restriction.LICENSE);
//***************** Not general Approach
// DefaultDataQuality processQuality=new DefaultDataQuality();
// DefaultLineage processLineage=new DefaultLineage();
//
//
// DefaultSource source=new DefaultSource();
// DefaultNominalResolution sourceResolution=new DefaultNominalResolution();
// sourceResolution.setGroundResolution(0.5d);
// sourceResolution.setScanningResolution(0.5d);
// source.getSourceExtents().add(DefaultExtent.WORLD);
// //FIXME Breaks Validation
//// source.setResolution(sourceResolution);
//
//
//
//
// DefaultCitation sourceCitation=new DefaultCitation();
// sourceCitation.setTitle(new DefaultInternationalString(params.getSourceTitle()));
// sourceCitation.getDates().add(new DefaultCitationDate(params.getSourceGenerationDate(), DateType.CREATION));
// sourceCitation.getIdentifiers().add(new DefaultIdentifier(params.getSourceTableName()));
// 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(AquaMapsObjectMetadataParameter.algorithmDescription));
//// StringBuilder customList=new StringBuilder();
//// for(SpeciesCustomization custom:params.getCustomizations())
//// customList.append(custom.toXML());
//// processing.setRunTimeParameters(new DefaultInternationalString(customList.toString()));
//// processing.getAlgorithms().add(algorithm);
//
// // FIXME Brakes Validation
//// processStep.setProcessingInformation(processing);
//
// processLineage.setStatement(new DefaultInternationalString(AquaMapsObjectMetadataParameter.algorithmDescription));
//
//
//
//
// processLineage.getProcessSteps().add(processStep);
// processLineage.getSources().add(source);
// processQuality.setLineage(processLineage);
// processQuality.setScope(new DefaultScope(ScopeCode.DATASET));
//*************** The Meta Object
DefaultMetadata meta=new DefaultMetadata(author, new Date(System.currentTimeMillis()), ident);
meta.setCharacterSet(CharacterSet.UTF_8);
meta.getContacts().add(distributor);
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);
meta.setFileIdentifier(UUID.randomUUID().toString());
return meta;
}
public static DefaultDistribution getDistributionByLayer(String layerName, String geoserverUrl, String style, String bbox, EnvironmentConfiguration config) throws URISyntaxException{
DefaultDistribution distribution=new DefaultDistribution();
distribution.getTransferOptions().add(getTransferOptionsByLayer(layerName, geoserverUrl, style, bbox, config));
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"));
distribution.setDistributionFormats(new ArrayList<DefaultFormat>(Arrays.asList(format1, format2, format3)));
return distribution;
}
public static DefaultDigitalTransferOptions getTransferOptionsByLayer(String layerName, String geoserverUrl, String style, String bbox, EnvironmentConfiguration config ) throws URISyntaxException{
DefaultDigitalTransferOptions transferOptions=new DefaultDigitalTransferOptions();
transferOptions.getOnLines().add(getOnline(layerName,config.getWmsProtocolDeclaration(),getWmsUrl(geoserverUrl, layerName, style, bbox, config.getDefaultCRS())));
transferOptions.getOnLines().add(getOnline(layerName,config.getWfsProtocolDeclaration(),getWfsUrl(geoserverUrl,layerName)));
transferOptions.getOnLines().add(getOnline(layerName,config.getWcsProtocolDeclaration(),getWcsUrl(geoserverUrl,layerName,bbox)));
return transferOptions;
}
public static DefaultOnlineResource getOnline(String name, String protocol, String uriString) throws URISyntaxException{
URI uri=new URI(uriString);
DefaultOnlineResource resource=new DefaultOnlineResource(uri);
resource.setName(name);
resource.setProtocol(protocol);
return resource;
}
private static String getWmsUrl(String geoServerUrl, String layerName,String style, String bbox,String CRS) {
return geoServerUrl +
"/wms?service=wms&version=1.1.0"
+ "&request=GetMap&layers=" + layerName
+ "&styles=" + (style == null ? "" : style)
+ "&bbox=" + bbox + "&width=676&height=330" +
"&srs=EPSG:4326&crs="+CRS+"&format=application/openlayers";
}
private static String getWfsUrl(String geoServerUrl, String layerName) {
return geoServerUrl +
"/ows?service=wfs&version=1.0.0"
+ "&request=GetFeature&typeName=" + layerName
+"&format=json";
}
private static String getWcsUrl(String geoServerUrl, String layerName,String bbox) {
return geoServerUrl + "/wcs?service=wcs&version=1.0.0" + "&request=GetCoverage&coverage=" +
layerName + "&CRS=EPSG:4326" + "&bbox=" + bbox + "&width=676&height=330&format=geotiff";
}
// private static final String WMS_PROTOCOL="OGC:WMS-1.3.0-http-get-map";
// private static final String WFS_PROTOCOL="OGC:WFS-1.0.0-http-get-feature";
// private static final String HTTP_PROTOCOL="WWW:LINK-1.0-http--link";
//
// public static final String getProtocol(String uri){
// uri=uri.toLowerCase();
// if(uri.contains(("service=wms"))) return WMS_PROTOCOL;
// else if(uri.contains("service=wfs")) return WFS_PROTOCOL;
// else return HTTP_PROTOCOL;
// }
}

View File

@ -1,31 +0,0 @@
package org.gcube.spatial.data.geonetwork.iso;
public class MissingInformationException extends Exception {
public MissingInformationException() {
super();
// TODO Auto-generated constructor stub
}
public MissingInformationException(String arg0, Throwable arg1) {
super(arg0, arg1);
// TODO Auto-generated constructor stub
}
public MissingInformationException(String arg0) {
super(arg0);
// TODO Auto-generated constructor stub
}
public MissingInformationException(Throwable arg0) {
super(arg0);
// TODO Auto-generated constructor stub
}
/**
*
*/
private static final long serialVersionUID = -6926907389393350700L;
}

View File

@ -1,204 +0,0 @@
package org.gcube.spatial.data.geonetwork.iso;
import java.util.Date;
import org.opengis.metadata.identification.KeywordType;
import com.thoughtworks.xstream.annotations.XStreamAlias;
@XStreamAlias("Thesaurus")
public class Thesaurus {
private KeywordType type;
private String title;
private Date citationDate;
private String citationDescription;
private String citationUri;
private String citationOrganization;
private boolean isAuthored=false;
public Thesaurus(KeywordType type, String title, Date citationDate) {
super();
this.type = type;
this.title = title;
this.citationDate = citationDate;
}
public Thesaurus(KeywordType type, String title, Date citationDate,
String citationDescription, String citationUri,
String citationOrganization) {
super();
this.type = type;
this.title = title;
this.citationDate = citationDate;
this.citationDescription = citationDescription;
this.citationUri = citationUri;
this.citationOrganization = citationOrganization;
this.isAuthored=true;
}
/**
* @return the type
*/
public KeywordType getType() {
return type;
}
/**
* @param type the type to set
*/
public void setType(KeywordType type) {
this.type = type;
}
/**
* @return the title
*/
public String getTitle() {
return title;
}
/**
* @param title the title to set
*/
public void setTitle(String title) {
this.title = title;
}
/**
* @return the citationDate
*/
public Date getCitationDate() {
return citationDate;
}
/**
* @param citationDate the citationDate to set
*/
public void setCitationDate(Date citationDate) {
this.citationDate = citationDate;
}
/**
* @return the citationDescription
*/
public String getCitationDescription() {
return citationDescription;
}
/**
* @param citationDescription the citationDescription to set
*/
public void setCitationDescription(String citationDescription) {
this.citationDescription = citationDescription;
}
/**
* @return the citationUri
*/
public String getCitationUri() {
return citationUri;
}
/**
* @param citationUri the citationUri to set
*/
public void setCitationUri(String citationUri) {
this.citationUri = citationUri;
}
/**
* @return the citationOrganization
*/
public String getCitationOrganization() {
return citationOrganization;
}
/**
* @param citationOrganization the citationOrganization to set
*/
public void setCitationOrganization(String citationOrganization) {
this.citationOrganization = citationOrganization;
}
/**
* @return the isAuthored
*/
public boolean isAuthored() {
return isAuthored;
}
/**
* @param isAuthored the isAuthored to set
*/
public void setAuthored(boolean isAuthored) {
this.isAuthored = isAuthored;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((title == null) ? 0 : title.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Thesaurus other = (Thesaurus) obj;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
if (type == null) {
if (other.type != null)
return false;
} else if (!type.equals(other.type))
return false;
return true;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Thesaurus [type=");
builder.append(type);
builder.append(", title=");
builder.append(title);
builder.append(", citationDate=");
builder.append(citationDate);
builder.append(", citationDescription=");
builder.append(citationDescription);
builder.append(", citationUri=");
builder.append(citationUri);
builder.append(", citationOrganization=");
builder.append(citationOrganization);
builder.append(", isAuthored=");
builder.append(isAuthored);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,22 +0,0 @@
package org.gcube.spatial.data.geonetwork.utils;
import java.io.IOException;
import java.util.Properties;
import org.gcube.spatial.data.geonetwork.GeoNetwork;
public class RuntimeParameters {
private Properties props=new Properties();
public RuntimeParameters() throws IOException {
props.load(GeoNetwork.class.getResourceAsStream("query.properties"));
}
public Properties getProps() {
return props;
}
}

View File

@ -1,13 +0,0 @@
package org.gcube.spatial.data.geonetwork.utils;
public class StringValidator {
public static boolean isValidateString(String text){
if(text == null || text.isEmpty())
return false;
return true;
}
}

View File

@ -1,16 +0,0 @@
geonetwork.category=Gis
geonetwork.platform.name=geonetwork
geonetwork.endpoint.name=geonetwork
geonetwork.master=master
geonetwork.scopeuser.password.suffix=_Public
geonetwork.privateuser.password.suffix=_Private
geonetwork.scopegroup.id=_group
#ISO Metadata Constants
#Generic Resource to retrieve
genericResource.SecondaryType=ISO
genericResource.Name=MetadataConstants
#Milliseconds 2*60*1000 = 2 Minutes
metadataConfiguration.ttl=120000

View File

@ -1,132 +0,0 @@
package org.gcube.spatial.data.geonetwork.test;
import java.util.Date;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.spatial.data.geonetwork.iso.EnvironmentConfiguration;
import org.gcube.spatial.data.geonetwork.iso.GcubeISOMetadata;
import org.gcube.spatial.data.geonetwork.iso.Thesaurus;
import org.geotoolkit.metadata.iso.extent.DefaultExtent;
import org.opengis.metadata.citation.PresentationForm;
import org.opengis.metadata.identification.KeywordType;
import org.opengis.metadata.identification.TopicCategory;
import org.opengis.metadata.spatial.GeometricObjectType;
import org.opengis.metadata.spatial.TopologyLevel;
public class EnvironmentMetaConstantsTest {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
//*************** Environment Configuration creation + Publishing
EnvironmentConfiguration config=generateiMarine();
ScopeProvider.instance.set("/d4science.research-infrastructures.eu");
String id=config.publish().id();
System.out.println("Published configuration [res ID = "+id+"] under scope "+ScopeProvider.instance.get());
//*************** Environemnt Configuration Check
// ScopeProvider.instance.set("/gcube/devsec");
//
// XML.marshal(fillMeta().getMetadata(),System.out);
}
private static GcubeISOMetadata fillMeta() throws Exception{
GcubeISOMetadata meta=new GcubeISOMetadata();
meta.setAbstractField("This metadata is just a test");
meta.setCreationDate(new Date(System.currentTimeMillis()));
meta.setExtent((DefaultExtent) DefaultExtent.WORLD);
meta.setGeometricObjectType(GeometricObjectType.SURFACE);
meta.setPresentationForm(PresentationForm.MAP_DIGITAL);
meta.setPurpose("Purpose of this layer is to test the library");
meta.setResolution(0.5d);
meta.setTitle("My Test Layer");
meta.setTopologyLevel(TopologyLevel.GEOMETRY_ONLY);
meta.setUser("fabio.sinibaldi");
meta.addCredits("Thanks to me");
meta.addGraphicOverview("http://www.d4science.org/D4ScienceOrg-Social-theme/images/custom/D4ScienceInfrastructure.png");
Thesaurus generalThesaurus=meta.getConfig().getThesauri().get("General");
meta.addKeyword("TEST", generalThesaurus);
meta.addKeyword("Geoserverinterface", generalThesaurus);
meta.addTopicCategory(TopicCategory.BIOTA);
return meta;
}
private static EnvironmentConfiguration generateiMarine(){
EnvironmentConfiguration config=new EnvironmentConfiguration();
//Protocol declarations
config.setWmsProtocolDeclaration("OGC:WMS-1.3.0-http-get-map");
config.setWfsProtocolDeclaration("OGC:WFS-1.0.0-http-get-feature");
config.setWcsProtocolDeclaration("WWW:LINK-1.0-http--link");
config.setHttpProtocolDeclaration("WWW:LINK-1.0-http--link");
config.setDefaultCRS("EPSG:4326");
//Project
config.setProjectName("iMarine Consortium");
config.setProjectCitation("This layer has been produced by iMarine (www.i-marine.eu). " +
"iMarine (283644) is funded by the European Commission under Framework Programme 7 ");
//Distributor
config.setDistributorEMail("info@i-marine.eu");
config.setDistributorIndividualName("iMarine.eu");
config.setDistributorOrganisationName(config.getProjectName());
config.setDistributorSite("http://www.i-marine.eu");
//Provider
config.setProviderEMail("support@i-marine.eu");
config.setProviderIndividualName("iMarine Consortium Technical Support");
config.setProviderOrganisationName(config.getProjectName());
config.setProviderSite("http://www.i-marine.eu");
config.setLicense("CC-BY-SA");
//Thesauri
Thesaurus OBIS=new Thesaurus(KeywordType.THEME, "OBIS", new Date(System.currentTimeMillis()),
"Intergovernmental Oceanographic Commission (IOC) of UNESCO. The Ocean Biogeographic Information System. Web. http://www.iobis.org. (Consulted on DATE)",
"http://www.iobis.org", "UNESCO");
Thesaurus WORMS=new Thesaurus(KeywordType.THEME, "WORMS", new Date(System.currentTimeMillis()), "Appeltans W, Bouchet P, Boxshall GA, De Broyer C, de Voogd NJ, " +
"Gordon DP, Hoeksema BW, Horton T, Kennedy M, Mees J, Poore GCB, Read G, Stöhr S, Walter TC, Costello MJ. (eds) (2012). " +
"World Register of Marine Species. Accessed at http://www.marinespecies.org on 2013-05-06.", "http://www.marinespecies.org", "World Register of Marine Species");
Thesaurus IRMNG=new Thesaurus(KeywordType.THEME,"IRMNG",new Date(System.currentTimeMillis()),"OBIS - Australia","http://www.obis.org.au/irmng/","Interim Register of Marine and Nonmarine Genera");
Thesaurus CATALOG_OF_LIFE=new Thesaurus(KeywordType.THEME, "CATALOG OF LIFE",new Date(System.currentTimeMillis()),"Species 2000 & ITIS Catalogue of Life: 2013 Annual Checklist",
"http://www.catalogueoflife.org/","Integrated Taxonomic Information System");
Thesaurus ITIS=new Thesaurus(KeywordType.THEME, "ITIS", new Date(System.currentTimeMillis()),
"Retrieved on DATE, from the Integrated Taxonomic Information System on-line database", "http://www.itis.gov/", "Integrated Taxonomic Information System");
Thesaurus FISHBASE=new Thesaurus(KeywordType.THEME, "FISHBASE", new Date(System.currentTimeMillis()), "FishBase is a global species database of fish species (specifically finfish)."
, "http://www.fishbase.org/search.php", "IFM-GEOMAR");
Thesaurus THREE_A_CODE=new Thesaurus(KeywordType.THEME,"3A Code",new Date(System.currentTimeMillis()));
Thesaurus GENERAL=new Thesaurus(KeywordType.THEME,"General",new Date(System.currentTimeMillis()));
Thesaurus[] thesauri=new Thesaurus[]{
OBIS,
WORMS,
IRMNG,
CATALOG_OF_LIFE,
ITIS,
FISHBASE,
THREE_A_CODE,
GENERAL
};
for(Thesaurus t : thesauri)
config.getThesauri().put(t.getTitle(), t);
return config;
}
}

View File

@ -1,24 +0,0 @@
package org.gcube.spatial.data.geonetwork.test;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.spatial.data.geonetwork.GeoNetwork;
import org.gcube.spatial.data.geonetwork.GeoNetworkReader;
import org.gcube.spatial.data.geonetwork.LoginLevel;
public class GetByTest {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
String scope="/d4science.research-infrastructures.eu/gCubeApps";
String uuid="2d847dfa-46e3-4093-99aa-5a07a7c3b14f";
ScopeProvider.instance.set(scope);
GeoNetworkReader reader=GeoNetwork.get();
reader.login(LoginLevel.DEFAULT);
System.out.println(reader.getById(uuid));
}
}

View File

@ -1,113 +0,0 @@
package org.gcube.spatial.data.geonetwork.test;
import it.geosolutions.geonetwork.util.GNInsertConfiguration;
import it.geosolutions.geonetwork.util.GNPriv;
import it.geosolutions.geonetwork.util.GNPrivConfiguration;
import it.geosolutions.geonetwork.util.GNSearchRequest;
import java.io.File;
import java.util.EnumSet;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.spatial.data.geonetwork.GeoNetwork;
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/devVRE";
// private static final String defaultScope="/d4science.research-infrastructures.eu/gCubeApps";
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
ScopeProvider.instance.set(defaultScope);
System.out.println("Checking scope : "+defaultScope);
// ConfigurationManager.setConfiguration(MyConfiguration.class);
// String metaFile="meta.xml";
// long id=publishMeta(LoginLevel.PRIVATE, metaFile);
//// long id=142301;
// System.out.println("Published "+metaFile+" with id "+id);
// for(LoginLevel lvl: LoginLevel.values()){
// System.out.println("Accessible as "+lvl+" "+isReadable(id, lvl));
// }
checkLevelsCount();
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);
}
public static void checkLevelsCount() throws Exception{
// GeoNetworkReader reader=GeoNetwork.get(new MyConfiguration());
GeoNetworkReader reader=GeoNetwork.get();
System.out.println(reader.getConfiguration());
GNSearchRequest request=new GNSearchRequest();
request.addParam(GNSearchRequest.Param.any, "");
for(LoginLevel lvl: LoginLevel.values()){
try{
System.out.print("LOGIN LEVEL : "+lvl+"\t");
reader.login(lvl);
System.out.println(" Number of elements found : "+reader.query(request).getCount());
}catch (Exception e) {
e.printStackTrace(System.err);
}
}
}
public static long publishMeta(LoginLevel level, String metaPath) throws Exception{
GeoNetworkPublisher publisher=GeoNetwork.get();
publisher.login(level);
GNInsertConfiguration config=new GNInsertConfiguration(publisher.getConfiguration().getScopeGroup()+"", "datasets", "_none_", true);
long id=publisher.insertMetadata(config,new File(metaPath));
//****Visibility means
GNPrivConfiguration privConfig=new GNPrivConfiguration();
if(level.equals(LoginLevel.SCOPE)){
privConfig.addPrivileges(publisher.getConfiguration().getScopeGroup(),EnumSet.of(GNPriv.VIEW));
}
publisher.setPrivileges(id, privConfig);
return id;
}
public static boolean isReadable(long id,LoginLevel level) throws Exception{
GeoNetworkReader reader=GeoNetwork.get();
reader.login(level);
try{
reader.getById(id);
return true;
}catch(Exception e){
return false;
}
}
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);
}
}

View File

@ -1,60 +0,0 @@
package org.gcube.spatial.data.geonetwork.test;
import java.net.URISyntaxException;
import org.gcube.spatial.data.geonetwork.iso.GcubeISOMetadata;
import org.gcube.spatial.data.geonetwork.iso.MissingInformationException;
import org.opengis.metadata.Metadata;
//Extends org.gcube.common.geoserverinterface.bean.iso.GcubeISOMetadata
public class MyApplicationIsoMetadata extends GcubeISOMetadata {
//We want this citation to be automatically added to credits
private static final String applicationCitation="....";
//Our mandatory field
private String mandatoryField=null;
/**
* @return the mandatoryField
*/
public String getMandatoryField() {
return mandatoryField;
}
/**
* @param mandatoryField the mandatoryField to set
*/
public void setMandatoryField(String mandatoryField) {
this.mandatoryField = mandatoryField;
}
public MyApplicationIsoMetadata() throws Exception {
//Let the super class initialize itself
super();
//Let's add our citation to credits
this.getCredits().add(applicationCitation);
}
@Override
protected void checkConstraints() throws MissingInformationException {
// We let the super class to perform its checks before continuing
super.checkConstraints();
// Custom check against mandatoryField
if(mandatoryField==null) throw new MissingInformationException();
}
@Override
public Metadata getMetadata() throws URISyntaxException,
MissingInformationException {
Metadata toReturn=super.getMetadata();
//We set our mandatory field to the metadata
return toReturn;
}
}

View File

@ -1,38 +0,0 @@
package org.gcube.spatial.data.geonetwork.test;
import java.util.HashMap;
import java.util.Map;
import org.gcube.spatial.data.geonetwork.LoginLevel;
import org.gcube.spatial.data.geonetwork.configuration.Configuration;
public class MyConfiguration implements Configuration {
private static final Map<LoginLevel,String> pwds=new HashMap<LoginLevel, String>();
private static final Map<LoginLevel,String> usrs=new HashMap<LoginLevel, String>();
static {
pwds.put(LoginLevel.DEFAULT, "admin");
usrs.put(LoginLevel.DEFAULT, "admin");
}
@Override
public String getGeoNetworkEndpoint() {
return "http://geoserver-dev3.d4science-ii.research-infrastructures.eu:8080/geonetwork";
}
@Override
public Map<LoginLevel, String> getGeoNetworkUsers() {
return usrs;
}
@Override
public Map<LoginLevel, String> getGeoNetworkPasswords() {
return pwds;
}
@Override
public int getScopeGroup() {
return 2;
}
}

View File

@ -1,430 +0,0 @@
package org.gcube.spatial.data.geonetwork.test;
import it.geosolutions.geonetwork.GNClient;
import it.geosolutions.geonetwork.util.GNInsertConfiguration;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
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 javax.xml.bind.JAXBException;
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.extent.DefaultGeographicBoundingBox;
import org.geotoolkit.metadata.iso.identification.DefaultDataIdentification;
import org.geotoolkit.metadata.iso.identification.DefaultKeywords;
import org.geotoolkit.metadata.iso.identification.DefaultResolution;
import org.geotoolkit.metadata.iso.identification.DefaultUsage;
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.ResponsibleParty;
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.lineage.ProcessStep;
import org.opengis.metadata.maintenance.MaintenanceFrequency;
import org.opengis.metadata.maintenance.ScopeCode;
import org.opengis.metadata.spatial.GeometricObjectType;
import org.opengis.metadata.spatial.SpatialRepresentationType;
import org.opengis.metadata.spatial.TopologyLevel;
import org.opengis.util.InternationalString;
public class NetCDFMetadata {
private String geonetworkUrl = "http://geoserver-dev.d4science-ii.research-infrastructures.eu/geonetwork/";
private String geonetworkUser = "admin";
private String geonetworkPwd = "admin";
private String threddsCatalogUrl = "http://thredds.research-infrastructures.eu:8080/thredds/catalog/public/netcdf/catalog.xml";
private String title = "temperature 04091217ruc.nc";
private String layerName = "T";
private String usageField = "Environmental enrichment";
private String processdescription = "Maps publication";
private String usageLimitations = "Not for commercial scopes";
private Date sourceGenerationDate = new Date(System.currentTimeMillis());
private String sourceFileName = "04091217_ruc.nc";
private String contactInfo = "support@d4science.research-infrastructures.eu";
private String abstractField = "T: temperature (degK) from 04091217ruc.nc resident on the THREDDS instance " + threddsCatalogUrl;
private String purpose = "Maps publication";
private String author = "gCube Ecological Engine Library";
private double res = 0.5d;
private double xLL = -180;
private double xRU = 180;
private double yLL = -85.5;
private double yRU = 85.5;
private String layerUrl = "http://thredds.research-infrastructures.eu:8080/thredds/dodsC/public/netcdf/04091217_ruc.nc";
public String getGeonetworkUrl() {
return geonetworkUrl;
}
public void setGeonetworkUrl(String geonetworkUrl) {
this.geonetworkUrl = geonetworkUrl;
}
public String getGeonetworkUser() {
return geonetworkUser;
}
public void setGeonetworkUser(String geonetworkUser) {
this.geonetworkUser = geonetworkUser;
}
public String getGeonetworkPwd() {
return geonetworkPwd;
}
public void setGeonetworkPwd(String geonetworkPwd) {
this.geonetworkPwd = geonetworkPwd;
}
public String getThreddsCatalogUrl() {
return threddsCatalogUrl;
}
public void setThreddsCatalogUrl(String threddsCatalogUrl) {
this.threddsCatalogUrl = threddsCatalogUrl;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getLayerName() {
return layerName;
}
public void setLayerName(String layerName) {
this.layerName = layerName;
}
public String getUsageField() {
return usageField;
}
public void setUsageField(String usageField) {
this.usageField = usageField;
}
public String getProcessdescription() {
return processdescription;
}
public void setProcessdescription(String processdescription) {
this.processdescription = processdescription;
}
public String getUsageLimitations() {
return usageLimitations;
}
public void setUsageLimitations(String usageLimitations) {
this.usageLimitations = usageLimitations;
}
public Date getSourceGenerationDate() {
return sourceGenerationDate;
}
public void setSourceGenerationDate(Date sourceGenerationDate) {
this.sourceGenerationDate = sourceGenerationDate;
}
public String getSourceFileName() {
return sourceFileName;
}
public void setSourceFileName(String sourceTableName) {
this.sourceFileName = sourceTableName;
}
public String getContactInfo() {
return contactInfo;
}
public void setContactInfo(String contactInfo) {
this.contactInfo = contactInfo;
}
public String getAbstractField() {
return abstractField;
}
public void setAbstractField(String abstractField) {
this.abstractField = abstractField;
}
public String getPurpose() {
return purpose;
}
public void setPurpose(String purpose) {
this.purpose = purpose;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public double getResolution() {
return res;
}
public void setResolution(double res) {
this.res = res;
}
public double getXLeftLow() {
return xLL;
}
public void setXLeftLow(double xLL) {
this.xLL = xLL;
}
public double getXRightUpper() {
return xRU;
}
public void setXRightUpper(double xRU) {
this.xRU = xRU;
}
public double getYLeftLow() {
return yLL;
}
public void setYLeftLow(double yLL) {
this.yLL = yLL;
}
public double getYRightUpper() {
return yRU;
}
public void setYRightUpper(double yRU) {
this.yRU = yRU;
}
public String getLayerUrl() {
return layerUrl;
}
public void setLayerUrl(String layerUrl) {
this.layerUrl = layerUrl;
}
static File meta2File(Metadata meta) throws IOException, JAXBException {
File temp = File.createTempFile("meta", ".xml");
FileWriter writer = new FileWriter(temp);
writer.write(XML.marshal(meta));
writer.close();
return temp;
}
public void insertMetaData() throws Exception {
// layer uri: wms, wfs wcs
List<String> layerUris = new ArrayList<String>();
layerUris.add(OGCFormatter.getWmsNetCDFUrl(layerUrl, layerName, OGCFormatter.buildBoundingBox(xLL, yLL, xRU, yRU)));
layerUris.add(layerUrl);
layerUris.add(OGCFormatter.getWcsNetCDFUrl(layerUrl, layerName, OGCFormatter.buildBoundingBox(xLL, yLL, xRU, yRU)));
layerUris.add(threddsCatalogUrl);
// layer keywords
HashMap<KeywordType, HashSet<String>> descriptiveKeyWords = new HashMap<KeywordType, HashSet<String>>();
HashSet<String> keySet = new HashSet<String>();
keySet.add("THREDDS");
keySet.add("i-Marine");
keySet.add("NetCDF");
descriptiveKeyWords.put(KeywordType.THEME, keySet);
// author:
DefaultResponsibleParty party = new DefaultResponsibleParty();
party.setIndividualName(author);
DefaultContact contact = new DefaultContact();
contact.setContactInstructions(new DefaultInternationalString(contactInfo));
party.setContactInfo(contact);
party.setRole(Role.ORIGINATOR);
// citation:
DefaultCitation citation = new DefaultCitation();
citation.setTitle(new DefaultInternationalString(title));
ArrayList<DefaultCitationDate> citDates = new ArrayList<DefaultCitationDate>();
citDates.add(new DefaultCitationDate(sourceGenerationDate, DateType.CREATION));
citDates.add(new DefaultCitationDate(sourceGenerationDate, DateType.PUBLICATION));
citDates.add(new DefaultCitationDate(sourceGenerationDate, DateType.REVISION));
citation.setDates(citDates);
ArrayList<InternationalString> citAltTitle = new ArrayList<InternationalString>();
citAltTitle.add(new DefaultInternationalString(title));
citation.setAlternateTitles(citAltTitle);
citation.setEditionDate(sourceGenerationDate);
citation.getPresentationForms().add(PresentationForm.MAP_DIGITAL);
ArrayList<DefaultKeywords> keywordslist = new ArrayList<DefaultKeywords>();
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());
DefaultCitation thesaurus = new DefaultCitation();
thesaurus.setTitle(new DefaultInternationalString("General"));
thesaurus.setDates(citDates);
keywords.setThesaurusName(thesaurus);
keywordslist.add(keywords);
}
// usage:
DefaultUsage usage = new DefaultUsage();
usage.setSpecificUsage(new DefaultInternationalString(usageField));
usage.setUsageDate(sourceGenerationDate);
usage.setUserDeterminedLimitations(new DefaultInternationalString(usageLimitations));
usage.setUserContactInfo(new ArrayList<ResponsibleParty>(Arrays.asList(party)));
ArrayList<DefaultUsage> usages = new ArrayList<DefaultUsage>(Arrays.asList(usage));
ArrayList<TopicCategory> categories = new ArrayList<TopicCategory>();
categories.add(TopicCategory.BIOTA);
categories.add(TopicCategory.ENVIRONMENT);
categories.add(TopicCategory.OCEANS);
// Spatial Rapresentation Info
DefaultGeometricObjects geoObjs = new DefaultGeometricObjects();
geoObjs.setGeometricObjectType(GeometricObjectType.SURFACE);
DefaultVectorSpatialRepresentation spatial = new DefaultVectorSpatialRepresentation();
spatial.setTopologyLevel(TopologyLevel.GEOMETRY_ONLY);
spatial.getGeometricObjects().add(geoObjs);
// Extent:
DefaultExtent extent = new DefaultExtent();
extent.setGeographicElements(Collections.singleton(new DefaultGeographicBoundingBox(xLL, xRU, yLL, yRU)));
extent.setDescription(new DefaultInternationalString("Bounding box"));
extent.freeze();
//resolution
DefaultNominalResolution resolution = new DefaultNominalResolution();
resolution.setGroundResolution(res);
resolution.setScanningResolution(res);
DefaultResolution dres = new DefaultResolution();
dres.setDistance(res);
// layers access:
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"));
distribution.setDistributionFormats(new ArrayList<DefaultFormat>(Arrays.asList(format1, format2, format3)));
// legal constraints
DefaultLegalConstraints constraints = new DefaultLegalConstraints();
constraints.getUseLimitations().add(new DefaultInternationalString("Licensed"));
constraints.getAccessConstraints().add(Restriction.LICENSE);
constraints.getUseConstraints().add(Restriction.LICENSE);
// quality declaration:
DefaultDataQuality processQuality = new DefaultDataQuality();
//citation
DefaultCitation sourceCitation = new DefaultCitation();
sourceCitation.setTitle(new DefaultInternationalString(title));
sourceCitation.getDates().add(new DefaultCitationDate(sourceGenerationDate, DateType.CREATION));
sourceCitation.getIdentifiers().add(new DefaultIdentifier(sourceFileName));
//source
DefaultSource source = new DefaultSource();
source.setResolution(resolution);
source.setDescription(new DefaultInternationalString(title));
source.setSourceCitation(sourceCitation);
// provenance
DefaultProcessStep preprocessStep = new DefaultProcessStep();
DefaultProcessStep processStep = new DefaultProcessStep(preprocessStep);
DefaultProcessing processing = new DefaultProcessing();
processing.setSoftwareReferences(new ArrayList<DefaultCitation>(Arrays.asList(sourceCitation)));
processStep.setDescription(new DefaultInternationalString(processdescription));
DefaultLineage processLineage = new DefaultLineage();
processLineage.setProcessSteps(new ArrayList<ProcessStep>(Arrays.asList(processStep)));
processQuality.setLineage(processLineage);
processQuality.setScope(new DefaultScope(ScopeCode.DATASET));
// fulfill identification
DefaultDataIdentification ident = new DefaultDataIdentification();
ident.setCitation(citation);
ident.setAbstract(new DefaultInternationalString(abstractField));
ident.setPurpose(new DefaultInternationalString(purpose));
ident.getResourceMaintenances().add(new DefaultMaintenanceInformation(MaintenanceFrequency.AS_NEEDED));
ident.setDescriptiveKeywords(keywordslist);
ident.setTopicCategories(categories);
ident.setResourceSpecificUsages(usages);
ident.setExtents(new ArrayList<DefaultExtent>(Arrays.asList(extent)));
ident.setSpatialRepresentationTypes(new ArrayList<SpatialRepresentationType>(Arrays.asList(SpatialRepresentationType.GRID)));
ident.setSpatialResolutions(new ArrayList<DefaultResolution>(Arrays.asList(dres)));
ident.setLanguages(new ArrayList<Locale>(Arrays.asList(Locale.ENGLISH)));
// Metadata Obj:
DefaultMetadata meta = new DefaultMetadata(party, sourceGenerationDate, ident);
meta.getSpatialRepresentationInfo().add(spatial);
meta.setDistributionInfo(distribution);
meta.getMetadataConstraints().add(constraints);
meta.getDataQualityInfo().add(processQuality);
meta.setLanguage(Locale.ENGLISH);
GNClient client = new GNClient(geonetworkUrl);
client.login(geonetworkUser, geonetworkPwd);
File tmetafile = meta2File(meta);
client.insertMetadata(new GNInsertConfiguration("3", "datasets", "_none_", true), tmetafile);
tmetafile.delete();
// System.out.println(meta);
}
}

View File

@ -1,44 +0,0 @@
package org.gcube.spatial.data.geonetwork.test;
public class OGCFormatter {
public static String getWfsUrl(String geoServerUrl, String layerName, String bbox, int limit, String format) {
return geoServerUrl + "/wfs?service=wfs&version=1.1.0&REQUEST=GetFeature" + "&TYPENAME=" + layerName + "&BBOX=" + bbox + (limit == 0 ? "" : "&MAXFEATURES=" + limit) + (format == null ? "" : "&OUTPUTFORMAT=" + format);
}
public static String getWmsUrl(String geoServerUrl, String layerName, String style, String bbox) {
return geoServerUrl + "/wms?service=wms&version=1.1.0" + "&request=GetMap&layers=" + layerName + "&styles=" + (style == null ? "" : style) + "&bbox=" + bbox + "&width=676&height=330&srs=EPSG:4326&format=application/openlayers";
}
public static String getWcsUrl(String geoServerUrl, String layerName, String bbox) {
return geoServerUrl + "/wcs?service=wcs&version=1.0.0" + "&request=GetCoverage&coverage=" + layerName + "&CRS=EPSG:4326" + "&bbox=" + bbox + "&width=676&height=330&format=geotiff";
}
public static String getWmsNetCDFUrl(String fileUrl, String layerName, String bbox) {
return fileUrl.replace("dodsC", "wms") + "?service=wms&version=1.3.0" + "&request=GetMap&layers=" + layerName + "&bbox=" + bbox + "&styles=&width=676&height=330&srs=EPSG:4326&CRS=EPSG:4326&format=image/png";
}
public static String getWcsNetCDFUrl(String fileUrl, String layerName, String bbox) {
return fileUrl.replace("dodsC", "wcs") + "?service=wcs&version=1.0.0" + "&request=GetCoverage&coverage=" + layerName + "&CRS=EPSG:4326" + "&bbox=" + bbox + "&width=676&height=330&format=geotiff";
}
public static String buildBoundingBox(double x1, double y1, double x2, double y2) {
// note: the bounding box is left,lower,right,upper
return (x1 + "," + y1 + "," + x2 + "," + y2);
}
public static String pointToBoundingBox(double x1, double y1, double tolerance) {
// note: the bounding box is left,lower,right,upper
double x11 = x1 - tolerance;
double y11 = y1 - tolerance;
double x22 = x1 + tolerance;
double y22 = y1 + tolerance;
return OGCFormatter.buildBoundingBox(x11, y11, x22, y22);
}
public static void main(String [] args){
//http://geoserver-dev.d4science-ii.research-infrastructures.eu/geoserver/wcs?service=WCS&version=1.0.0&request=GetCoverage&COVERAGE=aquamaps:WorldClimBio2&CRS=EPSG:4326&BBOX=-180,-90,180,90&WIDTH=640&HEIGHT=480&FORMAT=geotiff
String wcs = getWcsUrl("http://geoserver-dev.d4science-ii.research-infrastructures.eu/geoserver", "aquamaps:WorldClimBio2", buildBoundingBox(-180, -85.5,180, 90));
System.out.println(wcs);
}
}

View File

@ -1,116 +0,0 @@
package org.gcube.spatial.data.geonetwork.test;
import it.geosolutions.geonetwork.exception.GNLibException;
import it.geosolutions.geonetwork.exception.GNServerException;
import it.geosolutions.geonetwork.util.GNSearchRequest;
import it.geosolutions.geonetwork.util.GNSearchResponse;
import java.io.File;
import java.util.ArrayList;
import org.apache.commons.io.FileUtils;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.spatial.data.geonetwork.GeoNetwork;
import org.gcube.spatial.data.geonetwork.GeoNetworkReader;
import org.gcube.spatial.data.geonetwork.LoginLevel;
import org.gcube.spatial.data.geonetwork.configuration.AuthorizationException;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
import org.junit.Test;
public class QueryLogger {
// private static final String defaultScope="/gcube/devsec";
private static final String defaultScope="/d4science.research-infrastructures.eu/gCubeApps/EcologicalModelling";
private static final boolean printEverything=true;
private static XMLOutputter out = new XMLOutputter(Format.getPrettyFormat());
public static final String CITATION="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.";
public static void main(String[] args) throws Exception, AuthorizationException {
new QueryLogger().test();
}
@Test
public void test() throws Exception, AuthorizationException{
File metaDir=new File("meta");
if(!metaDir.exists()) metaDir.mkdirs();
else{
FileUtils.cleanDirectory(metaDir);
}
System.out.println(System.getenv());
ScopeProvider.instance.set(defaultScope);
System.out.println("Looking for ANY 'aquamaps'");
final GNSearchRequest req=new GNSearchRequest();
req.addParam(GNSearchRequest.Param.any,"");
// req.addConfig(GNSearchRequest.Config.similarity, "1");
// req.addConfig(GNSearchRequest.Config.hitsPerPage, "0");
// req.addConfig(GNSearchRequest.Config.remote, "true");
System.out.println(out.outputString(req.toElement()));
// req.addConfig(GNSearchRequest.Config.sortBy, "title");
// req.addParam(GNSearchRequest.Param.themeKey, "figis");
final GeoNetworkReader gn=GeoNetwork.get();
System.out.println(gn.getConfiguration());
gn.login(LoginLevel.DEFAULT);
Thread t=new Thread(){
@Override
public void run() {
GNSearchResponse resp;
try {
resp = gn.query(req);
System.out.println("Found "+resp.getCount()+" items");
} catch (GNLibException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (GNServerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
t.start();
Thread.sleep(10*1000);
// GNSearchResponse resp=gn.query(req);
// System.out.println("Found "+resp.getCount()+" items");
// System.out.println("From "+resp.getFrom());
// System.out.println("To "+resp.getTo());
// System.out.println("Summary "+resp.getSummary());
// System.out.println("Is Complete "+resp.isCompleteResponse());
// ArrayList<String> files=new ArrayList<String>();
// long count=0;
// if(resp.getCount()!=0)
// for(GNSearchResponse.GNMetadata metadata:resp){
//// long id=metadata.getId();
//// System.out.println(out.outputString(metadata.getInfo()));
//// System.out.print(id + (metadata+""));
// try{
// count++;
// System.out.println(count+" out of "+resp.getCount());
// System.out.println(gn.getById(metadata.getUUID()));
//// System.out.println(meta);
// }catch(Exception e){
// FileUtils.writeStringToFile(new File(metaDir,metadata.getUUID()+".xml"), gn.getByIdAsRawString(metadata.getUUID()));
// files.add(metadata.getUUID());
// }
//// ArrayList<InternationalString> key=new ArrayList<InternationalString>();
//// key.add(new DefaultInternationalString("AquaMaps"));
//// Keywords keys= new DefaultKeywords(key);
//// Identification ident=new DefaultDataIdentification();
//// ((Collection<Keywords>)ident.getDescriptiveKeywords()).add(keys);
//// ((Collection<Identification>) meta.getIdentificationInfo()).add(ident);
////
//// gn.updateMetadata(id, meta);
//// System.out.println("*********************UPDATED************************");
//// System.out.println(gn.getById(id));
////
//// break;
//
//
// }
// System.out.println("Wrote "+files.size()+" files into "+metaDir);
// for(String s:files)System.out.println(s);
}
}

View File

@ -1,52 +0,0 @@
package org.gcube.spatial.data.geonetwork.test;
import java.io.File;
import java.util.Date;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.spatial.data.geonetwork.GeoNetwork;
import org.gcube.spatial.data.geonetwork.GeoNetworkPublisher;
import org.gcube.spatial.data.geonetwork.LoginLevel;
import org.gcube.spatial.data.geonetwork.iso.GcubeISOMetadata;
import org.gcube.spatial.data.geonetwork.iso.ISOMetadataFactory;
import org.gcube.spatial.data.geonetwork.iso.Thesaurus;
import org.geotoolkit.metadata.iso.DefaultMetadata;
import org.geotoolkit.metadata.iso.extent.DefaultExtent;
import org.geotoolkit.xml.XML;
import org.opengis.metadata.Metadata;
import org.opengis.metadata.citation.PresentationForm;
import org.opengis.metadata.identification.TopicCategory;
import org.opengis.metadata.spatial.GeometricObjectType;
public class TrueMarbleMeta {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
ScopeProvider.instance.set("/gcube");
// ScopeProvider.instance.set("/d4science.research-infrastructures.eu");
GcubeISOMetadata gMeta=new GcubeISOMetadata();
gMeta.setAbstractField("This layer is used as a base layer for GIS VIewer widget");
gMeta.setCreationDate(new Date(System.currentTimeMillis()));
gMeta.setExtent((DefaultExtent) DefaultExtent.WORLD);
gMeta.setGeometricObjectType(GeometricObjectType.SURFACE);
gMeta.setPresentationForm(PresentationForm.IMAGE_DIGITAL);
gMeta.setPurpose(gMeta.getAbstractField());
gMeta.setTitle("TrueMarble");
gMeta.setUser("fabio.sinibaldi");
Thesaurus general=gMeta.getConfig().getThesauri().get("General");
gMeta.addKeyword("True Marble", general);
gMeta.addTopicCategory(TopicCategory.ENVIRONMENT);
Metadata meta=gMeta.getMetadata();
((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);
// System.out.println("Inserted meta with id : "+publisher.insertMetadata(meta));
}
}

View File

@ -1,21 +0,0 @@
package org.gcube.spatial.data.geonetwork.test;
import org.gcube.spatial.data.geonetwork.GeoNetwork;
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;
public class Wiki {
public static void main(String[] args) throws Exception{
ConfigurationManager.setConfiguration(MyConfiguration.class);
String uuid="86a7ac79-866a-49c6-b5d5-602fc2d87ddd";
GeoNetworkReader reader=GeoNetwork.get();
reader.login(LoginLevel.DEFAULT);
System.out.println(reader.getByIdAsRawString(uuid));
System.out.println("\n\n*********************************************************************************\n\n");
System.out.println(XML.marshal(reader.getById(uuid)));
}
}

View File

@ -1,15 +0,0 @@
log4j.rootLogger=DEBUG, A1, stdout
log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.File=log.txt
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
# ***** Max file size is set to 100KB
log4j.appender.A1.MaxFileSize=100MB
# ***** Keep one backup file
log4j.appender.A1.MaxBackupIndex=1
#CONSOLE
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Threshold=DEBUG
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%t] %-5p %c %d{dd MMM yyyy ;HH:mm:ss.SSS} - %m%n