Saxstore a n aspect oriented persistence library for java based on sax events
This presentation is the property of its rightful owner.
Sponsored Links
1 / 20

SaxStore: a n aspect oriented persistence library for Java based on SAX events PowerPoint PPT Presentation


  • 40 Views
  • Uploaded on
  • Presentation posted in: General

SaxStore: a n aspect oriented persistence library for Java based on SAX events. Riccardo Solmi University of Bologna May 2001. Summary. SaxStore: features and usage scenarios Choice of a perspective XML representation Accessing XML data Accessing application objects

Download Presentation

SaxStore: a n aspect oriented persistence library for Java based on SAX events

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Saxstore a n aspect oriented persistence library for java based on sax events

SaxStore: an aspect orientedpersistence library for Javabased on SAX events

Riccardo Solmi

University of BolognaMay 2001


Summary

Summary

  • SaxStore: features and usage scenarios

  • Choice of a perspective

  • XML representation

  • Accessing XML data

  • Accessing application objects

  • SaxStore persistence management


Features

Features

  • SaxStore provides a mechanism to map arbitrary Java objects into a stream of SAX events and backward.

  • SAX events can be serialized to an XML stream and saved to disk or transmitted across a network.

  • XSLT transformations (translets) can be used to support versioning, stylesheet application and conformance to a given XML Schema.


Long term persistence scenario

Long-term persistence scenario

Runtime

Application

objects

Stylesheet

1.0 to 1.1

Stylesheet

1.1 to 1.2

Stylesheet

1.2 to 1.1

Stylesheet

1.1 to 1.0

XML

parser

XSLT

compiler

XSLT

compiler

SaxStore

XSLT

compiler

XSLT

compiler

XML

serializer

XML

  • Compression

  • Integrity signature

  • Given XML Schema


Representation scenario

Representation scenario

Runtime

Application

objects

Stylesheet

for XSLFO

representation

XSLFO

representation

SaxStore

XSLT

compiler

  • Dynamic form filling

  • XSLFO, XHTML, SVG, …


Data exchange scenario

Data exchange scenario

Runtime

Application

objects

Runtime

Application

objects

Stylesheet

transformation

to a given

XML Schema

Stylesheet

transformation

from a given

XML Schema

Schema

instance

SaxStore

XSLT

compiler

XSLT

compiler

SaxStore

  • Given XML Schema

  • Sun XMLB is better (may be)


Persistence

Persistence

  • To preserve something of the current execution state between successive program runnings.

  • To store a (runtime) graph of objects to a non volatile memory and to reconstruct an equivalent graph of objects.


Requirements

Requirements

  • Exchangable and neutral data format(i.e. XML)

  • Almost automatic but customizable

  • Large graphs of objects

  • Versioning

  • Performance


Goals

Goals

  • Powerful and easy to use as Java Serialization API

  • Support short-term & long-term persistence

    • Data exchange between running applications

    • Document format for successive executions

  • Decouple producers and consumers

  • Support distributed applications


Persistence and java

Persistence and Java

  • Java has not yet a standard persistence library

  • Java Serialization API provides only short term persistence and was introduced to support RMI.

  • SUN is working only on projects that doesn’t satisfy my requirements.


Runtime and persistent representations

Runtime and persistent representations

  • Both runtime and persistent representations should be user defined.

    • Runtime. To implement efficiently application algorithms

    • Persistent. To support interoperability of applications and loosly coupled distributed systems


Choice of a perspective

Choice of a perspective

  • An (almost) automatic transformation between two unconstrained and unrelated forms is not possible!

  • Two alternative points of view are suitable:

    • Java side:

    • XML side:

My

classes

XML

My

XML

custumizable

manual

My

classes

Java

classes

My

XML

manual

auto


Data binding focus on xml side

Data Binding: focus on XML side

  • Data Binding (JSR-031) – Bind Java objects to an XML document. Compiles an XML Schema to Java classes with specific accessor and mutator methods that affect the underlying XML document.

  • Writing the XML Schema from application classes (or even from scratch) is expansive.

  • Writing the code, in application classes, that store/retrive data to/from the graph of generated classes is not trivial.

  • Generated classes requires additional memory


Saxstore focus on java side

SaxStore: focus on Java side

  • In many applications the format of XML representation doesn’t matter.

  • Versioning support is the major requirement.

  • An easy to understand XML representation is enough.

  • Customization is required only for a very small number of classes.


Saxstore xml representation

SaxStore XML representation

  • Is an XML-Schema instance.

  • Objects are mapped to elements

  • Objects have an id attribute with a unique value and a xsi:type attribute with the runtime type.

  • Fields are mapped to nested elements with the same name (because attributes are not referenceable)

  • Objects already mapped are represented by an element with an idref attribute.


Accessing xml data

Accessing XML data

  • Callbacks(SAX) – Is an event-driven model; the parsing of an XML document trigger callback methods.

  • Trees (DOM) – The parsing of an XML document create a tree structure manageable with a set of standard methods.

    SaxStore is based on SAX2 events.


Accessing application objects

Accessing application objects

  • Reflection

  • State exposition

    • Field level accessor and mutator methods

    • Object level persistence methods

  • Aspect


Persistence vs encapsulation

Persistence vs encapsulation

  • Reflection violates encapsulation and performs poorly.

  • Field level state exposition make encapsulation useless.

  • Object level state exposition alone is a weak solution and requires excessive work.

  • Aspects preserve encapsulation while retaining instance methods performance.


Saxstore persistence management

SaxStore persistence management

  • User defined

    • XmlSerializable interface (source required)

      • Custom aspect or single classes

    • XmlSerializer interface or adapter class

      • Singletons

      • Part objects

  • Automatic

    • AspectWriter preprocessor (source required)

    • Reflective XmlSerializer


Future works

Future works

  • Produce an XML-Schema

  • Support XML-Schema constraints

  • Generation of persistence code based on reverse engineering of classes that uses Java serialization API

  • Integration with distributed API


  • Login