-
Couldn't load subscription status.
- Fork 0
Class JSX
JSX is the principal class to manage the XML file.
This is a simple construct.
Example:
JSX jsx = new JSX();
throws JSXLockException
This construct set the file path of XML document to be load.
Parameters:
- filePath, path to XML file
Exceptions:
- JSXLockException, exception raised if JSX-Lock failed
Example:
JSX jsx = new JSX("path/to/file.xml");
This construct set the XML document to work on.
Parameters:
-
document, XML document. Class
org.w3c.dom.Document
Example:
Document doc = JSX.createDocument("path/to/file.xml"); JSX jsx = new JSX(doc);
throws XMLException
This method write a log.
Return:
Return an object org.w3c.dom.Document that rapresents the XML file.
Parameters:
- pathFile, path to XML file
Exceptions:
- XMLException, exception raised the document creation return a error.
Example:
Document doc = Jogger.createDocument("path/to/file.xml");
Document createDocument(String pathFile, boolean validating, boolean namespaceAware, boolean featValidation, boolean featNamespaces, boolean featLoadDTDGramm, boolean featLoadExtDTD)
throws XMLException
This method write a log.
Return:
Return an object org.w3c.dom.Document that rapresents the XML file.
Parameters:
- pathFile, path to XML file
- validating, activate validating
- namespaceAware, activate namespace aware
- featValidation, activate feature validation
- featNamespaces, activate feature namespaces
- featLoadDTDGramm, activate feature load DTD gramm
- featLoadExtDTD, activate feature load ext DTD
Exceptions:
- XMLException, exception raised the document creation return a error.
Example:
Document doc = Jogger.createDocument("path/to/file.xml", false, false, false, false, false, false);
throws XMLException
This method get the great Integer id.
Return:
Return the great Integer id
Parameters:
- idSet, set of id
Example:
JSX jsx = new JSX("path/to/file.xml"); HashMap<String, Node> mapElement = jsx.getMapIdElement("my-element"); Set<String> idSet = mapElement.keySet(); int greatId = Jogger.getGreatId(idSet);
throws JSXException
This method remove the blank lines on XML document.
Parameters:
-
document, XML document. Class
org.w3c.dom.Document
Exceptions:
- JSXException, exception raised if the operation return a error.
Example:
Document doc = Jogger.createDocument("path/to/file.xml"); Jogger.removeBlankLines(doc);
This method get the prefix for log file name.
Default "log_"
Return:
Return the prefix for log file name.
Example:
Jogger jogger = new Jogger(); String string = jogger.getPrefixLogFile();
This method set the prefix for log file name.
Parameters:
- prefixLogFile, prefix for log file name
Example:
Jogger jogger = new Jogger(); jogger.setPrefixLogFile("mylog_");
This method get the log name.
Default "jogger"
Return:
Return the log name.
Example:
Jogger jogger = new Jogger(); String string = jogger.getLogName();
This method set the log name.
Parameters:
- logName, log name
Example:
Jogger jogger = new Jogger(); jogger.setLogName("myapp");
Default ".log"
This method get the log file type.
Return:
Return the log file type.
Example:
Jogger jogger = new Jogger(); String string = jogger.getFileType();
This method set the log file type.
Parameters:
- fileType, log file type
Example:
Jogger jogger = new Jogger(); jogger.setFileType(".log");
This method get the maximum size for log file.
Default 51200
Return:
Return the maximum size, in bytes, for log file.
Example:
Jogger jogger = new Jogger(); int maxSize = jogger.getMaxSizeBytes();
This method set the maximum size for log file.
Parameters:
- maxSizeBytes, maximum size, in bytes, for log file
Example:
Jogger jogger = new Jogger(); jogger.setMaxSizeBytes(1024000);
This method check if the Jogger-Lock is active.
Read Jogger-Lock.
Default false
Return:
Return true if Jogger-Lock is active, false otherwise.
Example:
Jogger jogger = new Jogger(); jogger.setLock(true); if (jogger.isLock()) { //your code }
This method can enable or disable Jogger-Lock. Read Jogger-Lock.
Parameters:
- lock, true for active it, false otherwise
Example:
Jogger jogger = new Jogger(); jogger.setLock(true);
This method get the split path of log directory.
Default {"jogger"}
Return:
Return the split path of log directory.
Example:
Jogger jogger = new Jogger(); String[] splitPath = jogger.getSplitLogDir();
This method get the split path of log directory.
Parameters:
- splitLogDir, split path to log directory
Example:
Jogger jogger = new Jogger(); jogger.setSplitLogDir("my", "log", "dir");
throws LockLogException
This method write the string passed, on the log.
Implement Jogger-Lock. For more info Jogger-Lock.
Parameters:
- write, string to be writer on log file
Exceptions:
- LockLogException, exception raised if Jogger-Lock failed
Example:
Jogger jogger = new Jogger(); jogger.writeLog("YEEEEEAAAAHH!!!");
throws LogFileException
This method get the path of log file to work on.
Return:
Return the string with the path of log file to work on.
Exceptions:
- LogFileException, exception raised if an error is return while working on the log file
Example:
Jogger jogger = new Jogger(); String logFilePath = jogger.getLogFilePath();
throws LogFileException
This method get the log file to work on.
Return:
Return the log file to work on.
Exceptions:
- LogFileException, exception raised if an error is return while working on the log file
Example:
Jogger jogger = new Jogger(); File logFile = jogger.getFile();
throws LogFileException
This method get the log file to work on, only if it exists.
Return:
If the log file exists return it, otherwise return null.
Exceptions:
- LogFileException, exception raised if an error is return while working on the log file
Example:
Jogger jogger = new Jogger(); File logFile = jogger.getFileIfExists();
throws LockLogException
This method is used to implement Jogger-Lock.
It check if Jogger-Lock is enable,
then in this case try to lock the file using the class java.util.concurrent.locks.ReentrantLock.
For more info Jogger-Lock.
Return:
Return true if Jogger-Lock is disable or the lock is successful, false otherwise.
Exceptions:
- LockLogException, exception raised if the timeout for the lock expires
This method is used to implement Jogger-Lock.
It check if Jogger-Lock is enable,
then in this case unlock the file using the class java.util.concurrent.locks.ReentrantLock.
For more info Jogger-Lock.