prof. a. taleb-bendiab room 605
TRANSCRIPT
Prof. A. Taleb-BendiabRoom 605
[email protected]://www.cms.livjm.ac.uk/taleb/lectures/cmscb3005
A. Taleb-Bendiab, Module: Contemporary Issues in IT, Code: CMSCB3005, Lecture: 2, Page: A. Taleb-Bendiab, Module: Contemporary Issues in IT, Code: CMSCB3005, Lecture: 2, Page: 11
Distributed Application Services Distributed Application Services and E-business and E-business
Part IIPart II
Liverpool John Moores UniversitySchool of Computing and Mathematical Sciences
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 22
So far …So far … E-business
Definitions, E-business Models E-business Patterns Systems requirements
E-business drivers for Multi-tier Applications Architecture
Emerging web development technologies Thin versus Thick Clients, and Thin server vs Thick server
In this session …. A brief introduction to Java
Brief introduction to Java Overview of XML
Web applications using Java and XML An example web application services
Tutorial session
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 33
What is Java?What is Java?
Java language and environment Born on May 23rd 1995. Grew out of a product called Oak
Oak was designed for embedded software and consumer devices.
See http://www.javasoft.com
Java is an environment is Ideal environment for writing object-oriented, distributed
and platform independent applications, real-time, etc.
Java has a lot in common with C and C++ Versions and editions
1.0 1.1 Java 2 PlatformJava 2 PlatformEnterprise editionStandard editionStandard edition
Micro edition
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 44
The Java timelineThe Java timeline
19951995 19961996 19971997 19981998 19991999
JDK 1.1 ships
JDK 1.1 ships
May - Sun launches Java (alpha version) on the Internet
May - Sun launches Java (alpha version) on the Internet
January - Java Development Kit (JDK) 1.0
ships
January - Java Development Kit (JDK) 1.0
ships
Sun announces
Java 2 Platform (JDK
1.2)
Sun announces
Java 2 Platform (JDK
1.2)
Sun announce
s Jini technolog
y
Sun announce
s Jini technolog
y
Sun announces
Java 2 Platform (JDK
1.3)
Sun announces
Java 2 Platform (JDK
1.3)
20002000
Sun announces
Java 2 Platform (JDK
1.4)
Sun announces
Java 2 Platform (JDK
1.4)
2001 ++2001 ++
Many moreMany more
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 55
How does it work?How does it work?
A Java program is compiled into bytecodes These bytecodes are interpreted by a JVM The JVM converts these instructions into
appropriate machine code The program executes on the machine Each platform therefore needs its own JVMEach platform therefore needs its own JVM
Enabling WORA -- “Write Once, Run Anywhere”“Write Once, Run Anywhere” Java Virtual Machine
“An imaginary machine that is implemented by emulating it in software on a real machine.”
It specifies: Instruction set, register set, class file format, stack, garbage collection, memory area
A JVM exists for various operating systems including; Windows 95/98/NT/2000, Solaris, Macintosh, OS/2, Linux, OS/400,
OS/390, HPUX, AIX, IRIX, EPOC, Windows CE, PlamOS, etc.
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 66
Java Runtime EnvironmentJava Runtime Environment
JavaJavasourcesource(java)(java)
JavaJavasourcesource(java)(java)
Java Java compilercompiler
Java Java compilercompiler
JavaJavabyte byte codecode
(class)(class)
JavaJavabyte byte codecode
(class)(class)
Java byte codes move locally or
through network
Class loaderClass loaderByte code Byte code
verifierverifier
Class loaderClass loaderByte code Byte code
verifierverifier
Java Java class class
librarieslibraries
Java Java class class
librarieslibraries
Java Java interpreterinterpreter
Java Java interpreterinterpreter
Just-in-time Just-in-time compilercompiler
Just-in-time Just-in-time compilercompiler
Runtime systemRuntime systemRuntime systemRuntime system
Operating systemOperating systemOperating systemOperating system
HardwareHardwareHardwareHardware
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 77
Running Java ProgramsRunning Java Programs
A Java application is a stand-alone program that can use all of the features of the Java language environment
A Java applet is a restricted Java application that is designed to be run inside a Java-enabled web browser
Security restrictions Applets have a different lifecycle to applications
A Java servlet is the equivalent of an applet, which is executed at server-side
It is a Java application that is designed to be run inside a Http servers
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 88
/** Comments here – Example of authenticator class */package test;
import java.util.*;import java.security.*; import com.server.http.*;
public class TestAuthenticator extends AbstractAuthenticator { public void init(CauchoApplication app, RegistryNode params)
{ } public Principal authenticateCookie(String cookieValue)
{ return null; } public Principal authenticate(String user, String password) {
if (password != null && password.equals("quidditch")) return new BasicPrincipal(user);
else return null; } public boolean updateCookie(Principal user, String cookieValue)
{return true; } public boolean isUserInRole(Principal user, String role)
{return user != null && "user".equals(role); } }
Examples: Java ProgrammeExamples: Java Programme
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 99
Java Java 2 2 Enterprise EditionEnterprise Edition Enterprise JavaBeansTM Architecture
Defines an API to enable developers to create, deploy and manage cross-platform, component-based enterprise applications.
JavaServer PagesTM Enables rapid development of server-side web-based
applications, such as; dynamic web content management. JavaTM Servlet Java Naming and Directory InterfaceTM (JNDI) JavaTM Message Service (JMS)
Provides a standard Java API for enterprise messaging services such as reliable queuing, publish and subscribe communication and various aspects of push/pull technologies.
JavaTM Transaction API (JTA) JavaMail
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 1010
Example Application #1Example Application #1
Location AD Service Manager
System
Location & Advertisement ServicesLocation & Advertisement Services
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 1111
… … But …But …
RequestRequest
Data sourceData source
Web LayerWeb LayerResponseResponse
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 1212
Web Page ExampleWeb Page Example
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 1313
HTML CodeHTML Code<html ><head><meta name="GENERATOR" content="Microsoft FrontPage 4.0"><meta name="Microsoft Theme" content="global 101, default"><meta name="Microsoft Border" content="tlrb, default"><title>Home Page</title> </head><body background="../../_themes/global/glotextb.gif" bgcolor="#FFFFCC"
text="#510000" link="#999900" vlink="#CC9966" alink="#990066"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td><font face="Arial, Helvetica"><p align="center"><br><font size="4" face="Arial">Student Learning Space</font></p><p align="center"><a href="../Default.htm">Home</a> <a
href="../cmssem011/Module%20specification.doc">Module<a href="http://www.cms.livjm.ac.uk/markallen/multi-media.htm">Tutorials</a> <a
href="../cmssem011/indicative_references.htm"> Reading List</a></p><p align="left"><font size="4">Contemporary issues in IT: Distributed
Applications and E-Commerce <em>CMSCB3005</em><font size="4" face="Arial"> </font></font></p>
</html>
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 1414
Associated XML CodeAssociated XML Code
<?xml version="1.0"?> ><?xml-stylesheet type="text/xsl" href="..\xsl\ENR-change-table.xsl"?><!DOCTYPE Components SYSTEM "Project6.dtd"><head><meta name="Microsoft Theme" content="global 101, default"><title> Student Learning Space </title> </head><body> <main> <page type=“html” href="../Default.htm"> <headings>
<heading 1 href="../cmssem011/Module%20specification.doc">
<heading 2 href="http://www.cms.livjm.ac.uk/markallen/multi-media.htm">
<heading 3 href="../cmssem011/indicative_references.htm"></headings>
</main></body></xml>
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 1515
What is XML? What is XML? XML is
an eXtensible Markup Language for describing both structured and unstructured information, which could be used on the web.
XML documents containing structured information including;
Content: words, pictures (vector graphics), e-commerce transactions, mathematical equations, object meta-data, server APIs, and other XML documents.
XML is a meta-language for defining other markup languages not like HTML or SGML
Unlike Html or SGML it provides; extensible tag semantics a facility to define tags and the structural relationships
between them. All of the semantics of an XML document will either be
defined by the applications that process them or by stylesheets.
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 1616
How Is XML Defined?How Is XML Defined?
XML is defined by a number of related specifications: Extensible Markup Language (XML) 1.0
Defining the syntax of XML. XML Pointer Language (XPointer) and
XML Linking Language (XLink) Defining a standard way to represent links between resources.
In addition to simple links, like HTML's <A> tag, XML has mechanisms for links between multiple resources and links between read-only resources.
XPointer describes how to address a resource, XLink describes how to associate two or more resources.
Extensible Style Language (XSL) Defines the standard stylesheet language for XML.
XQL -- Defines a standard query language for XML. XUL -- Defines a standard user-interface language for XML.
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 1717
XML Markup #1XML Markup #1
Six kinds of markup used in XML documents: 1. Elements -- Delimited by angle brackets, most
elements identify the nature of the content they surround.
It begins with a start-tag, <element>, and ends with an end-tag, </element>.
Attributes -- Attributes are name-value pairs that occur inside start-tags after the element name.
<div class="preface">is a div element with the attribute class having the value preface.
2. entity references -- introduce markup into a document, some characters have been reserved to identify the start of markup.
entities are used to represent these special characters. Entities are also used to refer to often repeated or varying text and to include the content of external files.
Entity references begin with the ampersand and end with a semicolon.
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 1818
XML Markup #2XML Markup #2 For example, the lt entity inserts a literal < into a document. So the
string <element> can be represented in an XML document as <element>.
A special form of entity reference, called a character reference, can be used to insert arbitrary Unicode characters into your document. This is a mechanism for inserting characters that cannot be typed directly on your keyboard.
3. Comments -- begin with <!-- and end with -->. Comments can contain any data except the literal string.
4. processing instructions (PIs) -- are an escape hatch to provide information to an application.
Processing instructions have the form: <?name pidata?>. The name, called the PI target, identifies the PI to the application.
5. CDATA Sections – to instruct the parser to ignore most markup characters.
to prevent xml parser from evaluating a CDATA. <![CDATA[ *p = &q; b = (i <= 3); ]]>
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 1919
XML Markup #3XML Markup #3 Between the start of the section, <![CDATA[ and the end of
the section, ]]>, all character data is passed directly to the application, without interpretation.
The only string that cannot occur in a CDATA section is ]]>.
6. Document Type Declarations XML allows you to create your own tag names. DTD enables document to communicate their meta-
information to the parser including; allowed sequence and nesting of tags, attribute values and their types defaults, the names of external files that may be referenced formats of some external (non-XML) data that may be
referenced, the entities that may be encountered.
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 2020
ValidationValidation Two categories of XML documents:
Well-formed Documents it obeys the syntax and the grammar of XML documents. A document that includes sequences of markup
characters that cannot be parsed or are invalid cannot be well-formed.
not well-formed document -- is not XML document.
well-formed and valid: well-formed document is valid only if it contains a proper
document type declaration and if the document obeys the constraints of that declaration.
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 2121
Well-formed?
XMLDocument
DTD
DTDRequired?
Valid?Yes Yes
No
NoNo
XMLSyntax
Error Message
StructuralNon-conformance
Error Message
Stop Processing / Edit XML and/or DTD / Re-initiate Parsing
Well-formedXML
Well-formed& Valid
XML
PARSER
Fur
ther
pro
cess
ing
ofX
ML
Doc
umen
t
XML Document Parsing
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 2222
• XML Document/DTD/Parser
• Document Object Model (DOM)
• Script/Programming (manipulation of objects)
• XSL (render ready transformation)
• Browser/Display Application(rendering)
XML Processing and Rendering
XMLDocument
DTD
PARSERDOM
XML API
ApplicationScript/Program
XSL
XSL-basedProcessing
layer
HTMLOutput
RTF(MS Word)
SAX
PDFOutput
Other Markup
LanguagesWML
Scalable Vector
Graphics(SVG)
RDF, XMI Etc.
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 2323
Mobilisation tool
Fire Fighter
Search Engine
Login System
C&C Operator
System Admin.
Admin tools
Reporting tools
Communication
RDBMS
Combining Java and XMLCombining Java and XML
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 2424
Presentation Tier( XML Web Browser )
Servlets
Login Query Machanism
XML Generation
Callback Machanism
Control GUI
Applet
Delivery Machanism
Http & XML
RMI
Table
Table
DBMSJDBC
Table
Romote Mothod
Middle Tier(Servlet-supported Web Server ) Database Tier
XML File
System
XML File
System
XML File
System
Target System ArchitectureTarget System Architecture
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 2525
Implementation #1Implementation #1
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 2626
Implementation #2Implementation #2
A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: A. Taleb-Bendiab, Module: Multimedia Systems Development, Code: CMSSEM011, Lecture: 2, Page: 2727
Implementation #3Implementation #3