@Override public List<Property> getProperties( QName propName ) { return getReferencedObject().getProperties( propName ); } }
@Override public GMLObjectType getType() { return getReferencedObject().getType(); }
@Override public String getId( TypedObjectNode context ) { if ( context instanceof GMLObject ) { return ( (GMLObject) context ).getId(); } // TODO implement fallback to generic gml:id attribute return null; } }
private void traverseGMLObject( GMLObject node ) { for ( Property prop : node.getProperties() ) { if ( prop.getValue() != null ) { TypedObjectNode ton = prop.getValue(); traverseTypedObjectNode( ton ); } } }
private boolean isResolvable( GMLReference<?> ref ) { try { ref.getReferencedObject(); return true; } catch ( ReferenceResolvingException e ) { return false; } }
private static QName getName( GMLObject object ) { if ( object.getType() != null ) { return object.getType().getName(); } if ( object instanceof Feature ) { return ( (Feature) object ).getName(); } else if ( object instanceof Geometry ) { // TODO should be covered by the type return new QName( "GEOMETRY" ); } else if ( object instanceof TimeInstant ) { return new QName( GML3_2_NS, "TimeInstant" ); } else if ( object instanceof TimePeriod ) { return new QName( GML3_2_NS, "TimePeriod" ); } throw new IllegalArgumentException( "Creating GMLObjectNode from " + object.getClass() + " needs implementation." ); }
@Override public GMLObject getObject( String uri, String baseURL ) { for ( GMLReferenceResolver resolver : resolvers ) { try { GMLObject obj = resolver.getObject( uri, baseURL ); if ( obj != null ) { return obj; } } catch ( Throwable t ) { // just skip to the next resolver } } return null; }
/** * Adds a new {@link GMLReference} that has been encountered during the parsing of the GML document. * * @param ref * GML reference, must not be <code>null</code> */ public void addReference( GMLReference<?> ref ) { refs.add( ref ); if ( ref.getURI().startsWith( "#" ) ) { localRefs.add( ref ); } }
@Override public StringOrRef getDescription() { return gmlProps.getDescription(); }
@Override public CodeType[] getNames() { return gmlProps.getNames(); }
@Override public GMLObjectType getGeometryType( QName gtName ) { final GMLObjectType gmlObjectType = typeNameToType.get( gtName ); if ( gmlObjectType == null || gmlObjectType.getCategory() != GEOMETRY ) { return null; } return gmlObjectType; }
@Override public List<Property> getProperties() { return getReferencedObject().getProperties(); }
@Override public synchronized Feature getReferencedObject() throws ReferenceResolvingException { try { return super.getReferencedObject(); } catch ( ReferenceResolvingException e ) { if ( internalResolver == null ) throw e; return resolveInternalFeature( e ); } }
@Override public String handleReference( GMLReference<?> ref ) { if ( localReferencesPossible ) { LOG.debug( "Exporting potential forward reference to object {} which may or may not be exported later.", ref.getId() ); // try { // xmlStream.activateBuffering(); // } catch ( XMLStreamException e ) { // throw new RuntimeException( e.getMessage(), e ); // } return "{" + ref.getId() + "}"; } LOG.debug( "Exporting reference to object {} as remote reference.", ref.getId() ); return remoteXlinkTemplate.replace( "{}", ref.getId() ); }
/** * Adds a new {@link GMLObject} that has been encountered during the parsing of the GML document. * * @param object * GML object, must not be <code>null</code> and must not be of type {@link GMLReference} */ public void addObject( GMLObject object ) { String id = object.getId(); if ( id != null && id.length() > 0 ) { idToObject.put( object.getId(), object ); } }
@Override public void add( GMLObject obj ) { idToObject.put( obj.getId(), new SoftReference<GMLObject>( obj ) ); }
@Override public boolean visitObject( final GMLObject o ) { checkForDuplication( o.getId() ); return true; }