Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize logging for feature references to speed up batch import jobs #1286

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//$HeadURL$
/*----------------------------------------------------------------------------
This file is part of deegree, http://deegree.org/
Copyright (C) 2001-2009 by:
Copyright (C) 2001-2022 by:
Department of Geography, University of Bonn
and
lat/lon GmbH
and
- grit graphische Informationstechnik Beratungsgesellschaft mbH -

This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Expand All @@ -31,6 +32,11 @@
Germany
http://www.geographie.uni-bonn.de/deegree/

grit graphische Informationstechnik Beratungsgesellschaft mbH
Landwehrstr. 143, 59368 Werne
Germany
http://www.grit.de/

e-mail: info@deegree.org
----------------------------------------------------------------------------*/
package org.deegree.feature;
Expand Down Expand Up @@ -64,9 +70,8 @@
* Provides utility methods for common tasks that involve {@link Feature} and {@link FeatureCollection} objects.
*
* @author <a href="mailto:schneider@lat-lon.de">Markus Schneider</a>
* @author last edited by: $Author$
* @author <a href="mailto:reichhelm@grit.de">Stephan Reichhelm</a>
*
* @version $Revision$, $Date$
*/
public class Features {

Expand Down Expand Up @@ -227,7 +232,7 @@ public static void findFeaturesAndGeometries( TypedObjectNode node, Set<Geometry
else
return;
} catch ( ReferenceResolvingException e ) {
LOG.warn( "Unable to resolve external reference '" + ref.getURI() + ". Ignoring." );
LOG.warn( "Unable to resolve external reference '{}'. Ignoring.", ref.getURI() );
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//$HeadURL$
/*----------------------------------------------------------------------------
This file is part of deegree, http://deegree.org/
Copyright (C) 2001-2009 by:
Copyright (C) 2001-2022 by:
Department of Geography, University of Bonn
and
lat/lon GmbH
and
- grit graphische Informationstechnik Beratungsgesellschaft mbH -

This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Expand All @@ -31,6 +32,11 @@
Germany
http://www.geographie.uni-bonn.de/deegree/

grit graphische Informationstechnik Beratungsgesellschaft mbH
Landwehrstr. 143, 59368 Werne
Germany
http://www.grit.de/

e-mail: info@deegree.org
----------------------------------------------------------------------------*/
package org.deegree.gml.reference;
Expand Down Expand Up @@ -66,9 +72,7 @@
* @see GMLStreamReader
*
* @author <a href="mailto:schneider@lat-lon.de">Markus Schneider </a>
* @author last edited by: $Author$
*
* @version $Revision$, $Date$
* @author <a href="mailto:reichhelm@grit.de">Stephan Reichhelm</a>
*/
public class GmlDocumentIdContext implements GMLReferenceResolver {

Expand All @@ -86,6 +90,8 @@ public class GmlDocumentIdContext implements GMLReferenceResolver {

private ReferencePatternMatcher referencePatternMatcher;

private boolean skipUrnWarning = false;

/**
* Creates a new {@link GmlDocumentIdContext} instance for a GML document of the given version.
*
Expand Down Expand Up @@ -139,6 +145,9 @@ public void addReference( GMLReference<?> ref ) {
*/
public void setReferencePatternMatcher( ReferencePatternMatcher referencePatternMatcher ) {
this.referencePatternMatcher = referencePatternMatcher;

// NOTE allow to suppress warnings regarding urn: (only if explicitly requested)
this.skipUrnWarning = uriShouldBeSkipped( "urn:" );
}

/**
Expand Down Expand Up @@ -175,12 +184,14 @@ public GMLObject getObject( String uri, String baseURL ) {
if ( uri.startsWith( "#" ) ) {
return idToObject.get( uri.substring( 1 ) );
} else if ( uri.startsWith( "urn:" ) ) {
LOG.warn( "Unable to resolve external object reference: " + uri
+ ". Resolving of urn references is not implemented yet." );
} else if( !uriShouldBeSkipped( uri) ) {
if ( !skipUrnWarning ) {
LOG.warn( "Unable to resolve external object reference: {}. Resolving of urn references is not implemented yet.",
uri );
}
} else if ( !uriShouldBeSkipped( uri ) ) {
return fetchExternalGmlObject( uri, baseURL );
} else {
LOG.info( "URL " + uri + " is configured to be skipped" );
LOG.info( "URL {} is configured to be skipped", uri );
}
return null;
}
Expand All @@ -198,7 +209,7 @@ private GMLObject fetchExternalGmlObject( String uri, String baseURL ) {
gmlReader.setApplicationSchema( schema );
object = gmlReader.read();
gmlReader.close();
LOG.debug( "Read GML object: id='" + object.getId() + "'" );
LOG.debug( "Read GML object: id='{}'", object.getId() );
} catch ( Throwable e ) {
String msg = "Unable to resolve external object reference to '" + uri + "': " + e.getMessage();
throw new ReferenceResolvingException( msg );
Expand All @@ -217,7 +228,7 @@ public void resolveLocalRefs()

for ( GMLReference<?> ref : localRefs ) {
String id = ref.getURI().substring( 1 );
LOG.debug( "Resolving reference to object '" + id + "'" );
LOG.debug( "Resolving reference to object '{}'", id );
if ( ref.getReferencedObject() == null ) {
String msg = "Cannot resolve reference to object with id '" + id
+ "'. There is no object with this id in the document.";
Expand Down