|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectUtil
public class Util
Contains tools useful for XML-based configuration file handling as well as file zipping.
Field Summary | |
---|---|
private static org.slf4j.Logger |
_log
|
private static HashMap<String,org.quartz.JobDataMap> |
config
|
private static String |
config_src
|
private static int |
writers
|
Constructor Summary | |
---|---|
Util()
Constructor. |
Method Summary | |
---|---|
static Integer |
getInteger(Object object)
Parses an Object to an Integer . |
static String |
getString(Object object)
Parses an Object to a String . |
static org.quartz.JobDataMap |
loadDataMap(org.quartz.JobExecutionContext context)
Loads configurations for local component elements stored in a JobDataMap ,
which is available during runtime of the component. |
static Object |
parseXMLelement(String element1,
String element2)
Parses an XML-based configuration file and looks for the value of a (sub)element. |
private static Object |
parseXMLelement(String element1,
String element2,
boolean list)
Parses an XML-based configuration file and looks for one or more values of a (sub)element. |
static Object |
parseXMLelements(String element1,
String element2)
Parses an XML-based configuration file and looks for multiple values of a (sub)element. |
static Object |
parseXMLid(String id,
String element1,
String element2)
Parses an XML-based configuration file and looks for the value of a (sub)element with a specific ID. |
private static Object |
parseXMLid(String id,
String element1,
String element2,
boolean list)
Parses an XML-based configuration file and looks for one or more values of a (sub)element with a specific ID. |
static Object |
parseXMLids(String id,
String element1,
String element2)
Parses an XML-based configuration file and looks for multiple values of a (sub)element with a specific ID. |
static TreeMap<Object,Object> |
parseXMLparameter(String element1,
String parameter1,
String parameter2)
Parses an XML-based configuration file and looks for the values of the parameters of an element. |
static void |
setConfig(String src)
Sets location of the configuration file to be used. |
static void |
storeDataMap(org.quartz.JobExecutionContext context,
org.quartz.JobDataMap dataMap)
Stores configurations for local component elements in a JobDataMap , which
is available during runtime of the component. |
static void |
zipFile(String name,
String path,
String file,
String ext,
int buffer)
Zips a file of a given name and extension in a given folder. |
static void |
zipFiles(String name,
String path,
String file,
String ext,
int buffer,
int max_files)
Zips files of a given extension in a given folder to a single file with a given name. |
private static void |
zipLock()
Locks the zipping process in order to prevent asynchronous writing. |
private static void |
zipUnlock()
Releases the lock on the zipping process that is used in order to prevent asynchronous writing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static HashMap<String,org.quartz.JobDataMap> config
private static int writers
private static String config_src
private static org.slf4j.Logger _log
Constructor Detail |
---|
public Util()
Method Detail |
---|
public static void setConfig(String src)
src
- Path and file name of configuration file to be used.public static org.quartz.JobDataMap loadDataMap(org.quartz.JobExecutionContext context)
JobDataMap
,
which is available during runtime of the component.
context
- Execution context of the component.
JobDataMap
representing component configuration.public static void storeDataMap(org.quartz.JobExecutionContext context, org.quartz.JobDataMap dataMap)
JobDataMap
, which
is available during runtime of the component.
context
- Execution context of the component.dataMap
- Component configuration.public static Integer getInteger(Object object)
Object
to an Integer
.
object
- Object
to be parsed.
Integer
value representing the Object
to be parsed.public static String getString(Object object)
Object
to a String
.
object
- Object
to be parsed.
String
value representing the Object
to be parsed.private static Object parseXMLelement(String element1, String element2, boolean list)
element1
- Main element to be parsed.element2
- Sub-element to be parsed.list
- Boolean
value indicating whether one (false
) or multiple (
true
) values are desired
Object
representing the value(s) of the (sub)element to be parsed. Depending
on the value of list
this is either an Object
or an ArrayList
of Object
instances.public static Object parseXMLelement(String element1, String element2)
element1
- Main element to be parsed.element2
- Sub-element to be parsed.
Object
representing the value of the (sub)element to be parsed.public static Object parseXMLelements(String element1, String element2)
element1
- Main element to be parsed.element2
- Sub-element to be parsed.
Object
representing the values of the (sub)element to be parsed.private static Object parseXMLid(String id, String element1, String element2, boolean list)
id
- Unique id of the (sub)element to be parsed.element1
- Main element to be parsed.element2
- Sub-element to be parsed.list
- Boolean
value indicating whether one (false
) or multiple (
true
) values are desired
Object
representing the value(s) of the (sub)element to be parsed. Depending
on the value of list
this is either an Object
or an ArrayList
of Object
instances.public static Object parseXMLid(String id, String element1, String element2)
id
- Unique id of the (sub)element to be parsed.element1
- Main element to be parsed.element2
- Sub-element to be parsed.
Object
representing the value of the (sub)element to be parsed.public static Object parseXMLids(String id, String element1, String element2)
id
- Unique id of the (sub)element to be parsed.element1
- Main element to be parsed.element2
- Sub-element to be parsed.
Object
representing the values of the (sub)element to be parsed.public static TreeMap<Object,Object> parseXMLparameter(String element1, String parameter1, String parameter2)
element1
- Main element to be parsed.parameter1
- First parameter to be parsed.parameter2
- Second parameter to be parsed.
TreeMap
of Object
instances representing the values of the parameters
of the element to be parsed.public static void zipFile(String name, String path, String file, String ext, int buffer)
name
- Name of the storage initiating zip action.path
- Path of the file to be zipped.file
- Name of the file to be zipped.ext
- Extension of the file to be zipped.buffer
- Buffer used when zipping.public static void zipFiles(String name, String path, String file, String ext, int buffer, int max_files)
name
- Name of the storage initiating zip action.path
- Path of the files to be zipped.file
- Name of the resulting zip file.ext
- Extension of the files to be zipped.buffer
- Buffer used when zipping.max_files
- Maximum number of files to be added to the zip file.private static void zipLock() throws InterruptedException
InterruptedException
- An exception that indicates the waiting process has been
interrupted.private static void zipUnlock()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |