com.sun.enterprise.util.io
Class InstanceDirs

java.lang.Object
  extended by com.sun.enterprise.util.io.InstanceDirs

public final class InstanceDirs
extends Object

A class for keeping track of the directories that an instance lives in and under. All the methods throw checked exception to avoid the inevitable NPE otherwise - when working with invalid directories... Example: new InstanceDirs(new File("/glassfish3/glassfish/nodes/mymachine/instance1")); getInstanceDir() == /glassfish3/glassfish/nodes/mymachine/instance1 getNodeAgentDir() == /glassfish3/glassfish/nodes/mymachine getNodeAgentsDir() == /glassfish3/glassfish/nodes getInstanceName() == instance1

Since:
3.1 Created: April 19, 2010
Author:
Byron Nevins

Constructor Summary
InstanceDirs(File theInstanceDir)
          This constructor is used when the instance dir is known
InstanceDirs(ServerDirs sd)
          Create a InstanceDir from the more general ServerDirs instance.
InstanceDirs(String nodeDirParentPath, String nodeDirName, String instanceName)
          This constructor handles 0, 1, 2 or 3 null args.
 
Method Summary
 File getDasPropertiesFile()
           
protected  String getInstallRootPath()
          Gets the GlassFish installation root (using property com.sun.aas.installRoot),
 File getInstanceDir()
           
 String getInstanceName()
           
 File getNodeAgentDir()
           
 File getNodeAgentsDir()
           
 ServerDirs getServerDirs()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstanceDirs

public InstanceDirs(File theInstanceDir)
             throws IOException
This constructor is used when the instance dir is known

Parameters:
instanceDir - The instance's directory
Throws:
IOException - If any error including not having a grandparent directory.

InstanceDirs

public InstanceDirs(String nodeDirParentPath,
                    String nodeDirName,
                    String instanceName)
             throws IOException
This constructor handles 0, 1, 2 or 3 null args. It is smart enough to figure out many defaults.

Parameters:
nodeDirParent - E.g. install-dir/nodes
nodeDir - E.g. install-dir/nodes/localhost
instanceName - E.g. i1
Throws:
IOException

InstanceDirs

public InstanceDirs(ServerDirs sd)
Create a InstanceDir from the more general ServerDirs instance. along with getServerDirs() you can convert freely back and forth

Parameters:
aServerDir -
Method Detail

getInstallRootPath

protected String getInstallRootPath()
                             throws IOException
Gets the GlassFish installation root (using property com.sun.aas.installRoot),

Returns:
path of GlassFish install root
Throws:
CommandException - if the GlassFish install root is not found
IOException

getInstanceName

public final String getInstanceName()

getInstanceDir

public final File getInstanceDir()

getNodeAgentDir

public final File getNodeAgentDir()

getNodeAgentsDir

public final File getNodeAgentsDir()

getServerDirs

public final ServerDirs getServerDirs()

getDasPropertiesFile

public final File getDasPropertiesFile()


Copyright © 2012 GlassFish Community. All Rights Reserved.