FileDocCategorySizeDatePackage
DefaultPaths.javaAPI DocJava SE 5 API6432Fri Aug 26 14:55:06 BST 2005com.sun.jmx.snmp.defaults

DefaultPaths

public class DefaultPaths extends Object
This class represents a set of default directories used by Java DMK.

This API is a Sun Microsystems internal API and is subject to change without notice.

since
1.5

Fields Summary
private static final String
INSTALL_PATH_RESOURCE_NAME
private static String
etcDir
Directories used by Java DMK.
private static String
tmpDir
private static String
installDir
Constructors Summary
private DefaultPaths()

    // private constructor defined to "hide" the default public constructor
      
	
    
Methods Summary
public static java.lang.StringgetEtcDir()
Returns the etc directory for Java DMK.

The default value of the etc directory is:

  • DefaultPaths.getInstallDir("etc").

return
Java DMK etc directory.

        if (etcDir == null)
            return getInstallDir("etc");
        else
            return etcDir;
    
public static java.lang.StringgetEtcDir(java.lang.String dirname)
Returns the etc directory for Java DMK concatenated with dirname.

The default value of the etc directory is:

  • DefaultPaths.getInstallDir("etc").

param
dirname The directory to be appended.
return
Java DMK etc directory + File.separator + dirname.

        if (etcDir == null) {
            if (dirname == null) {
                return getEtcDir();
            } else {
                return getEtcDir() + File.separator + dirname;
            }
        } else {
            if (dirname == null) {
                return etcDir;
            } else {
                return etcDir + File.separator + dirname;
            }
        }
    
public static java.lang.StringgetInstallDir()
Returns the installation directory for Java DMK. The default value of the installation directory is: <base_dir> + File.separator + SUNWjdmk + File.separator + jdmk5.0

return
Java DMK installation directory.

        if (installDir == null)
            return useRessourceFile();
        else
            return installDir;
    
public static java.lang.StringgetInstallDir(java.lang.String dirname)
Returns the installation directory for Java DMK concatenated with dirname. The default value of the installation directory is: <base_dir> + File.separator + SUNWjdmk + File.separator + jdmk5.0

param
dirname The directory to be appended.
return
Java DMK installation directory + File.separator + dirname.

        if (installDir == null) {
            if (dirname == null) {
                return getInstallDir();
            } else {
                return getInstallDir() + File.separator + dirname;
            }
        } else {
            if (dirname == null) {
                return installDir;
            } else {
                return installDir + File.separator + dirname;
            }
        }
    
public static java.lang.StringgetTmpDir()
Returns the tmp directory for the product.

The default value of the tmp directory is:

  • DefaultPaths.getInstallDir("tmp").

return
Java DMK tmp directory.

	 if (tmpDir == null)
            return getInstallDir("tmp");
        else
            return tmpDir;
    
public static java.lang.StringgetTmpDir(java.lang.String dirname)
Returns the tmp directory for Java DMK concatenated with dirname.

The default value of the tmp directory is:

  • DefaultPaths.getInstallDir("tmp").

param
dirname The directory to be appended.
return
Java DMK tmp directory + File.separator + dirname.

        if (tmpDir == null) {
            if (dirname == null) {
                return getTmpDir();
            } else {
                return getTmpDir() + File.separator + dirname;
            }
        } else {
            if (dirname == null) {
                return tmpDir;
            } else {
                return tmpDir + File.separator + dirname;
            }
        }
    
public static voidsetEtcDir(java.lang.String dirname)
Sets the etc directory for Java DMK.

param
dirname The etc directory for Java DMK.

    
        etcDir = dirname;
    
public static voidsetInstallDir(java.lang.String dirname)
Sets the installation directory for Java DMK.

param
dirname The directory where Java DMK resides.

    
        installDir = dirname;
    
public static voidsetTmpDir(java.lang.String dirname)
Sets the tmp directory for the product

param
dirname The tmp directory for Java DMK.

        tmpDir = dirname;
    
private static java.lang.StringuseRessourceFile()

	
	InputStream in = null;
	BufferedReader r = null;
	try {
	    in = 
		DefaultPaths.class.getClassLoader().getResourceAsStream(INSTALL_PATH_RESOURCE_NAME);
	    if(in == null) return null;
	    r = new BufferedReader(new InputStreamReader(in));
	    installDir = r.readLine();
	}catch(Exception e) {
	}
	finally {
	    try {
		if(in != null) in.close();
		if(r != null) r.close();
	    }catch(Exception e) {}
	}
	return installDir;