Copyright © 2002 Systek The Adapter Pattern Overview And Experience Report Johannes Brodwall, Systek AS.

Slides:



Advertisements
Similar presentations
15 Copyright © 2005, Oracle. All rights reserved. Adding User Interface Components and Event Handling.
Advertisements

SOAP.
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
XML in the real world (2) SOAP. What is SOAP? ► SOAP stands for Simple Object Access Protocol ► SOAP is a communication protocol ► SOAP is for communication.
SOAP SOAP is a protocol for accessing a Web Service. SOAP stands for Simple Object Access Protocol * SOAP is a communication protocol * SOAP is for communication.
SOAP Lee Jong-uk. Introduction What is SOAP? The features of SOAP The structure of SOAP SOAP exchange message model & message Examples of SOAP.
SOAP Quang Vinh Pham Simon De Baets Université Libre de Bruxelles1.
Java Programming, 3e Concepts and Techniques Chapter 4 Decision Making and Repetition with Reusable Objects.
MC365 XML Parsers. Today We Will Cover: An overview of the Java API’s used for XML processing Creating an XML document in Java Parsing an XML document.
By: Jeremy Smith.  Introduction  Droid Draw  Add XML file  Layouts  LinearLayout  RelativeLayout  Objects  Notifications  Toast  Status Bar.
ASHIMA KALRA.  INTRODUCTION TO JSP INTRODUCTION TO JSP  IMPLICIT OBJECTS IMPLICIT OBJECTS  COOKIES COOKIES.
Programming With Java ICS201 University Of Hail1 Chapter 12 UML and Patterns.
Networking Nasrullah. Input stream Most clients will use input streams that read data from the file system (FileInputStream), the network (getInputStream()/getInputStream()),
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
Christopher Paolini Computational Science Research Center College of Engineering San Diego State University Computational Science 670 Fall 2009 Monday.
Lesson 13: Building Web Forms Introduction to Adobe Dreamweaver CS6 Adobe Certified Associate: Web Communication using Adobe Dreamweaver CS6.
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
Aurora: A Conceptual Model for Web-content Adaptation to Support the Universal Accessibility of Web-based Services Anita W. Huang, Neel Sundaresan Presented.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Exlibris: Developers Meet Developers Feb. 1-2, 2010 Voyager To NUFinancials ( peoplesoft ) System ( for Invoice Payment ) Michael North Northwestern University.
XML for E-commerce III Helena Ahonen-Myka. In this part... n Transforming XML n Traversing XML n Web publishing frameworks.
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
SOAP Tutorial Ching-Long Yeh 葉慶隆 Department of Computer Science and Engineering Tatung University
Module 14: WCF Send Adapters. Overview Lesson 1: Introduction to WCF Send Adapters Lesson 2: Consuming a Web Service Lesson 3: Consuming Services from.
Presentation: SOAP in a distributed object framework, Application Servers & AXIS SOAP.
17 Apr 2002 XML Programming - DOM Andy Clark. DOM Design Premise Derived from browser document model Defined in IDL – Lowest common denominator programming.
Integration Broker PeopleTools Integration Broker Steps –Introduction & terminologies –Application Server PUB/SUB services (Application Server)
James Holladay, Mario Sweeney, Vu Tran. Web Services Presentation Web Services Theory James Holladay Tools – Visual Studio Vu Tran Tools – Net Beans Mario.
Web Server Administration Web Services XML SOAP. Overview What are web services and what do they do? What is XML? What is SOAP? How are they all connected?
Mobile Computing Lecture#11 Adapters and Dialogs.
© 2010 Delmar, Cengage Learning Chapter 8 Collecting Data with Forms.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
Swing, part 2 Tutorial 07 1 / 31 Leonid Barenboim 25/4/2010.
WEB BASED DATA TRANSFORMATION USING XML, JAVA Group members: Darius Balarashti & Matt Smith.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
Software Engineering Design Patterns. Singleton Single instance of class Constructor is private static final Class instance constructed when application.
Trees CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Chapter 12 Support for Object oriented Programming.
JTree javax.swing.tree javax.swing.event. Components JTree and JTable COMPONENT – Model – Selection Model – Editor – Renderer.
How does a simple protocol like the protocol SMTP work 1. open telnet & do remote login in to the system you want to send to.
Compliance Test Language (CTL) Chuck Morris Northrop Grumman.
Advanced Java Session 4 New York University School of Continuing and Professional Studies.
 defined as Extensible Markup Language (XML) is a set of rules for encoding documents  Defines structure and data.
עקרונות תכנות מונחה עצמים תרגול 8: MVC. Outline  MVC  Using the default models  Example- File Browser.
.NET Mobile Application Development XML Web Services.
Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.
MINIX Presented by: Clinton Morse, Joseph Paetz, Theresa Sullivan, and Angela Volk.
Presented By:. What is JavaHelp: Most software developers do not look forward to spending time documenting and explaining their product. JavaSoft has.
Review IS Overview: Data  Inside the application Collections  Outside the application Database XML  Getting/displaying Swing  Communicating.
USING ANDROID WITH THE DOM. Slide 2 Lecture Summary DOM concepts SAX vs DOM parsers Parsing HTTP results The Android DOM implementation.
Hybris Payment Integration
Spell Checker web service (you build a web client that interacts with the service) The client uses a servlet class and a JSP page. The user passes information.
SOAP, Web Service, WSDL Week 14 Web site:
Live Project Based Industrial Training SSDN Technologies Pvt. Ltd. Call Us: /
21-Jun-16 Document Object Model DOM. SAX and DOM SAX and DOM are standards for XML parsers-- program APIs to read and interpret XML files DOM is a W3C.
XML 1.Introduction to XML 2.Document Type Definition (DTD) 3.XML Parser 4.Example: CGI Gateway to XML Middleware.
USING ANDROID WITH THE INTERNET. Slide 2 Lecture Summary Getting network permissions Working with the HTTP protocol Sending HTTP requests Getting results.
Advanced Swing Trees. Contents I.Introduction to Trees II. Simple Trees III. Editing Trees and Tree Paths IV. Node Enumeration V. Rendering Nodes VI.
Message Handling in MFC
“Form Ever Follows Function” Louis Henri Sullivan
Outline SOAP and Web Services in relation to Distributed Objects
Advanced Swing Trees.
Outline SOAP and Web Services in relation to Distributed Objects
Data Modeling II XML Schema & JAXB Marc Dumontier May 4, 2004
Processing XML.
AJAX Robin Burke ECT 360.
עקרונות תכנות מונחה עצמים תרגול 8: MVC
Java Lesson 36 Mr. Kalmes.
Presentation transcript:

Copyright © 2002 Systek The Adapter Pattern Overview And Experience Report Johannes Brodwall, Systek AS

Copyright © 2002 Systek Contents Introduction to the adapter pattern A DOM to JTree adapter A logical to physical presentation adapter A gateway Lessons learned

Copyright © 2002 Systek Why adapter It’s simple It appears in most programs It’s the pattern I have identified in the most number of instances in my work

Copyright © 2002 Systek What is an adapter? Add an interface implementation in front of an existing class Adapt an existing class to a new environment

Copyright © 2002 Systek DOM to JTree Adapt W3C DOM XML Tree model to Java JTree interface The full code for this example is available at /johannes/code/ /johannes/code/

Copyright © 2002 Systek Code Highlights public class DomTreeModel implements javax.swing.tree.TreeModel { public Object getChild(Object parent, int index) { return((Node)parent).getChildNodes().item(index); } public int getIndexOfChild(Object parent, Object child) { NodeList children = ((Node)parent).getChildNodes(); for ( int i=0; i<children.getLength(); i++ ) if ( children.item(i).equals(child) ) return i; return -1; } public void setRoot(TreeNode newRoot) { throw new UnsupportedOperationException("DomTreeModel controls its own root!"); } public void addTreeModelListener(TreeModelListener listener) {} org.w3c.dom.Document document; }

Copyright © 2002 Systek What is m-Commerce? Commerce Server Merchant Financial Institution Customer

Copyright © 2002 Systek Telenor m-Commerce Different kinds of user channels: SMS users – communicate through an SMS Gateway STK Dialog uses – communicate through a Wireless Information Gateway All user channels should be able to implement the following: Send an offer to purchase an item Receive an answer Send a receipt Send an error This our Adapter Target interface

Copyright © 2002 Systek Adapter: UserConnection

Copyright © 2002 Systek Adapter: UserConnection sendOffer(String text, String callbackId) Sent by SMS or STK Dialog If SMS: “Send OK to … to accept” If STK Dialog: Presented as menus sendReceipt(String text) If STK: Send message “Receipt will come as SMS” Send Receipt as SMS sendError(String text) If STK: Present error in STK If SMS: Send SMS to user

Copyright © 2002 Systek Example II: Gateway Problem: Not all merchants were happy with the Commerce Server interface For some merchants, we implemented a custom adapter for them The Target interface is chosen by merchant to be one that would work better with them The Adaptee is the Commerce Server interface

Copyright © 2002 Systek Adaptee: Commerce Server interface HTTP GET with arguments as HTTP parameters First: Final Offer Sends offer to user Blocks until user answers Second: Receipt Issue Sends receipt to user Verifies that merchant has accepted payment

Copyright © 2002 Systek Target interface HTTP Post with XML documents Asynchronous Implicit receipt Possible rollback after the fact No rollback from merchant means confirm

Copyright © 2002 Systek The Adapter

Copyright © 2002 Systek Lessons learned Adapter is very useful and very common The Target interface does not need to support the same time constrains as the Adoptee The Adapter pattern applies on several logical levels Individual classes Internal module divisions Standalone processes

Copyright © 2002 Systek Lessons from the DOMTreeAdapter Three options Populate an entirely new JTree Adapt org.w3c.dom.Node to javax.swing.tree.TreeNode Adapt org.w3c.dom.Document to javax.swing.tree.TreeModel Node – TreeNode adaption seemed best at first, but Document – TreeModel turned out to be the best

Copyright © 2002 Systek Mapping Hierarchies Very hard to go from Adaptee hierarchy back to Adapter hierarchy What should treechild1.getParent() return?