Tabnine Logo
PathUtil
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: apache/archiva

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

/**
 * Given a basedir and a child file, return the relative path to the child.
 *
 * @param basedir the basedir.
 * @param file    the file to get the relative path for.
 * @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character)
 */
public static String getRelative( String basedir, File file )
{
  return getRelative( basedir, file.getAbsolutePath() );
}
origin: apache/archiva

public static String toUrl( String path )
{
  // Is our work already done for us?
  if ( path.startsWith( "file:/" ) )
  {
    return path;
  }
  return toUrl( Paths.get( path ) );
}
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

/**
 * Given a basedir and a child file, return the relative path to the child.
 *
 * @param basedir the basedir.
 * @param child   the child path (can be a full path)
 * @return the relative path to the child. (NOTE: this path will NOT start with a file separator character)
 */
public static String getRelative( String basedir, String child )
{
  return getRelative(basedir, Paths.get(child));
}
origin: org.apache.archiva/archiva-common

public static String toUrl( String path )
{
  // Is our work already done for us?
  if ( path.startsWith( "file:/" ) )
  {
    return path;
  }
  return toUrl( new File( path ) );
}
origin: apache/archiva

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

public String getRelativePath()
{
  return PathUtil.getRelative( this.baseDir.getAbsolutePath(), this );
}
origin: apache/archiva

String defaultRepositoryUrl = PathUtil.toUrl( repositoryDirectory );
origin: apache/archiva

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

public BaseFile( File repoDir, File pathFile )
{
  this( repoDir, PathUtil.getRelative( repoDir.getAbsolutePath(), pathFile ) );
}
origin: org.apache.archiva/archiva-converter

String defaultRepositoryUrl = PathUtil.toUrl( repositoryDirectory );
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

public static String getRelative(String basedir, Path file) {
  return getRelative(Paths.get(basedir), file);
}
origin: apache/archiva

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

public BaseFile( File repoDir, File pathFile )
{
  this( repoDir, PathUtil.getRelative(repoDir.getAbsolutePath(), pathFile.toPath() ) );
}
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

public String getRelativePath()
{
  return PathUtil.getRelative( this.baseDir.getAbsolutePath(), this.toPath() );
}
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

  PathUtil.getRelative( managedRepository.getRepoRoot(), path1 )
).filter( filetypes::matchesArtifactPattern ).findFirst().orElse( null );
if (result!=null) {
org.apache.archiva.common.utilsPathUtil

Javadoc

PathUtil - simple utility methods for path manipulation.

Most used methods

  • getPathFromUri
    Returns a path object from the given URI. If the URI has no scheme, the path of the URI is used for
  • 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
  • startActivity (Activity)
  • scheduleAtFixedRate (Timer)
  • setContentView (Activity)
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Collectors (java.util.stream)
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Best plugins for Eclipse
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