Class: CaTissue::Database
- Inherits:
-
CaRuby::Database
- Object
- CaRuby::Database
- CaTissue::Database
- Defined in:
- lib/catissue/database.rb
Overview
CaTissue::Database
mediates access to the caTissue application service and database. The CaRuby::Database
functionality is preserved, but CaTissue::Database
overrides several base class private methods to enable alternate CaTissue-specific search strategies and work around caTissue and caCORE bugs.
There is a single caTissue client database instance per thread.
This class contains a grab-bag of long and convoluted method implementations for the many caTissue API quirks that necessitate special attention.
Class Method Summary collapse
Instance Method Summary collapse
- #access_properties ⇒ Object
-
#annotator ⇒ Annotator
The annotator utility.
- #create(obj) ⇒ Object
-
#ensure_exists(obj) ⇒ Object
Augments CaRuby::Database.ensure_exists} to ensure that an {Annotation::Proxy reference identifier reflects the hook identifier.
-
#executor ⇒ Object
return [CaRuby::SQLExecutor] a utility SQL executor.
-
#initialize ⇒ Database
constructor
Creates a new Database with the
catissuecore
service and #access_properties. -
#persistence_service(klass) ⇒ Object
If the given domain object is an Annotation, then this method returns the
CaRuby::AnnotationService
for the object AnnotationModule, otherwise this method returns the standard Database service.
Constructor Details
#initialize ⇒ Database
Creates a new Database with the catissuecore
service and #access_properties.
24 25 26 |
# File 'lib/catissue/database.rb', line 24 def initialize super(SVC_NAME) { access_properties } end |
Class Method Details
.current ⇒ Object
19 20 21 |
# File 'lib/catissue/database.rb', line 19 def self.current Thread.current[:crtdb] ||= new end |
Instance Method Details
#access_properties ⇒ Object
29 30 31 |
# File 'lib/catissue/database.rb', line 29 def access_properties CaTissue.properties end |
#annotator ⇒ Annotator
Returns the annotator utility.
39 40 41 |
# File 'lib/catissue/database.rb', line 39 def annotator @annotator ||= Annotator.new(self) end |
#create(obj) ⇒ Object
61 62 63 64 65 66 |
# File 'lib/catissue/database.rb', line 61 def create(obj) if CaTissue::Address === obj then raise CaRuby::DatabaseError.new("Address creation is not supported.new(since a caTissue bug does not set the create result identifier property.") end super end |
#ensure_exists(obj) ⇒ Object
Augments CaRuby::Database.ensure_exists} to ensure that an {Annotation::Proxy reference identifier reflects the hook identifier.
72 73 74 75 76 77 |
# File 'lib/catissue/database.rb', line 72 def ensure_exists(obj) if Annotation::Proxy === obj then obj.ensure_hook_exists end super end |
#executor ⇒ Object
return [CaRuby::SQLExecutor] a utility SQL executor
34 35 36 |
# File 'lib/catissue/database.rb', line 34 def executor @executor ||= create_executor end |
#persistence_service(klass) ⇒ Object
If the given domain object is an Annotation, then this method returns the CaRuby::AnnotationService
for the object AnnotationModule, otherwise this method returns the standard CaTissue::Database service.
49 50 51 |
# File 'lib/catissue/database.rb', line 49 def persistence_service(klass) klass < Annotation ? klass.annotation_module.persistence_service : super end |