Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Service Data Objects (SDO) and Data Access Service (DAS)"— Presentation transcript:

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

2 Support for SDO 1 since XIC 4.0 (June 2005) Support for SDO 2 since XIC 5.0 Java SDO2 client with dirty tracking Support for SDO2 APIs, metadata and XML data transfer SDO2  / JDO2 interoperability SDO2 used as an alternate format to attach/detach Efficient implementation not based on Eclipse EMF Additional APIs to create SDOs Additional APIs to associate static types with dynamic SDOs Support for.Net SDO 2 client Integration with LINQ Integration with ASP.Net data sources

3 Selected by Microsoft EBT as part of their IDEES program Founding member of the Interop Vendor Alliance One 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 PR 19developerqa.mspx 19developerqa.mspx

4 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 queries Intense Lab-Lab relationships between Xcalia and MS 4

5 Xcalia SDO DAS uses JDOQL in standard 5 Xcalia SDO DAS can now alternately use LINQ

6 ILinqDataAccessService linqDas = LinqDataAccessService.Decorate (das); linqDas.FetchGroups.Add("full"); linqDas.FetchGroups.Add("customer"); var fetchResult = from c in linqDas.GetInstances () 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

7 LINQ to JDOQL Conversion of LINQ query to JDOQL Key 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.

8 var results = from u in users where u.Age >= 30 && u.Age = 30 && u.Age < 40 select u;  select this from User where (age >= 30 && age = 30 && age < 40) var results = from u in users where (((u.Age >= 30 && 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 = 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.

9 var results = from u in users where 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.

10 var results = from u in users where Math.Abs(-10) == u.Age select u;  select this from User where 10 == age var results = from u in users where 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.

11 var results = from u in users where u.Name == "test“ orderby u.Age ascending select u;  select this from User where name == "test" order by age var results = from u in users where u.Name == "test“ orderby u.Age descending select 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.

12 var results = from u in users where 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 users from p in u.Policies where 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.

13 Create a.Net Data Source from a XIC DAS request Provides 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 page Connect the Visual Studio widgets (Grid View, Forms, etc.) to the XIC DAS Data Source Provides a fully introspectable model, based on SDO. Can manage connection and reconnection to a Data Access Service. This already works with Visual Studio 2005 Will be soon available in XIC

14 14 XIC Data Access Service data source Full integration in the ASP.NET editor

15 15 A configured data source is defined… And different standard ASP.NET controls are bound to this data source

16 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

17 Fetch graphs Somewhat 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 DAS Orcas related aspects: Use.NET expressions to express fetch plans Use 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

18 Simple 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

19 Express fetch graphs using expressions Defines what parts of the model should be included with condition.NET expressions. A condition is a Func<> typed as: Condition examples fgf => ! fgf.Value.PropertyType.Namespace.StartsWith("System") fgf => fgf.Value.PropertyType != typeof(string) fgf => typeof(IEnumerable).IsAssignableFrom(fgf.Value.PropertyType) 19 Func (Where TCandidate can be a System.Type, System.Reflection.PropertyInfo…)

20 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)

21 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)

22 Use Cases Defines « 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.

23 Enter use case / Leave use case

24 US0 + US1 US0 Support for overrides (use case that defines twice the same value)

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

26 Data Access Service configuration Eases configuration Performs common administrative tasks to initialize and configure a Data Access Service. 26

27 LINQ DAS Can also predefined LINQ queries Automatically register SDO static types 27

28

29 Local mode 29 Xcalia DAS Datastore Service oriented mode Xcalia DAS Datastore Same JVM Web Services

30 DataAccessServiceFactory Bootstrap object Creates « manager » and « das » instances DataAccessServiceManager Provides management tasks for a DAS DataAccessService Retrieve SDO data graphs from the data sources Apply changed SDO to the data sources 30

31 public interface DataAccessServiceFactory { DataAccessServiceManager getManager(Map options); DataAccessService getDataAccessService(Map options); } 31

32 public interface DataAccessServiceManager { void start(); void setupDataSource(); void stop(); void close(); } 32

33 public interface DataAccessService { Object fetch(String queryText, String fetchGroups); Object fetch(String queryText, String fetchGroups, Map options); void applyChanges(Object dataObject); void applyChanges(Object dataObject, Map options);...} 33

34 DataAccessServiceFactory factory = DataAccessServiceFactory.INSTANCE; DataAccessServiceManager dasManager = factory.getManager(options); dasManager.start(); DataAccessService das = factory.getDataAccessService(options); Collection fetchResult; fetchResult = (Collection ) das.fetch("query", "default"); for (DataObject dataObject : fetchResult) { dataObject.setString("MyProperty", "new value"); das.applyChanges(dataObject);}... 34

35 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”}); das.fetch("select this from bom.Customer where name==myName parameters String myName", "default", new Object[]{“Christophe”}); Named Query das.fetch("named into bom.Customer:queryName", "default", new Object[]{christophe}); Direct SQL das.fetch("sql:SELECT NAME, AGE, ADDRESS FROM QCUSTOMER ORDER BY AGE", null); In.Net JDOQL can be replaced by LINQ 35

36 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 clients Based on the full featured XIC MappingCachingTransaction Multiple data sources support Admin through JMX

37 Tuscany is an open source DAS, SDO, SCA implementation Hosted by the well-respected Apache community Funded by IBM 37 Client Change Summary Data Graph DataObject JDBC XPath/XQuery Local XML/HTTP CCI/Proprietary JCA Web Service RDB XML DB EJB Customer Data Access Service Right vision  The DAS, an universal “Data as a Service” provider

38 Java /.Net interoperability Scalability  caches, transactions Agility  client apps isolated from back ends 38 Client Java.Net C++ ? Change Summary Data Graph DataObject JDBC /XPathXQuery Local XML / HTTP CCI /Proprietary JCA Web Service RDB XML DB EJB Customer Data Access Service  Mapping with Logical Business Model  Caching & Dynamic tuning  Distributed transactions, queries  …

39 A limited DAS implementation. Rather a PoC. 39 Client Java C++ Change Summary Data Graph DataObject 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.

40 A DAS implementation built on top of the mature Xcalia Intermediation technology 40 Client Java.Net Change Summary Data Graph DataObject JDBC /Xpath XQuery Local XML / HTTP CCI / Mainframe Packaged applications … Proprietary JCA Web Service RDB XML EJB Customer Xcalia Intermediation Core Mapping with Logical Business Model Caching & Dynamic tuning Distributed transactions Extensibility kit Xcalia Intermediation Core Mapping with Logical Business Model Caching & Dynamic tuning Distributed transactions Extensibility kit The DAS vision implemented with respect of market requirements.

41 © 2007 Microsoft France Votre potentiel, notre passion TM


Download ppt "Service Data Objects (SDO) and Data Access Service (DAS)"

Similar presentations


Ads by Google