public class SpecHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
NO |
static String |
PACK_KEY |
static String |
PACK_NAME |
static String |
YES |
| Constructor and Description |
|---|
SpecHelper(Resources resources)
Constructs a SpecHelper.
|
| Modifier and Type | Method and Description |
|---|---|
List<IXMLElement> |
getAllSubChildren(IXMLElement root,
String[] childdef)
Returns a Vector with all leafs of the tree which is described with childdef.
|
String |
getOptionalAttribute(IXMLElement element,
String attrName) |
IXMLElement |
getPackForName(String packDestName)
Returns a XML element which represents the pack for the given name.
|
String |
getRequiredAttribute(IXMLElement element,
String attrName)
Returns the attribute for the given attribute name.
|
InputStream |
getResource(String res)
Gets the stream to a resource.
|
IXMLElement |
getSpec()
Returns the specification.
|
boolean |
haveSpec()
Returns true if a specification exist, else false.
|
boolean |
isAttributeYes(IXMLElement element,
String attribute,
boolean defaultValue)
Returns whether the value to the given attribute is "yes" or not.
|
void |
parseError(IXMLElement parent,
String message)
Create parse error with consistent messages.
|
void |
readSpec(InputStream input)
Reads the XML specification given by the input stream.
|
void |
readSpec(String specFileName)
Reads the XML specification given by the file name.
|
void |
setSpec(IXMLElement element)
Sets the specifaction to the given XML element.
|
public static final String YES
public static final String NO
public static final String PACK_KEY
public static final String PACK_NAME
public SpecHelper(Resources resources)
resources - the resourcespublic void readSpec(String specFileName) throws Exception
Exception - for any problems in reading the specificationpublic void readSpec(InputStream input) throws Exception
Exception - for any problems in reading the specificationpublic InputStream getResource(String res)
res - The resource id.public IXMLElement getPackForName(String packDestName)
packDestName - name of the pack which should be returnedpublic void parseError(IXMLElement parent, String message) throws InstallerException
parent - The element in which the error occuredmessage - Brief message explaining errorInstallerExceptionpublic boolean haveSpec()
public IXMLElement getSpec()
public void setSpec(IXMLElement element)
element - public List<IXMLElement> getAllSubChildren(IXMLElement root, String[] childdef)
root - the IXMLElement which is the current root for the searchchilddef - a String array which describes the tree; the last element contains the leaf
namepublic boolean isAttributeYes(IXMLElement element, String attribute, boolean defaultValue)
element - the XML element which contains the attributeattribute - the name of the attributedefaultValue - the default valuepublic String getRequiredAttribute(IXMLElement element, String attrName) throws InstallerException
element - XML element which should contain the attributeattrName - key of the attributeInstallerExceptionpublic String getOptionalAttribute(IXMLElement element, String attrName)
Copyright © 2001–2025. All rights reserved.