Oracle Object Interface CMS Evaluation Zhen Xie CERN-EP/CMC
Download
Report
Transcript Oracle Object Interface CMS Evaluation Zhen Xie CERN-EP/CMC
Oracle Object Interface
CMS Evaluation
Zhen Xie
CERN-EP/CMC
Object interface
Object
At database level, Oracle9i supports object by
object-relational mapping.
Support object identity, navigation,inheritance.
Interface (our main concern)
A generic interface that shields application from
SQL and other database operations.
OCCI+OTT model
Our model: OCCI+class library
Jan 29 2002
Zhen Xie, CERN-EP/CMC
2
OCCI/OTT
Huh?…I’ll tell you next
week. This object
includes 10 other
objects and they may
include other other
objects.
Your data
model
OCCI
PObject
(abstract )
Is a
Is a
OTT
.. …
Is a
Data
Base
Is a
Is a
Is a
.. …
Your objects here
What?! My job is to
make Vincenzo’s object
persistent. He will kill
me if I change his
Jan 29 2002
original classes. Zhen Xie, CERN-EP/CMC
3
Problems of using OTT
Data model drives object model.
But we want the other way around.
Force changes in existing code which
we cann’t afford.
Even if we could write software from
scratch, we couldn’t afford to train
object-oriented programmers to be
data-oriented programmers.
Jan 29 2002
Zhen Xie, CERN-EP/CMC
4
Our current prototype
Extract data model from object
model using a C++ compiler
front-end.
Provide a template class library for
common services.
User implements a very simple
wrapper class of the transient object
class.
Jan 29 2002
Zhen Xie, CERN-EP/CMC
5
Our current prototype
PObject
(abstract )
Is a
C++ Parser
library
AST
uses
AST-SQL
interpreter
Data
Base
Jan 29 2002
PObjectHandle
<T>
knows
Vincenzo’s
T’.h file
OCCI
Middle layer
Generic
StreamIn
T(T’)
Generic
StreamOut
uses
uses
StreamIn
StreamOut
Ah! I just need to write a class T
that clones Vincenzo’s object T’ and
tell the generic Streamer what to
Zhen Xie,stream
CERN-EP/CMC
6
An example
Class aPoint_C{
public:
aPoint_C (aPoint* p):clone_(p){}
void write(OCCI::AnyData& stream){
StreamIn<float,float,float> st;
st(stream,clone_->x(), clone_->y(), clone_->z());
}
//a similar thing for read.
Private:
aPoint* clone_;
};
Jan 29 2002
Zhen Xie, CERN-EP/CMC
7
Conclusions
As a database, Oracle9i supports objects
OCCI provides C++ language binding and
basic services.
A middle layer missing between OCCI and
application
OTT has data-oriented applications in C++ in
mind, thus not suitable for our object-oriented
system.
Our prototype proves that building such a
middle layer is not mission impossible.
Jan 29 2002
Zhen Xie, CERN-EP/CMC
8