service data objects (sdo) and data access service (das)

41
Xcalia Intermediation 13 décembre 2007 Eric SAMSON, CTO - XCALIA Stève SFARTZ, MICROSOFT France rvice Data Objects (SDO) and Data Access Service (D

Upload: donte-musto

Post on 01-Apr-2015

227 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Service Data Objects (SDO) and Data Access Service (DAS)

Xcalia Intermediation

13 décembre 2007Eric SAMSON, CTO - XCALIAStève SFARTZ, MICROSOFT France

Service Data Objects (SDO) and Data Access Service (DAS)

Page 2: Service Data Objects (SDO) and Data Access Service (DAS)

Xcalia SDO support

Support for SDO 1 since XIC 4.0 (June 2005)Support for SDO 2 since XIC 5.0

Java SDO2 client with dirty trackingSupport for SDO2 APIs, metadata and XML data transferSDO2 / JDO2 interoperability

SDO2 used as an alternate format to attach/detach

Efficient implementation not based on Eclipse EMFAdditional APIs to create SDOsAdditional APIs to associate static types with dynamic SDOs

Support for .Net SDO 2 clientIntegration with LINQIntegration with ASP .Net data sources

Page 3: Service Data Objects (SDO) and Data Access Service (DAS)

Microsoft & Xcalia

Selected by Microsoft EBT as part of their IDEES programFounding member of the Interop Vendor AllianceOne of the 5 companies selected worldwide for the new MS Tool program

Support for .Net 3.x, LINQ, ASP .Net Data Sources CardSpace…

Visual Studio 2008 and .Net 3.5 PRhttp://www.microsoft.com/presspass/features/2007/nov07/11-19developerqa.mspxhttp://www.microsoft.com/casestudies/casestudy.aspx?casestudyid=4000000963

Page 4: Service Data Objects (SDO) and Data Access Service (DAS)

LinQ to JDOQL

Xcalia DAS server only understood JDOQL

.NET developers want to benefit from upcoming LINQ capabilities

Relies on Visual Studio 2008

Convert LinQ expressions to JDOQL queriesIntense Lab-Lab relationships between Xcalia and MS

4

Page 5: Service Data Objects (SDO) and Data Access Service (DAS)

LINQ and XIC SDO DAS

Xcalia SDO DAS uses JDOQL in standard

5

Xcalia SDO DAS can now alternately use LINQ

Page 6: Service Data Objects (SDO) and Data Access Service (DAS)

Example with fetch groups

ILinqDataAccessService linqDas = LinqDataAccessService.Decorate (das);linqDas.FetchGroups.Add("full");linqDas.FetchGroups.Add("customer");

var fetchResult = from c in linqDas.GetInstances<Customer>()                        where c.Lastname.StartsWith ("Killian")                   select c;

foreach (Customer customer in fetchResult){    Address address = customer.Address;

    resultView.Add("Result is " + customer.Firstname + " " + customer.Lastname + " " + address.Street );

    ((IDataObject) customer).ChangeSummary.BeginLogging();    customer.Comment = customer.Comment + "-c#(linq)";    das.ApplyChanges(customer);}

6

Page 7: Service Data Objects (SDO) and Data Access Service (DAS)

LINQ To JDOQL

LINQ to JDOQLConversion of LINQ query to JDOQLKey aspects:

Visitor for the LinQ Expressions Structures.Translates LINQ queries to JDOQL using visitors.Send JDOQL query to a DAS implementation and return strongly typed results.

Page 8: Service Data Objects (SDO) and Data Access Service (DAS)

LINQ to JDOQL – Basic samples

var results = from u in userswhere u.Age >= 30 && u.Age < 40 select u;

select this from User where (age >= 30 && age < 40)

var results = from u in userswhere (((u.Age >= 30 && u.Age < 40) || (u.Id == 123 &&

u.FirstName == "test")) || u.Name == "ok")select u;

select this from User where (((age >= 30 && age < 40) || (id == 123 && firstName == "test")) || name == "ok")

8

A condition on the User’s age property…

… translated into a Java property name (note the lower case ‘age’).

A more complex condition…

… translated in JDO QL.

Page 9: Service Data Objects (SDO) and Data Access Service (DAS)

LINQ to JDOQL – Java / .NET conversionsvar results = from u in userswhere u.Name.Substring(3, 4) == param.Substring(2,4)select u;

select this from User where name.substring(3, 7) == "test"

9

The ‘substring’ method in .NET is different from Java …

… but translated to Java.

Please note that an optimization has been performed on the condition’s right operand.

Page 10: Service Data Objects (SDO) and Data Access Service (DAS)

LINQ to JDOQL – Constant evaluation

var results = from u in userswhere Math.Abs(-10) == u.Ageselect u;

select this from User where 10 == age

var results = from u in userswhere u.Name.ToUpper() == "abcdtest".Substring(Math.Abs(1 * "abcdef".IndexOf("e"))).ToUpper()select u;

select this from User where name.toUpperCase() == "TEST“

10

‘Math.Abs(-10)’ is constant expression…

… that is directly evaluated for the LINQ to JDOQL translation.

With a more complex expression…

… the result can still be correcly optimized.

Page 11: Service Data Objects (SDO) and Data Access Service (DAS)

LINQ to JDOQL - Ordering

var results = from u in userswhere u.Name == "test“orderby u.Age ascendingselect u;

select this from User where name == "test" order by agevar results = from u in userswhere u.Name == "test“orderby u.Age descendingselect u;

select this from User where name == "test" order by age descending

11

The ascending ordering…

… is the default ordering in JDOQL.

But the descending ordering…

… has to be explicitely declared.

Page 12: Service Data Objects (SDO) and Data Access Service (DAS)

LINQ to JDOQL - Navigation

var results = from u in userswhere u.Address.Street == u.Address.Street2 &&

(u.Id.IndexOf(u.Address.ZipCode) > 0)select u;

select this from User where (address.street == address.street2 && (id.indexOf(address.zipCode) > 0)

var results = from u in usersfrom p in u.Policieswhere p.Name == "test“select u;

select this from User where policies.contains(gen_var1) && p.name == "test" variables Policy gen_var1

12

LINQ to JDOQL also supports navigation in the model…

… that are translated in «. » notation.

For queries against multivalued collections…

… the translator generates variables in order to match the JDOQL language.

Page 13: Service Data Objects (SDO) and Data Access Service (DAS)

ASP.NET data source

Create a .Net Data Source from a XIC DAS requestProvides easy integration of Xcalia DAS within ASP.NET

Drag & Drop this XIC DAS Data Source onto the ASP Page

Use regular Visual Studio widgets to design the pageConnect the Visual Studio widgets (Grid View, Forms, etc.) to the XIC DAS Data SourceProvides a fully introspectable model, based on SDO.Can manage connection and reconnection to a Data Access Service.

This already works with Visual Studio 2005Will be soon available in XIC 5.3

13

Page 14: Service Data Objects (SDO) and Data Access Service (DAS)

ASP.NET data source

14

XIC Data Access Service data source

Full integration in the ASP.NET editor

Page 15: Service Data Objects (SDO) and Data Access Service (DAS)

ASP.NET Datasource

15

A configured data source is defined…

And different standard ASP.NET controls are bound to this data source

Page 16: Service Data Objects (SDO) and Data Access Service (DAS)

ASP.NET data source

16

At runtime, the data source can provide the data model and generate the appropriate columns.

The data source supports basic CRUD operations.

Data is shared accross the different components and update in one component is reflected on every component that shares the same data source

Page 17: Service Data Objects (SDO) and Data Access Service (DAS)

Fetch graphs

Fetch graphsSomewhat equivalent to DataShapes in System.Data.Linq…

…but not limited to relational databases

Defines what parts of the model (which classes / attributes) should be loaded when a query is executed on the DASOrcas related aspects:

Use .NET expressions to express fetch plansUse LINQ expressions on data structures

Fetch graphs are optional in a connected model but required in a disconnected model (SOA), because lazy loading over SOAP is not suitable

Page 18: Service Data Objects (SDO) and Data Access Service (DAS)

Fetch graphs – SampleSimple model with two main particularities:

IPerson interface contains a one to many relationship to IPerson (« Friends »)Address introduces a cycle with relationship to IPerson (« President »).

IPerson will be used for the next examples

18

Page 19: Service Data Objects (SDO) and Data Access Service (DAS)

Fetch graphs

Express fetch graphs using expressionsDefines what parts of the model should be included with condition .NET expressions.A condition is a Func<> typed as:

Condition examplesfgf => ! fgf.Value.PropertyType.Namespace.StartsWith("System")fgf => fgf.Value.PropertyType != typeof(string)fgf => typeof(IEnumerable).IsAssignableFrom(fgf.Value.PropertyType)

19

Func<TCandidate, bool>(Where TCandidate can be a System.Type, System.Reflection.PropertyInfo…)

Page 20: Service Data Objects (SDO) and Data Access Service (DAS)

Fetch graphs – Condition

fgf => fgf.Value.PropertyType != typeof(string)

20

[FetchPlansTests.Model.IPerson][Age] (System.Int32)[HomeAddress] (FetchPlansTests.Model.IAddress)[WorkAddress] (FetchPlansTests.Model.IAddress)[Friends] (System.Collections.Generic.IList`1[FetchPlansTests.Model.IPerson])

[FetchPlansTests.Model.IPerson][Name] (System.String)[FirstName] (System.String)[Age] (System.Int32)[HomeAddress] (FetchPlansTests.Model.IAddress)[WorkAddress] (FetchPlansTests.Model.IAddress)[Friends] (System.Collections.Generic.IList`1[FetchPlansTests.Model.IPerson])

• Example of fetch group creation for the IPerson type• fgf => true (No Condition)

Page 21: Service Data Objects (SDO) and Data Access Service (DAS)

Fetch graphs – Multiple Conditions

Fetch groups can « combine » conditions.A fetch group can be created with more than one condition.

The result of C1 + C2 on IPerson is:

21

C1: fgf => fgf.Value.PropertyType != typeof(string)C2 : fgf => typeof(IEnumerable).IsAssignableFrom(fgf.Value.PropertyType)

[FetchPlansTests.Model.IPerson][Age] (System.Int32)[HomeAddress] (FetchPlansTests.Model.IAddress)[WorkAddress] (FetchPlansTests.Model.IAddress)

Page 22: Service Data Objects (SDO) and Data Access Service (DAS)

Use Cases

Use CasesDefines « scopes » in code where a particular context is active.Developers enter and leave programmatically use cases in code.Allows flexibility for developer: developer can define additional data (even data not included in the product).Orcas related aspects:

Extensive use of LINQ query on data structures.

Page 23: Service Data Objects (SDO) and Data Access Service (DAS)

Use Cases – Example (1/2)

Enter use case / Leave use case

Page 24: Service Data Objects (SDO) and Data Access Service (DAS)

US0 + US1

US0

Use Cases – Example (1/2)

Support for overrides (use case that defines twice the same value)

Page 25: Service Data Objects (SDO) and Data Access Service (DAS)

Use Cases – Example (2/2)

This method call gets the active configuration (eventually with merges if multiple data instances were found)

Page 26: Service Data Objects (SDO) and Data Access Service (DAS)

Use Cases – Scenarios (1/2)

Data Access Service configurationEases configurationPerforms common administrative tasks to initialize and configure a Data Access Service.

26

Page 27: Service Data Objects (SDO) and Data Access Service (DAS)

Use Cases – Scenarios (2/2)

LINQ DASCan also predefined LINQ queriesAutomatically register SDO static types

27

Page 28: Service Data Objects (SDO) and Data Access Service (DAS)

Xcalia DAS

Page 29: Service Data Objects (SDO) and Data Access Service (DAS)

Architecture

Local mode

29

JavaApplication

Xcalia DAS Datastore

Service oriented mode

Java or .Net

ApplicationXcalia DAS Datastore

Same JVM

Web Services

Page 30: Service Data Objects (SDO) and Data Access Service (DAS)

Xcalia DAS Main APIs

DataAccessServiceFactoryBootstrap objectCreates « manager » and « das » instances

DataAccessServiceManagerProvides management tasks for a DAS

DataAccessServiceRetrieve SDO data graphs from the data sourcesApply changed SDO to the data sources

30

Page 31: Service Data Objects (SDO) and Data Access Service (DAS)

DataAccessServiceFactory

public interface DataAccessServiceFactory {

DataAccessServiceManager getManager(Map<String, Object> options);

DataAccessService getDataAccessService(Map<String, Object> options);

}

31

Page 32: Service Data Objects (SDO) and Data Access Service (DAS)

DataAccessServiceManager

public interface DataAccessServiceManager {

void start();

void setupDataSource();

void stop();

void close();}

32

Page 33: Service Data Objects (SDO) and Data Access Service (DAS)

DataAccessService

public interface DataAccessService {

Object fetch(String queryText, String fetchGroups);

Object fetch(String queryText, String fetchGroups, Map<String, Object>

options);

void applyChanges(Object dataObject);

void applyChanges(Object dataObject, Map<String, Object> options);

...}

33

Page 34: Service Data Objects (SDO) and Data Access Service (DAS)

Sample

DataAccessServiceFactory factory = DataAccessServiceFactory.INSTANCE;

DataAccessServiceManager dasManager = factory.getManager(options);dasManager.start();

DataAccessService das = factory.getDataAccessService(options);

Collection<DataObject> fetchResult;fetchResult = (Collection<DataObject>) das.fetch("query", "default");

for (DataObject dataObject : fetchResult) {dataObject.setString("MyProperty", "new value");das.applyChanges(dataObject);

}...

34

Page 35: Service Data Objects (SDO) and Data Access Service (DAS)

Fetch examples

Any JDO2 QL query, with navigation, contains, aggregates, projections, in heritance, etc.Query  with parameters

das.fetch("select this from bom.Customer where name==myName parameters String myName", "default", new Object[]{“Christophe”}); 

Named Querydas.fetch("named into bom.Customer:queryName", "default", new Object[]{christophe});

Direct SQLdas.fetch("sql:SELECT NAME, AGE, ADDRESS FROM QCUSTOMER ORDER BY AGE", null);

In .Net JDOQL can be replaced by LINQ

35

Page 36: Service Data Objects (SDO) and Data Access Service (DAS)

Xcalia DAS support

First support of DAS in XIC 5.1 (Q2 2007)XIC DAS interface returns SDO 2 data graphs

Generic CRUD Web Service interface

Optimized client-server implementation (metadata exchange)Both Java and .Net clientsBased on the full featured XIC

MappingCachingTransactionMultiple data sources supportAdmin through JMX

Page 37: Service Data Objects (SDO) and Data Access Service (DAS)

Apache Tuscany

Tuscany is an open source DAS, SDO, SCA implementation

Hosted by the well-respected Apache communityFunded by IBM

37

Client

ChangeSummary

Data GraphDataObject JDBC

XPath / XQuery

Local

XML/HTTP

CCI / Proprietary

JCA

Web Service

RDB

XML DB

EJBCustomer

Data Access Service

Right vision The DAS, an universal “Data as a Service” provider

Page 38: Service Data Objects (SDO) and Data Access Service (DAS)

Market requirements

Java / .Net interoperabilityScalability caches, transactionsAgility client apps isolated from back ends

38

Client

Java.NetC++ ?

ChangeSummary

Data GraphDataObject

JDBC

/ XPathXQuery

Local

XML / HTTP

CCI / Proprietary

JCA

Web Service

RDB

XML DB

EJBCustomer

Data Access Service

Mapping with Logical Business ModelCaching & Dynamic tuningDistributed transactions, queries …

Page 39: Service Data Objects (SDO) and Data Access Service (DAS)

What Tuscany has today…

A limited DAS implementation. Rather a PoC.

39

Client

Java

C++

ChangeSummary

Data GraphDataObject

JDBC

Web Service

RDB

Data Access Service

- Just RDBMS Straight SQL from SDO client to database- No mapping, no cache Low value for developers, low scalability in production.

Page 40: Service Data Objects (SDO) and Data Access Service (DAS)

What XIC offers today

A DAS implementation built on top of the mature Xcalia Intermediation technology

40

Client

Java.Net

ChangeSummary

Data GraphDataObject

JDBC

/ Xpath XQuery

Local

XML / HTTP

CCI /MainframePackaged applications…

Proprietary

JCA

Web Service

RDB

XML

EJBCustomer

XIC Data Access Service

Xcalia Intermediation Core• Mapping with Logical

Business Model• Caching & Dynamic tuning• Distributed transactions• Extensibility kit

The DAS vision implemented with respect of market requirements.

Page 41: Service Data Objects (SDO) and Data Access Service (DAS)

© 2007 Microsoft France

Votre potentiel, notre passion TM