congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
PathUtil.getPathFromUri
Code IndexAdd Tabnine to your IDE (free)

How to use
getPathFromUri
method
in
org.apache.archiva.common.utils.PathUtil

Best Java code snippets using org.apache.archiva.common.utils.PathUtil.getPathFromUri (Showing top 17 results out of 315)

origin: apache/archiva

private Path getIndexPath( ArchivaIndexingContext ctx )
{
  return PathUtil.getPathFromUri( ctx.getPath( ) );
}
origin: apache/archiva

@Override
public void setLocation( URI location )
{
  super.setLocation( location );
  Path newLoc = PathUtil.getPathFromUri( location );
  if (!Files.exists( newLoc )) {
    try
    {
      Files.createDirectories( newLoc );
    }
    catch ( IOException e )
    {
      log.error("Could not create directory {}",location, e);
    }
  }
}
origin: apache/archiva

@Override
public Path toFile( ArchivaArtifact reference )
{
  return PathUtil.getPathFromUri( repository.getLocation()).resolve( toPath( reference ) );
}
origin: apache/archiva

@Override
public Path toFile( ArtifactReference reference )
{
  return PathUtil.getPathFromUri( repository.getLocation()).resolve( toPath( reference ) );
}
origin: apache/archiva

@Override
public Path getLocalPath() {
  Path localPath;
  if (StringUtils.isEmpty(getLocation().getScheme()) || "file".equals(getLocation().getScheme()) ) {
    localPath = PathUtil.getPathFromUri(getLocation());
    if (localPath.isAbsolute()) {
      return localPath;
    } else {
      return repositoryBase.resolve(localPath);
    }
  } else {
    return repositoryBase.resolve(getId());
  }
}
origin: apache/archiva

private Path getPackedIndexPath(Repository repo) throws IOException {
  IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get();
  Path repoDir = repo.getLocalPath();
  URI indexDir = icf.getPackedIndexPath();
  Path indexDirectory = null;
  if ( ! StringUtils.isEmpty(indexDir.toString( ) ) )
  {
    indexDirectory = PathUtil.getPathFromUri( indexDir );
    // not absolute so create it in repository directory
    if ( !indexDirectory.isAbsolute( ) )
    {
      indexDirectory = repoDir.resolve( indexDirectory );
    }
  }
  else
  {
    indexDirectory = repoDir.resolve( DEFAULT_PACKED_INDEX_DIR );
  }
  if ( !Files.exists( indexDirectory ) )
  {
    Files.createDirectories( indexDirectory );
  }
  return indexDirectory;
}
origin: apache/archiva

Path repoBase = PathUtil.getPathFromUri(repository.getLocation()).toAbsolutePath();
Path repoDir = repoBase.resolve( path );
origin: apache/archiva

private Path getIndexPath(Repository repo) throws IOException {
  IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get();
  Path repoDir = repo.getLocalPath();
  URI indexDir = icf.getIndexPath();
  Path indexDirectory = null;
  if ( ! StringUtils.isEmpty(indexDir.toString( ) ) )
  {
    indexDirectory = PathUtil.getPathFromUri( indexDir );
    // not absolute so create it in repository directory
    if ( !indexDirectory.isAbsolute( ) )
    {
      indexDirectory = repoDir.resolve( indexDirectory );
    }
  }
  else
  {
    indexDirectory = repoDir.resolve( DEFAULT_INDEXER_DIR );
  }
  if ( !Files.exists( indexDirectory ) )
  {
    Files.createDirectories( indexDirectory );
  }
  return indexDirectory;
}
origin: apache/archiva

private Path getIndexPath(Repository repo) throws IOException {
  IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get();
  Path repoDir = repo.getLocalPath();
  URI indexDir = icf.getIndexPath();
  Path indexDirectory = null;
  if ( ! StringUtils.isEmpty(indexDir.toString( ) ) )
  {
    indexDirectory = PathUtil.getPathFromUri( indexDir );
    // not absolute so create it in repository directory
    if ( !indexDirectory.isAbsolute( ) )
    {
      indexDirectory = repoDir.resolve( indexDirectory );
    }
  }
  else
  {
    indexDirectory = repoDir.resolve( DEFAULT_INDEXER_DIR);
  }
  if ( !Files.exists( indexDirectory ) )
  {
    Files.createDirectories( indexDirectory );
  }
  return indexDirectory;
}
origin: apache/archiva

Path repoBase = PathUtil.getPathFromUri(repository.getLocation());
Path repoDir = repoBase.resolve( path );
origin: apache/archiva

Path repoDir = PathUtil.getPathFromUri( repository.getLocation() ).resolve( path );
origin: apache/archiva

@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
  if (excludeMatcher.stream().noneMatch(m -> m.matches(file)) && includeMatcher.stream().allMatch(m -> m.matches(file))) {
    log.debug( "Walk Step: {}, {}", file );
    stats.increaseFileCount();
    // consume files regardless - the predicate will check the timestamp
    Path repoPath = PathUtil.getPathFromUri( repository.getLocation() );
    BaseFile basefile = new BaseFile( repoPath.toString(), file.toFile() );
    // Timestamp finished points to the last successful scan, not this current one.
    if ( Files.getLastModifiedTime(file).toMillis() >= changesSince )
    {
      stats.increaseNewFileCount();
    }
    consumerProcessFile.setBasefile( basefile );
    consumerWantsFile.setBasefile( basefile );
    Closure<RepositoryContentConsumer> processIfWanted = IfClosure.ifClosure( consumerWantsFile, consumerProcessFile );
    IterableUtils.forEach( this.knownConsumers, processIfWanted );
    if ( consumerWantsFile.getWantedFileCount() <= 0 )
    {
      // Nothing known processed this file.  It is invalid!
      IterableUtils.forEach( this.invalidConsumers, consumerProcessFile );
    }
  }
  return FileVisitResult.CONTINUE;
}
origin: apache/archiva

Path repoBase = PathUtil.getPathFromUri(repository.getLocation()).toAbsolutePath();
Path repoDir = artifactFile.getParent().toAbsolutePath();
origin: apache/archiva

@Override
public void beginScan( ManagedRepository repository, Date whenGathered )
  throws ConsumerException
{
  this.repository = repository;
  managedRepository = PathUtil.getPathFromUri( repository.getLocation() );
  try
  {
    log.info( "Creating indexing context for repo : {}", repository.getId() );
    if (repository.getType()== RepositoryType.MAVEN) {
      indexingContext = repository.getIndexingContext().getBaseContext(IndexingContext.class);
    } else  {
      indexingContext= null;
    }
  } catch (UnsupportedBaseContextException e) {
    log.error("Bad repository type. Not nexus indexer compatible.");
    throw new ConsumerException("Bad repository type "+repository.getType());
  }
}
origin: apache/archiva

@Test
public void testNoExistingChecksums()
  throws Exception
{
  String path = "no-checksums-artifact/1.0/no-checksums-artifact-1.0.jar";
  Path basePath = PathUtil.getPathFromUri( repoConfig.getLocation() );
  Path sha1Path = basePath.resolve(path + ".sha1" );
  Path md5FilePath = basePath.resolve(path + ".md5" );
  Files.deleteIfExists( sha1Path );
  Files.deleteIfExists( md5FilePath );
  Assertions.assertThat( sha1Path.toFile() ).doesNotExist();
  Assertions.assertThat( md5FilePath.toFile() ).doesNotExist();
  consumer.beginScan( repoConfig, Calendar.getInstance().getTime() );
  consumer.processFile( path );
  Assertions.assertThat( sha1Path.toFile() ).exists();
  long sha1LastModified = sha1Path.toFile().lastModified();
  Assertions.assertThat( md5FilePath.toFile() ).exists();
  long md5LastModified = md5FilePath.toFile().lastModified();
  Thread.sleep( 1000 );
  consumer.processFile( path );
  Assertions.assertThat( sha1Path.toFile() ).exists();
  Assertions.assertThat( md5FilePath.toFile() ).exists();
  Assertions.assertThat( sha1Path.toFile().lastModified() ).isEqualTo( sha1LastModified );
  Assertions.assertThat( md5FilePath.toFile().lastModified() ).isEqualTo( md5LastModified );
}
origin: apache/archiva

FileUtils.copyDirectory( Paths.get(repoConfig.getLocation() ).toFile(), newLocation.toFile() );
repoConfig.setLocation( newLocation.toAbsolutePath().toUri() );
Path basePath = PathUtil.getPathFromUri( repoConfig.getLocation() );
origin: apache/archiva

Path repoPath = PathUtil.getPathFromUri( repository.getLocation() );
BaseFile baseFile = new BaseFile( repoPath.toString(), localFile.toFile() );
ConsumerWantsFilePredicate predicate = new ConsumerWantsFilePredicate( repository );
org.apache.archiva.common.utilsPathUtilgetPathFromUri

Javadoc

Returns a path object from the given URI. If the URI has no scheme, the path of the URI is used for creating the filesystem path.

Popular methods of PathUtil

  • getRelative
    Given a basedir and a child file, return the relative path to the child.
  • toUrl

Popular in Java

  • Creating JSON documents from java classes using gson
  • getExternalFilesDir (Context)
  • getContentResolver (Context)
  • onRequestPermissionsResult (Fragment)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • JComboBox (javax.swing)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now