com.sun.tools.doclets.internal.toolkit.util
Class DirectoryManager

java.lang.Object
  extended by com.sun.tools.doclets.internal.toolkit.util.DirectoryManager

public class DirectoryManager
extends java.lang.Object

Handle the directory creations and the path string generations. All static - never instaniated. This code is not part of an API. It is implementation that is subject to change. Do not use it as an API

Since:
1.2

Field Summary
static java.lang.String URL_FILE_SEPERATOR
          The file separator string, "/", used in the formation of the URL path.
 
Constructor Summary
private DirectoryManager()
          Never instaniated.
 
Method Summary
static void createDirectory(Configuration configuration, java.lang.String path)
          Given a path string create all the directories in the path.
static java.lang.String createPathString(ClassDoc cd)
          Given a ClassDoc, return its URL path string.
static java.lang.String createPathString(PackageDoc pd)
          Given a PackageDoc, return its URL path string.
static java.lang.String getDirectoryPath(PackageDoc pd)
          Given a PackageDoc, return the corresponding directory name with the platform-dependent file separator between subdirectory names.
static java.lang.String getDirectoryPath(java.lang.String packageName)
          Given a package name, return the corresponding directory name with the platform-dependent file separator between subdirectory names.
static java.lang.String getPath(java.lang.String name)
          Given a package name (a string), return the path string, with the URL separator "/" separating the subdirectory names.
static java.lang.String getPathNoTrailingSlash(java.lang.String path)
          Given a relative or absolute path that might be empty, convert it to a path that does not end with a URL separator "/".
static java.lang.String getPathToClass(ClassDoc cd)
          Given a class name return the full path to the class file.
static java.lang.String getPathToPackage(PackageDoc pd, java.lang.String filename)
          Given a package name and a file name, return the full path to that file.
static java.lang.String getRelativePath(PackageDoc from)
          Given a package name as a string, return relative path string from the corresponding package directory to the root of the documentation, using the URL separator "/" between subdirectory names.
static java.lang.String getRelativePath(java.lang.String from)
          Given a package name as a string, return relative path string from the corresponding package directory to the root of the documentation, using the URL separator "/" between subdirectory names.
static java.lang.String getRelativePath(java.lang.String from, java.lang.String to)
          Given two package names as strings, return the relative path from the package directory corresponding to the first string to the package directory corresponding to the second string, with the URL file separator "/" separating subdirectory names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URL_FILE_SEPERATOR

public static final java.lang.String URL_FILE_SEPERATOR
The file separator string, "/", used in the formation of the URL path.

See Also:
Constant Field Values
Constructor Detail

DirectoryManager

private DirectoryManager()
Never instaniated.

Method Detail

createPathString

public static java.lang.String createPathString(PackageDoc pd)
Given a PackageDoc, return its URL path string.

Parameters:
pd - PackageDoc
See Also:
getPath(String)

createPathString

public static java.lang.String createPathString(ClassDoc cd)
Given a ClassDoc, return its URL path string.

Parameters:
cd - ClassDoc
See Also:
getPath(String)

getDirectoryPath

public static java.lang.String getDirectoryPath(PackageDoc pd)
Given a PackageDoc, return the corresponding directory name with the platform-dependent file separator between subdirectory names. For example, if name of the package is "java.lang" , then it returns "java/lang" on Unix and "java\lang" on Windows. If name of the package contains no dot, then the value will be returned unchanged. Because package names cannot end in a dot, the return value will never end with a slash.

Also see getPath for the URL separator version of this method that takes a string instead of a PackageDoc.

Parameters:
pd - the PackageDoc
Returns:
the platform-dependent directory path for the package

getDirectoryPath

public static java.lang.String getDirectoryPath(java.lang.String packageName)
Given a package name, return the corresponding directory name with the platform-dependent file separator between subdirectory names. For example, if name of the package is "java.lang" , then it returns "java/lang" on Unix and "java\lang" on Windows. If name of the package contains no dot, then the value will be returned unchanged. Because package names cannot end in a dot, the return value will never end with a slash.

Also see getPath for the URL separator version of this method that takes a string instead of a PackageDoc.

Parameters:
packageName - the name of the package
Returns:
the platform-dependent directory path for the package

getPath

public static java.lang.String getPath(java.lang.String name)
Given a package name (a string), return the path string, with the URL separator "/" separating the subdirectory names. If name of the package contains no dot, then the value will be returned unchanged. Because package names cannot end in a dot, the return value will never end with a slash.

For example if the string is "com.sun.javadoc" then the URL path string will be "com/sun/javadoc".

Parameters:
name - the package name as a String
Returns:
the String URL path

getRelativePath

public static java.lang.String getRelativePath(java.lang.String from,
                                               java.lang.String to)
Given two package names as strings, return the relative path from the package directory corresponding to the first string to the package directory corresponding to the second string, with the URL file separator "/" separating subdirectory names.

For example, if the parameter "from" is "java.lang" and parameter "to" is "java.applet", return string "../../java/applet".

Parameters:
from - the package name from which path is calculated
to - the package name to which path is calculated
Returns:
relative path between "from" and "to" with URL separators
See Also:
getRelativePath(String), getPath(String)

getRelativePath

public static java.lang.String getRelativePath(PackageDoc from)
Given a package name as a string, return relative path string from the corresponding package directory to the root of the documentation, using the URL separator "/" between subdirectory names.

For example, if the string "from" is "java.lang", return "../../"

Parameters:
from - the package
Returns:
String relative path from "from".
See Also:
getRelativePath(String, String)

getRelativePath

public static java.lang.String getRelativePath(java.lang.String from)
Given a package name as a string, return relative path string from the corresponding package directory to the root of the documentation, using the URL separator "/" between subdirectory names.

For example, if the string "from" is "java.lang", return "../../"

Parameters:
from - the package name
Returns:
String relative path from "from".
See Also:
getRelativePath(String, String)

getPathNoTrailingSlash

public static java.lang.String getPathNoTrailingSlash(java.lang.String path)
Given a relative or absolute path that might be empty, convert it to a path that does not end with a URL separator "/". Used for converting HtmlStandardWriter.relativepath when replacing ../../../../../../...

Parameters:
path - the path to convert. An empty path represents the current directory.

createDirectory

public static void createDirectory(Configuration configuration,
                                   java.lang.String path)
Given a path string create all the directories in the path. For example, if the path string is "java/applet", the method will create directory "java" and then "java/applet" if they don't exist. The file separator string "/" is platform dependent system property.

Parameters:
path - Directory path string.

getPathToPackage

public static java.lang.String getPathToPackage(PackageDoc pd,
                                                java.lang.String filename)
Given a package name and a file name, return the full path to that file. For example, if PackageDoc passed is for "java.lang" and the filename passed is "package-summary.html", then the string returned is "java/lang/package-summary.html".

Parameters:
pd - PackageDoc.
filename - File name to be appended to the path of the package.

getPathToClass

public static java.lang.String getPathToClass(ClassDoc cd)
Given a class name return the full path to the class file. For example, if ClassDoc passed is for "java.lang.Object" then the string returned is "java/lang/Object.html".

Parameters:
cd - ClassDoc.