This commit is contained in:
Fabio Sinibaldi 2014-10-16 14:57:52 +00:00
parent b49a3d56ef
commit b9482dff08
5 changed files with 62 additions and 7 deletions

24
log.txt Normal file
View File

@ -0,0 +1,24 @@
0 [main] INFO org.gcube.common.scope.impl.ScopeProviderScanner - using scope provider org.gcube.common.scope.impl.DefaultScopeProvider@771199f0
2 [main] DEBUG org.gcube.common.scope.impl.DefaultScopeProvider - setting scope /gcube/devsec in thread 1
945 [main] INFO org.gcube.common.scan.DefaultScanner - matched 13 resources from 40 urls in 101 ms
971 [main] INFO org.gcube.common.scope.impl.ServiceMapScanner - loading jar:file:/home/fabio/.m2/repository/org/gcube/core/common-scope-maps/1.0.2-SNAPSHOT/common-scope-maps-1.0.2-SNAPSHOT.jar!/d4science.servicemap
1129 [main] INFO org.gcube.common.scope.impl.ServiceMapScanner - loading jar:file:/home/fabio/.m2/repository/org/gcube/core/common-scope-maps/1.0.2-SNAPSHOT/common-scope-maps-1.0.2-SNAPSHOT.jar!/vo1.servicemap
1130 [main] INFO org.gcube.common.scope.impl.ServiceMapScanner - loading jar:file:/home/fabio/.m2/repository/org/gcube/core/common-scope-maps/1.0.2-SNAPSHOT/common-scope-maps-1.0.2-SNAPSHOT.jar!/openbio.servicemap
1131 [main] INFO org.gcube.common.scope.impl.ServiceMapScanner - loading jar:file:/home/fabio/.m2/repository/org/gcube/core/common-scope-maps/1.0.2-SNAPSHOT/common-scope-maps-1.0.2-SNAPSHOT.jar!/cnr.servicemap
1132 [main] INFO org.gcube.common.scope.impl.ServiceMapScanner - loading jar:file:/home/fabio/.m2/repository/org/gcube/core/common-scope-maps/1.0.2-SNAPSHOT/common-scope-maps-1.0.2-SNAPSHOT.jar!/testing.servicemap
1132 [main] INFO org.gcube.common.scope.impl.ServiceMapScanner - loading jar:file:/home/fabio/.m2/repository/org/gcube/core/common-scope-maps/1.0.2-SNAPSHOT/common-scope-maps-1.0.2-SNAPSHOT.jar!/gcube.servicemap
1133 [main] INFO org.gcube.common.scope.impl.ServiceMapScanner - loading jar:file:/home/fabio/.m2/repository/org/gcube/core/common-scope-maps/1.0.2-SNAPSHOT/common-scope-maps-1.0.2-SNAPSHOT.jar!/farm.servicemap
1134 [main] INFO org.gcube.common.scope.impl.ServiceMapScanner - loading jar:file:/home/fabio/.m2/repository/org/gcube/core/common-scope-maps/1.0.2-SNAPSHOT/common-scope-maps-1.0.2-SNAPSHOT.jar!/isti.servicemap
1135 [main] INFO org.gcube.common.scope.impl.ServiceMapScanner - loading jar:file:/home/fabio/.m2/repository/org/gcube/core/common-scope-maps/1.0.2-SNAPSHOT/common-scope-maps-1.0.2-SNAPSHOT.jar!/gcubeapps.servicemap
1136 [main] INFO org.gcube.common.scope.impl.ServiceMapScanner - loading jar:file:/home/fabio/.m2/repository/org/gcube/core/common-scope-maps/1.0.2-SNAPSHOT/common-scope-maps-1.0.2-SNAPSHOT.jar!/ecosystem.servicemap
1137 [main] INFO org.gcube.common.scope.impl.ServiceMapScanner - loading jar:file:/home/fabio/.m2/repository/org/gcube/core/common-scope-maps/1.0.2-SNAPSHOT/common-scope-maps-1.0.2-SNAPSHOT.jar!/securevo.servicemap
1137 [main] INFO org.gcube.common.scope.impl.ServiceMapScanner - loading jar:file:/home/fabio/.m2/repository/org/gcube/core/common-scope-maps/1.0.2-SNAPSHOT/common-scope-maps-1.0.2-SNAPSHOT.jar!/devsec.servicemap
1138 [main] INFO org.gcube.common.scope.impl.ServiceMapScanner - loading jar:file:/home/fabio/.m2/repository/org/gcube/core/common-scope-maps/1.0.2-SNAPSHOT/common-scope-maps-1.0.2-SNAPSHOT.jar!/devnext.servicemap
1399 [main] INFO org.gcube.common.clients.stubs.jaxws.StubFactory - fetching wsdl for XQueryAccessService at http://dlib01.isti.cnr.it:8080/wsrf/services/gcube/informationsystem/collector/XQueryAccess?wsdl
1799 [main] INFO org.gcube.common.clients.stubs.jaxws.StubCache - caching stub for interface org.gcube.resources.discovery.icclient.stubs.CollectorStub
2061 [main] INFO org.gcube.resources.discovery.icclient.ICClient - executing query declare namespace ic = 'http://gcube-system.org/namespaces/informationsystem/registry'; for $resource in collection('/db/Profiles/GenericResource')//Document/Data/ic:Profile/Resource where ($resource/Profile/SecondaryType/text() eq 'ISO') and ($resource/Profile/Name/text() eq 'MetadataConstants') return $resource
2123 [main] INFO org.gcube.common.clients.stubs.jaxws.handlers.HandlerRegistry - loaded call handler org.gcube.common.clients.stubs.jaxws.handlers.ScopeHandler@7dd84118
2123 [main] INFO org.gcube.common.clients.stubs.jaxws.handlers.HandlerRegistry - loaded call handler org.gcube.common.clients.stubs.jaxws.handlers.TargetServiceHandler@c10420b
2124 [main] INFO org.gcube.common.clients.stubs.jaxws.handlers.HandlerRegistry - loaded call handler org.gcube.common.clients.stubs.jaxws.handlers.ClientInfoHandler@593e9bf1
2124 [main] INFO org.gcube.common.clients.stubs.jaxws.handlers.HandlerRegistry - loaded call handler org.gcube.common.clients.stubs.jaxws.handlers.LegacyWSAddressingHandler@3d3b10b1
2317 [main] INFO org.gcube.resources.discovery.icclient.ICClient - executed query declare namespace ic = 'http://gcube-system.org/namespaces/informationsystem/registry'; for $resource in collection('/db/Profiles/GenericResource')//Document/Data/ic:Profile/Resource where ($resource/Profile/SecondaryType/text() eq 'ISO') and ($resource/Profile/Name/text() eq 'MetadataConstants') return $resource in 256 ms

View File

@ -8,7 +8,7 @@
</parent>
<groupId>org.gcube.spatial.data</groupId>
<artifactId>geonetwork</artifactId>
<version>2.0.2-SNAPSHOT</version>
<version>2.0.3-SNAPSHOT</version>
<name>geonetwork</name>
<properties>

View File

@ -11,12 +11,15 @@ import it.geosolutions.geonetwork.util.GNSearchResponse;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
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.gcube.spatial.data.geonetwork.configuration.XMLAdapter;
import org.geotoolkit.xml.XML;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
@ -120,7 +123,7 @@ public class GeoNetwork implements GeoNetworkPublisher {
*/
@Override
public long insertMetadata(GNInsertConfiguration configuration,Metadata meta) throws GNLibException, GNServerException, IOException, JAXBException{
return insertMetadata(configuration, meta2File(meta));
return insertMetadata(configuration, meta2File(meta,registeredXMLAdapters));
}
/* (non-Javadoc)
@ -136,7 +139,7 @@ public class GeoNetwork implements GeoNetworkPublisher {
*/
@Override
public long insertMetadata(Metadata meta) throws GNLibException, GNServerException, IOException, JAXBException{
return insertMetadata(meta2File(meta));
return insertMetadata(meta2File(meta,registeredXMLAdapters));
}
@ -153,10 +156,12 @@ public class GeoNetwork implements GeoNetworkPublisher {
*/
@Override
public void updateMetadata(long id,Metadata meta) throws GNLibException, GNServerException, IOException, JAXBException{
updateMetadata(id, meta2File(meta));
updateMetadata(id, meta2File(meta,registeredXMLAdapters));
}
/* (non-Javadoc)
* @see org.gcube.spatial.data.geonetwork.GeoNetworkReader#deleteMetadata(long)
*/
@ -167,6 +172,15 @@ public class GeoNetwork implements GeoNetworkPublisher {
}
@Override
public void registerXMLAdapter(XMLAdapter adapter) {
registeredXMLAdapters.add(adapter);
}
//************* PRIVATE
private GNClient theClient=null;
@ -178,10 +192,16 @@ public class GeoNetwork implements GeoNetworkPublisher {
}
private static File meta2File(Metadata meta) throws IOException, JAXBException{
private List<XMLAdapter> registeredXMLAdapters=new ArrayList<XMLAdapter>();
private static File meta2File(Metadata meta,List<XMLAdapter> adapters) throws IOException, JAXBException{
File temp=File.createTempFile("meta", ".xml");
FileWriter writer=new FileWriter(temp);
writer.write(XML.marshal(meta));
String marshalled=XML.marshal(meta);
for(XMLAdapter adapter:adapters)
marshalled=adapter.adaptXML(marshalled);
writer.write(marshalled);
writer.close();
return temp;
}

View File

@ -10,7 +10,7 @@ import java.io.IOException;
import javax.xml.bind.JAXBException;
import org.gcube.spatial.data.geonetwork.configuration.AuthorizationException;
import org.gcube.spatial.data.geonetwork.configuration.XMLAdapter;
import org.opengis.metadata.Metadata;
public interface GeoNetworkPublisher extends GeoNetworkReader {
@ -32,6 +32,7 @@ public interface GeoNetworkPublisher extends GeoNetworkReader {
GNServerException, IOException,
JAXBException;
public void updateMetadata(long id, File metadataFile)
throws GNLibException, GNServerException;
@ -41,4 +42,7 @@ public interface GeoNetworkPublisher extends GeoNetworkReader {
public void deleteMetadata(long id) throws GNLibException,
GNServerException;
public void registerXMLAdapter(XMLAdapter adapter);
}

View File

@ -0,0 +1,7 @@
package org.gcube.spatial.data.geonetwork.configuration;
public interface XMLAdapter {
public String adaptXML(String xml);
}