IRMIS3 Data Service and Application Layer Gabriele Carcassi Oct 14 2008.

Slides:



Advertisements
Similar presentations
18 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Introduction to Web Services.
Advertisements

REST Vs. SOAP.
REST Introduction 吴海生 博克软件(杭州)有限公司.
Web Service Ahmed Gamal Ahmed Nile University Bioinformatics Group
IRMIS3 Status Gabriele Carcassi 15 Oct IRMIS3 Status  This talk is about: what is currently downloadable from the website what is ready for production.
IRMIS Components Overview Gabriele Carcassi 18 April 2011.
AJAX Presented by: Dickson Fu Dimas Ariawan Niels Andreassen Ryan Dial Jordan Nielson CMPUT 410 University of Alberta 2006.
15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
Multiple Tiers in Action
Dynamic Web Pages Bert Wachsmuth. Review  Internet, IP addresses, ports, client-server, http, smtp  HTML, XHTML, XML  Style Sheets, external, internal,
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
Peoplesoft: Building and Consuming Web Services
Chapter 14 Database Connectivity and Web Technologies
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Mgt 240 Lecture Website Construction: Software and Language Alternatives March 29, 2005.
CS 415 N-Tier Application Development By Umair Ashraf July 6,2013 National University of Computer and Emerging Sciences Lecture # 9 Introduction to Web.
DEV-14: Understanding and Programming for the AppServer™
Web Application Architecture: multi-tier (2-tier, 3-tier) & mvc
UNIT-V The MVC architecture and Struts Framework.
Client/Server Architectures
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Copyright © cs-tutorial.com. Introduction to Web Development In 1990 and 1991,Tim Berners-Lee created the World Wide Web at the European Laboratory for.
DIRAC Web User Interface A.Casajus (Universitat de Barcelona) M.Sapunov (CPPM Marseille) On behalf of the LHCb DIRAC Team.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
REST.  REST is an acronym standing for Representational State Transfer  A software architecture style for building scalable web services  Typically,
TVAC Electronic Call Sheet System Team HeatWave Summer 2007.
Fundamentals of Database Chapter 7 Database Technologies.
Lecture 19 Web Application Frameworks Boriana Koleva Room: C54
IRMIS 2 Overview Andrew Johnson Computer Scientist, AES Controls.
National Center for Supercomputing Applications NCSA OPIE Presentation November 2000.
Csi315csi315 Client/Server Models. Client/Server Environment LAN or WAN Server Data Berson, Fig 1.4, p.8 clients network.
© 2006 IBM Corporation Agile Planning Web UI. © 2006 IBM Corporation Agenda  Overview of APT Web UI  Current Issues  Required Infrastructure  API.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 14 Database Connectivity and Web Technologies.
A FIRST TOUCH ON NOSQL SERVERS: COUCHDB GENOVEVA VARGAS SOLAR, JAVIER ESPINOSA CNRS, LIG-LAFMIA, FRANCE
HTML5 AND THE FUTURE JAVASCRIPT PLATFORM Marcelo Lopez Ruiz Senior Software Design Engineer Microsoft Corporation.
API Crash Course CWU Startup Club. OUTLINE What is an API? Why are API’s useful? What is HTTP? JSON? XML? What is a RESTful API? How do we consume an.
Kemal Baykal Rasim Ismayilov
CMap Version 0.16 Ben Faga. CMap CMap Version 0.16 Bug fixes and code optimizations More intuitive menu system Asynchronous loading of comparative map.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
AJAX and REST. Slide 2 What is AJAX? It’s an acronym for Asynchronous JavaScript and XML Although requests need not be asynchronous It’s not really a.
Institute for the Protection and Security of the Citizen HAZAS – Hazard Assessment ECCAIRS Technical Course Provided by the Joint Research Centre - Ispra.
Expense Tracking System Developed by: Ardhita Maharindra Muskan Regmi Nir Gurung Sudeep Karki Tikaprem Gurung Date: December 05 th, 2008.
Interstage BPM v11.2 1Copyright © 2010 FUJITSU LIMITED INTERSTAGE BPM ARCHITECTURE BPMS.
 Project Team: Suzana Vaserman David Fleish Moran Zafir Tzvika Stein  Academic adviser: Dr. Mayer Goldberg  Technical adviser: Mr. Guy Wiener.
IRMIS3 Status Gabriele Carcassi Oct Web tools architecture IRMIS DB (MySQL) Data service Java applets AJAX components Scripts and CLI (perl,
Open Solutions for a Changing World™ Eddy Kleinjan Copyright 2005, Data Access WordwideNew Techniques for Building Web Applications June 6-9, 2005 Key.
Technologies For Creating Rich Internet Applications Presenter's name
The Object-Oriented Thought Process Chapter 13
Understanding SOAP and REST calls The types of web service requests
Google Web Toolkit Tutorial
Data Virtualization Tutorial… CORS and CIS
AJAX and REST.
Unit – 5 JAVA Web Services
Server Concepts Dr. Charles W. Kann.
Introduction to Web Services and SOA
WEB API.
DWR: Direct Web Remoting
Lecture 1: Multi-tier Architecture Overview
ARCH-1: Application Architecture made Simple
$, $$, $$$ API testing Edition
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
Database Connectivity and Web Development
REST APIs Maxwell Furman Department of MIS Fox School of Business
RESTful Web Services.
Introduction to Web Services and SOA
WCF Data Services and Silverlight
Web Application Development Using PHP
Presentation transcript:

IRMIS3 Data Service and Application Layer Gabriele Carcassi Oct

Disclaimer The specifications are not final – parts are missing and there will be a certain amount of evolution on the part that exist – good time to participate The overall architecture and the guidelines, though, are stable – we will concentrate on those

IRMIS3 architecture IRMIS3 RDB (MySQL) IRMIS3 Data service Java applets AJAX components Scripts and CLI (perl, Python, …) Browser (Firefox, IE, …) XML protocol Web server (Glassfish)

Data service The architecture is your typical Service Oriented Architecture (SOA) and service is a Representational State Transfer Web Service (REST-WS) Allows to capture the business logic (all the rules that separate valid transactions from invalid transactions) in one place – Clients can be “stupid” Exposes the data in a well defined xml format – Allows the internals of the database to change – Allows to use any available xml tools

Data service: guidelines The service is responsible that all data modifications are valid and to always return valid information – It should fail to run invalid changes (i.e. installing a building in a room) – If it doesn’t, it’s a bug on the server – Note that valid != correct Service is stateless

XML protocol (REST style WS) IRMIS3 software stack Few database utilities: backup, consistency check, etc… Client Server Integration with external tools (i.e. physcs) 3 rd party Perl/Pyton scripts 3 rd party Java apps Jython scripts Web applications JavaScript bridge Applets and Widgets Java Client API Data Service layer Database layer

How you can interact with IRMIS3 Just use the GUI Run scripts that others develop Read the XML directly Write phyton/perl scripts that consume the XML Write Jython script using the API Develop your own GUI

XML protocol Few database utilities: backup, consistency check, etc… Client Server 3 rd party Java apps Jython scripts Web applications JavaScript bridge Applets and Widgets Java Client API Data Service layer Database layer

XML protocol An XML schema defines the elements and attribute used by the service. To read: each different query corresponds to a different web address. HTML parameters are used for query parameters. To write: send an XML which represent a transaction. Each element in the transaction is processed independently.

XML protocol: an Oscilloscope......

XML protocol: a transaction...

XML protocol guidelines Queries are designed to return “chunks” with related information – minimize roundtrips at the cost of repetition a componentType returns all the details of the ports, interfaces, manufacturers, etc… port information for a component returns all the ports, pins, portType, cables and conductors – more or less the opposite of a database query Transactions are executed in a single DB transaction No guarantee that the data you read wasn’t modified when you write (no “FOR UPDATE”) – Will provide the timestamp for the last modification

Testing the protocol

Demo Let’s have a look at the Data Service

Exercise Using the test interface – List the manufacturers (at /IRMISDataService/data/manufacturers) – Create a new manufacturers called “ACME” (schema documentation at /IRMISDataService) – List the manufacturers again – Delete manufacturer “ACME”

XML protocol (REST style WS) IRMIS software stack Few database utilities: backup, consistency check, etc… Client Server Integration with external tools (i.e. physcs) 3 rd party Perl/Pyton scripts Web applications JavaScript bridge Applets and Widgets Data Service layer Database layer

Java API: design principles The Java API implement the XML protocol and provides objects that represent the data All reads are cached: no need to keep caches in your code. All reads are synchronized – you can have reads on multiple threads on the same data and will not trigger multiple reads on the server (extremely useful for GUIs)

Java API design principles The read access is object oriented – Data is exposed through interfaces Component, ComponentType, Manufacturer – Some classes function as “finders” for the classes containing the data Components.getById(123), FormFactors.getByName(“Rack”) – You can follow references from one object to the other component.getComponentType().getManufacturer()

Java API design principles The write access is protocol oriented – You create a transaction – You call methods to add elements in the transaction Manufacturers.createManufacturer(transaction, “ACME”) – You save the transaction, which may fail – The read access is refreshed only after the data is saved

Importing components from Excel (using Jython) from gov.bnl.irmis.api import * from java.net import URI from java.io import File from jxl import * workbook = Workbook.getWorkbook(File(“components.xls")) sheet = workbook.getSheet(0) nRows = sheet.getRows() nColumns = sheet.getColumns() irmisDB = IrmisDB.getInstance(); irmisDB.setURI(URI(" transaction = irmisDB.createTransaction(); for row in range(1, nRows): componentTypeName = sheet.getCell(0, row).getContents(); componentType = ComponentTypes.getByName(componentTypeName); serialNumber = sheet.getCell(1, row).getContents(); Components.createComponent(transaction, componentType, serialNumber) transaction.save(); print "Operation successful"

Importing from Excel (Jython) from gov.bnl.irmis.api import * from java.net import URI from java.io import File from jxl import * workbook = Workbook.getWorkbook(File(“components.xls")) sheet = workbook.getSheet(0) nRows = sheet.getRows() nColumns = sheet.getColumns() irmisDB = IrmisDB.getInstance(); irmisDB.setURI(URI(" transaction = irmisDB.createTransaction(); for row in range(1, nRows): componentTypeName = sheet.getCell(0, row).getContents(); componentType = ComponentTypes.getByName(componentTypeName); serialNumber = sheet.getCell(1, row).getContents(); Components.createComponent(transaction, componentType, serialNumber) transaction.save(); print "Operation successful" Load excel file

Importing from Excel (Jython) from gov.bnl.irmis.api import * from java.net import URI from java.io import File from jxl import * workbook = Workbook.getWorkbook(File(“components.xls")) sheet = workbook.getSheet(0) nRows = sheet.getRows() nColumns = sheet.getColumns() irmisDB = IrmisDB.getInstance(); irmisDB.setURI(URI(" transaction = irmisDB.createTransaction(); for row in range(1, nRows): componentTypeName = sheet.getCell(0, row).getContents(); componentType = ComponentTypes.getByName(componentTypeName); serialNumber = sheet.getCell(1, row).getContents(); Components.createComponent(transaction, componentType, serialNumber) transaction.save(); print "Operation successful" Connect to the service

Importing from Excel (Jython) from gov.bnl.irmis.api import * from java.net import URI from java.io import File from jxl import * workbook = Workbook.getWorkbook(File(“components.xls")) sheet = workbook.getSheet(0) nRows = sheet.getRows() nColumns = sheet.getColumns() irmisDB = IrmisDB.getInstance(); irmisDB.setURI(URI(" transaction = irmisDB.createTransaction(); for row in range(1, nRows): componentTypeName = sheet.getCell(0, row).getContents(); componentType = ComponentTypes.getByName(componentTypeName); serialNumber = sheet.getCell(1, row).getContents(); Components.createComponent(transaction, componentType, serialNumber) transaction.save(); print "Operation successful" Loop over the rows

Importing from Excel (Jython) from gov.bnl.irmis.api import * from java.net import URI from java.io import File from jxl import * workbook = Workbook.getWorkbook(File(“components.xls")) sheet = workbook.getSheet(0) nRows = sheet.getRows() nColumns = sheet.getColumns() irmisDB = IrmisDB.getInstance(); irmisDB.setURI(URI(" transaction = irmisDB.createTransaction(); for row in range(1, nRows): componentTypeName = sheet.getCell(0, row).getContents(); componentType = ComponentTypes.getByName(componentTypeName); serialNumber = sheet.getCell(1, row).getContents(); Components.createComponent(transaction, componentType, serialNumber) transaction.save(); print "Operation successful" Get data out Create components

Demo Let’s browse the API documentation

Exercise Write a Java (or Jython, JRuby, Groovy, …) script that exports the components (id, Type name, Serial, FieldName) to an Excel file – API and documentation at /IRMISDataService – Use JXL from

XML protocol (REST style WS) Applets and javascript Few database utilities: backup, consistency check, etc… Client Server Integration with external tools (i.e. physcs) 3 rd party Perl/Pyton scripts 3 rd party Java apps Jython scripts Java Client API Data Service layer Database layer

Why applets?!? Especially given the bad history of applets, and the number of Web 2.0 javascript framework (jMaki, GWT, DOJO, DWR, …)? The code generated by these framework cannot be directly modified: you have to know the framework By providing you a Java API and applets, you can more easily develop on top: either by writing a couple of lines of javascript, or by integrating in a javascript framework

What we provide A set of Swing models to access the data – These models will be able to populate themselves asynchronously (some already can), so that no logic needs to be put in the GUI A set of Swing components – You are free to take these components and put them in your application A way to wrap these components in applets – So you can script on top of them with web pages

Scripting applets We had a summer student (Vikram Aravamudhan) write a general purpose library that allows to register javascript to Swing events

Scripting applets registerEvent(); function componentTypeChanged(res1) { document.getElementById('manufacturer').value = res1.getSource().getSelectedValue().getManufacturer().toString(); document.getElementById('description').value = res1.getSource().getSelectedValue().getDescription().toString(); document.getElementById('ffactor').value = res1.getSource().getSelectedValue().getFormFactor().toString(); document.getElementById('name').value = res1.getSource().getSelectedValue().getName(); } function registerEvent() { // The applet might not be ready when this function is called the first time. // If it fails, it retries after a second. try { document.applet1.registerEvent("valueChanged","componentTypeChanged"); } catch (ex) { setTimeout('registerEvent()', 1000); } The idea is that each IRMIS applet wraps around a JComponent, and you can register to the events that that component exposes.

Demo Let’s have a look at the documentation

Exercise Run the scripting example Modify the example to use the ComponentTreeApplet – Applet documentation at /IRMIS/ – Glassfish unpacks the application in glassfish/domains/domain1/applications/j2ee- modules/IRMISWebUI (This is a hack to get stuff done quickly here)