Presentation Transcript
Xcalia Intermediation :Xcalia Intermediation 13 décembre 2007
Eric SAMSON, CTO - XCALIA
Stève SFARTZ, MICROSOFT France Service Data Objects (SDO) and Data Access Service (DAS)
Xcalia SDO support :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 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
Microsoft & Xcalia :Microsoft & Xcalia 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
http://www.microsoft.com/presspass/features/2007/nov07/11-19developerqa.mspx
http://www.microsoft.com/casestudies/casestudy.aspx?casestudyid=4000000963
LinQ to JDOQL :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 queries
Intense Lab-Lab relationships between Xcalia and MS 4
LINQ and XIC SDO DAS :LINQ and XIC SDO DAS Xcalia SDO DAS uses JDOQL in standard 5
Example with fetch groups :Example with fetch groups 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
LINQ To JDOQL :LINQ To JDOQL 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.
LINQ to JDOQL – Basic samples :LINQ to JDOQL – Basic samples var results = from u in users
where u.Age >= 30 && u.Age = 30 && age = 30 && u.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.
LINQ to JDOQL – Java / .NET conversions :LINQ to JDOQL – Java / .NET conversions 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.
LINQ to JDOQL – Constant evaluation :LINQ to JDOQL – Constant evaluation 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.
LINQ to JDOQL - Ordering :LINQ to JDOQL - Ordering 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.
LINQ to JDOQL - Navigation :LINQ to JDOQL - Navigation 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.
ASP.NET data source :ASP.NET data source 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 5.3 13
ASP.NET data source :ASP.NET data source 14 XIC Data Access Service data source Full integration in the ASP.NET editor
ASP.NET Datasource :ASP.NET Datasource 15 A configured data source is defined… And different standard ASP.NET controls are bound to this data source
ASP.NET data source :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
Fetch graphs :Fetch graphs 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
Fetch graphs – Sample :Fetch graphs – Sample 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
Fetch graphs :Fetch graphs 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…)
Fetch graphs – Condition :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)
Fetch graphs – Multiple Conditions :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)
Use Cases :Use Cases 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.
Use Cases – Example (1/2) :Use Cases – Example (1/2) Enter use case / Leave use case
Use Cases – Example (1/2) :US0 + US1 US0 Use Cases – Example (1/2) Support for overrides (use case that defines twice the same value)
Use Cases – Example (2/2) :Use Cases – Example (2/2) This method call gets the active configuration (eventually with merges if multiple data instances were found)
Use Cases – Scenarios (1/2) :Use Cases – Scenarios (1/2) Data Access Service configuration
Eases configuration
Performs common administrative tasks to initialize and configure a Data Access Service. 26
Use Cases – Scenarios (2/2) :Use Cases – Scenarios (2/2) LINQ DAS
Can also predefined LINQ queries
Automatically register SDO static types 27
Xcalia DAS :Xcalia DAS
Architecture :Architecture Local mode 29 Java
Application Xcalia DAS Datastore Service oriented mode Java or .Net
Application Xcalia DAS Datastore Same JVM Web Services
Xcalia DAS Main APIs :Xcalia DAS Main APIs 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
DataAccessServiceFactory :DataAccessServiceFactory public interface DataAccessServiceFactory {
DataAccessServiceManager getManager(Map options);
DataAccessService getDataAccessService(Map options);
} 31
DataAccessServiceManager :DataAccessServiceManager public interface DataAccessServiceManager {
void start();
void setupDataSource();
void stop();
void close();
} 32
DataAccessService :DataAccessService 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
Sample :Sample 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
Fetch examples :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 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
Xcalia DAS support :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 clients
Based on the full featured XIC
Mapping
Caching
Transaction
Multiple data sources support
Admin through JMX
Apache Tuscany :Apache Tuscany Tuscany is an open source DAS, SDO, SCA implementation
Hosted by the well-respected Apache community
Funded by IBM 37 Change
Summary Data Graph DataObject JDBC XPath / XQuery Local XML / HTTP CCI / Proprietary Right vision The DAS, an universal
“Data as a Service” provider
Market requirements :Market requirements Java / .Net interoperability
Scalability caches, transactions
Agility client apps isolated from back ends 38 Change
Summary Data Graph DataObject JDBC / XPathXQuery Local XML / HTTP CCI / Proprietary
What Tuscany has today… :What Tuscany has today… A limited DAS implementation.
Rather a PoC. 39 Change
Summary Data Graph DataObject JDBC - Just RDBMS Straight SQL from SDO client to database
- No mapping, no cache Low value for developers, low scalability in production.
What XIC offers today :What XIC offers today A DAS implementation built on top of the mature Xcalia Intermediation technology 40 Change
Summary Data Graph DataObject JDBC / Xpath XQuery Local XML / HTTP CCI /
Mainframe
Packaged applications
… Proprietary Xcalia Intermediation Core
Mapping with Logical Business Model
Caching & Dynamic tuning
Distributed transactions
Extensibility kit The DAS vision implemented with respect of market requirements.
Slide 41:© 2007 Microsoft France