Professional Documents
Culture Documents
IPT Full Materials
IPT Full Materials
DEPARTMENT OF IT
Integrative Programming
Technologies(IPT)
Desta D.
Ast. Professor in IT
School of Informatics, WSU
INTRODUCTION TO INTEGRETIVE PROGRAMMING AND
TECHNOLOGY
Integration (from the Latin integer, meaning whole or entire) generally means
combining parts so that they work together or form a whole. In information
technology, there are several common usages:
1) Integration during product development is a process in which separately produced
components or subsystems are combined and problems in their interactions are
addressed
2) Integration is an activity by companies that specialize in bringing different
manufacturers' products together into a smoothly working system.
3) In marketing usage, products or components said to be integrated appear to meet
one or more of the following conditions:
A/ They share a common purpose or set of objectives.
B/ They all observe the same standard or set of standard protocol or they share a
mediating capability, such the Object Request Broker (ORB) in the Common Object
Request Broker Architecture (CORBA).
Continued..
IL (Intermediate Language)
Twist: - What is MSIL or CIL, What is JIT?
(IL)Intermediate Language is also known as MSIL (Microsoft
Intermediate Language) or CIL (Common Intermediate
Language). All .NET source code is compiled to IL. IL is then
converted to machine code at the point where the software is
installed, or at run-time by a Just-In-Time (JIT) compiler
CTS
CTS
In order that two language communicate smoothly CLR has CTS
(Common Type System).Example in VB you have “Integer” and
in C++ you have “long” these data types are not compatible so
the interfacing between them is very complicated. In order that
these two different languages communicate Microsoft introduced
Common Type System. So “Integer” data type in VB6 and “int”
data type in C++ will convert it to System.int32, which is data
type of CTS. CLS is subset of CTS.
Note: If you have undergone COM programming period
interfacing VB6 application with VC++ application was a real pain
as the data type of both languages did not have a common
ground where they can come and Interface, by having CTS
interfacing is smooth.
CLS
machines.
The Web was conceived of as, primarily, a means to share linked collections of
documents.
Mobile phone networks have been able to scale up and out in response to
increase in demand (e.g., some three million net additions between 2006 and
2007, and again between 2007 and 2008).
Electronic funds transfer networks have many member organizations and can be
quite large (e.g., in 2008, LINK had 51, with 60,000 ATMs), still they are highly
reliable and highly available.
Other Examples..
Middleware Protocols
a middleware is an application that contains general-
purpose protocols to provide services
example of middleware services
authentication and authorization services
distributed transactions (commit protocols; locking
mechanisms)
middleware communication protocols (calling a
procedure or invoking an object remotely,
synchronizing streams for real-time data, multicast
services)
hence an adapted reference model for networked
communications is required
Architecture of IS
• the general organization of an Internet search engine into three
different layers
Client-Server Architectures
how to physically distribute a client-server application across
several machines
Multitiered Architectures 25
Two-tiered architecture: alternative client-server organizations
a) put only terminal-dependent part of the user interface on the client
machine and let the applications remotely control the presentation
b) put the entire user-interface software on the client side
c) move part of the application to the client, e.g. checking
correctness in filling forms
d) and e) are for powerful client machines
26
Web services…in n-tier architecture
31
41
•
Chapter 3
Network Programming
Based on Classes in the java.net package
42
TCP and UDP
java.sun.com
“Dotted quad” form:
123.255.28.120
static InetAddress.getByName()
produces java object containing
address
Servers and Clients
For testing your program, you can do it without network. (server & client
on same machine)
Localhost: the IP address for testing without a network
Three ways to identify:
Test w/o networking
(Continue)
InetAddress
addr=InetAddress.getByName(null);
Equivalently:
InetAddress.getByName(“localhost”);
Or using the reserved IP number for the loopback:
InetAddress.getByName(“127.0.0.1”);
Port number
When set up client and server, you must specify IP address and port.
Port number range: 0 to 65,535
1-1024 are reserved, others may be used.
Sockets
Software abstraction
used to represent the
connection between
two machines
Socketis the actual
2-way connector.
Sockets
At the server class, the following establishes the server port, and waits
for a client request to establish a socket
ServerSocket s =
new ServerSocket(8080);
Socket socket = s.accept();
Data transfer using sockets
Install Jdk1.3
Setting environment jdk.
Go to Windows -> Search on Advanced system setting -> go
to Environmental setting-> Write new-> Name: Path,
Value: c:\jdk1.3\bin
Click on Ok.
Socket Programming Designs
Server Socket
import java.io.*;
import java.net.*;
public class myServer{
public static void main(String[]args){
try{
ServerSocket ss=new ServerSocket(6666);
Socket s=ss.accept();
DataInputStream dis = new DataInputStream(s.getInputStream());
String str=(String)dis.readUTF();
System.out.println("Message from Clients="+str);
ss.close();
}catch(Exception e){
System.out.println(e);} }}
Client side Programs
import java.io.*;
import java.net.*;
public class myClient{
public static void main(String[]args){
try{
Socket s=new Socket("localhost",6666);
DataOutputStream dout = new
DataOutputStream(s.getOutputStream());
dout.writeUTF("Hello Server this is from maja kero...");
dout.flush();
dout.close();
s.close();
}catch(Exception e){
System.out.println(e);}
}}
To Run Socket programs java
import java.rmi.Remote;
import java.rmi.RemoteException;
// Creating Remote interface for our application
public interface Hello extends Remote {
void printMsg() throws RemoteException;
}
Implementation save on
ImplExample.java
public class ImplExample implements Hello
{
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class Server extends ImplExample {
public Server() {}
public static void main(String args[]) {
try {
ImplExample obj = new ImplExample();
Hello stub = (Hello) UnicastRemoteObject.exportObject(obj, 0);
Registry registry = LocateRegistry.getRegistry();
registry.bind("Hello", stub);
System.err.println("Server ready");
} catch (Exception e) {
System.err.println("Server exception: " + e.toString());
e.printStackTrace();
} }}
Client Program Save on Client.java
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
public class Client {
private Client() {}
public static void main(String[] args) {
try {
Registry registry = LocateRegistry.getRegistry(null);
Hello stub = (Hello) registry.lookup("Hello");
stub.printMsg();
} catch (Exception e) {
System.err.println("Client exception: " + e.toString());
e.printStackTrace();
}}}
Compiling and Running
Open 3- CMD windows.
Go to the folder directory(by using cd..)
Compile all Programs by One(javac *.java)
Run Implementation on the same CMD windows (rmic ImplExample)
Run RMI registry on the same CMD windows (start rmiregistry)
Run the server on the second CMD windows(java Server)
Run the Client on the Third CMD windows(java Client)
Chapter 4
XML
History
1995/98
1985 1990
XML
eXtensible Markup Language
Slide
70
Why do we need XML (1) ?
Data-exchange
XML is used to aid the exchange of data. It
makes it possible to define data in a clear
way.
Both the sending and the receiving party will
use XML to understand the kind of data that's
been sent.
By using XML everybody knows
that the same interpretation of
Slide
75
What is XML Used For?
XML documents are used to transfer data from one
place to another often over the Internet.
XML subsets are designed for particular
applications.
One is RSS (Rich Site Summary or Really Simple
Syndication ). It is used to send breaking news
bulletins from one web site to another.
A number of fields have their own subsets. These
include chemistry, mathematics, and books
publishing.
Most of these subsets are registered with the
W3Consortium and are available for anyone’s use.
Design rationale for XML (1)
1. XML must be easily usable over the Internet
Book
FrontMatter
BookTitle
Author(s)
PubInfo
Chapter(s)
ChapterTitle
Paragraph(s)
BackMatter
References
Index Slide
80
XML Data Model: Example
<BOOKS>
<book id=“123” loc=“library”> BOOKS
book
<author>Hull</author> article
loc=“library”
<title>California</title> ref
123 555
<year> 1995 </year>
</book> author year author title
<article id=“555” ref=“123”>
title
<author>Su</author>
<title> Purdue</title> Hull 1995 Su Purdue
</article> California
</BOOKS>
XML information structures (2)
Premise: A text is the sum of its component parts
A <Book> could be defined as containing:
<FrontMatter>, <Chapter>s, <BackMatter>
<FrontMatter> could contain:
<BookTitle> <Author>s <PubInfo>
A <Chapter> could contain:
<ChapterTitle> <Paragraph>s
A <Paragraph> could contain:
<Sentence>s or <Table>s or <Figure>s …
Components chosen for book markup language should reflect anticipated
use ….
Slide
82
XML information structures (3)
A corresponding XML fragment
(based on corresponding XML application):
begin end
<Book> element element
<FrontMatter>
<BookTitle> XML Is Easy </BookTitle>
<Author> Tim Cole </Author>
<Author> Tom Habing </Author>
<PubInfo> CDP Press, 2002 </PubInfo>
</FrontMatter>
<Chapter>
<ChapterTitle> First Was SGML </ChapterTitle>
<Paragraph> Once upon a time …</Paragraph>
</Chapter>
</Book> Slide
83
XML information structures (4)
Example 2: Movies
Elements can have attributes attribut
<movies> e
<movie genre="action" star="Halle Berry">
<name>Catwoman</name>
<date>(2004)</date>
<length>104 minutes</length>
</movie>
88
XML vs. Relational Database
CUSTOMER
Name Age
ABC 30
XYZ 40
<customers>
<custRec>
<Name type=“String”>ABC</custName>
<Age type=“Integer”>30</custAge>
</custRec>
<custRec>
<Name type=“String”>XYZ</custName>
<Age type=“Integer”>40</custAge>
</custRec>
</customers>
XML vs. Relational
Database
XML vs. Relational
Database
93
XML Documents Form a
Tree Structure
The elements in an XML document form a document tree. The tree starts at the
root and branches to the lowest level of the tree.
XML documents must contain a root element. This element is "the parent" of all
other elements.
All elements can have sub elements (child elements)
The terms parent, child, and sibling are used to describe the relationships
between elements. Parent elements have children. Children on the same level are
called siblings (brothers or sisters).
All elements can have text content and attributes (just like in HTML).
94
XML Documents Form a
Tree Structure
95
XML Tags :
XML tags are created like HTML tags. There's a start tag and a closing tag.
<TAG>content</TAG>
The closing tag uses a slash after the opening bracket, just like in HTML.
XML Element :
The text between the brackets is called an element.
Empty Tags :
An empty tag does not have a closing tag.
The syntax differs from HTML:
<TAG/>
96
XML documents
The XML declaration
The first line of an XML document is the
XML declaration. It's a special kind of tag:
<?xml version="1.0"?>
The version 1.0 is the actual version of XML.
</root>
XML documents
A real XML page
<product>
<?xml version="1.0"?>
<name>
<sales>
carrots
<shop>
</name>
<number>
<totalprice>
100
10
</number>
</totalprice>
<manager>
</product>
Ray Bradbury
</sales>
</manager>
</shop>
100
XML documents
XML Attributes
Elements in XML can use attributes. The syntax is:
<car>
<brand>volvo</brand>
<color>green</color>
</car> 101
XML Syntax Rules
All XML Elements Must Have a Closing Tag
In XML, it is illegal to omit the closing tag. All elements must have a closing tag:
102
XML Syntax Rules
XML Elements Must be Properly Nested
In HTML, you might see improperly nested elements:
<root>
<child>
<subchild>.....</subchild>
</child> 103
</root>
XML Syntax Rules
XML Attribute Values Must be Quoted
XML elements can have attributes in name/value pairs just like in HTML. In
XML, the attribute values must always be quoted.
<note date="12/11/2007">
<to>Tove</to>
<from>Jani</from>
</note>
Comments in XML
The syntax for writing comments in XML is similar to that of HTML.
104
XML Syntax Rules
White-space is Preserved in XML
HTML truncates multiple white-space characters to one single white-space: With
XML, the white-space in a document is not truncated.
106
XML Naming Rules
XML elements must follow these naming rules:
Names can contain letters, numbers, and
other characters
Names cannot start with a number or
punctuation character
Names cannot start with the letters xml (or
XML, or Xml, etc)
Names cannot contain spaces
Any name can be used, no words are reserved.
107
CHAPTER 5
Design Patterns: