|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrailo.runtime.schedule.StorageUtil
public final class StorageUtil
Constructor Summary | |
---|---|
StorageUtil()
|
Method Summary | |
---|---|
Element |
getElement(NodeList list,
String key,
String value)
return XML Element matching name |
Document |
loadDocument(Resource file)
load a XML Document as DOM representation |
Document |
loadDocument(String content)
|
void |
loadFile(File file,
String resourcePath)
create xml file from a resource definition |
void |
loadFile(Resource res,
String resourcePath)
create xml file from a resource definition |
void |
setBoolean(Element el,
String key,
boolean value)
sets a boolean value to a XML Element |
void |
setCredentials(Element el,
String username,
String password,
Credentials c)
sets a Credentials to a XML Element |
void |
setDateTime(Element el,
String key,
DateTime value)
sets a datetime value to a XML Element |
void |
setFile(Element el,
String key,
File value)
sets a file value to a XML Element |
void |
setFile(Element el,
String key,
Resource value)
sets a file value to a XML Element |
void |
setInt(Element el,
String key,
int value)
sets a int value to a XML Element |
void |
setString(Element el,
String key,
String value)
sets a string value to a XML Element |
void |
store(Document doc,
File file)
store loaded data to xml file |
void |
store(Document doc,
Resource res)
store loaded data to xml file |
boolean |
toBoolean(Element el,
String attributeName)
reads a XML Element Attribute ans cast it to a boolean value |
boolean |
toBoolean(Element el,
String attributeName,
boolean defaultValue)
reads a XML Element Attribute ans cast it to a boolean value |
Credentials |
toCredentials(Element el,
String attributeUser,
String attributePassword)
reads 2 XML Element Attribute ans cast it to a Credential |
Credentials |
toCredentials(Element el,
String attributeUser,
String attributePassword,
Credentials defaultCredentials)
reads 2 XML Element Attribute ans cast it to a Credential |
Date |
toDate(Config config,
Element el,
String attributeName)
reads a XML Element Attribute ans cast it to a Date Object |
Date |
toDate(Element el,
String attributeName,
Date defaultValue)
reads a XML Element Attribute ans cast it to a Date |
DateTime |
toDateTime(Config config,
Element el,
String attributeName)
reads a XML Element Attribute ans cast it to a DateTime Object |
DateTime |
toDateTime(Element el,
String attributeName,
DateTime defaultValue)
reads a XML Element Attribute ans cast it to a DateTime |
int |
toInt(Element el,
String attributeName)
reads a XML Element Attribute ans cast it to a int value |
int |
toInt(Element el,
String attributeName,
int defaultValue)
reads a XML Element Attribute ans cast it to a int value |
long |
toLong(Element el,
String attributeName)
|
Resource |
toResource(Config config,
Element el,
String attributeName)
reads a XML Element Attribute ans cast it to a File |
String |
toString(Element el,
String attributeName)
reads a XML Element Attribute ans cast it to a String |
String |
toString(Element el,
String attributeName,
String defaultValue)
reads a XML Element Attribute ans cast it to a String |
Time |
toTime(Config config,
Element el,
String attributeName)
reads a XML Element Attribute ans cast it to a Time Object |
Time |
toTime(Element el,
String attributeName,
Time defaultValue)
reads a XML Element Attribute ans cast it to a Date |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StorageUtil()
Method Detail |
---|
public void loadFile(File file, String resourcePath) throws IOException
file
- resourcePath
-
IOException
public void loadFile(Resource res, String resourcePath) throws IOException
res
- resourcePath
-
IOException
public Document loadDocument(Resource file) throws SAXException, IOException
file
- XML File to load
SAXException
IOException
public Document loadDocument(String content) throws SAXException, IOException
SAXException
IOException
public Element getElement(NodeList list, String key, String value)
list
- source node listkey
- key to comparevalue
- value to compare
public void store(Document doc, File file) throws IOException
doc
- file
-
IOException
public void store(Document doc, Resource res) throws IOException
doc
- res
-
IOException
public String toString(Element el, String attributeName)
el
- XML Element to read Attribute from itattributeName
- Name of the Attribute to read
public String toString(Element el, String attributeName, String defaultValue)
el
- XML Element to read Attribute from itattributeName
- Name of the Attribute to readdefaultValue
- if attribute doesn't exist return default value
public Resource toResource(Config config, Element el, String attributeName)
el
- XML Element to read Attribute from itattributeName
- Name of the Attribute to read
public boolean toBoolean(Element el, String attributeName)
el
- XML Element to read Attribute from itattributeName
- Name of the Attribute to read
public boolean toBoolean(Element el, String attributeName, boolean defaultValue)
el
- XML Element to read Attribute from itattributeName
- Name of the Attribute to readdefaultValue
- if attribute doesn't exist return default value
public int toInt(Element el, String attributeName)
el
- XML Element to read Attribute from itattributeName
- Name of the Attribute to read
public long toLong(Element el, String attributeName)
public int toInt(Element el, String attributeName, int defaultValue)
el
- XML Element to read Attribute from itattributeName
- Name of the Attribute to readdefaultValue
- if attribute doesn't exist return default value
public DateTime toDateTime(Config config, Element el, String attributeName)
config
- el
- XML Element to read Attribute from itattributeName
- Name of the Attribute to read
public DateTime toDateTime(Element el, String attributeName, DateTime defaultValue)
el
- XML Element to read Attribute from itattributeName
- Name of the Attribute to readdefaultValue
- if attribute doesn't exist return default value
public Date toDate(Config config, Element el, String attributeName)
el
- XML Element to read Attribute from itattributeName
- Name of the Attribute to read
public Date toDate(Element el, String attributeName, Date defaultValue)
el
- XML Element to read Attribute from itattributeName
- Name of the Attribute to readdefaultValue
- if attribute doesn't exist return default value
public Time toTime(Config config, Element el, String attributeName)
config
- el
- XML Element to read Attribute from itattributeName
- Name of the Attribute to read
public Time toTime(Element el, String attributeName, Time defaultValue)
el
- XML Element to read Attribute from itattributeName
- Name of the Attribute to readdefaultValue
- if attribute doesn't exist return default value
public Credentials toCredentials(Element el, String attributeUser, String attributePassword)
el
- XML Element to read Attribute from itattributeUser
- Name of the user Attribute to readattributePassword
- Name of the password Attribute to read
public Credentials toCredentials(Element el, String attributeUser, String attributePassword, Credentials defaultCredentials)
el
- XML Element to read Attribute from itattributeUser
- Name of the user Attribute to readattributePassword
- Name of the password Attribute to readdefaultCredentials
-
public void setString(Element el, String key, String value)
el
- Element to set value on itkey
- key to setvalue
- value to setpublic void setFile(Element el, String key, File value)
el
- Element to set value on itkey
- key to setvalue
- value to setpublic void setFile(Element el, String key, Resource value)
el
- Element to set value on itkey
- key to setvalue
- value to setpublic void setBoolean(Element el, String key, boolean value)
el
- Element to set value on itkey
- key to setvalue
- value to setpublic void setInt(Element el, String key, int value)
el
- Element to set value on itkey
- key to setvalue
- value to setpublic void setDateTime(Element el, String key, DateTime value)
el
- Element to set value on itkey
- key to setvalue
- value to setpublic void setCredentials(Element el, String username, String password, Credentials c)
el
- username
- password
- credentials
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |