com::cosylab::cdb::jdal::DALImpl Class Reference

Inheritance diagram for com::cosylab::cdb::jdal::DALImpl:
Inheritance graph
[legend]
Collaboration diagram for com::cosylab::cdb::jdal::DALImpl:
Collaboration graph
[legend]

List of all members.

Classes

class  Filter

Public Member Functions

void loadFactory ()
void recoverClients ()
String getRecordPath (String curl)
void parseNode (DALNode node, XMLHandler xmlSolver) 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 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)

Static Public Attributes

static final String SCHEMA_VALIDATION_FEATURE_ID
static final String EXTERNAL_SCHEMA_LOCATION_PROPERTY_ID

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)
void putToCache (String curl, String 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, DAOdaoMap = 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, String > cache = new LinkedHashMap<String, String>()
volatile boolean cacheLimitReached = false

Detailed Description

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.


Constructor & Destructor Documentation

com::cosylab::cdb::jdal::DALImpl::DALImpl ( String  args[],
ORB  orb_val,
POA  poa_val,
Logger  logger 
) [inline, package]

Member Function Documentation

int com::cosylab::cdb::jdal::DALImpl::add_change_listener ( DALChangeListener  listener  )  [inline]
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]
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]
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]
String com::cosylab::cdb::jdal::DALImpl::get_DAO ( String  curl  )  throws CDBRecordDoesNotExistEx, CDBXMLErrorEx [inline]
synchronized DAO com::cosylab::cdb::jdal::DALImpl::get_DAO_Servant ( String  curl  )  throws CDBRecordDoesNotExistEx, CDBXMLErrorEx [inline]
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  )  [inline, private]

References cache, and m_logger.

Referenced by internal_get_DAO().

String com::cosylab::cdb::jdal::DALImpl::getRecordPath ( String  curl  )  [inline]
SAXParser com::cosylab::cdb::jdal::DALImpl::getSaxParser (  )  [inline]
Returns:

References saxParser.

Referenced by com::cosylab::cdb::jdal::WDALImpl::validateXML().

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]
Returns:
File

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]
boolean com::cosylab::cdb::jdal::DALImpl::isShutdown (  )  [inline]

References shutdown().

String com::cosylab::cdb::jdal::DALImpl::list_daos ( String  name  )  [inline]
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]
void com::cosylab::cdb::jdal::DALImpl::loadFactory (  )  [inline]
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]
XMLHandler com::cosylab::cdb::jdal::DALImpl::loadRecords ( String  curl,
boolean  toString 
) throws AcsJCDBRecordDoesNotExistEx, AcsJCDBXMLErrorEx [inline]
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.

Parameters:
curl The requested node that does not exist.

References 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]
Parameters:
curl 

References daoMap, and com::cosylab::CDB::DAOOperations::destroy().

Referenced by clear_cache().

void com::cosylab::cdb::jdal::DALImpl::parseNode ( DALNode  node,
XMLHandler  xmlSolver 
) throws SAXException, IOException, AcsJCDBXMLErrorEx [inline]
void com::cosylab::cdb::jdal::DALImpl::putToCache ( String  curl,
String  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]
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]
boolean com::cosylab::cdb::jdal::DALImpl::wasCacheLimitReached (  )  [inline]

Member Data Documentation

LinkedHashMap<String, String> com::cosylab::cdb::jdal::DALImpl::cache = new LinkedHashMap<String, String>() [private]
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().

Initial value:
                "http://apache.org/xml/properties/schema/external-schemaLocation"

Property for setting the mapping of URIs to XML schemas.

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]

Referenced by getStorageFile().

Referenced by DALImpl(), and get_DAO_Servant().

repeat guard for "Curl 'xyz' does not exist" messages.

Referenced by DALImpl(), and logRecordNotExistWithRepeatGuard().

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().

Referenced by DALImpl(), and recoverClients().

HashMap<Integer, DALChangeListener> com::cosylab::cdb::jdal::DALImpl::regListeners = new HashMap<Integer, DALChangeListener>() [private]
Initial value:
                "http://apache.org/xml/features/validation/schema"

Schema validation feature id (http://apache.org/xml/features/validation/schema).

Referenced by loadFactory().

volatile boolean com::cosylab::cdb::jdal::DALImpl::shutdown = false [private]
Object com::cosylab::cdb::jdal::DALImpl::shutdownLock = new Object() [private]

Referenced by DALImpl(), and shutdown().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2