MCS 270 Spring 2014 Object-Oriented Software Development.

Slides:



Advertisements
Similar presentations
Google Web Toolkit (GWT) Steve Wargolet. Introduction Desktop client-server applications and their drawbacks. Static-only Web pages Introduction of Web.
Advertisements

MANIPULATING DATA

Internet Sellouts Final Presentation Enterprise Architecture Group.
Peoplesoft Fundamentals David Lewis 10/18/02 (adapted from Psoft Training Materials)
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Java Data Object Che-Rung Lee. JDO Objectives Transparent persistence Range of implementations  embedded (J2ME)  two tier (J2SE)  enterprise (J2EE,
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Session-02.
MCS 270 Spring 2014 Object-Oriented Software Development.
Platform as a Service (PaaS)
Google AppEngine. Google App Engine enables you to build and host web apps on the same systems that power Google applications. App Engine offers fast.
Google App Engine Google APIs OAuth Facebook Graph API
By: Devesh Sharma.  Why Cloud Computing? ◦ Traditional Business Applications  Expensive  Complicated  Difficult to manage  Idea behind Cloud Computing.
Amazon EC2 Quick Start adapted from EC2_GetStarted.html.
SENG 422 Lab 4 Cloud Computing Time: ELW B220 from (4:00 - 6:50) every Tuesday TA: Philip Baback Alipour Ph.D. Candidate in Electrical, Computer Engineering.
Google App Engine Danail Alexiev Technical Trainer SoftAcad.bg.
The Java Persistence API Edel Sherratt. Contents Revisit applications programming Using Java Persistence API.
Data Persistence and Object-Relational Mapping Slides by James Brucker, used with his permission 1.
Deploying Dynamics Applications Thomas Hansen – Director, appSolutions a|s
Object Persistence and Object-Relational Mapping James Brucker.
CSE446 S OFTWARE Q UALITY M ANAGEMENT Spring 2014 Yazılım ve Uyguluma Geliştirme Yöneticisi Orhan Başar Evren.
Training - Day 3 OJB. What is OR Mapping? OR Mapping is the mapping of relational database tables to objects (Java Objects in our case) Many OR Mapping.
Prof. A.R. Rele. What Is Google App Engine? Google App Engine lets users run web applications on Google's infrastructure. App Engine applications are.
Agenda What is Hibernate Spring Integration Questions Overview
Container-Managed Persistence (CMP) Entity Beans Lesson 3A / Slide 1 of 42J2EE Server Components Objectives In this lesson, you will learn to: Identify.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
J2EE Structure & Definitions Catie Welsh CSE 432
© 2012 Autodesk Implementing Cloud-Based Productivity Solutions with the AutoCAD® ObjectARX® API Ravi Krishnaswamy Senior Software Architect.
1 © 2008 Avaya Inc. All rights reserved. IPOffice Configuration Service Emil Ratnam.
MCS 270 Spring 2014 Object-Oriented Software Development.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
XML Registries Source: Java TM API for XML Registries Specification.
ILDG Middleware Status Chip Watson ILDG-6 Workshop May 12, 2005.
Chapter 6 Server-side Programming: Java Servlets
Hibernate Persistence. What is Persistence Persist data to database or other storage.  In OO world, persistence means persist object to external storage.
Hibernate 3.0. What is Hibernate Hibernate is a free, open source Java package that makes it easy to work with relational databases. Hibernate makes it.
Topic : Hibernate 2: Object Persistence and ORM Kaster Nurmukan.
July 7-11, 2003  Portland, Oregon JDO (Java Data Objects) What It Is And Why It Matters Ron Hitchens JavaPolis.
Server-side Programming The combination of –HTML –JavaScript –DOM is sometimes referred to as Dynamic HTML (DHTML) Web pages that include scripting are.
Sakai WebApp Structure
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
What is MySQL? MySQL is a relational database management system (RDBMS) based on SQL (Structured Query Language). First released in January, Many.
Ajax and the GWT. Ajax  Asynchronous JavaScript And XML  Technology behind interactive web sites  Provide smoother experience than conventional web.
Classes, Interfaces and Packages
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Chapter 3: Relational Databases
IS-907 Java EE Introduction to JPA. Java Persistence API A framework for using relational databases in Java programs mapping between tables and classes,
Java Object-Relational Layer Sharon Diskin GUS 3.0 Workshop June 18-21, 2002.
Creating Java Applications (Software Development Life Cycle) 1. specify the problem requirements - clarify 2. analyze the problem - Input? Processes? Output.
Google Code Libraries Dima Ionut Daniel. Contents What is Google Code? LDAPBeans Object-ldap-mapping Ldap-ODM Bug4j jOOR Rapa jongo Conclusion Bibliography.
Google App Engine using Java 1. Outline Getting started Guestbook example Todo example Simplified Madlib 2.
Using Datastore with JDO 1. Setting up DataNucleus Access Platform 2. JDO class enhancement 3. POJOs and JDO Annotations 4. PersistencyManager and its.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
OOPSLA Lab1 Chapter 7 Java Binding Prof. Hyoung-Joo Kim OOPSLA Lab. Dept. of Computer Engineering Seoul National University.
Google App Engine using Java 1. Outline Getting started Guestbook example Todo example Simplified Madlib 2.
Platform as a Service (PaaS)
Platform as a Service (PaaS)
Platform as a Service (PaaS)
Google App Engine Mandeep Singh (37926)
Google Web Toolkit Tutorial
Java Servlets By: Tejashri Udavant..
Platform as a Service Applications
Google App Engine B. Ramamurthy Based on the material available at
Google App Engine Danail Alexiev
Google App Engine Ying Zou 01/24/2016.
Developing and testing enterprise Java applications
CS4961 Software Design Laboratory Understand Aquila Backend
Java Object-Relational Layer
Presentation transcript:

MCS 270 Spring 2014 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Today’s schedule GWT Persistence - JDO MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Persistence Persistence is the ability of an object to survive the lifecycle of the process in which it resides. Objects that “die“ with the end of a process are called transient Web Apps - storage is primarily on the server side. (Cookies can be set on client, but not guaranteed to persist) CRUD - create, read, update and delete basics of persistence process MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Google Web Toolkit Storage Options Java Data Objects (JDO) A standardized way of storing objects Create an object, store it, load it later Java Persistence API (JPA) Another standardized way of storing objects JPA is basically a refinement of JDO As well supported in GAE as JDO MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu JDO Overview Java Data Objects (JDO) is a standard interface for storing objects containing data into a database. The standard defines interfaces for annotating Java objects, retrieving objects with queries, and interacting with a database using transactions MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu JDO Overview An application that uses the JDO interface can work with different kinds of databases without using any database-specific code, including relational databases, hierarchical databases, and object databases. Note: JDO is Not an object database May use conventional RDBMS, OODB, etc- datastore MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu JDO Overview MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Eclipse and JDO: GWT Plug-In: JDO and DataNucleus App Engine plugin JARs (datanucleus) placed in app's war/WEB-INF/lib/ directory. Build process performs post-compilation "enhancement" step on compiled data classes (PostData) to associate them with the JDO implementation. MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu PersistenceManager Web app interacts with JDO (Storage) using an instance of the PersistenceManager class. Use PersistenceManagerFactory to get PM. PersistenceManagerFactory instance takes time to initialize, – an app should reuse a single static instance. – to enforce this, an exception is thrown if the app instantiates more than one PersistenceManagerFactory MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Example – PMF.java MCS 270 Object-Oriented Software Development package edu.gac.mcs270.hvidsten.guslist.server; import javax.jdo.JDOHelper; import javax.jdo.PersistenceManagerFactory; public final class PMF { private static final PersistenceManagerFactory pmfInstance = JDOHelper.getPersistenceManagerFactory("transactions-optional"); private PMF() {} public static PersistenceManagerFactory get() { return pmfInstance; }

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Example – PMF class – used in GusListModel.java MCS 270 Object-Oriented Software Development public class GusListModel { static final PersistenceManagerFactory pmf = PMF.get();. }

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Defining Data Classes for Storage JDO is used to store plain Java data objects ("Plain Old Java Objects" or "POJOs") in the datastore. Each object made persistent with the PersistenceManager becomes an entity in the datastore. Code Annotations tell JDO how to store and recreate instances of your data classes. MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu MCS 270 Object-Oriented Software Development.java.class Java Compiler JDO Enhancer JDO MetaData (XML) Byte code enhancement

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Code Annotations PersistenceCapable - The interface that all persistent objects must implement. Annotated before class definition. Persistent – Designates that field of class will be stored PrimaryKey – Unique identifier of class Unowned – Designates an unowned 1-to-1 relationship (i.e. class that is a member of another class, but will not disappear when parent class disappears) MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu public class PostData implements // Needed for RPC communication of PostData class to = "datanucleus", key = "gae.encoded-pk", value = "true”) private String private String title="no private String private double price=0.0; MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Example (cont’d) // Need to define the Seller and Buyer as "Unowned" child objects, // as they do not disappear when PostData object private private Buyer buyer; ….. } MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Enabling Group Transactions Default JDO mode: one group stored (persisted) at one time. PostData has a child Seller that is unowned – different group. JDO configuration – can be set to allow more than one group (up to 5) to be stored in a single transaction, a so-called “cross-group” transaction. Add to src/META-INF/jdoconfig.xml MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Storing PersistenceCapable Object (GusListModel) public static void storePost(PostData post) { PersistenceManager pm = pmf.getPersistenceManager(); // Transactions lock all records in a datastore and keep them locked // until they are ready to commit their changes. try { pm.currentTransaction().begin(); pm.makePersistent(post); pm.currentTransaction().commit(); } finally { if (pm.currentTransaction().isActive()) pm.currentTransaction().rollback(); if (!pm.isClosed()) pm.close(); }} MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Reading PersistenceCapable Object (GusListModel) public static List getPostData() { PersistenceManager pm = pmf.getPersistenceManager(); Query query = pm.newQuery(PostData.class); List posts = (List ) query.execute(); // Child classes are loaded "lazily" - not until they are accessed. // To make sure they are loaded before the PersistenceManager closes, // we reference them here so they are forced to load. for(PostData post: posts){ post.getSeller(); post.getBuyer(); } return new ArrayList (posts); } MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Inspecting the Datastore After running an instance of the web app, go to to Browse through the data - The Full Key is shown GWT pug-in (Eclipse) generates persistence files in war directory MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu MCS 270 Object-Oriented Software Development

GUSTAVUS ADOLPHUS COLLEGEgustavus.edu Demo MCS 270 Object-Oriented Software Development