congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
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

  • Reactive rest calls using spring rest template
  • getContentResolver (Context)
  • runOnUiThread (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • JTextField (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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