@Override public T inspect( T record, Connection conn, SQLDialect dialect ) throws MetadataInspectorException { List<SchemaValidationEvent> errors = validate( record.getAsOMElement() ); if ( errors.isEmpty() ) { return record; } else { StringBuilder sb = new StringBuilder(); for ( SchemaValidationEvent error : errors ) { sb.append( error ); sb.append( "\n" ); } String msg = Messages.getMessage( "ERROR_VALIDATE" + sb ); LOG.debug( msg ); throw new MetadataInspectorException( msg ); } } }
String msg = "Could not update the profile: " + e.getMessage(); LOG.debug( msg ); try {
/** * If there is a data metadata record available for the service metadata record. * */ private boolean getCoupledDataMetadatasets( Connection conn, String resourceIdentifier, SQLDialect dialect ) throws MetadataInspectorException { String resourceIdCol = ISOPropertyNameMapper.CommonColumnNames.resourceid.name(); String mainTable = ISOPropertyNameMapper.DatabaseTables.idxtb_main.name(); ResultSet rs = null; PreparedStatement stm = null; LOG.warn( "Check table / column names." ); String s = "SELECT " + resourceIdCol + " FROM " + mainTable + " WHERE " + resourceIdCol + " = ?"; try { stm = conn.prepareStatement( s ); stm.setString( 1, resourceIdentifier ); rs = stm.executeQuery(); return rs.next(); } catch ( SQLException e ) { String msg = Messages.getMessage( "ERROR_SQL", s, e.getMessage() ); LOG.debug( msg ); throw new MetadataInspectorException( msg ); } finally { close( rs ); close( stm ); } }
/** * Before any transaction operation is possible there should be an evaluation of the record. The response of the * full ISO record has to be valid. With this method this is guaranteed. * * @param elem * that has to be evaluated before there is any transaction operation possible. * @return a list of error-strings, or empty list if there is no validation needed. * @throws MetadataStoreException */ private List<SchemaValidationEvent> validate( OMElement elem ) throws MetadataInspectorException { InputStream is = null; try { StreamBufferStore os = new StreamBufferStore(); elem.serialize( os ); is = os.getInputStream(); } catch ( Throwable e ) { LOG.debug( "error: " + e.getMessage(), e ); throw new MetadataInspectorException( e.getMessage() ); } if ( new QName( "http://www.isotc211.org/2005/gmd", "MD_Metadata" ).equals( elem.getQName() ) ) { return SchemaValidator.validate( is, SCHEMA_URL_GMD, SCHEMA_URL_SRV ); } // DublinCore return SchemaValidator.validate( is, SCHEMA_URL ); }
@Override public ISORecord inspect( ISORecord record, Connection conn, SQLDialect dialect ) throws MetadataInspectorException { // 2.2.5 Unique resource identifier for dataset and dataset series String type = record.getType(); if ( ( type == null || "dataset".equals( type ) || "series".equals( type ) ) && record.getParsedElement().getQueryableProperties().getResourceIdentifier() == null ) { throw new MetadataInspectorException( Messages.get( "INSPIRE_COMPLIANCE_MISSING_RI", record.getIdentifier() ) ); } return record; } }
String msg = Messages.getMessage( "ERROR_SQL", stm.toString(), e.getMessage() ); LOG.debug( msg ); throw new MetadataInspectorException( msg ); } finally { close( rs );
String msg = Messages.getMessage( "ERROR_REJECT_FI" ); LOG.debug( msg ); throw new MetadataInspectorException( msg );
String msg = Messages.getMessage( "ERROR_COUPLING" ); LOG.debug( msg ); throw new MetadataInspectorException( msg );
String msg = Messages.getMessage( "ERROR_MANDATORY_ELEMENT_MISSING", "contact" ); LOG.debug( msg ); throw new MetadataInspectorException( msg );