Distributed Object Computing and Java

75
CSE298 CSE300 CSE.RU-1.1 Distributed Object Computing Distributed Object Computing and Java and Java Wei Lin, Xu Ma Walter McClure, Chengzhong Wang Computer Science & Engineering Department The University of Connecticut 191 Auditorium Road, Box U-155 Storrs, CT 06269-3155 {weilin,xma,czwang}@engr.uconn.edu [email protected]

description

Distributed Object Computing and Java. Wei Lin, Xu Ma Walter McClure, Chengzhong Wang Computer Science & Engineering Department The University of Connecticut 191 Auditorium Road, Box U-155 Storrs, CT 06269-3155. {weilin,xma,czwang}@engr.uconn.edu [email protected]. Motivation. - PowerPoint PPT Presentation

Transcript of Distributed Object Computing and Java

Page 1: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.1

Distributed Object Computing and JavaDistributed Object Computing and Java

Wei Lin, Xu MaWalter McClure, Chengzhong Wang

Computer Science & Engineering DepartmentThe University of Connecticut

191 Auditorium Road, Box U-155Storrs, CT 06269-3155

{weilin,xma,czwang}@[email protected]

Page 2: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.2

MotivationMotivation

Distributed Object ComputingDistributed Object Computing Interaction Among Various Components Large-scale Software Systems Over

Heterogeneous Platforms and Networks Java is an Excellent Candidate to Implement Java is an Excellent Candidate to Implement

Distributed SystemsDistributed Systems Java Features Support DOCJava Features Support DOC

Middleware and Distributed Architectures Enterprise JavaBeans Database Support Java and XML and more...

Page 3: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.3

ObjectivesObjectives

Investigate the Current State of the Art of Java in Support of DOC

Focus on Java Support of Enterprise Computing Interoperability of Servers, databases, COTs,

and Legacy Applications Commercial Products

Explore and Predict the future with Respect to emerging and potential tools and technologies

Page 4: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.4

Overview of PresentationOverview of Presentation

Distributed ComputingDistributed Computing Middleware and Distributed ArchitecturesMiddleware and Distributed Architectures

Survey of Distributed Architectures CORBA

– IIOP

RMI JavaSpaces

XML and JavaXML and Java Java Database SupportJava Database Support

JDBC SQLJ embedded SQL Object-relational Mapping (ODMG Java Binding)

Enterprise JavaBeansEnterprise JavaBeans

Conclusions and Future ResearchConclusions and Future Research

Page 5: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.5

Why Distributed ApplicationsWhy Distributed Applications

Evolution of Current SystemsEvolution of Current Systems First there were Mainframes

Hierarchical Databases and Dumb Terminals All software was monolithic

– User Interface, Business Logic, and Data access were all combined together into single application.

Client/Server Architecture(Two-tier) GUI would reside on client, Database on server,

and business logic on client, server, or both. Client/Server(Multi-tier)

Further separates application layers into components.

Shields client from changes to other parts of system

Page 6: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.6

Next Step: Distributed SystemsNext Step: Distributed Systems

Brings Concept of Multi-Tier Client/Server Systems to Brings Concept of Multi-Tier Client/Server Systems to Natural Conclusion:Natural Conclusion: Business Logic and Data Access are no longer

differentiated. Functionality of application is exposed as objects. Can interact with other objects in that system as well as other

systems. Furnishes Utmost FlexibilityFurnishes Utmost Flexibility

Communication is constrained by component interface definitions. Specify functionality and implementations of that functionality. Implementations can be altered significantly without affecting

other components throughout the system.

Page 7: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.7

Why Distributed ComputingWhy Distributed Computing

Continues evolution of computer systems from Continues evolution of computer systems from multi-tier client/server architectures.multi-tier client/server architectures. Improves concurrency through connectivity

and internetworking. Replication of systems will produce more

reliable and available applications. Scalability and portability will be amplified by

modularity. Dynamic configuration and reconfiguration of

the applications will help extend them throughout the enterprise.

System itself becomes more effective by availability of open systems and shared resources.

Page 8: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.8

Why Distributed ComputingWhy Distributed Computing

Continues evolution of computer systems from Continues evolution of computer systems from multi-tier client/server architectures.multi-tier client/server architectures. Distribute related processing among multiple

resources. Decentralizes nature of the enterprise.

Processing power is no longer central, but spread over the network.

Heterogeneous environments pose challenge to software components of system to exploit their power. Distributed computing offers software to use full

potential of the enterprise.

Page 9: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.9

Java and Distributed Object ComputingJava and Distributed Object Computing

Java’s extensibility and affinity for the Internet Java’s extensibility and affinity for the Internet and networking technologies makes it ideal to and networking technologies makes it ideal to develop distributed applications.develop distributed applications.

Programming models offered by Java technology Programming models offered by Java technology offer platforms to develop simpler and more offer platforms to develop simpler and more powerful applications.powerful applications. Java can be used to develop applications in

heterogeneous and homogeneous environments.

Extensions can be built on top of current Java architectures to leverage the technology with current systems in place.

New systems built on top of Java technologies offer robust, dynamic, and scalable solutions.

Page 10: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.10

Distributed Object Computing and JavaDistributed Object Computing and Java

Middleware and Architectures for Middleware and Architectures for Distributed SystemsDistributed Systems

Page 11: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.11

CORBACORBA

Common Object Request Broker ArchitectureCommon Object Request Broker Architecture Facilitates communication of application Facilitates communication of application

components and objects across a distributed, components and objects across a distributed, heterogeneous environment. heterogeneous environment. Language and platform independent. Interfaces are defined for objects across the

network. Provide interoperability for other objects

communicating with them. Objects across the network are passed by

reference. Underlying functionality of architecture

provided through the Object Request Broker.

Page 12: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.12

Object Request Broker(ORB)Object Request Broker(ORB)

Facilitates the client/server relationship between Facilitates the client/server relationship between components and their objects.components and their objects. All communication among distributed

components handled by ORB. Comprises all mechanisms needed to:

– Find and identify objects across the system.

– Manage connections of various components across the network.

– Monitor the delivery of data.

Provides transparency to the users of objects in the application.

Translate all parameters into format for transportation. -Process of marshaling and unmarshaling.

Page 13: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.13

Object Requests to other ObjectsObject Requests to other Objects

ORB finds object being referenced. The client has no knowledge of where the object resides.Reference to that object is passed back to the client where the method is invoked.

Client

ORB

Object Reference to Server

Orb finds server

ORB

Server

Network

Client invokes method on that reference which in turn invokes it on the server. The ORB marshals and unmarshals the parameters as shown.

Client

ORB

Method Invocation

ORB

Server

Network

Method Invocation

Unmarshall ParametersMarshall Parameters

ORB returns value in marshaled form which is then unmarshaled for by the client’s ORB

Client

ORB

Object Reference to Server

ORB

Server

Network

Marshall Return ValueUnmarshall Return Value

Page 14: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.14

Interface Definition Language(IDL)Interface Definition Language(IDL)

When a client makes a request on an object When a client makes a request on an object methods supported by that object must be known.methods supported by that object must be known. IDL defines interfaces; thus interactions

between application components. Provides basic framework for outlining the

objects handled by the ORB. Interface determines types of requests that can

be made on the object. Compiled IDL code generates client stubs and Compiled IDL code generates client stubs and

server skeletons.server skeletons. Stubs and skeletons map IDL interface

specifications to language specific implementations of those interfaces.

Page 15: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.15

Object AdaptersObject Adapters

Object adapters interface a component’s Object adapters interface a component’s implementation with its ORB.implementation with its ORB. Common set of operations for accessing ORB. Connect CORBA objects and ORB itself. Maps interface of a called object to the expected

interface of the client. Register CORBA objects and create object

references to those objects. Object Adapters sanction the diversity of objects Object Adapters sanction the diversity of objects

and implementations that can be developed and implementations that can be developed throughout the CORBA architecture.throughout the CORBA architecture. Ensures to keep ORB as simple as possible. Without OAs, variety of objects that could

interface with ORB would be very limited.

Page 16: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.16

Internet Inter-Orb Protocol(IIOP)Internet Inter-Orb Protocol(IIOP)

The different ORBs in use need a standard protocol The different ORBs in use need a standard protocol to communicate over.to communicate over.

The General Inter-Orb Protocol(GIOP) is a The General Inter-Orb Protocol(GIOP) is a collection of message requests ORBs can make collection of message requests ORBs can make over a network.over a network.

Adherence to this standard ensures ORBs from Adherence to this standard ensures ORBs from different vendors will be able to interoperate.different vendors will be able to interoperate.

The GIOP was mapped to TCP/IP to create the The GIOP was mapped to TCP/IP to create the Internet Inter-Orb Protocol.Internet Inter-Orb Protocol. Maps GIOP connections to TCP/IP sockets. Allows ORBs to use Internet as backbone. Transport protocol which allows other

architectures to interface with CORBA applications, i.e. Java RMI

Page 17: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.17

Extending CORBA’s FunctionalityExtending CORBA’s Functionality

Additional functionality is needed to build upon Additional functionality is needed to build upon the ORB and object adapters to create enterprise-the ORB and object adapters to create enterprise-class-distributed applications.class-distributed applications.

The OMG provides interfaces through which the The OMG provides interfaces through which the additional functionality is offered.additional functionality is offered. Implementations of these services is up to the

vendors. CORBAservices and CORBAfacilities provide CORBAservices and CORBAfacilities provide

additional horizontal and vertical functionality to additional horizontal and vertical functionality to the CORBA architecture.the CORBA architecture. CORBAservices are useful to all applications. CORBAfacilities provides general facilities

and specialized facilities.

Page 18: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.18

CORBA and JavaCORBA and Java

Creating CORBA applications with Java will Creating CORBA applications with Java will require a Java enabled ORB as well as an IDL require a Java enabled ORB as well as an IDL compiler.compiler. Java IDL is an ORB available by SUN for

CORBA applications idl2java compiler will map an IDL interface to

generate client stubs and server skeletons in Java.

Java fits well with CORBA due to architectural Java fits well with CORBA due to architectural similarities.similarities. CORBA’s module construct is analogous to

Java’s package construct. CORBA use of interfaces directly corresponds

with that of Java

Page 19: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.19

CORBA and JavaCORBA and Java

Creating CORBA applications with Java will Creating CORBA applications with Java will require a Java enabled ORB as well as an IDL require a Java enabled ORB as well as an IDL compiler.compiler. Java IDL is an ORB available by SUN for

CORBA applications idl2java compiler will map an IDL interface to

generate client stubs and server skeletons in Java.

Java fits well with CORBA due to architectural Java fits well with CORBA due to architectural similarities.similarities. CORBA’s module construct is analogous to

Java’s package construct. CORBA use of interfaces directly corresponds

with that of Java

Page 20: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.20

Java RMIJava RMI

Simple and direct model for distributed computing.Simple and direct model for distributed computing. Java-to-Java distributed solution.Java-to-Java distributed solution. Three layer architecture.Three layer architecture.

Stubs/Skeletons: Client side stubs and server side skeletons

Remote reference layer: Reference/invocation behavior.

Transport: Connection set up and management and remote object tracking.

Boundary at each layer is defined by a specific Boundary at each layer is defined by a specific interface and protocol.interface and protocol. Each layer can be replaced by an alternate

implementation without affecting other layers in the system.

Page 21: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.21

Java RMIJava RMI

RMI can pass full objects as arguments and return RMI can pass full objects as arguments and return values.values.

RMI can move class implementations from client RMI can move class implementations from client to server and server to client. to server and server to client.

Ability to pass behavior.Ability to pass behavior.

Building distributed applications isa four step process.

•Define interfaces to remote objects.

•Implement remote objects.

•Run rmic on remote implementation classes.

•Make code network accessible.

Page 22: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.22

Passing BehaviorPassing Behavior

Ability to move behavior(class implementations) Ability to move behavior(class implementations) across the network provides maximum flexibility.across the network provides maximum flexibility. Changing server policies would only require one

new Java class to be installed on on server. Example: Server Defined PolicyExample: Server Defined Policy

Suppose a current application enforces specific policies. Client could upload behavior from the server with a

simple method call. Client receives implementation and offloads

processing to client. Ability to pass objects by value optimizes Ability to pass objects by value optimizes

distributed architecture. Much of the processing for distributed architecture. Much of the processing for applications can occur locally. applications can occur locally.

Page 23: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.23

Transport ProtocolsTransport Protocols

Original protocol which RMI operated over was Original protocol which RMI operated over was the Java Remote Method Protocol(JRMP).the Java Remote Method Protocol(JRMP).

Addition of IIOP to RMI transport protocols Addition of IIOP to RMI transport protocols enabled architecture to interface with CORBA enabled architecture to interface with CORBA objects. objects.

Page 24: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.24

Extensions on top of Java RMIExtensions on top of Java RMI

New interfaces that sit on top of Java RMINew interfaces that sit on top of Java RMI LeasingLeasing

Allows Java objects to negotiate and establish contracts with each other for the use of its resources. Enhances reliability and fault tolerance by

providing a means for Java objects to react to failures in the system.

TransactionsTransactions Support consistency over a set of operations

between participating objects. Operations can be grouped to guarantee completion

of all or none.

Page 25: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.25

Extensions on top of Java RMIExtensions on top of Java RMI

Distributed EventsDistributed Events Provide a system for objects to register to be

notified when state changes of objects occur. Enables reliable event-based programming in

distributed applications.

Page 26: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.26

JavaSpacesJavaSpaces

Unified mechanism for dynamic communication, Unified mechanism for dynamic communication, coordination, and sharing of objects between Java-coordination, and sharing of objects between Java-based network resources such as clients and based network resources such as clients and servers.servers. No need to track client, server, or intermediate

associations of objects by requester or provider. Full objects can be stored as entries into the

space. Simplifies creating distributed applications. Can be used with existing software infra-

structures. Decouples the providers and requestors of network Decouples the providers and requestors of network

services by delivering a unified space for sharing, services by delivering a unified space for sharing, communication, and coordination.communication, and coordination.

Page 27: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.27

JavaSpacesJavaSpaces

JavaSpaces acts like dynamic networked JavaSpaces acts like dynamic networked marketplace for distributed objects.marketplace for distributed objects.

A JavaSpaces server holds entries.A JavaSpaces server holds entries. An entry is a typed group of objects.

Page 28: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.28

Goals of JavaSpaces TechnologyGoals of JavaSpaces Technology

Simple programming interface.Simple programming interface. Easier development using less code.Easier development using less code. One simple interface can be used for sharing, One simple interface can be used for sharing,

cooperation, and communication of objects.cooperation, and communication of objects. Legacy interoperability.Legacy interoperability. Objects can be stored as data and behavior.Objects can be stored as data and behavior. Network resources can communicate Network resources can communicate

asynchronously.asynchronously. Multiple implementations are possible, including Multiple implementations are possible, including

database connectivity.database connectivity. Service implementations will be transparent. All Service implementations will be transparent. All

entries will operate in the same manner.entries will operate in the same manner.

Page 29: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.29

JavaSpaces: Stock Trading ExampleJavaSpaces: Stock Trading Example

Stock trading system would exchange entries Stock trading system would exchange entries containing stocks, owners, bids, quantities, containing stocks, owners, bids, quantities, portfolio, and live feed and graphic applets.portfolio, and live feed and graphic applets. Seller places entry in the space and requests to

be notified when there is an interested buyer. Anonymous buyers read for stocks that are

attractive to them. Buyer determines to buy a stock and places a bid

entry. Seller is notified that bid entry has been placed.

Seller could send code to buyer to complete the Seller could send code to buyer to complete the purchase.purchase.

This example could be extended greatly using This example could be extended greatly using leases, transactions, and distributed events.leases, transactions, and distributed events.

Page 30: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.30

Distributed Persistence and Distributed Distributed Persistence and Distributed AlgorithmsAlgorithms

JavaSpaces is to help address these two issues.JavaSpaces is to help address these two issues. Distributed PersistenceDistributed Persistence

Provides ability to store related objects and retrieve them based on value-matching lookup for specific fields.

Distributed AlgorithmsDistributed Algorithms Can be modeled as a flow of objects between

participants. Different from traditional distributed architectures

which is to create method-call-like protocols . JavaSpaces implements “flow of objects”

Protocols are based on the movement of objects in and out of JavaSpaces implementation

Page 31: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.31

JavaSpacesJavaSpaces

JavaSpaces is a way of building distributed JavaSpaces is a way of building distributed systems.systems.

The requestor and provider of network services The requestor and provider of network services can be decoupled by using objects exchanged in can be decoupled by using objects exchanged in one or more spaces.one or more spaces.

Technology provides reliable distributed storage Technology provides reliable distributed storage for the objects in the system.for the objects in the system.

Page 32: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.32

What is XML?What is XML?

XML stands for Extensible Markup Language, XML stands for Extensible Markup Language, which is a subset of SGMLwhich is a subset of SGML

Different between XML and HTMLDifferent between XML and HTML HTML is a markup language; XML is a meta

language, which can be used to define markup language.

HTML defines presentation structure; XML defines data structure

Page 33: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.33

XML 1.0XML 1.0

W3C Recommendation 2/10/98W3C Recommendation 2/10/98 XML DocumentsXML Documents

Logical structure: properly nested elements Physical structure: properly nested entities

Well-formed XML DocumentsWell-formed XML Documents Valid XML DocumentsValid XML Documents BNFBNF

document ::= prolog element Misc*document ::= prolog element Misc*prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?doctypedecl ::= ‘<!DOCTYPE’ S Name (S ExternalID)? S? (‘[‘doctypedecl ::= ‘<!DOCTYPE’ S Name (S ExternalID)? S? (‘[‘

(markupdecl | PEReference | S)* ‘]’ S?)? ‘>’(markupdecl | PEReference | S)* ‘]’ S?)? ‘>’markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NOtationDecl | PI | Commentmarkupdecl ::= elementdecl | AttlistDecl | EntityDecl | NOtationDecl | PI | Commentelement ::=EmptyElemTag | Stag content Etagelement ::=EmptyElemTag | Stag content Etag

Page 34: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.34

DTD - Document Type DefinitionDTD - Document Type Definition

document type definition contains markup document type definition contains markup declarations that provide a grammar for a class of declarations that provide a grammar for a class of documents. This grammar is known as a document documents. This grammar is known as a document type definition, or DTD.type definition, or DTD. Element type declaration Attribute-list declaration Entity declaration Notation declaration

Page 35: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.35

XML Document Example - DTDXML Document Example - DTD

<!-- DTD for Shakespeare J. Bosak 1994.03.01, 1997.01.02 --><!-- Revised for case sensitivity 1997.09.10 --><!-- Revised for XML 1.0 conformity 1998.01.27 (thanks to Eve Maler) -->

<!-- <!ENTITY amp "&#38;#38;"> --><!ELEMENT PLAY (TITLE, FM, PERSONAE, SCNDESCR, PLAYSUBT, INDUCT?,

PROLOGUE?, ACT+, EPILOGUE?)><!ELEMENT TITLE (#PCDATA)><!ELEMENT FM (P+)><!ELEMENT P (#PCDATA)><!ELEMENT PERSONAE (TITLE, (PERSONA | PGROUP)+)><!ELEMENT PGROUP (PERSONA+, GRPDESCR)><!ELEMENT PERSONA (#PCDATA)><!ELEMENT GRPDESCR (#PCDATA)><!ELEMENT SCNDESCR (#PCDATA)><!ELEMENT PLAYSUBT (#PCDATA)><!ELEMENT INDUCT (TITLE, SUBTITLE*, (SCENE+|(SPEECH|STAGEDIR|SUBHEAD)+))><!ELEMENT ACT (TITLE, SUBTITLE*, PROLOGUE?, SCENE+, EPILOGUE?)><!ELEMENT SCENE (TITLE, SUBTITLE*, (SPEECH | STAGEDIR | SUBHEAD)+)><!ELEMENT PROLOGUE (TITLE, SUBTITLE*, (STAGEDIR | SPEECH)+)><!ELEMENT EPILOGUE (TITLE, SUBTITLE*, (STAGEDIR | SPEECH)+)><!ELEMENT SPEECH (SPEAKER+, (LINE | STAGEDIR | SUBHEAD)+)><!ELEMENT SPEAKER (#PCDATA)><!ELEMENT LINE (#PCDATA | STAGEDIR)*><!ELEMENT STAGEDIR (#PCDATA)><!ELEMENT SUBTITLE (#PCDATA)><!ELEMENT SUBHEAD (#PCDATA)>

Page 36: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.36

XML Document Example - DataXML Document Example - Data

<?xml version="1.0"?><!DOCTYPE PLAY SYSTEM "play.dtd">

<PLAY><TITLE>The Tragedy of Richard the Third</TITLE>

<FM><P>Text placed in the public domain by Moby Lexical Tools, 1992.</P><P>SGML markup by Jon Bosak, 1992-1994.</P><P>XML version by Jon Bosak, 1996-1998.</P><P>This work may be freely copied and distributed worldwide.</P></FM>

<PERSONAE> ...</PERSONAE>

<SCNDESCR>SCENE England.</SCNDESCR>

<PLAYSUBT>KING RICHARD III</PLAYSUBT>

<ACT><TITLE>ACT I</TITLE> ...</ACT>......</PLAY>

Page 37: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.37

DOM - Document Object ModelDOM - Document Object Model

An application programming interface for HTML An application programming interface for HTML and XML documentsand XML documents

Language-independent specification: defined in Language-independent specification: defined in OMG IDLOMG IDL

Language bindings for Java and ECMAScriptLanguage bindings for Java and ECMAScript HTML or XML document <-> object treeHTML or XML document <-> object tree DOM (Core) Level1 and DOM (HTML) Leve1DOM (Core) Level1 and DOM (HTML) Leve1

Page 38: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.38

The DOM Structure ModelThe DOM Structure Model

Interface Node and NodeListInterface Node and NodeList Derived interfacesDerived interfaces

Document DocumentFragment DocumentType -- no children EntityReference Element Attr ProcessingInstruction --no children Comment -- no children CDATASection -- no children Entity Notation Others

Page 39: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.39

Portable Data/Portable CodePortable Data/Portable Code

Sun Microsystem’s vision of XML technologySun Microsystem’s vision of XML technology Project XProject X

Java Platform Standard Extension for XML Provide basic XML functionality to read,

manipulate, and generate text. Conform to the XML1.0 specification and

(DOM) Level 1 Core Recommendation Conversion between Java Class/Bean and XML Conversion between Java Class/Bean and XML

documentdocument IBM’s BeanML Bluestone’s XwingML

Page 40: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.40

Conclusions - XML and Java, the Natural Conclusions - XML and Java, the Natural CompanionsCompanions

XML’s markup and charater data are encode in XML’s markup and charater data are encode in Unicode and Java intrinsically supports the Unicode and Java intrinsically supports the Unicode standardUnicode standard

XML structures map easily to Java object XML structures map easily to Java object structuresstructures

Both Java and XML are portable across platformsBoth Java and XML are portable across platforms Many XML components are already available for Many XML components are already available for

Java, from parsers to XSL and Xlink enginesJava, from parsers to XSL and Xlink engines Many of the core standards for processing XML Many of the core standards for processing XML

are developed with Java in mind, I.e. DOM, SAX, are developed with Java in mind, I.e. DOM, SAX, etc.etc.

Risks: securityRisks: security

Page 41: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.41

Java Database SupportJava Database SupportA call-level interface:JDBCA call-level interface:JDBC

Low Level, Invoke SQL Commands DirectlyLow Level, Invoke SQL Commands Directly A Base Upon Which to Build Higher-level

Interfaces and Tools, such as SQLJ Java Blend

What does JDBC do?What does JDBC do? Establish a Connection with a Database Send SQL Statements Process the Results

Latest Update: JDBC 2.0 APILatest Update: JDBC 2.0 API Core API Standard Extensions

Page 42: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.42

Java Database SupportJava Database SupportJDBC 2.0 APIJDBC 2.0 API

New Features of JDBC Core APINew Features of JDBC Core API Scrollable Result Sets Result Sets that can be Updated Batch Updates SQL3 Data Type Support (SQL types ARRAY,

BLOB, CLOB, STRUCT, DISTINCT and REF) Custom Mapping of SQL3 User-Defined Types

to Java Classes Storing Java Objects in an Object-Relational

Database

Page 43: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.43

Java Database SupportJava Database SupportJDBC 2.0 APIJDBC 2.0 API

JDBC 2.0 API Standard Extension Rowset Establishing Database Connections Using

DataSource Objects and the Java Naming and Directory InterfaceTM (JNDI)

Connection Pooling Distributed Transactions

Page 44: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.44

Java Database SupportJava Database SupportJDBC ProductJDBC Product

A Distributed Object JDBC ArchitectureA Distributed Object JDBC Architecture

OPENjdbc, the JDBC Driver for DataBrokerOPENjdbc, the JDBC Driver for DataBroker

CORBA-based JDBC solution provides a complete technology bridge from current to future IT solutions

Page 45: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.45

Java Database SupportJava Database SupportEmbedded SQL Statements:SQLJEmbedded SQL Statements:SQLJ

A Language that Embeds Static SQL in Java A Language that Embeds Static SQL in Java ProgramProgram

Specified by Oracle, IBM and Compaq's Tandem Specified by Oracle, IBM and Compaq's Tandem Jointly, Accepted as ANSI Standard in December Jointly, Accepted as ANSI Standard in December 19981998

How Does SQLJ work?How Does SQLJ work?

Page 46: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.46

Java Database SupportJava Database SupportSQLJ FeaturesSQLJ Features

Preceded by: #sqlPreceded by: #sql #sql { UPDATE TAB SET COL1=:x WHERE COL2>:y AND

COL3<:z }; Provides Application Developers with a Higher-Provides Application Developers with a Higher-

level Programming Interface for Static SQLlevel Programming Interface for Static SQL SQLJ translator performs type-checking and SQLJ translator performs type-checking and

schema-checking of SQL statements at program schema-checking of SQL statements at program development timedevelopment time

SQLJ Runtime, a Thin Layer of Pure Java Code SQLJ Runtime, a Thin Layer of Pure Java Code above a JDBC Driverabove a JDBC Driver

Comprehensive FacilitiesComprehensive Facilities Database IndependenceDatabase Independence

Page 47: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.47

Java Database SupportJava Database SupportSQLJ and Oracle8iSQLJ and Oracle8i

Oracle Database Server -- Oracle8iOracle Database Server -- Oracle8i Java virtual machine internal to the database

Oracle Extends Support for Standards Based SQLJ Oracle Extends Support for Standards Based SQLJ Implemented SQLJ into Oracle8i Supports Access to BLOB and CLOB Data Supports SQL Object Types in SQLJ Programs

through JPulisher tool Java Stored Procedures and Triggers Provides Access to Oracle Proprietary

Language PL/SQL Using SQLJ in Oracle8i EJB Server Oracel Java IDE -- JDeveloper

Page 48: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.48

Java Database SupportJava Database Support SQLJ Example SQLJ Example

import java.sql.*;import sqlj.runtime.ref.DefaultContext;import oracle.sqlj.runtime.Oracle;

public class JDBCInterop {#sql public static iterator Employees ( String ename, double sal ) ;

public static void main(String[] args) throws SQLException {if (args.length != 1) {

System.out.println("usage: JDBCInterop ");System.exit(1);

}

Oracle.connect(JDBCInterop.class, "connect.properties");Connection conn =

DefaultContext.getDefaultContext().getConnection();

Page 49: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.49

Java Database SupportJava Database Support SQLJ Example SQLJ Example

// create a JDBCStatement object to execute a dynamic queryStatement stmt = conn.createStatement();String query = "SELECT ename, sal FROM emp WHERE "; query += args[0];

// use the result set returned by executing the query to create// a new strongly-typed SQLJ iteratorResultSet rs = stmt.executeQuery(query);Employees emps;#sql emps = { CAST :rs };

while (emps.next()) {System.out.println(emps.ename() + " earns " +

emps.sal());}emps.close();stmt.close();

}}

Page 50: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.50

Java Database SupportJava Database SupportODMG Java BindingODMG Java Binding

Impedance MismatchImpedance Mismatch Object Data Management Group (ODMG)Object Data Management Group (ODMG)

Java Binding was Added to ODMG 2.0 Applies to both ODBMS and RDBMS

Persistence by ReachabilityPersistence by Reachability Database TransparencyDatabase Transparency

Automatically Mapping between Database and a Cache in the Application Memory

Java Objects are Mapped into the Cache When Application Navigates through them

Database Tracks Java Objects in the Cache and Write them back to Database at Transaction Commit Time

Page 51: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.51

Database Server

Java Database SupportJava Database SupportODMG Java BindingODMG Java Binding

Three-Tier ModelThree-Tier Model

Client...

GUIGUIGUIGUI Application Logic

Application Logic

Application Logic

Application Logic

Object Management

Object Management

Application Logic

Application Logic

Object Management

Object Management

Application Servers

Page 52: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.52

Java Database SupportJava Database SupportODMG Java Binding ComponentsODMG Java Binding Components

Java Object Definition Language (ODL)Java Object Definition Language (ODL) Define the Specifications of Object Types that

Conform to the ODMG Object Model Java Object Manipulation Language (OML)Java Object Manipulation Language (OML)

Support the ODMG Object Model with Collections, Transactions and Databases

Java Object Query Language (OQL)Java Object Query Language (OQL) Provides Fast and Efficient Object-Querying

Capabilities in Java OQL Queries and Java Methods can call each

other interchangeably

Page 53: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.53

Java Database SupportJava Database SupportODMG Java Binding Product 1ODMG Java Binding Product 1

Visual BSF from ObjectmatterVisual BSF from Objectmatter Object-relational Java Framework that Allows

Java Objects to be Easily Saved and Retrieved from Relational Databases Non-intrusive and Dynamic Open Architecture Complete Object Modeling Legacy Database Integration Security Powerful Query Capabilities Standards Based Fast Performance

Page 54: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.54

Java Database SupportJava Database SupportODMG Java Binding Product 2ODMG Java Binding Product 2

POET Object Server 5.0 from POET POET Object Server 5.0 from POET POET's Java SDK and SQL Object Factory

Adds Distributed and Enterprise Critical Feature ODMG 2.0 Compliant Java API Binding Java Objects are Mapped to the POET Object

Database or a Relational Database at Runtime Transparent Java Object Persistence Multi-threading and Transaction Capabilities Tier Independent

Other ProductsOther Products Java Blend, Jasmine…

Page 55: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.55

Introduction to Enterprise JavaBeansIntroduction to Enterprise JavaBeans

What is EJB?What is EJB? Server side component implementing business

logic wrapping DB wrapping existing application providing new business functions

Similar to Java Bean wrapped in ejb-jar visual deployment and management

Easy programmingEasy programming Write once, run anywhere (client and server)Write once, run anywhere (client and server) ReusableReusable

Page 56: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.56

Multi-tier EJB ApplicationsMulti-tier EJB Applications

Heavy-duty servers in the organizationsHeavy-duty servers in the organizations Deployed over intranet Improved performance Improved manageability Easier maintenance In-control system upgrade

Thin clientsThin clients GUI presentation Easy to download Possible built-in upgrading features

Page 57: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.57

High-level View of a Simple ScenarioHigh-level View of a Simple Scenario

Transparent invocationTransparent invocation Container-managed persistencyContainer-managed persistency TransactionTransaction

Page 58: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.58

EJB Roles and DeploymentEJB Roles and Deployment

Page 59: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.59

Client’s View ContractClient’s View Contract

Contract between client and containerContract between client and container Fulfilled by both EJB provider and container Fulfilled by both EJB provider and container

providerprovider IncludesIncludes

Identity Method invocation Home interface

JNDI Naming conventionNaming convention

Session Bean example: TraderBean Trader TraderHome

Page 60: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.60

SessionBean ExampleSessionBean Example

public class TraderBean implements SessionBean {public class TraderBean implements SessionBean { public void ejbRemove() throws ... { ... }public void ejbRemove() throws ... { ... } public void ejbActivate() … { … }public void ejbActivate() … { … } public void ejbPassivate() ...public void ejbPassivate() ... public void setSessionContext(SessionContext ctx) ...public void setSessionContext(SessionContext ctx) ...

public void ejbCreate () ...public void ejbCreate () ...

public TradeResult buy( ... ) ...public TradeResult buy( ... ) ... public TradeResult sell( ... ) ...public TradeResult sell( ... ) ... public double getStockPrice(String stockSymbol) ...public double getStockPrice(String stockSymbol) ...}}

public interface TraderHome extends EJBHome {public interface TraderHome extends EJBHome { Trader create() …Trader create() …}}

public interface Trader extends EJBObject {public interface Trader extends EJBObject { public TradeResult buy ( ... ) ...public TradeResult buy ( ... ) ... public TradeResult sell ( ... ) ...public TradeResult sell ( ... ) ... public double getStockPrice(String stockSymbol) ...public double getStockPrice(String stockSymbol) ...}}

Page 61: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.61

Component ContractComponent Contract

Contract between Bean and containerContract between Bean and container IncludesIncludes

Bean class instance’s view of its lifecycle For session Beans, state management callback

methods invoked by container to notify of important life cycle events

Context for communication between Bean and container

Environment properties Container provided services

Transaction demarcation Security enforcement

Page 62: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.62

Ejb-jar FileEjb-jar File

Java classes for enterprise JavaBeansJava classes for enterprise JavaBeans TraderBean.class, Trader.class,

TraderHome.class Deployment descriptorDeployment descriptor

TraderBeanDD.ser Environment propertiesEnvironment properties Manifest file containing EJB entriesManifest file containing EJB entries

example:Name: …/TraderBeanDD.ser

Enterprise-Bean: True

Page 63: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.63

Container IntermediatesContainer IntermediatesMethod InvocationMethod Invocation

Page 64: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.64

EJB TypesEJB Types

Session BeanSession Bean Executes on behalf of a single client Can be transaction-aware Access shared data source Short-lived

Entity BeanEntity Bean Shared by multiple clients Representing data source Transaction-aware Long-lived Survives server crashes

Page 65: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.65

Stateful Session Bean LifecycleStateful Session Bean Lifecycle

Transaction related restrictions:Transaction related restrictions: One TX at a timeOne TX at a time No invocation from outside the current TXNo invocation from outside the current TX No remove when in a TXNo remove when in a TX

Page 66: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.66

Stateless Session Bean LifecycleStateless Session Bean Lifecycle

ScalableScalable Minimized resourcesMinimized resources Client gets more complexClient gets more complex

Page 67: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.67

Entity Bean LifecycleEntity Bean Lifecycle

Page 68: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.68

Concurrency, Transaction and ReentrantConcurrency, Transaction and Reentrant

Page 69: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.69

EJB Transactions SupportEJB Transactions Support

JTS -- Java mapping of OMG OTSJTS -- Java mapping of OMG OTS Flat transaction Two-phase commit protocol

Declarative transaction attributeDeclarative transaction attribute Class level Method level

Client-managed demarcationClient-managed demarcation with begin and commit calls TX context is propagated to all servers

Bean-managed demarcationBean-managed demarcation Container-managed demarcationContainer-managed demarcation

Page 70: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.70

EJB Security SupportEJB Security Support

Compliant with JDK security packageCompliant with JDK security package User-based securityUser-based security

EJBContext.getCallerIdentity() call Role-based securityRole-based security

EJBContext.isCallerInRole(Identity) call AccessControlEntryAccessControlEntry in deployment descriptor in deployment descriptor

Method level Class level

RunAsModeRunAsMode and and RunAsIdentityRunAsIdentity Deployer and system administrator can modify Deployer and system administrator can modify

security role using container toolssecurity role using container tools Restrictions applyRestrictions apply

Page 71: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.71

Deployment Tools 1Deployment Tools 1

Manage deployment descriptor attributesManage deployment descriptor attributes Customize business logicCustomize business logic

Page 72: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.72

Deployment Tools 2Deployment Tools 2

Manage security attributesManage security attributes

Page 73: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.73

Deployment Tools 3Deployment Tools 3

Manage transaction attributesManage transaction attributes

Page 74: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.74

Deployment Tools 4Deployment Tools 4

Manage container-managed persistencyManage container-managed persistency

Page 75: Distributed Object Computing and Java

CSE298

CSE300

CSE.RU-1.75

Conclusions and Future ResearchConclusions and Future Research

ConclusionsConclusions Java’s extensibility and adherence to open

standards will continue to evolve as a robust technology with which to build distributed systems.

Extensions to current specification will allow newer technologies to be built upon existing standards for even more powerful distributed environments.

Future ResearchFuture Research Keeping up with introductions of newer

specifications. Converging technologies.