jpa the versant way
DESCRIPTION
TRANSCRIPT
![Page 1: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/1.jpg)
JPA the Versant Way
Jürgen BeckerViktor Dreiling
![Page 2: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/2.jpg)
Agenda
1. Versant 2. Big Data 3. Versant JPA 4. Java-Agent und Bytecode-Manipulation 5. Versant JPA Analytics Platform 6. Ingestion / Analytics Demo
![Page 3: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/3.jpg)
Versant
![Page 4: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/4.jpg)
Das Unternehmen
● Fokus auf Objektdatenbanken○ Datenbanken: VOD, DB4O, FastObjects
○ Schnittstellen: proprietär, JDO
● Kunden○ Verizon, Samsung, Ericsson, British Airways○ ...
![Page 5: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/5.jpg)
Big Data
![Page 6: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/6.jpg)
Ziele
● Große, komplexe Datenmengen○ Speicherung (Skalierbarkeit)
○ Analyse (Tools)
○ Zugriff (Standards)
![Page 7: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/7.jpg)
Architektur
![Page 8: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/8.jpg)
Architektur
Versant DB
![Page 9: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/9.jpg)
Architektur
Versant DB
![Page 10: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/10.jpg)
Architektur
Versant JPA Server
Versant JPA Analytics Platform Versant JPA (Client + Server)
![Page 11: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/11.jpg)
Versant JPA
![Page 12: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/12.jpg)
Versant JPA
● Client + Server○ Storage: Objektdatenbank
○ Subset des JPA Standards 2.0■ Kein ORM■ Anwendungsmodell = Datenbankmodell
○ Herstellerspezifische Erweiterungen■ Generic API, Indizes, Server Administration API
○ Fokus: Performance und einfache Benutzbarkeit
![Page 13: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/13.jpg)
Java-Agent und Bytecode-Manipulation
![Page 14: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/14.jpg)
Speichern einer Entity
Entity ?DB
![Page 15: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/15.jpg)
Beispiel Entity@Entitypublic class Attendee {
@Id private long id;private String firstName;
public String getFirstName() {return this.firstName;
}
public void setFirstName(String firstName) {this.firstName = firstName;
}}
![Page 16: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/16.jpg)
Entity Attribute
● JPA Spec: Feld muss mit private, protected oder package visibility deklariert werden
● Zugriff über getter / setter Methoden - JavaBean
● @Access(FIELD) oder @Access(PROPERTY)
![Page 17: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/17.jpg)
Entity Zustand
● Reflection / Dynamic Proxies ☹ ☹ ☹
● Bytecode-Manipulation ☺☺☺○ Build-time○ Run-time mit einem Agenten
![Page 18: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/18.jpg)
Bytecode Transformer
public class JPAClassTransformer implements ClassFileTransformer {
public byte[] transform(ClassLoader loader, String className, Class<?> clazz, ProtectionDomain domain, byte[] classfileBuffer) throws IllegalClassFormatException {
...}
}
![Page 19: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/19.jpg)
Java-Agent trifft Transformer
● MANIFEST.MFPremain-Class: com.versant.Agent
● public class Agent {public static void premain(String args, Instrumentation inst) {
inst.addTransformer(new JPAClassTransformer(args));}
}
● java -javaagent:<path>/versantjpa-agent.jar:<args>
![Page 20: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/20.jpg)
Bytecode-Manipulation
● ASM 4.0 Framework (http://asm.ow2.org/)
● Manipulation und Analyse
● Schnell und Stabil ☺☺☺
● 2 APIs○ Event / Visitor basiert ~ SAX Parser○ Objekt basiert ~ DOM
![Page 21: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/21.jpg)
Abfangen von Zugriffenpublic class FieldInterceptorsClassVisitor extends ClassVisitor {
public MethodVisitor visitMethod(int access, String name,String desc, String signature, String[] exceptions) {
...MethodVisitor mv = super.visitMethod(access, name, desc,
signature, exceptions);return new FieldInterceptorMethodVisitor(mv, ...);
}...
}
![Page 22: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/22.jpg)
Abfangen von Zugriffen (cont)
public class FieldInterceptorMethodVisitor extends MethodVisitor {public void visitFieldInsn(int opcode,String owner,String name,String desc) { ...
switch (opcode) {...case Opcodes.PUTFIELD:
super.visitMethodInsn(INVOKESTATIC, declaringClassName,"_vjpaInterceptWrite_" + name, methodTypeDescriptor);
return;}
}}
![Page 23: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/23.jpg)
Original Bytecode
public class Attendee extends Object {...private String firstName;
public void setFirstName(String); Code: 0: aload_0 1: aload_1 2: putfield #2; //Field firstName:String; 5: return...
![Page 24: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/24.jpg)
Enhanced Bytecode
public class Attendee extends Object { ...private String firstName;protected StateManager _vjpaStateManager;public void setFirstName(String); Code: 0: aload_0 1: aload_1 2: invokestatic #44; //Method
_vjpaInterceptWrite_firstName:(SimpleEntity;String;)V
5: return
![Page 25: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/25.jpg)
Enhanced Bytecode (cont)
public static void _vjpaInterceptWrite_firstName(SimpleEntity,String);
Code:...
30: invokeinterface #63, 2; //InterfaceMethodStateManager.markDirty:(I)V
35: aload_0 36: aload_1 37: putfield #52; //Field firstName:String; 40: return
![Page 26: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/26.jpg)
Agent + Bytecode-Manipulation
● Performance○ JIT Optimierung möglich
● Anwendungsmöglichkeiten○ Dynamic logging○ Method Tracing○ Class Generierung beim Testen○ ...
![Page 27: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/27.jpg)
Versant JPA Analytics Platform (TP)
![Page 28: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/28.jpg)
Komponenten
R-Integration
Hadoop Connector
Ingestion Server
Analytics Server
![Page 29: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/29.jpg)
Ingestion / R Demo
![Page 30: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/30.jpg)
http://community.versant.com/JPA.aspx
![Page 31: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/31.jpg)
Danke
● Fragen ?
● Kontakt○ [email protected]○ [email protected]
● http://community.versant.com/Forums.aspx
![Page 32: JPA the Versant Way](https://reader033.vdocuments.net/reader033/viewer/2022050905/54c416634a7959e9128b468f/html5/thumbnails/32.jpg)
Wir suchen Verstärkung !
Lust auf Analytics / Data Mining, Verteilte Anwendungen,Datenbank Systeme ?
Sehr gut in Java und/oder C/C++ ?