@Override public boolean supportsOperation( CSWRequestType type ) { return CSWRequestType.GetRepositoryItem.equals( type ) ? false : true; }
@Override public boolean returnAsDC( URI outputSchema ) throws MetadataStoreException { if ( outputSchema != null && outputSchema.equals( OutputSchema.determineOutputSchema( OutputSchema.ISO_19115 ) ) ) { return false; } return true; } }
public static ResultType determineResultType( String typeString ) { ResultType resultType = null; typeString = typeString.toLowerCase(); if ( typeString.equalsIgnoreCase( ResultType.hits.name() ) ) { resultType = ResultType.hits; } else if ( typeString.equalsIgnoreCase( ResultType.results.name() ) ) { resultType = ResultType.results; } else if ( typeString.equalsIgnoreCase( ResultType.validate.name() ) ) { resultType = ResultType.validate; } return resultType; }
@Override public boolean next() throws MetadataStoreException { try { return rs.next(); } catch ( SQLException e ) { throw new MetadataStoreException( e.getMessage(), e ); } }
/** * The mandatory "resultType" attribute in the GetRecords operation is set to "hits". * * @throws MetadataStoreException */ public int getRecordCount( final MetadataQuery query ) throws MetadataStoreException { final String resultTypeName = "hits"; LOG.debug( Messages.getMessage( "INFO_EXEC", "do " + resultTypeName + " on getRecords" ) ); try { QueryService queryService = getReadOnlySqlService(); return queryService.executeCounting( query, getConnection() ); } catch ( Throwable t ) { LOG.debug( t.getMessage(), t ); String msg = Messages.getMessage( "ERROR_REQUEST_TYPE", ResultType.results.name(), t.getMessage() ); LOG.debug( msg ); throw new MetadataStoreException( msg ); } finally { // Don't close the ResultSet or PreparedStatement if no error occurs, the ResultSet is needed in the // ISOMetadataResultSet and both will be closed by // org.deegree.metadata.persistence.XMLMetadataResultSet#close(). } }
public EbrimGetCapabilitiesHandler( XMLStreamWriter writer, Set<Sections> sections, ServiceIdentificationType identification, ServiceProviderType provider, Version version, boolean isTransactionEnabled, URL extendedCapabilities ) { this.writer = writer; this.provider = provider; this.sections = sections; this.identification = identification; this.version = version; this.isTransactionEnabled = isTransactionEnabled; this.extendedCapabilities = extendedCapabilities; supportedOperations.add( CSWRequestType.GetCapabilities.name() ); supportedOperations.add( CSWRequestType.DescribeRecord.name() ); supportedOperations.add( CSWRequestType.GetRecords.name() ); supportedOperations.add( CSWRequestType.GetRecordById.name() ); supportedOperations.add( CSWRequestType.GetRepositoryItem.name() ); }
public static ReturnableElement determineReturnableElement( String returnableElement ) { ReturnableElement elementSetName = null; returnableElement = returnableElement.toLowerCase(); if ( returnableElement.equalsIgnoreCase( ReturnableElement.brief.name() ) ) { elementSetName = ReturnableElement.brief; } else if ( returnableElement.equalsIgnoreCase( ReturnableElement.summary.name() ) ) { elementSetName = ReturnableElement.summary; } else if ( returnableElement.equalsIgnoreCase( ReturnableElement.full.name() ) ) { elementSetName = ReturnableElement.full; } else { elementSetName = ReturnableElement.summary; } return elementSetName; }
private static void writeElementSetNameElement( GetRecords getRecords, XMLStreamWriter writer ) throws XMLStreamException { writer.writeStartElement( CSW_202_PREFIX, "ElementSetName", CSW_202_NS ); writer.writeCharacters( getRecords.getElementSetName().toString() ); writer.writeEndElement(); }
protected MetadataResultSet<?> getRecordById( GetRecordById getRecBI, MetadataStore<?> store, List<String> requestedIdList ) throws OWSException { if ( store != null ) { try { return store.getRecordById( requestedIdList, getRecBI.getTypeNames() ); } catch ( MetadataStoreException e ) { throw new OWSException( e.getMessage(), OWSException.NO_APPLICABLE_CODE ); } } return null; }
@Override public URL getSchema( QName typeName ) { if ( OutputSchema.determineByTypeName( typeName ) == OutputSchema.DC ) { try { return new URL( CSWConstants.CSW_202_RECORD ); } catch ( MalformedURLException e ) { LOG.info( "Could not resolve URL " + CSWConstants.CSW_202_RECORD ); } } return null; }
public ReturnableElement getElementSetName() { String reAsString = adapter.getNodeAsString( adapter.getRootElement(), new XPath( "./rim:QueryExpression/csw:Query/csw:ElementSetName", ns ), null ); ReturnableElement re = ReturnableElement.summary; try { re = ReturnableElement.valueOf( reAsString ); } catch ( Exception e ) { // } return re; }
@Override public void skip( int rows ) throws MetadataStoreException { try { for ( int i = 0; i < rows; i++ ) { rs.next(); } } catch ( SQLException e ) { throw new MetadataStoreException( e.getMessage(), e ); } }
@Override public List<URL> getSchemaReferences( QName typeName ) { if ( OutputSchema.determineByTypeName( typeName ) == OutputSchema.DC ) { return Collections.singletonList( CommonCSWProfile.class.getResource( "/org/deegree/services/csw/exporthandling/dublinCore.xml" ) ); } else if ( OutputSchema.determineByTypeName( typeName ) == OutputSchema.ISO_19115 ) { List<URL> schemas = new ArrayList<URL>(); schemas.add( CommonCSWProfile.class.getResource( "/org/deegree/services/csw/exporthandling/iso_data.xml" ) ); schemas.add( CommonCSWProfile.class.getResource( "/org/deegree/services/csw/exporthandling/iso_service.xml" ) ); return schemas; } return null; }
private void deleteFile( TransactionStatus status, File file ) throws MetadataStoreException { boolean deleted = file.delete(); LOG.debug( "File {} was " + ( deleted ? "successful" : "not" ) + " deleted", file ); if ( !deleted ) throw new MetadataStoreException( "Commit failed: could not " + status + " record at " + file ); }
@Override public int getRemaining() throws MetadataStoreException { int i = 0; try { while ( rs.next() ) { i++; } } catch ( SQLException e ) { throw new MetadataStoreException( e.getMessage(), e ); } return i; }
@Override public MetadataResultSet<ISORecord> getRecords( MetadataQuery query ) throws MetadataStoreException { try { return storedIsoRecords.getRecords( query ); } catch ( FilterEvaluationException e ) { throw new MetadataStoreException( e ); } }
public static URI determineOutputSchema( OutputSchema outputSchema ) throws MetadataStoreException { URI schema = null; try { switch ( outputSchema ) { case DC: schema = new URI( CSWConstants.CSW_202_NS ); break; case ISO_19115: schema = new URI( CSWConstants.GMD_NS ); break; } } catch ( URISyntaxException e ) { throw new MetadataStoreException( e.getMessage() ); } return schema; }
private ServiceManagerProvider() throws MetadataStoreException { Iterator<ServiceManager> iter = ServiceLoader.load( ServiceManager.class ).iterator(); while ( iter.hasNext() ) { if ( serviceManager != null ) { String msg = "It is not allowed to specify more than one service manager. Please check " + ServiceManager.class.getName(); throw new MetadataStoreException( msg ); } serviceManager = iter.next(); } if ( serviceManager == null ) { serviceManager = new DefaultServiceManager(); } }
@Override public void commit() throws MetadataStoreException { LOG.debug( "Performing commit of transaction." ); try { conn.commit(); } catch ( SQLException e ) { String msg = "Commit failed: " + e.getMessage(); LOG.debug( msg ); throw new MetadataStoreException( msg ); } finally { JDBCUtils.close( conn ); } }
@Override public int getRecordCount( MetadataQuery query ) throws MetadataStoreException { try { List<ISORecord> records = storedIsoRecords.getRecords( query.getFilter() ); return records.size(); } catch ( FilterEvaluationException e ) { throw new MetadataStoreException( e ); } }