public static String getRepoName ( Properties repoProperties , RepositoryConnection repoConn ) throws InstallException { String repoName = null ; List < RepositoryConfig > configRepos = RepositoryConfigUtils . getRepositoryConfigs ( repoProperties ) ; if ( ! ( repoConn instanceof DirectoryRepositoryConnection || repoConn instanceof ZipRepositoryConnection ) ) { if ( RepositoryConfigUtils . isLibertyRepository ( ( RestRepositoryConnection ) repoConn , repoProperties ) ) return WLP_REPO ; } for ( RepositoryConfig rc : configRepos ) { if ( rc . getUrl ( ) != null ) { if ( rc . getUrl ( ) . toLowerCase ( ) . startsWith ( "file:" ) && ( repoConn instanceof DirectoryRepositoryConnection || repoConn instanceof ZipRepositoryConnection ) ) { String repoDir = rc . getUrl ( ) ; try { URL fileURL = new URL ( repoDir ) ; File repoFile = new File ( fileURL . getPath ( ) ) ; if ( repoFile . getAbsolutePath ( ) . equalsIgnoreCase ( repoConn . getRepositoryLocation ( ) ) ) { repoName = rc . getId ( ) ; break ; } } catch ( Exception e ) { throw new InstallException ( RepositoryUtils . getMessage ( "ERROR_DIRECTORY_NOT_EXISTS" , repoDir ) ) ; } } else { if ( rc . getUrl ( ) . equalsIgnoreCase ( repoConn . getRepositoryLocation ( ) ) ) { repoName = rc . getId ( ) ; break ; } } } } return repoName ; }
Gets the name of the repository by connection and properties