Download presentation
Presentation is loading. Please wait.
Published byTabitha Payne Modified over 9 years ago
1
Eike Stepper stepper@esc-net.de http://www.esc-net.de http://thegordian.blogspot.com Berlin, Germany Scale, Share and Store your Models with CDO 2.0 EclipseCon Talk, January 29, 2009
2
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 2 Business Objects Business Logic Input Persistence Logic.xml ResourceSet Output.dat
3
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 3 Business Objects Business Logic Input Persistence Logic.xml ResourceSet Output.dat
4
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 4 Scalability Distribution Transactions Queries Persistence Versioning CDO Model Repository Framework
5
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 5 Client 1 Client 2 Client 3 Model Repository Database
6
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 Model Repository 6 Database Package Registry Package Unit Store Store Accessors Chunk Readers MEM StoreDB StoreHibernate StoreObjectivity Store
7
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 7 Model Repository Database Package Registry Package Unit Store Package Unit Package Info EPackage Package Info TypeState
8
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 8 Model Repository Database Package Registry Revision Manager Package Unit Store 1 v1 23 4 v2 v3 v1 v2 v3 v2
9
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 9 Model Repository Database Package Registry Revision Manager Package Unit Store 1 v1 23 4 v2 v3 v1 v2 v3 v2 v3 Revision EClass CDOID int long eClass id version created revised Revision Data CDOID resourceID CDOID containerID int containerFeature Object[] values
10
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 10 Model Repository Database Package Registry Revision Manager Package Unit Store 1 v1 23 4 v2 v3 v1 v2 v3 v2
11
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 11 Model Repository Database Package Registry Revision Manager Store Commit Manager Notifcation Manager Query Manager / HandlersLock Manager Read / Write Access Handlers Session Manager Session 1Session 2Session 3
12
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 12 Model Repository Database Package Registry Revision Manager Store Commit Manager Notifcation Manager Query Manager / HandlersLock Manager Read / Write Access Handlers Session Manager Session 1Session 2Session 3
13
Server Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 13 Database Package Registry Revision Manager Store Commit Manager Notifcation Manager Query Manager / HandlersLock Manager Read / Write Access Handlers Session Manager Acceptor Channel Session 1Session 2Session 3 Protocol Connector
14
Server Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 14 Database Package Registry Revision Manager Store Commit Manager Notifcation Manager Query Manager / HandlersLock Manager Read / Write Access Handlers Session Manager Acceptor Channel Session 1Session 2Session 3 Protocol Connector
15
Server Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 15 Database Package Registry Revision Manager Store Commit Manager Notifcation Manager Query Manager / HandlersLock Manager Read / Write Access Handlers Session Manager Acceptor Channel Session 1Session 2Session 3 Protocol Connector
16
Client Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 16 Server Package RegistryRevision Manager Store Commit Manager Notifcation Manager Query Manager / HandlersLock Manager Read / Write Access Handlers Session Manager Acceptor Channel Session Protocol Connector Channel Connector Session Protocol
17
Client Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 17 Server Package RegistryRevision Manager Store Commit Manager Notifcation Manager Query Manager / HandlersLock Manager Read / Write Access Handlers Session Manager Acceptor Channel Session Protocol Connector Channel Connector Session Protocol
18
Session Protocol Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 18 Session Package Registry Revision Manager Package Unit 1 v1 23 4 v2 v3 v1 v2 v3 v2 Protocol View Transaction Audit 1 1 v2 v3 23 4 1 1100101001110111010010011110101110101 v4 11
19
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 19 Session Package Registry Revision Manager Package Unit 1 v1 v2 v3 1 v1 v2 Protocol View Transaction v3 Audit v3 1100101001110111010010011110101110101 v4 1 BookImpl Reflective Delegation String title int pages Category category Writer author Root Extends Class String title int pages Category category Writer author
20
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 20 Session Package Registry Revision Manager Package Unit 1 v1 v2 v3 1 v1 v2 Protocol View Transaction v3 Audit v3 1100101001110111010010011110101110101 v4 CDOObjectImpl CDOID id CDOState state CDOView view CDORevision revision Object[] settings Root Extends Class P E R S I S T E N T remote invalidate write commit read reload attach to view detach from view commit remote invalidate DIRTY PROXY CLEAN CONFLICT TRANSIENT NEW
21
Session Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 21 Session Package RegistryRevision Manager Protocol View Transaction Audit ResourceSet ? ? ? ? ?
22
Session Package Registry Transaction Session Package Registry Transaction Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 22 Session Package Registry Transaction ResourceSet View SetPackage Registry
23
Transaction Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 23 Transaction 1 2 3 4 5 1 2 3 4 1 2 3 4 5 ResourceSet Transaction Package RegistryView Set
24
Transaction Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 24 ResourceSet Transaction View Set
25
Transaction View Set Transaction View Set 123 Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 25 Transaction View Set XA Transaction 789456
26
Transaction View Set Transaction View Set 123 Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 26 Transaction View Set XA Transaction 789456 http://www.eclipse.org/cdo
27
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 27 Offline mode Checkout Re-sync Legacy model support Ecore UML 3rd party models OCL server-side As common query language For commit validation Model code server-side Custom data types (persistence) Operations (e.g. in OCL) Integrations GMF integration Workspace integration Team integration CDO Explorer
28
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 28 Opening Views, Audits and Transactions // Open multiple views on a session CDOView view = session.openView(); CDOAudit audit = session.openAudit(new Date("2009-01-19").getTime()); CDOTransaction transaction= session.openTransaction(); // Use own ResourceSet ResourceSet resourceSet = new ResourceSetImpl(); CDOTransaction transaction2= session.openTransaction(resourceSet); // Associate transactions with a distributed transaction CDOXATransaction xa = CDOUtil.createXATransaction(); xa.add(transaction.getViewSet()); xa.add(transaction2.getViewSet());
29
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 29 Structured Resources / Queries // Open CDO session and view CDOSession session = openSession(); CDOView view = session.openView(); // Navigate through the resource folder structure for (CDOResourceNode node : view.queryResources(null, "business", false)) { if (node instanceof CDOResourceFolder) { EList subNodes = ((CDOResourceFolder)node).getNodes(); } else { EList contents = ((CDOResource)node).getContents(); } } // Close the session when done session.close();
30
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 30 Explicit Locking CDOSession session = openSession(); CDOTransaction transaction = session.openTransaction(); transaction.setAutoReleaseLocksEnabled(true); // Lock a single object for writing CDOResource resource = transaction.getResource("/my/resource"); resource.cdoWriteLock().lock(); // Modify that object resource.getContents().add(new Company()); resource.getContents().add(new Company()); resource.getContents().add(new Company()); // Commit atomically and release all locks transaction.commit(); session.close();
31
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 31 Save Points CDOSession session = openSession(); CDOTransaction transaction = session.openTransaction(); // Create and populate a resource CDOResource resource = transaction.getOrCreateResource("/my/resource"); resource.getContents().add(new Customer()); resource.getContents().add(new Customer()); // Set save point, modify and rollback CDOSavepoint savepoint = transaction.setSavepoint(); resource.getContents().add(new Supplier()); resource.getContents().add(new Supplier()); transaction.rollback(savepoint); // Commit only the first changes (customers) transaction.commit(); session.close();
32
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 32 Passive Updates CDOSession session = openSession(); CDOView view = session.openView(); CDOResource resource = view.getResource("/my/resource"); // Decouple from passive updates session.options().setPassiveUpdateEnabled(false); for (EObject object : resource.getContents()) { Company company = (Company)object; // Work with local model… } session.refresh(); // Work with refreshed model… // Stay in sync from here session.options().setPassiveUpdateEnabled(true);
33
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 33 Change Subscriptions CDOSession session = openSession(); CDOView view = session.openView(); // Subscribe to repository for CDO adapters view.options().setChangeSubscriptionPolicy(CDOAdapterPolicy.CDO); // Define your CDO adapter class MyAdapter extends AdapterImpl implements CDOAdapter { @Override public void notifyChanged(Notification msg) { System.out.println("Modified remotely: " + msg.getNotifier()); } } // Attach your adapter to any object to trigger a particular subscription CDOResource resource = view.getResource("/my/resource"); resource.eAdapters().add(new MyAdapter());
34
Scale, Share and Store your Models with CDO 2.0 © 2009 by Eike Stepper, Berlin, Germany. Made available under the EPL v1.0 34 Query Framework CDOSession session = openSession(); CDOView view = session.openView(); // Create query CDOQuery query = view.createQuery("SQL", "SELECT cdoid FROM Company WHERE name LIKE ${name}"); query.setParameter("name", "Foo%"); query.setMaxResults(35); // Send query to server and iterate the result asynchronously for (Iterator it = query.getResultAsync(Company.class); it.hasNext()) { Company company = it.next(); System.out.println(company); } // Closing the view closes all open queries session.close();
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.