

Classes | |
| class | Filter |
Public Member Functions | |
| void | loadFactory () |
| void | recoverClients () |
| String | getRecordPath (String curl) |
| void | parseNode (DALNode node, XMLHandler xmlSolver, String path) throws SAXException, IOException, AcsJCDBXMLErrorEx |
| XMLHandler | loadRecords (String curl, boolean toString) throws AcsJCDBRecordDoesNotExistEx, AcsJCDBXMLErrorEx |
| boolean | wasCacheLimitReached () |
| String | get_DAO (String curl) throws CDBRecordDoesNotExistEx, CDBXMLErrorEx |
| synchronized String | internal_get_DAO (String curl, boolean precacheStage) throws CDBRecordDoesNotExistEx, CDBXMLErrorEx |
| synchronized DAO | get_DAO_Servant (String curl) throws CDBRecordDoesNotExistEx, CDBXMLErrorEx |
| void | shutdown () |
| void | shutdownEmbeddedDALImpl () |
| void | loadListeners () |
| boolean | saveListeners () |
| int | add_change_listener (DALChangeListener listener) |
| void | listen_for_changes (String curl, int listenerID) |
| void | remove_change_listener (int listenerID) |
| void | clear_cache (String curl) |
| void | clear_cache_all () |
| String | list_nodes (String name) |
| String | list_daos (String name) |
| String | configuration_name () |
| SAXParser | getSaxParser () |
| boolean | isShutdown () |
Static Public Member Functions | |
| static String | getSchemas (String root, Logger logger) |
| static void | getFiles (String filePath, LinkedHashMap< String, String > map) |
Public Attributes | |
| final boolean | useXsdCache |
Static Public Attributes | |
| static final String | SCHEMA_VALIDATION_FEATURE_ID |
| static final String | EXTERNAL_SCHEMA_LOCATION_PROPERTY_ID |
| static final String | USE_XSD_CACHE_PROPERTYNAME = "cdb.useXsdCache" |
Protected Member Functions | |
| void | object_changed (String curl) |
| File | getStorageFile () |
| void | cleanListenedCurls () |
Protected Attributes | |
| final AtomicLong | totalDALInvocationCounter |
Package Functions | |
| DALImpl (String args[], ORB orb_val, POA poa_val, Logger logger) | |
Private Member Functions | |
| String | getSchemas () |
| XMLHandler | loadRecord (String curl, boolean toString) throws AcsJCDBRecordDoesNotExistEx, AcsJCDBXMLErrorEx |
| void | checkCache () |
| boolean | checkCache (boolean tryOnly) |
| void | clearCache () |
| String | getFromCache (String curl) throws CDBRecordDoesNotExistEx, CDBXMLErrorEx |
| void | putToCache (String curl, Object xml) |
| void | logRecordNotExistWithRepeatGuard (String curl) |
Static Private Member Functions | |
| static String | removeXMLs (String list) |
Private Attributes | |
| ORB | orb |
| POA | poa |
| SAXParserFactory | factory |
| SAXParser | saxParser |
| String | m_root |
| HashMap< String, DAO > | daoMap = new HashMap<String, DAO>() |
| HashMap< String, ArrayList < Integer > > | listenedCurls = new HashMap<String, ArrayList<Integer>>() |
| File | listenersStorageFile = null |
| Random | idPool = new Random() |
| HashMap< Integer, DALChangeListener > | regListeners = new HashMap<Integer, DALChangeListener>() |
| boolean | recoveryRead = true |
| DALNode | rootNode = null |
| final Logger | m_logger |
| volatile boolean | shutdown = false |
| Object | shutdownLock = new Object() |
| final MultipleRepeatGuard | recordNotExistLogRepeatGuard |
| final int | recordNotExistLogRepeatGuardTimeSeconds |
| LinkedHashMap< String, Object > | cache = new LinkedHashMap<String, Object>() |
| volatile boolean | cacheLimitReached = false |
A note about the inheritance structure used in this module: The writable variant of the DAL interface delegates to an instance of DALImpl for all JDALOperations, see WDALBaseImpl. It only adds the implementation of the WDALOperations methods.
| com::cosylab::cdb::jdal::DALImpl::DALImpl | ( | String | args[], | |
| ORB | orb_val, | |||
| POA | poa_val, | |||
| Logger | logger | |||
| ) | [inline, package] |
C'tor
| args | ||
| orb_val | ||
| poa_val |
| IllegalArgumentException | if the computed CDB root directory does not exist. |
References checkCache(), loadFactory(), m_logger, m_root, orb, poa, recordNotExistLogRepeatGuard, recordNotExistLogRepeatGuardTimeSeconds, recoveryRead, shutdown(), shutdownLock, totalDALInvocationCounter, USE_XSD_CACHE_PROPERTYNAME, and useXsdCache.
| int com::cosylab::cdb::jdal::DALImpl::add_change_listener | ( | DALChangeListener | listener | ) | [inline] |
References idPool, listenedCurls, regListeners, and totalDALInvocationCounter.
Referenced by com::cosylab::cdb::jdal::WDALBaseImpl::add_change_listener().
| boolean com::cosylab::cdb::jdal::DALImpl::checkCache | ( | boolean | tryOnly | ) | [inline, private] |
References cache, cacheLimitReached, and m_logger.
| void com::cosylab::cdb::jdal::DALImpl::checkCache | ( | ) | [inline, private] |
Referenced by DALImpl(), internal_get_DAO(), and putToCache().
| void com::cosylab::cdb::jdal::DALImpl::cleanListenedCurls | ( | ) | [inline, protected] |
Cleans listened curls from invalid listeners to avoid repeatedly calling invalid listeners
References listenedCurls, and regListeners.
Referenced by clear_cache().
| void com::cosylab::cdb::jdal::DALImpl::clear_cache | ( | String | curl | ) | [inline] |
| void com::cosylab::cdb::jdal::DALImpl::clear_cache_all | ( | ) | [inline] |
Implements com::cosylab::CDB::JDALOperations.
References clear_cache(), clearCache(), com::cosylab::cdb::jdal::DALNode::getRoot(), listenedCurls, loadFactory(), m_root, rootNode, and totalDALInvocationCounter.
Referenced by com::cosylab::cdb::jdal::WDALBaseImpl::clear_cache_all(), and recoverClients().
| void com::cosylab::cdb::jdal::DALImpl::clearCache | ( | ) | [inline, private] |
References cache.
Referenced by clear_cache_all().
| String com::cosylab::cdb::jdal::DALImpl::configuration_name | ( | ) | [inline] |
Implements com::cosylab::CDB::DALOperations.
References totalDALInvocationCounter.
Referenced by com::cosylab::cdb::jdal::WDALBaseImpl::configuration_name().
| String com::cosylab::cdb::jdal::DALImpl::get_DAO | ( | String | curl | ) | throws CDBRecordDoesNotExistEx, CDBXMLErrorEx [inline] |
returns full expanded XML string
References internal_get_DAO().
Referenced by com::cosylab::cdb::jdal::WDALBaseImpl::get_DAO(), and com::cosylab::cdb::jdal::WDALImpl::set_DAO().
| synchronized DAO com::cosylab::cdb::jdal::DALImpl::get_DAO_Servant | ( | String | curl | ) | throws CDBRecordDoesNotExistEx, CDBXMLErrorEx [inline] |
create DAO servant with requested XML
References daoMap, loadRecords(), logRecordNotExistWithRepeatGuard(), m_logger, com::cosylab::cdb::jdal::XMLHandler::m_rootNode, poa, alma::cdbErrType::wrappers::AcsJCDBXMLErrorEx::setErrorString(), alma::cdbErrType::wrappers::AcsJCDBRecordDoesNotExistEx::toCDBRecordDoesNotExistEx(), alma::cdbErrType::wrappers::AcsJCDBXMLErrorEx::toCDBXMLErrorEx(), and totalDALInvocationCounter.
Referenced by com::cosylab::cdb::jdal::WDALBaseImpl::get_DAO_Servant(), and com::cosylab::cdb::jdal::WDALImpl::get_WDAO_Servant().
| static void com::cosylab::cdb::jdal::DALImpl::getFiles | ( | String | filePath, | |
| LinkedHashMap< String, String > | map | |||
| ) | [inline, static] |
Adds all *.xsd files from filePath directory if file already exists in map it is skipped
Referenced by getSchemas().
| String com::cosylab::cdb::jdal::DALImpl::getFromCache | ( | String | curl | ) | throws CDBRecordDoesNotExistEx, CDBXMLErrorEx [inline, private] |
References cache, and m_logger.
Referenced by internal_get_DAO().
| String com::cosylab::cdb::jdal::DALImpl::getRecordPath | ( | String | curl | ) | [inline] |
References m_root.
Referenced by com::cosylab::cdb::jdal::WDALImpl::getNodeFile(), loadRecord(), and parseNode().
| SAXParser com::cosylab::cdb::jdal::DALImpl::getSaxParser | ( | ) | [inline] |
| static String com::cosylab::cdb::jdal::DALImpl::getSchemas | ( | String | root, | |
| Logger | logger | |||
| ) | [inline, static] |
returns string of URIs separated by ' ' for all schema files in root/schemas and directories list given by ACS.cdbpath environment variable
This method is public static to be used more easily in the HibernateDAL (com.cosylab.cdb.jdal.XSDElementTypeResolver::initializeParser())
References getFiles().
| String com::cosylab::cdb::jdal::DALImpl::getSchemas | ( | ) | [inline, private] |
References m_logger, and m_root.
Referenced by loadFactory().
| File com::cosylab::cdb::jdal::DALImpl::getStorageFile | ( | ) | [inline, protected] |
: For the TMCDB XML import it does not make sense to create a recovery file. Shouldn't we support a mode that skips this?
References listenersStorageFile, and m_logger.
Referenced by loadListeners(), and saveListeners().
| synchronized String com::cosylab::cdb::jdal::DALImpl::internal_get_DAO | ( | String | curl, | |
| boolean | precacheStage | |||
| ) | throws CDBRecordDoesNotExistEx, CDBXMLErrorEx [inline] |
returns full expanded XML string
References checkCache(), getFromCache(), loadRecords(), logRecordNotExistWithRepeatGuard(), m_logger, putToCache(), shutdown(), alma::cdbErrType::wrappers::AcsJCDBRecordDoesNotExistEx::toCDBRecordDoesNotExistEx(), alma::cdbErrType::wrappers::AcsJCDBXMLErrorEx::toCDBXMLErrorEx(), com::cosylab::cdb::jdal::XMLHandler::toString(), and totalDALInvocationCounter.
Referenced by get_DAO().
| boolean com::cosylab::cdb::jdal::DALImpl::isShutdown | ( | ) | [inline] |
References shutdown().
| String com::cosylab::cdb::jdal::DALImpl::list_daos | ( | String | name | ) | [inline] |
References com::cosylab::cdb::jdal::XMLTreeNode::getNodesMap(), com::cosylab::cdb::jdal::DALNode::getRoot(), com::cosylab::cdb::jdal::DALNode::list(), loadRecord(), m_root, com::cosylab::cdb::jdal::XMLHandler::m_rootNode, removeXMLs(), rootNode, and totalDALInvocationCounter.
Referenced by com::cosylab::cdb::jdal::WDALBaseImpl::list_daos().
| String com::cosylab::cdb::jdal::DALImpl::list_nodes | ( | String | name | ) | [inline] |
| void com::cosylab::cdb::jdal::DALImpl::listen_for_changes | ( | String | curl, | |
| int | listenerID | |||
| ) | [inline] |
References listenedCurls, saveListeners(), and totalDALInvocationCounter.
Referenced by com::cosylab::cdb::jdal::WDALBaseImpl::listen_for_changes().
| void com::cosylab::cdb::jdal::DALImpl::loadFactory | ( | ) | [inline] |
References EXTERNAL_SCHEMA_LOCATION_PROPERTY_ID, factory, getSchemas(), m_logger, saxParser, SCHEMA_VALIDATION_FEATURE_ID, and useXsdCache.
Referenced by clear_cache_all(), and DALImpl().
| void com::cosylab::cdb::jdal::DALImpl::loadListeners | ( | ) | [inline] |
References getStorageFile(), listenedCurls, orb, and regListeners.
Referenced by recoverClients().
| XMLHandler com::cosylab::cdb::jdal::DALImpl::loadRecord | ( | String | curl, | |
| boolean | toString | |||
| ) | throws AcsJCDBRecordDoesNotExistEx, AcsJCDBXMLErrorEx [inline, private] |
References getRecordPath(), com::cosylab::cdb::jdal::XMLHandler::m_errorString, m_logger, saxParser, alma::cdbErrType::wrappers::AcsJCDBXMLErrorEx::setCurl(), alma::cdbErrType::wrappers::AcsJCDBRecordDoesNotExistEx::setCurl(), alma::cdbErrType::wrappers::AcsJCDBXMLErrorEx::setErrorString(), alma::cdbErrType::wrappers::AcsJCDBXMLErrorEx::setFilename(), and com::cosylab::cdb::jdal::XMLHandler::setMarkArrays().
Referenced by list_daos(), and loadRecords().
| XMLHandler com::cosylab::cdb::jdal::DALImpl::loadRecords | ( | String | curl, | |
| boolean | toString | |||
| ) | throws AcsJCDBRecordDoesNotExistEx, AcsJCDBXMLErrorEx [inline] |
Returns a xml constructed of all records below given curl
| curl | ||
| toString |
| AcsJCDBRecordDoesNotExistEx | ||
| AcsJCDBXMLErrorEx |
References com::cosylab::cdb::jdal::DALNode::findNode(), com::cosylab::cdb::jdal::XMLHandler::getChild(), alma::cdbErrType::wrappers::AcsJCDBRecordDoesNotExistEx::getCurl(), alma::acs::util::StopWatch::getLapTimeMillis(), com::cosylab::cdb::jdal::DALNode::getRoot(), com::cosylab::cdb::jdal::DALNode::hasXmlChild(), com::cosylab::cdb::jdal::DALNode::isSimple(), loadRecord(), m_logger, m_root, com::cosylab::cdb::jdal::DALNode::name, parseNode(), rootNode, com::cosylab::cdb::jdal::XMLHandler::setAutoCloseStartingElement(), alma::cdbErrType::wrappers::AcsJCDBXMLErrorEx::setCurl(), alma::cdbErrType::wrappers::AcsJCDBRecordDoesNotExistEx::setCurl(), alma::cdbErrType::wrappers::AcsJCDBXMLErrorEx::setErrorString(), alma::cdbErrType::wrappers::AcsJCDBXMLErrorEx::setFilename(), and com::cosylab::cdb::jdal::XMLHandler::setMarkArrays().
Referenced by get_DAO_Servant(), and internal_get_DAO().
| void com::cosylab::cdb::jdal::DALImpl::logRecordNotExistWithRepeatGuard | ( | String | curl | ) | [inline, private] |
Uses a repeat guard (recordNotExistLogRepeatGuard) to limit the occasionally excessive logs about a requested node not existing. The limiting is time based, so that the first log is logged, while all other logs from intervals of recordNotExistLogRepeatGuardTimeSeconds seconds are logged as a single record.
| curl | The requested node that does not exist. |
References alma::acs::logging::MultipleRepeatGuard::checkAndIncrement(), alma::acs::logging::MultipleRepeatGuard::counterAtLastExecution(), m_logger, and recordNotExistLogRepeatGuard.
Referenced by get_DAO_Servant(), and internal_get_DAO().
| void com::cosylab::cdb::jdal::DALImpl::object_changed | ( | String | curl | ) | [inline, protected] |
| curl |
References daoMap, and com::cosylab::CDB::DAOOperations::destroy().
Referenced by clear_cache().
| void com::cosylab::cdb::jdal::DALImpl::parseNode | ( | DALNode | node, | |
| XMLHandler | xmlSolver, | |||
| String | path | |||
| ) | throws SAXException, IOException, AcsJCDBXMLErrorEx [inline] |
References getRecordPath(), m_logger, com::cosylab::cdb::jdal::DALNode::name, saxParser, alma::cdbErrType::wrappers::AcsJCDBXMLErrorEx::setCurl(), alma::cdbErrType::wrappers::AcsJCDBXMLErrorEx::setErrorString(), alma::cdbErrType::wrappers::AcsJCDBXMLErrorEx::setFilename(), and alma::cdbErrType::wrappers::AcsJCDBXMLErrorEx::setNodename().
Referenced by loadRecords().
| void com::cosylab::cdb::jdal::DALImpl::putToCache | ( | String | curl, | |
| Object | xml | |||
| ) | [inline, private] |
References cache, checkCache(), and m_logger.
Referenced by internal_get_DAO().
| void com::cosylab::cdb::jdal::DALImpl::recoverClients | ( | ) | [inline] |
Recovery related implementation. Load list of listeners from the recovery file and notifies them to clear cache. NOTICE: This method should be called when DAL POA is alrady initialized and active. NOTE: Method execution depends on recoveryRead variable.
Implements com::cosylab::cdb::jdal::Recoverer.
References clear_cache_all(), loadListeners(), and recoveryRead.
Referenced by com::cosylab::cdb::jdal::WDALBaseImpl::recoverClients().
| void com::cosylab::cdb::jdal::DALImpl::remove_change_listener | ( | int | listenerID | ) | [inline] |
Implements com::cosylab::CDB::DALOperations.
References listenedCurls, regListeners, saveListeners(), and totalDALInvocationCounter.
Referenced by com::cosylab::cdb::jdal::WDALBaseImpl::remove_change_listener().
| static String com::cosylab::cdb::jdal::DALImpl::removeXMLs | ( | String | list | ) | [inline, static, private] |
Referenced by list_daos(), and list_nodes().
| boolean com::cosylab::cdb::jdal::DALImpl::saveListeners | ( | ) | [inline] |
References getStorageFile(), listenedCurls, orb, and regListeners.
Referenced by clear_cache(), listen_for_changes(), and remove_change_listener().
| void com::cosylab::cdb::jdal::DALImpl::shutdown | ( | ) | [inline] |
Implements com::cosylab::CDB::DALOperations.
References orb, shutdownEmbeddedDALImpl(), and totalDALInvocationCounter.
Referenced by DALImpl(), internal_get_DAO(), isShutdown(), and shutdownEmbeddedDALImpl().
| void com::cosylab::cdb::jdal::DALImpl::shutdownEmbeddedDALImpl | ( | ) | [inline] |
References shutdown(), and shutdownLock.
Referenced by shutdown(), and com::cosylab::cdb::jdal::WDALBaseImpl::shutdownEmbeddedWDALImpl().
| boolean com::cosylab::cdb::jdal::DALImpl::wasCacheLimitReached | ( | ) | [inline] |
References cacheLimitReached.
Referenced by com::cosylab::cdb::jdal::Server::preloadCache().
LinkedHashMap<String, Object> com::cosylab::cdb::jdal::DALImpl::cache = new LinkedHashMap<String, Object>() [private] |
Referenced by checkCache(), clearCache(), getFromCache(), and putToCache().
volatile boolean com::cosylab::cdb::jdal::DALImpl::cacheLimitReached = false [private] |
Referenced by checkCache(), and wasCacheLimitReached().
HashMap<String, DAO> com::cosylab::cdb::jdal::DALImpl::daoMap = new HashMap<String, DAO>() [private] |
Referenced by get_DAO_Servant(), and object_changed().
final String com::cosylab::cdb::jdal::DALImpl::EXTERNAL_SCHEMA_LOCATION_PROPERTY_ID [static] |
"http://apache.org/xml/properties/schema/external-schemaLocation"
Property for setting the mapping of URIs to XML schemas. See http://xerces.apache.org/xerces2-j/properties.html
Referenced by loadFactory().
SAXParserFactory com::cosylab::cdb::jdal::DALImpl::factory [private] |
Referenced by loadFactory().
Random com::cosylab::cdb::jdal::DALImpl::idPool = new Random() [private] |
Referenced by add_change_listener().
HashMap<String, ArrayList<Integer> > com::cosylab::cdb::jdal::DALImpl::listenedCurls = new HashMap<String, ArrayList<Integer>>() [private] |
File com::cosylab::cdb::jdal::DALImpl::listenersStorageFile = null [private] |
Referenced by getStorageFile().
final Logger com::cosylab::cdb::jdal::DALImpl::m_logger [private] |
String com::cosylab::cdb::jdal::DALImpl::m_root [private] |
Referenced by clear_cache_all(), DALImpl(), getRecordPath(), getSchemas(), list_daos(), list_nodes(), and loadRecords().
ORB com::cosylab::cdb::jdal::DALImpl::orb [private] |
Referenced by DALImpl(), loadListeners(), saveListeners(), and shutdown().
POA com::cosylab::cdb::jdal::DALImpl::poa [private] |
Referenced by DALImpl(), and get_DAO_Servant().
repeat guard for "Curl 'xyz' does not exist" messages.
Referenced by DALImpl(), and logRecordNotExistWithRepeatGuard().
final int com::cosylab::cdb::jdal::DALImpl::recordNotExistLogRepeatGuardTimeSeconds [private] |
The time in seconds for which recordNotExistLogRepeatGuard will collect identical log records to log them together upon a subsequent log request.
Note that the repeat guard will not actively flush out the "aggregate" log message, but will wait for the next log request, possibly coming much later than the number of seconds given here.
Referenced by DALImpl().
boolean com::cosylab::cdb::jdal::DALImpl::recoveryRead = true [private] |
Referenced by DALImpl(), and recoverClients().
HashMap<Integer, DALChangeListener> com::cosylab::cdb::jdal::DALImpl::regListeners = new HashMap<Integer, DALChangeListener>() [private] |
Referenced by add_change_listener(), cleanListenedCurls(), clear_cache(), loadListeners(), remove_change_listener(), and saveListeners().
DALNode com::cosylab::cdb::jdal::DALImpl::rootNode = null [private] |
Referenced by clear_cache_all(), list_daos(), list_nodes(), and loadRecords().
SAXParser com::cosylab::cdb::jdal::DALImpl::saxParser [private] |
Referenced by getSaxParser(), loadFactory(), loadRecord(), and parseNode().
final String com::cosylab::cdb::jdal::DALImpl::SCHEMA_VALIDATION_FEATURE_ID [static] |
"http://apache.org/xml/features/validation/schema"
Schema validation feature id (http://apache.org/xml/features/validation/schema). See http://xerces.apache.org/xerces2-j/features.html
Referenced by loadFactory().
volatile boolean com::cosylab::cdb::jdal::DALImpl::shutdown = false [private] |
Referenced by com::cosylab::cdb::jdal::WDALBaseImpl::shutdown().
Object com::cosylab::cdb::jdal::DALImpl::shutdownLock = new Object() [private] |
Referenced by DALImpl(), and shutdownEmbeddedDALImpl().
final AtomicLong com::cosylab::cdb::jdal::DALImpl::totalDALInvocationCounter [protected] |
Referenced by add_change_listener(), com::cosylab::cdb::jdal::WDALImpl::add_node(), clear_cache(), clear_cache_all(), configuration_name(), DALImpl(), get_DAO_Servant(), com::cosylab::cdb::jdal::WDALImpl::get_WDAO_Servant(), internal_get_DAO(), list_daos(), list_nodes(), listen_for_changes(), remove_change_listener(), com::cosylab::cdb::jdal::WDALImpl::remove_node(), com::cosylab::cdb::jdal::WDALImpl::set_DAO(), and shutdown().
final String com::cosylab::cdb::jdal::DALImpl::USE_XSD_CACHE_PROPERTYNAME = "cdb.useXsdCache" [static] |
The XSD cache may have additional bad side effects (one was a failure with xinclude which has been fixed), so we only use it if this property is set to true to switch it off easily in case of problems.
Referenced by DALImpl().
| final boolean com::cosylab::cdb::jdal::DALImpl::useXsdCache |
Referenced by DALImpl(), and loadFactory().
1.6.2