Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.flexstor.common.util
Class UrlAnalyzer  view UrlAnalyzer download UrlAnalyzer.java

java.lang.Object
  extended bycom.flexstor.common.util.UrlAnalyzer

public abstract class UrlAnalyzer
extends java.lang.Object

This class offers several methods to return the different parts of a file path. These parts are: - Remote file protocol - Server name; in DNS form or name-only form - location (not including file name) - file name - separator character It also returns whether path is local or remote


Field Summary
static char MAC_SEPARATOR
           
static char UNIX_SEPARATOR
           
static char WINDOWS_SEPARATOR
           
 
Constructor Summary
UrlAnalyzer()
           
 
Method Summary
static boolean comparePaths(java.lang.String sPath1, boolean bIsFile1, java.lang.String sPath2, boolean bIsFile2, boolean bIgnoreName)
          This method takes two paths, decomposes them into server, location, file name and examines each piece to determine if both paths represent the same location.
static java.lang.String getFileName(java.lang.String sPath)
          Returns the file name.
static java.lang.String getLocalParent(java.lang.String sPath)
          Returns the path String of this path's parent, or an empty String if this path does not name a parent directory.
static java.lang.String getLocalPath(java.lang.String sPath)
          Returns the local path to the file specified; not including the protocol neither the server name.
static java.lang.String getRemoteFileProtocol(java.lang.String sPath)
          Returns the remote file protocol for the path specified.
static char getSeparatorChar(java.lang.String sPath)
          Returns the file separator character as used in the path
static java.lang.String getServerDNS(java.lang.String sPath)
          Returns DNS name of the server if the path represents a remote url.
static java.lang.String getServerName(java.lang.String sPath)
          Returns the name of the server (not full DNS) if the path represents a remote url.
static boolean isPathLocal(java.lang.String sPath)
          Returns true if the path is local, false if remote.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNIX_SEPARATOR

public static final char UNIX_SEPARATOR
See Also:
Constant Field Values

WINDOWS_SEPARATOR

public static final char WINDOWS_SEPARATOR
See Also:
Constant Field Values

MAC_SEPARATOR

public static final char MAC_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

UrlAnalyzer

public UrlAnalyzer()
Method Detail

getRemoteFileProtocol

public static java.lang.String getRemoteFileProtocol(java.lang.String sPath)
Returns the remote file protocol for the path specified. If the path is local, it will return null.


getServerDNS

public static java.lang.String getServerDNS(java.lang.String sPath)
Returns DNS name of the server if the path represents a remote url. If it represents a local path, it will return the DNS for the local server.


getServerName

public static java.lang.String getServerName(java.lang.String sPath)
Returns the name of the server (not full DNS) if the path represents a remote url. If it represents a local path, it will return the name of the local server.


isPathLocal

public static boolean isPathLocal(java.lang.String sPath)
Returns true if the path is local, false if remote.


getLocalParent

public static java.lang.String getLocalParent(java.lang.String sPath)
Returns the path String of this path's parent, or an empty String if this path does not name a parent directory. The parent of a path consists of each name in the path's name sequence except for the last. If the name sequence is empty then the path does not name a parent directory. The parent of a path does not contain the protocol neither the server name. The parent of a path does not end in a file separator character.


getFileName

public static java.lang.String getFileName(java.lang.String sPath)
Returns the file name. The file name is the last name in the path. A file name does not imply that it is a file or a directory. To find out whether it is a directory or a file use FlexXFile.isFile() and FlexXFile.isDirectory().


getLocalPath

public static java.lang.String getLocalPath(java.lang.String sPath)
Returns the local path to the file specified; not including the protocol neither the server name.


getSeparatorChar

public static char getSeparatorChar(java.lang.String sPath)
Returns the file separator character as used in the path


comparePaths

public static boolean comparePaths(java.lang.String sPath1,
                                   boolean bIsFile1,
                                   java.lang.String sPath2,
                                   boolean bIsFile2,
                                   boolean bIgnoreName)
This method takes two paths, decomposes them into server, location, file name and examines each piece to determine if both paths represent the same location. If a path does not contain a protocol, it assumes it is a local path. If a path does not contain a server, it assumes it is a local path. Path will be equal, if their server, location and file name matches, regardless of the protocol specified. Example: 1) nfs://server.com/path/to/file is equal to ftp://server.com/path/to/file 2) flex://server.com/path/to/file is equal to /path/to/file