Package com.sun.javatest
Class TemplateUtilities
- java.lang.Object
-
- com.sun.javatest.TemplateUtilities
-
public class TemplateUtilities extends java.lang.Object
Template support utility methods. Only meant to be used internally by JT Harness.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TemplateUtilities.ConfigInfo
-
Constructor Summary
Constructors Constructor Description TemplateUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TemplateUtilities.ConfigInfo
getConfigInfo(java.io.File f)
static java.io.File
getTemplateFile(WorkDirectory wd)
Get the path to the template associated with the work dir.static java.lang.String
getTemplateFromWd(java.io.File dir)
Using a lightweight method,, find out if and which template is associated with a work dir.static java.lang.String
getTemplatePath(WorkDirectory wd)
Get the path to the template associated with the work dir.static boolean
isTemplate(java.io.File f)
static void
setTemplateFile(WorkDirectory wd, java.io.File t, boolean changeable)
Associate a template file with a work directory.
-
-
-
Method Detail
-
getTemplateFile
public static java.io.File getTemplateFile(WorkDirectory wd)
Get the path to the template associated with the work dir.- Parameters:
wd
- The work directory to query.- Returns:
- Null if no associated template could be found. A file which refers to the template file associated with the work directories. May or may not be possible to actually open this file, the caller is responsible for determining that.
-
getTemplatePath
public static java.lang.String getTemplatePath(WorkDirectory wd)
Get the path to the template associated with the work dir.- Parameters:
wd
- The work directory to query.- Returns:
- Null if no associated template could be found. An abstract path otherwise.
-
setTemplateFile
public static void setTemplateFile(WorkDirectory wd, java.io.File t, boolean changeable) throws java.io.IOException
Associate a template file with a work directory. None of the parameters may be null.- Parameters:
wd
- Work dir to operate on.t
- Template file to associate the work directory with.changeable
- Can the workdir be later associated with a different template? Not currently used.- Throws:
java.io.IOException
- If the complete path to the template file cannot be resolve, or if there is an error writing to the work dir.
-
getTemplateFromWd
public static java.lang.String getTemplateFromWd(java.io.File dir) throws java.io.IOException
Using a lightweight method,, find out if and which template is associated with a work dir.- Returns:
- Null if no template is associated. Will also be null if the given dir is not a workdir - this is something that should be checked first.
- Throws:
java.io.IOException
- If there are problems getting the template information, which usually means there is a problem reading the workdir.
-
isTemplate
public static boolean isTemplate(java.io.File f) throws java.io.IOException
- Throws:
java.io.IOException
-
getConfigInfo
public static TemplateUtilities.ConfigInfo getConfigInfo(java.io.File f) throws java.io.IOException
- Throws:
java.io.IOException
-
-