org.apache.maven.plugins.site.wagon
Class PathUtils

java.lang.Object
  extended by org.apache.maven.plugins.site.wagon.PathUtils

public final class PathUtils
extends Object

Various path (URL) manipulation routines. Note: This is a copy of a file from Wagon. It was copied here to be able to work around WAGON-307. This class can be removed when the prerequisite Maven version uses wagon-provider-api:1.0-beta-7.

Version:
$Id: PathUtils.html 816561 2012-05-08 12:02:24Z hboutemy $
Author:
Michal Maczka

Method Summary
static String basedir(String url)
          Derive the path portion of the given URL.
static String dirname(String path)
          Returns the directory path portion of a file specification string.
static String[] dirnames(String path)
           
static String filename(String path)
          Returns the filename portion of a file specification string.
static String host(String url)
          Return the host name (Removes protocol and path from the URL) E.g: for input http://www.codehause.org this method will return www.apache.org
static String password(String url)
           
static int port(String url)
           
static String protocol(String url)
          /** Return the protocol name.
static String toRelative(File basedir, String absolutePath)
           
static String user(String url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

dirname

public static String dirname(String path)
Returns the directory path portion of a file specification string. Matches the equally named unix command.

Returns:
The directory portion excluding the ending file separator.

filename

public static String filename(String path)
Returns the filename portion of a file specification string.

Returns:
The filename string with extension.

dirnames

public static String[] dirnames(String path)

host

public static String host(String url)
Return the host name (Removes protocol and path from the URL) E.g: for input http://www.codehause.org this method will return www.apache.org

Parameters:
url - the url
Returns:
the host name

protocol

public static String protocol(String url)
/** Return the protocol name.
E.g: for input http://www.codehause.org this method will return http

Parameters:
url - the url
Returns:
the host name

port

public static int port(String url)
Parameters:
url -
Returns:
the port or WagonConstants.UNKNOWN_PORT if not existent

basedir

public static String basedir(String url)
Derive the path portion of the given URL.

Parameters:
url - the repository URL
Returns:
the basedir of the repository

user

public static String user(String url)

password

public static String password(String url)

toRelative

public static String toRelative(File basedir,
                                String absolutePath)


Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.