|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.izforge.izpack.installer.WebRepositoryAccessor
public class WebRepositoryAccessor
This class enumerates the availabe packs at the web repository. Parses the config files - install.xml, packsinfo.xml, langpacks and is used to override the static configuration in the installer jar.
Field Summary | |
---|---|
private java.lang.String |
baseUrl
Base repository URL |
private static int |
BUFFER_SIZE
Files being downloaded in the buffer, 1MB max |
private static java.lang.String |
installFilename
Files to be looked for at the repository base url |
private java.lang.String |
installXmlString
install.xml |
private java.lang.String |
installXmlUrl
URL to remote install.xml |
private static boolean |
NO
Constant for checking attributes. |
private java.util.ArrayList<PackInfo> |
packs
list of PackInfo entries |
private java.lang.String |
packsInfo
packsinfo.xml contains nbytes, pack name and pack id |
private static java.lang.String |
packsinfoFilename
|
private static boolean |
YES
Constant for checking attributes. |
Constructor Summary | |
---|---|
WebRepositoryAccessor(java.lang.String urlbase)
Create a new WebRepositoryAccessor. |
Method Summary | |
---|---|
static java.lang.String |
getCachedUrl(java.lang.String url,
java.lang.String tempFolder)
First download the jar file. |
java.util.ArrayList<PackInfo> |
getOnlinePacks()
Get the list of the packs from the remore install.xml |
protected java.util.ArrayList<PackInfo> |
loadPacksList(XMLElement data)
|
protected void |
parseError(java.lang.String message)
Create parse error with consistent messages. |
protected void |
parseError(XMLElement parent,
java.lang.String message)
Create parse error with consistent messages. |
protected void |
parseError(XMLElement parent,
java.lang.String message,
java.lang.Throwable cause)
Create a chained parse error with consistent messages. |
private java.util.ArrayList<PackInfo> |
parsePacks()
Parse install.xml and return the list of packs |
private void |
parsePacksInfo()
Parse packsinfo.xml, fill the nbytes field, which is not available at runtime otherwise. |
protected void |
parseWarn(XMLElement parent,
java.lang.String message)
Create a parse warning with consistent messages. |
private void |
readConfig()
Reads the install.xml into confgiString |
private void |
readPacksInfo()
Reads packsinfo.xml |
protected java.lang.String |
requireAttribute(XMLElement element,
java.lang.String attribute)
Call getAttribute on an element, producing a meaningful error message if not present, or empty. |
protected XMLElement |
requireChildNamed(XMLElement parent,
java.lang.String name)
Call getFirstChildNamed on the parent, producing a meaningful error message on failure. |
protected java.lang.String |
requireContent(XMLElement element)
Call getContent on an element, producing a meaningful error message if not present, or empty. |
protected int |
requireIntAttribute(XMLElement element,
java.lang.String attribute)
Get a required attribute of an element, ensuring it is an integer. |
protected java.net.URL |
requireURLContent(XMLElement element)
Call getContent on an element, producing a meaningful error message if not present, or empty, or a valid URL. |
protected boolean |
requireYesNoAttribute(XMLElement element,
java.lang.String attribute)
Call getAttribute on an element, producing a meaningful error message if not present, or one of "yes" or "no". |
private java.lang.String |
stringFromURL(java.lang.String url)
Returns the contents of a file at url as a string (must be a text file) |
protected boolean |
validateYesNoAttribute(XMLElement element,
java.lang.String attribute,
boolean defaultValue)
Call getAttribute on an element, producing a meaningful warning if not "yes" or "no". |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String installXmlUrl
private java.lang.String baseUrl
private java.lang.String installXmlString
private java.lang.String packsInfo
private java.util.ArrayList<PackInfo> packs
private static boolean YES
private static boolean NO
private static final java.lang.String installFilename
private static final java.lang.String packsinfoFilename
private static final int BUFFER_SIZE
Constructor Detail |
---|
public WebRepositoryAccessor(java.lang.String urlbase)
urlbase
- Method Detail |
---|
public java.util.ArrayList<PackInfo> getOnlinePacks()
private java.lang.String stringFromURL(java.lang.String url)
url
-
private void readConfig()
private void readPacksInfo()
private java.util.ArrayList<PackInfo> parsePacks()
private void parsePacksInfo()
public static java.lang.String getCachedUrl(java.lang.String url, java.lang.String tempFolder) throws java.lang.Exception
url
-
java.lang.Exception
protected java.util.ArrayList<PackInfo> loadPacksList(XMLElement data) throws CompilerException
CompilerException
protected void parseError(java.lang.String message) throws CompilerException
message
- Brief message explaining error
CompilerException
protected void parseError(XMLElement parent, java.lang.String message) throws CompilerException
parent
- The element in which the error occuredmessage
- Brief message explaining error
CompilerException
protected void parseError(XMLElement parent, java.lang.String message, java.lang.Throwable cause) throws CompilerException
parent
- The element in which the error occuredmessage
- Brief message explaining error
CompilerException
protected void parseWarn(XMLElement parent, java.lang.String message)
parent
- The element in which the warning occuredmessage
- Warning messageprotected XMLElement requireChildNamed(XMLElement parent, java.lang.String name) throws CompilerException
parent
- The element to search for a childname
- Name of the child element to get
CompilerException
protected java.net.URL requireURLContent(XMLElement element) throws CompilerException
element
- The element to get content of
CompilerException
protected java.lang.String requireContent(XMLElement element) throws CompilerException
element
- The element to get content of
CompilerException
protected java.lang.String requireAttribute(XMLElement element, java.lang.String attribute) throws CompilerException
element
- The element to get the attribute value ofattribute
- The name of the attribute to get
CompilerException
protected int requireIntAttribute(XMLElement element, java.lang.String attribute) throws CompilerException
element
- The element to get the attribute value ofattribute
- The name of the attribute to get
CompilerException
protected boolean requireYesNoAttribute(XMLElement element, java.lang.String attribute) throws CompilerException
element
- The element to get the attribute value ofattribute
- The name of the attribute to get
CompilerException
protected boolean validateYesNoAttribute(XMLElement element, java.lang.String attribute, boolean defaultValue)
element
- The element to get the attribute value ofattribute
- The name of the attribute to getdefaultValue
- Value returned if attribute not present or invalid
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |