Class InstanceDirs

java.lang.Object
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("/glassfish7/glassfish/nodes/mymachine/instance1")); getInstanceDir() == /glassfish7/glassfish/nodes/mymachine/instance1 getNodeAgentDir() == /glassfish7/glassfish/nodes/mymachine getNodeAgentsDir() == /glassfish7/glassfish/nodes getInstanceName() == instance1
Since:
3.1 Created: April 19, 2010
Author:
Byron Nevins
  • Constructor Details

    • InstanceDirs

      public InstanceDirs(File instanceDir) 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:
      nodeDirParentPath - E.g. install-dir/nodes
      nodeDirName - 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 Details

    • getInstallRootPath

      protected String getInstallRootPath() throws IOException
      Gets the GlassFish installation root (using property com.sun.aas.installRoot),
      Returns:
      path of GlassFish install root
      Throws:
      IOException - if the GlassFish install root is not found
    • getInstanceName

      public String getInstanceName()
    • getInstanceDir

      public File getInstanceDir()
    • getNodeAgentDir

      public File getNodeAgentDir()
    • getNodeAgentsDir

      public File getNodeAgentsDir()
    • getServerDirs

      public ServerDirs getServerDirs()
    • getDasPropertiesFile

      public File getDasPropertiesFile()
    • toString

      public String toString()
      Overrides:
      toString in class Object