| java.lang.Object com.izforge.izpack.util.SpecHelper
SpecHelper | public class SpecHelper (Code) | | This class contains some helper methods to simplify handling of xml specification files.
author: Klaus Bartz |
Constructor Summary | |
public | SpecHelper() The default constructor. |
SpecHelper | public SpecHelper()(Code) | | The default constructor.
|
getAllSubChildren | public Vector<XMLElement> getAllSubChildren(XMLElement root, String[] childdef)(Code) | | Returns a Vector with all leafs of the tree which is described with childdef.
Parameters: root - the XMLElement which is the current root for the search Parameters: childdef - a String array which describes the tree; the last element contains the leafname a Vector of XMLElements of all leafs founded under root |
getPackForName | public XMLElement getPackForName(String packDestName)(Code) | | Returns a XML element which represents the pack for the given name.
Parameters: packDestName - name of the pack which should be returned a XML element which represents the pack for the given name |
getRequiredAttribute | public String getRequiredAttribute(XMLElement element, String attrName) throws InstallerException(Code) | | Returns the attribute for the given attribute name. If no attribute exist, an
InstallerException with a detail message is thrown.
Parameters: element - XML element which should contain the attribute Parameters: attrName - key of the attribute the attribute as string throws: InstallerException - |
getResource | public InputStream getResource(String res)(Code) | | Gets the stream to a resource.
Parameters: res - The resource id. The resource value, null if not found |
getSpec | public XMLElement getSpec()(Code) | | Returns the specification.
the specification |
haveSpec | public boolean haveSpec()(Code) | | Returns true if a specification exist, else false.
true if a specification exist, else false |
isAttributeYes | public boolean isAttributeYes(XMLElement element, String attribute, boolean defaultValue)(Code) | | Returns whether the value to the given attribute is "yes" or not. If the attribute does not
exist, or the value is not "yes" and not "no", the default value is returned.
Parameters: element - the XML element which contains the attribute Parameters: attribute - the name of the attribute Parameters: defaultValue - the default value whether the value to the given attribute is "yes" or not |
parseError | public void parseError(XMLElement parent, String message) throws InstallerException(Code) | | Create parse error with consistent messages. Includes file name and line # of parent. It is
an error for 'parent' to be null.
Parameters: parent - The element in which the error occured Parameters: message - Brief message explaining error |
readSpec | public void readSpec(String specFileName) throws Exception(Code) | | Reads the XML specification given by the file name. The result is stored in spec.
exception: Exception - for any problems in reading the specification |
readSpec | public void readSpec(String specFileName, VariableSubstitutor substitutor) throws Exception(Code) | | Reads the XML specification given by the file name. The result is stored in spec.
exception: Exception - for any problems in reading the specification |
readSpec | public void readSpec(InputStream input) throws Exception(Code) | | Reads the XML specification given by the input stream. The result is stored in spec.
exception: Exception - for any problems in reading the specification |
setSpec | public void setSpec(XMLElement element)(Code) | | Sets the specifaction to the given XML element.
Parameters: element - |
substituteVariables | public InputStream substituteVariables(InputStream input, VariableSubstitutor substitutor) throws Exception(Code) | | Creates an temp file in to the substitutor the substituted contents of input writes; close it
and (re)open it as FileInputStream. The file will be deleted on exit.
Parameters: input - the opened input stream which contents should be substituted Parameters: substitutor - substitutor which should substitute the contents of input a file input stream of the created temporary file throws: Exception - |
|
|