Die Präsentation wird geladen. Bitte warten

Die Präsentation wird geladen. Bitte warten

1 Persistence Strategies for WebServices Senior Consultant Java Forum Stuttgart, 27. Juni 2002.

Ähnliche Präsentationen


Präsentation zum Thema: "1 Persistence Strategies for WebServices Senior Consultant Java Forum Stuttgart, 27. Juni 2002."—  Präsentation transkript:

1 1 Persistence Strategies for WebServices Martin.Wessel@versant.de Senior Consultant Java Forum Stuttgart, 27. Juni 2002

2 2 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. Agenda Web Services Architecture  Persistence Strategies for Web Services Transparent Java Persistence with Versant Summary Q&A

3 3 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. A Web Service Definition “A collection of functions that are packaged as a single entity and published to the network for use by other programs. Web services are building blocks for creating open distributed systems, and allow companies and individuals to quickly and cheaply make their digital assets available worldwide.“ (*) (*) http://www-106.ibm.com/developerworks/webservices/library/ws-peer1.html?dwzone=ws http://www-106.ibm.com/developerworks/webservices/library/

4 4 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. The Web Services Reference Architecture Web Services Business Services WSDL Web Services Container Web Services Runtime Web Services Client Registry UDDI ebXML Service Oriented Interfaces Service Oriented Interfaces discovery description execution SOAP/ HTTP(S) Business Processes

5 5 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. Web Services Gateway Business Logic Web Content Delivery EIS Users Clustering HTTP Servers Load Balancing Web Application Servers Application Servers Clustering Line of Business Systems JSP Servlets EJBSOAP HTTP JDBC JMS

6 6 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. The case for Middle-tier Persistence Need to store/retrieve “Application Data”  Distinct from “Enterprise Data” “Application Data” modeled as objects  Never need leave middle-tier Interactions & Business transactions  “Interactions” have different data access requirements to traditional business transactions  Process-centric versus data-centric Need solution able to handle “object” complexities

7 7 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. Web Services Gateway Business Logic Web Content Delivery EIS Users Clustering HTTP Servers Load Balancing Web Application Servers Application Servers Clustering Application Data Line of Business Systems Object Server SOAP HTTP JSP Servlets EJBJDBC JMS

8 8 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. Persistent Strategies for Web Services: Entity Beans standard way to persist the domain model  encapsulate the persistence mechanism distributed objects  but should not be accessed remotely, common design practice  to wrap entity beans with session beans supposed to be transaction aware objects  the transactional context is to be managed by the calling session bean Is there really a big difference between Entity Beans and Persistent Java Objects ? Is there really a big difference between Entity Beans and Persistent Java Objects ?

9 9 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. Persistent Strategies for Web Services: Session Beans Tests have shown that using Session Beans with direct access to persistent Java objects can lead to much more  Performance and scalability  Ease of use in typical EJB projects  Clean design and implementation  Persistence Layer is independent of the component framework

10 10 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. Persistent Strategies for Web Services: Transparent Java Persistence Transparent persistence of Java objects  No relational transformation code required  Versus mapping of Java to relational models  All you need to know is Java! Transparent object navigation of complex models Full support for inherent object complexity  Inheritance, collections, multi-valued types

11 11 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. Employee.java javac java com.versant. Enhance config.jvi java Employee mydb Employee.class Employee.class c Employee c Department a LoadDatabase a QueryDatabase c Employee c Department a LoadDatabase a QueryDatabase Transparent Java Persistence: Development process No changes in source code for persistence  Based on byte-code enhancement  Java applications can be easily adapted

12 12 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. Transparent Java Persistence: The UML Model

13 13 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. public class Employee { String name; float salary; Employee (String name) { this.name = name; this.salary = (float) 70000; } void modifySalary(float delta) { salary = salary + delta; } public String toString () { return "Employee: " + name + " salary: " + salary; } public class Employee { String name; float salary; Employee (String name) { this.name = name; this.salary = (float) 70000; } void modifySalary(float delta) { salary = salary + delta; } public String toString () { return "Employee: " + name + " salary: " + salary; } Class Employee

14 14 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. import java.util.Vector; public class Department { String name; Employee manager; Vector employees; Department (String name, Employee manager) { this.name = name; this.manager = manager; employees = new Vector(); } void addEmployee(Employee emp) { int size = employees.size(); employees.setSize( size + 1 ); employees.setElementAt( emp, size ); } import java.util.Vector; public class Department { String name; Employee manager; Vector employees; Department (String name, Employee manager) { this.name = name; this.manager = manager; employees = new Vector(); } void addEmployee(Employee emp) { int size = employees.size(); employees.setSize( size + 1 ); employees.setElementAt( emp, size ); } Class Department

15 15 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. Employee getManager() { return manager; } Vector getEmployees() { return employees; } public String toString () { return "Department: " + name + " employees:" + employees; } Employee getManager() { return manager; } Vector getEmployees() { return employees; } public String toString () { return "Department: " + name + " employees:" + employees; } Class Department (cont)

16 16 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. import com.versant.trans.*; public class LoadDatabase { public static void main (String[] args) { String database = args [0]; TransSession session = new TransSession (database); Employee boss = new Employee ("Boss"); Department department = new Department("RD", boss); Employee emp1 = new Employee ("Walt"); Employee emp2 = new Employee ("Dilbert"); department.addEmployee(emp1); department.addEmployee(emp2); session.makePersistent(department); session.commit(); session.endSession (); } import com.versant.trans.*; public class LoadDatabase { public static void main (String[] args) { String database = args [0]; TransSession session = new TransSession (database); Employee boss = new Employee ("Boss"); Department department = new Department("RD", boss); Employee emp1 = new Employee ("Walt"); Employee emp2 = new Employee ("Dilbert"); department.addEmployee(emp1); department.addEmployee(emp2); session.makePersistent(department); session.commit(); session.endSession (); } Load Database Open database; create Boss, Department and Employees; commit.

17 17 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. Query Database import com.versant.trans.*; import java.util.Vector; import java.util.Enumeration; public class QueryDatabase { public static void main (String[] args) { String database = args [0]; TransSession session = new TransSession (database); VQLQuery query = new VQLQuery ( session, "select selfoid from Department where manager->name = 'Boss'" ); Enumeration e = query.execute (); if ( !e.hasMoreElements() ) { System.out.println ("No objects were found."); } else { while ( e.hasMoreElements() ) { typicalDilbertAction( (Department) e.nextElement() ); } session.commit(); session.endSession (); } import com.versant.trans.*; import java.util.Vector; import java.util.Enumeration; public class QueryDatabase { public static void main (String[] args) { String database = args [0]; TransSession session = new TransSession (database); VQLQuery query = new VQLQuery ( session, "select selfoid from Department where manager->name = 'Boss'" ); Enumeration e = query.execute (); if ( !e.hasMoreElements() ) { System.out.println ("No objects were found."); } else { while ( e.hasMoreElements() ) { typicalDilbertAction( (Department) e.nextElement() ); } session.commit(); session.endSession (); }

18 18 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. private static final float increase = 5000; private static void typicalDilbertAction(Department dep) { Vector employees = dep.getEmployees(); // Boss gets 5000$ more salary dep.getManager().modifySalary(increase); float decrease = increase/ employees.size(); for (int i = 0; i < employees.size(); i++) { Employee currentEmployee = (Employee) employees.elementAt(i); currentEmployee.modifySalary(-decrease); } private static final float increase = 5000; private static void typicalDilbertAction(Department dep) { Vector employees = dep.getEmployees(); // Boss gets 5000$ more salary dep.getManager().modifySalary(increase); float decrease = increase/ employees.size(); for (int i = 0; i < employees.size(); i++) { Employee currentEmployee = (Employee) employees.elementAt(i); currentEmployee.modifySalary(-decrease); } Query Database (cont)

19 19 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. Web Services Gateway Business Logic Web Content Delivery EIS Users Clustering HTTP Servers Load Balancing Web Application Servers Application Servers Clustering Application Data Line of Business Systems Object Server SOAP HTTP JSP Servlets EJBJDBC JMS

20 20 © 2002 Versant GmbH Die hier vermittelten Informationen sind vertraulich zu behandeln und dürfen Dritten nur nach Genehmigung durch Versant zugänglich gemacht werden. All products are trademarks or registered trademarks of their respective companies. The information contained in this document is property of Versant GmbH. Persistent Strategies for Web Services: Summary Transparent Java Persistence  Faster development cycles No Mapping  Better performance with Navigation No Joins Full Database Management System Features  Scalability Client- and Server-Cache Distributed Database Object-Level Locking  24x7 Support Fault Tolerant Server On-Line Backup, HA-Backup


Herunterladen ppt "1 Persistence Strategies for WebServices Senior Consultant Java Forum Stuttgart, 27. Juni 2002."

Ähnliche Präsentationen


Google-Anzeigen