private void validateFields ( ) throws RepositoryConfigException { try { /* * Ontology file */ if ( owlFile . filter ( f -> ! f . exists ( ) ) . isPresent ( ) ) { throw new RepositoryConfigException ( String . format ( "The OWL file %s does not exist!" , owlFile . get ( ) . getAbsolutePath ( ) ) ) ; } if ( owlFile . filter ( f -> ! f . canRead ( ) ) . isPresent ( ) ) { throw new RepositoryConfigException ( String . format ( "The OWL file %s is not accessible!" , owlFile . get ( ) . getAbsolutePath ( ) ) ) ; } /* * Mapping file */ if ( obdaFile == null ) { throw new RepositoryConfigException ( String . format ( "No mapping file specified for repository creation " ) ) ; } if ( ! obdaFile . exists ( ) ) { throw new RepositoryConfigException ( String . format ( "The mapping file %s does not exist!" , obdaFile . getAbsolutePath ( ) ) ) ; } if ( ! obdaFile . canRead ( ) ) { throw new RepositoryConfigException ( String . format ( "The mapping file %s is not accessible!" , obdaFile . getAbsolutePath ( ) ) ) ; } /* * Properties file */ if ( propertiesFile == null ) { throw new RepositoryConfigException ( String . format ( "No properties file specified for repository creation " ) ) ; } if ( ! propertiesFile . exists ( ) ) { throw new RepositoryConfigException ( String . format ( "The properties file %s does not exist!" , propertiesFile . getAbsolutePath ( ) ) ) ; } if ( ! propertiesFile . canRead ( ) ) { throw new RepositoryConfigException ( String . format ( "The properties file %s is not accessible!" , propertiesFile . getAbsolutePath ( ) ) ) ; } if ( constraintFile . isPresent ( ) ) { File file = constraintFile . get ( ) ; if ( ! file . exists ( ) ) { throw new RepositoryConfigException ( String . format ( "The implicit key file %s does not exist!" , file . getAbsolutePath ( ) ) ) ; } if ( ! file . canRead ( ) ) { throw new RepositoryConfigException ( String . format ( "The implicit key file %s is not accessible!" , file . getAbsolutePath ( ) ) ) ; } } } /* * Sometimes thrown when there is no access right to the files. */ catch ( SecurityException e ) { throw new RepositoryConfigException ( e . getMessage ( ) ) ; } }
Checks that the fields are not missing and that files exist and are accessible .