public static RepositoryConfiguration read ( String resourcePathOrJsonContentString ) throws ParsingException , FileNotFoundException { CheckArg . isNotNull ( resourcePathOrJsonContentString , "resourcePathOrJsonContentString" ) ; InputStream stream = ResourceLookup . read ( resourcePathOrJsonContentString , RepositoryConfiguration . class , true ) ; if ( stream != null ) { Document doc = Json . read ( stream ) ; return new RepositoryConfiguration ( doc , withoutExtension ( resourcePathOrJsonContentString ) ) ; } // Try a file ... File file = new File ( resourcePathOrJsonContentString ) ; if ( file . exists ( ) && file . isFile ( ) ) { return read ( file ) ; } String content = resourcePathOrJsonContentString . trim ( ) ; if ( content . startsWith ( "{" ) ) { // Try to parse the document ... Document doc = Json . read ( content ) ; return new RepositoryConfiguration ( doc , null ) ; } throw new FileNotFoundException ( resourcePathOrJsonContentString ) ; }
Read the repository configuration given by the supplied path to a file on the file system the path a classpath resource file or a string containg the actual JSON content .