arsitektur aplikasi perangkat enterprise #5lecturer.ukdw.ac.id/anton/download/enterprise5.pdf ·...

Post on 23-Feb-2018

222 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Arsitektur Aplikasi

Perangkat Enterprise #5

Antonius Rachmat C, S.Kom, M.CsAntonius Rachmat C, S.Kom, M.Cs

Company ACompany A

Consumers, PartnersConsumers, Partners

MobileMobileEmployeesEmployees

Company BCompany B

Consumers, PartnersConsumers, Partners

MobileMobileEmployeesEmployees

Enterprise Demand

Customers Customers Partners Partners SuppliersSuppliers

Enterprise Application Inside

Application Platforms Today

BrowserApps

Web ServicesApps

OtherApps

LocalApps

Standard Library

GUI Services

Transaction Services

Web Scripting

Data Access

More

Operating System

Runtime Environment

What is Microsoft .Net?

� .NET is microsoft technolgy and platform for developing and integrating services in the digital world� To unify Desktop, Web, and Mobile programming

� Diperkenalkan oleh Microsoft sejak Feb � Diperkenalkan oleh Microsoft sejak Feb 2002

.NET FRAMEWORK

� Bersifat independen dalam hal bahasa� Aplikasi dapat dikembangkan di beberapa bahasa yang

didukung oleh .NET:� C#� Managed Extensions for C++� Java - Visual J# .NET� Java - Visual J# .NET� JavaScript - JScript .NET� Perl� Pascal, Delphi� PHP� Smalltalk

� Programmer dapat memilih salah satu bahasa yang paling dikuasainya.

� Mampu dijalankan beberapa platform (tidaksemua)

Keuntungan .NET

Visual Visual Studio.NETStudio.NET

Visual Visual Studio.NETStudio.NET

ApplicationsApplicationsUsing Your Using Your

ServiceService

ApplicationsApplicationsUsing Your Using Your

ServiceService

Your Internal ServicesYour Internal Services

.NET Enterprise Servers.NET Enterprise Servers.NET Enterprise Servers.NET Enterprise ServersSQL ServerSQL Server

BizTalk ServerBizTalk Server

Application CenterApplication Center

Commerce ServerCommerce Server

Host Integration ServerHost Integration Server

Internet Security and AccelerationInternet Security and Acceleration

Sales Data ServiceSales Data ServiceCorporate Fullfilment ServiceCorporate Fullfilment Service

Smart ClientsSmart ClientsSmart ClientsSmart Clients

.NET Blueprint

Your Your application application

and web and web serviceservice

Your Your application application

and web and web serviceservice

Open Internet ProtocolsOpen Internet Protocols

XML, XSLT, XSD, SOAP, XML, XSLT, XSD, SOAP,

DISCO, UDDI, XHTML, DISCO, UDDI, XHTML,

HTTP, SSL, WAPHTTP, SSL, WAP

Simple Simple BrowsersBrowsersSimple Simple

BrowsersBrowsers

33rdrd Party Web ServicesParty Web Services33rdrd Party Web ServicesParty Web ServicesGeographic Mapping ServiceGeographic Mapping ServiceCredit Card Statement ServiceCredit Card Statement Service

… [ActiveX Paradigm]… [ActiveX Paradigm]

Building Block ServicesBuilding Block ServicesBuilding Block ServicesBuilding Block ServicesPassport Passport –– Identity ServiceIdentity ServiceCalendaring ServiceCalendaring Service

… [myServices]… [myServices]

WindowsWindows

Internet Security and AccelerationInternet Security and Acceleration

Exchange ServerExchange Server

Smart Smart DevicesDevicesSmart Smart

DevicesDevices

Smart ClientsSmart ClientsSmart ClientsSmart Clients

.NET FW.NET FW

WindowsWindows

.NET FW.NET FW

Windows Windows CE, XP, 2000, .NETCE, XP, 2000, .NET

Windows Windows CE, XP, 2000, .NETCE, XP, 2000, .NET

.NET .NET FrameworkFramework

.NET .NET FrameworkFramework .NET FW.NET FW

.NET Framework in General

.NET Framework 4.0

.NET Framework class

System.WebSystem.Web

CachingCaching SecuritySecurity

ServicesServicesDescriptionDescription

DiscoveryDiscovery

ProtocolsProtocols

UIUIHtmlControlsHtmlControls

WebControlsWebControls

System.DrawingSystem.Drawing

Drawing2DDrawing2D

TextText

PrintingPrinting

System.WinFormsSystem.WinForms

DesignDesign ComponentModelComponentModel

SystemSystem

System.DataSystem.Data System.XmlSystem.Xml

GlobalizationGlobalization

TextText

SecuritySecurity

CollectionsCollections

ResourcesResources

ReflectionReflection

NetNet

IOIO

ThreadingThreading

DiagnosticsDiagnostics

ServiceProcessServiceProcess

ConfigurationConfiguration

DesignDesign

ADO.NETADO.NET SqlClientSqlClient

Xslt/XPathXslt/XPath

XmlDocumentXmlDocument

RuntimeRuntimeInteropServicesInteropServices

RemotingRemoting

SerializationSerialization

SerializationSerialization

ConfigurationConfiguration SessionStateSessionState ImagingImaging TextText

Reader/WritersReader/WritersOleDB, odbc, Oracle OleDB, odbc, Oracle

.NET Compact Framework class

System.WebSystem.Web

CachingCaching SecuritySecurity

ServicesServicesDescriptionDescription

DiscoveryDiscovery

ProtocolsProtocols

UIUIHtmlControlsHtmlControls

WebControlsWebControls

System.DrawingSystem.Drawing

Drawing2DDrawing2D

TextText

PrintingPrinting

System.WinFormsSystem.WinForms

DesignDesign ComponentModelComponentModel

SystemSystem

System.DataSystem.Data System.XmlSystem.Xml

GlobalizationGlobalization

TextText

SecuritySecurity

CollectionsCollections

ResourcesResources

ReflectionReflection

NetNet

IOIO

ThreadingThreading

DiagnosticsDiagnostics

ServiceProcessServiceProcess

ConfigurationConfiguration

DesignDesign

ADO.NETADO.NET SqlClientSqlClient

Xslt/XPathXslt/XPath

XmlDocumentXmlDocument

RuntimeRuntimeInteropServicesInteropServices

RemotingRemoting

SerializationSerialization

SerializationSerialization

ConfigurationConfiguration SessionStateSessionState ImagingImaging TextText

Reader/WritersReader/WritersSqlServerCeSqlServerCe

Common Language Runtime� Bagian utama dari framework yang akan

mengkompilasi dan mengeksekusi program yang ditulis dengan bahasa yang mendukung .NET

� Compilation process� Pertama program di compile menjadi Microsoft Intermediate

Language (MSIL) / Common Intermediate Language (CIL)

� Mendefinisikan instruksi untuk CLR

� Kemudian MSIL code diterjemahkan kedalam machine code

� Machine code untuk platform yang khusus

� Mengapa dua proses kompilasi ?� Agar platformnya bersifat independence

� .NET Framework dapat diinstal di platform berbeda� Mengeksekusi program .NET tanpa modifikasi kode-nya

� Language independence� .NET program tidak terikat dengan bahasa tertentu

� Komponen yang lama dan baru dapat terintegrasi

MSIL

.assembly hello {}

.assembly extern mscorlib {}

.method static public void main() il managed {

HelloWorld:HelloWorld:

{.entrypoint.maxstack 1ldstr "Hello World from IL!"call void [mscorlib]System.Console::WriteLine(class System.String)ret

}

Common Language Runtime� Keuntungan lain dari CLR

� Execution-management features� Manages memory

� Programmer lebih berkonsentrasi pada program logic

� CLR menyediakan JIT compilation. � JIT hanya akan mengkompilasi method-method � JIT hanya akan mengkompilasi method-method

yang memang digunakan dalam suatu bagianaplikasi pada saat tertentu, dan hasil kompilasiini sendiri di cache di dalam mesin dan akandikompile kembali jika memang ada perubahanpada kode aplikasi kita. � Jadi tidak semua method diload ke-memori pada saat

yang sama

� CLR disimpan pada file: mscoree.dll� C:\windows\System32

Common Language Runtime

Type CheckerType Checker Exception ManagerException Manager

Thread SupportThread Support COM MarshalerCOM Marshaler

Base Class Library SupportBase Class Library Support

Class LoaderClass Loader

IL to NativeIL to NativeCompilersCompilers

CodeCodeManagerManager

GarbageGarbageCollectorCollector

Security EngineSecurity Engine Debug EngineDebug Engine

DevelopmentDevelopment

CLR Execution Model

VBVB C#C# ScriptScript ......

Assembly: Assembly: MSIL + MetadataMSIL + Metadata

NativeNativeCodeCode

Install timeInstall timeCode GenCode Gen

DeploymentDeployment

DevelopmentDevelopment

JITJITCode GenCode Gen

NativeNativeCodeCode

CommonCommonLanguageLanguageRuntimeRuntime

Compiling & Executing Managed

Code

Source Code

Language Compiler

Microsoft Intermediate

Language (MSIL)

Compilation

JIT Compiler

NativeCode

The first time each method is called

Execution

Data Types in the CLR

� The CLR mendefinisikan Common Type System (CTS)

� All languages built on the CLR use the CTS (managed code)

� Ada 2 kategori:� Ada 2 kategori:

� Value types:

� Relatively simple types

� Allocated on the stack

� Reference types:

� More complex types

� Allocated on the heap

� Destroyed through garbage collection

Illustrating the Common Type System

Object

ValueType

Byte Int16 SingleUInt16

Class

Interface

Boolean

Byte

Char

Decimal

Double

Int16

Int32

Single

Int64

UInt16

UInt32

UInt64String

Array

Delegate

Reference Types Value Types

Enum

Structure

Others Others

CTS Data Type

.NET Class Library� Sering disebut sebagai Base Class Library.� Class library bersifat berorientasi objek yang

akan menyediakan types dan fungsi-fungsi managed code.

� Dengan BCL kita dapat membuat:� Aplikasi console � Aplikasi console � Aplikasi berbasis windowd (Windows Form) � Aplikasi ASP.NET (berbasis web) � Aplikasi Web Services XML

� Aplikasi berbasis Windows Services

.NET Class Library (2)

�Tampilan ILDASM – assembly view

.NET assembly

� Private assemblies are required to be located in application’s directory or subdirectory

� The disadvantage is that each time a copy of the Assembly is created which in turn occupies more memory and reduces the performance

Output: .dll� Output: .dll

� Must be imported

� Shared assemblies� installing an assembly:

� gacutil.exe –i MyAssembly.dll

� Two or more assemblies of the same name can coexist in the GAC (must have different versions)

� the end of "DLL hell"

Adding external assembly to ur

application (on C#)

Obfuscation� Entity renaming

� changing names of namespaces, classes, methods, properties, fields, enumerations

� Control flow obfuscation� modifying the original code (e.g. transforming if or while

statements by using goto statement)

Removal of unused members� Removal of unused members� String encryption� Breaking IL Disassembler

� injecting code into the obfuscated assembly that is designed to break IL Disassembler so that it won’t open the assembly at all

� Compiling into native code

Hasil Obfuscation

C++ .NET

� C++ with Managed Extensions can be used to create .NET applications

� Managed C++ provides:

� Garbage collection support

� Built-in support for interfaces, properties, and events� Built-in support for interfaces, properties, and events

� Access to all other CLR features

� C++ can still create native binaries if desired

� All other Visual Studio.NET languages produce only MSIL

Database Access in .NET

� In .NET there is ADO.NET

� “connectionless”

DataSet

Client

Data Adapter

Data Source

DataSetCommandCommand

Connection

DataReader

Managed Provider

Data Adapter

ASP.NET

(Server-Side Scripting)

� ASP.NET Architecture:

IIS WebServer

Client

(1) get a.apx(1) get a.apx(1) get a.apx(1) get a.apx (2) process(2) process(2) process(2) process .NETAssembly

OtherAssemblies

(4) HTTP file(4) HTTP file(4) HTTP file(4) HTTP file

.NETEngine

Database

(3) result(3) result(3) result(3) result

(4) HTTP file(4) HTTP file(4) HTTP file(4) HTTP file

.NET framework

� .NET Framework 1.1 was included in Windows Server 2003 and was an optional component of Windows XP Service Pack 1 Redistributable packages (dotnetfx.exe)� .NET Framework 1.1

� 23.1 MB� 23.1 MB

� Windows 98/Me/NT/2000/XP/2003, IE 5.01

� .NET Framework 2.0� 22.4 MB

� Windows 98/Me/NT/2000/XP SP2/2003, IE 5.01

� Windows Installer 3.0

� disk space: 280 MB (x86), 610 MB (x64)

� .NET 3.5 -> 197 MB

MONO

� Mono project (http://www.mono-project.com)� support for .NET client and server applications on Linux,

Solaris, Mac OS X, Windows and Unix

� sponsored by Novell

� LGPL (Lesser General Public Licence)supported systems: GNU/Linux, NetBSD, FreeBSD, � supported systems: GNU/Linux, NetBSD, FreeBSD,

� 120,000 lines of C code and 600,000 lines of C# code.

� Cygwin/Mingw32, Mac OS X, Solaris, AIX � GPL (General Public Licence)

� Official international standards:� ECMA-334: The C# Language Specification

� ECMA-335: The Common Language Infrastructure (CLI)

ASP.NETEvolution#

Mono Architecture

MySQL/Postgress

Novell iFolderMozilla

Gtk#Apache Mono

Gnome#Novell LDAP

ADO.NET

Windows.Form

Mono Runtime

(Implementation of ECMA #335)

ZipLibJava CompatibilityWindows.Form

Microsoft Compatibility Libraries Mono Libraries

Windows Phone 7 Architecture

Java 2 Platform

� Dimulai tahun 1995 pada browser HotJava – Netscape

� Platform diperkenalkan pada June, 1999

� WORE – Write Once Run Everywhere

Java 2 Platform

J2SE Platform

Java system overview

Yang dibutuhkan?

� J2RE untuk menjalankan Java.

� J2RE akan berisi Java Virtual Machine.

� J2SDK untuk mendevelop Java.

� J2SDK akan berisi JVM dan SDK� J2SDK akan berisi JVM dan SDK

� J2ME untuk mendevelop aplikasi Mobile

� J2EE untuk mendevelop aplikasi Enterprise

� J2EE berisi seluruh komponen Java 2 Platform

Proses Kompilasi

� Pada kompilasi Java, terdapat 2 bagian penting yaitu: Java Compiler dan Java Interpreter

� Java compiler mengenerate bytecode (sekumpulan instruksi yang me-ressemble kode mesin, tetapi tidak spesifik pada prosesor) yang bersifat “cross-platform intermediary, bersifat “cross-platform intermediary, halfway between source code and machine language”.

� Java interpreter akan meng-interpret Java bytecode yang ada untuk eksekusi program.

� Kekurangan dari bytecode terletak pada kecepatan eksekusi, karena tidak bersifat native

Proses Kompilasi

Kode Java Java bytecode

Win32

HP-UX

Intermediate compilation

Solaris

compilation

Runtime VM Intepretation

Mac

The Java Virtual Machine

� An abstract computing machine that executes bytecode programs� An instruction set and the meaning of those instructions

� An algorithm to verify the class file

� InterpreterSimple, compact� Simple, compact

� Slow

� Just-in-time compilation� Hanya mengkompilasi “bagian” yg dibutuhkan saja

A Bytecode Examplepublic class X {

public static void

main(String[] args) {

add(1, 2);

}

public static int

add(int a, int b) {

public static void main(java.lang.String[]);

Code:

0: iconst_1

1: iconst_2

//Method add:(II)I

2: invokestatic #2; 5: pop

6: return

add(int a, int b) {

return a+b;

}

}

public static int add(int,int);

Code:

0: iload_0

1: iload_1

2: iadd

3: ireturn

Introduction to the JVM

� JVM is a component of the Java system that

interprets and executes the instructions in our

class files.

Memory configuration by the JVM.

� Each instance of the JVM has one method area, one heap, and one or more stacks - one for each thread

� When JVM loads a class file, it puts its information in the method area

Introduction to the JVM (Cont’d)

� As the program runs, all objects instantiated are stored in the heap

� The stack area is used to store activation records as a program runs

Introduction to the JVM (Cont’d)

Content of Memory Blocks at runtime.

The Class Loader Subsystem

� The class loader performs three main functions of

JVM, namely: loading, linking and initialization

� The linking process consists of three sub-tasks,

verification, preparation, and resolution

Class loading process.

Tahap Compile & Execute� Loading means reading the class file for a type, parsing it

to get its information, and storing the information in the method area.

� Verification is the process of ensuring that binary representation of a class is structurally correct

� In preparation, the JVM allocates memory for the class � In preparation, the JVM allocates memory for the class

(i.e static) variables and sets them to default initial values.

� Resolution is the process of replacing symbolic names for

types, fields and methods used by a loaded type with their

actual references.

� Class initialization, This is the process of setting class

variables to their proper initial values - initial values desired

by the programmer.

J2EE� Stands for “Java 2, Enterprise Edition”� Superset of Java 2 Standard Edition (J2SE)� J2EE (1.4+) is an infrastructure specification for:

� Components ("Beans")� Data Source Connectivity� XML and Messaging� XML and Messaging� Web Pages and Web Services

Class-class Java

� Java Servlets (menggunakan Apache-Tomcat): javax.servlet

� JSP (menggunakan Apache-Tomcat): javax.servlet.jsp

� EJB (menggunakan JBoss): javax.ejb.*� JMS: javax.jms.*� JMS: javax.jms.*� JDBC (J2SDK): java.sql.*, javax.sql.*� JNDI (J2SDK): javax.naming.*� JTA / JTS: java.transaction.*� JavaMail (Java MailAPI): javax.mail.*� XML: javax.xml.*� JavaNet: java.net

J2EE Architecture

4 Aplikasi Java

� Applications: program standalone di komputer, dari aplikasi console sampai dengan GUI yang kompleks yang menggunakan javax.swing

� Applet: program Java yang dijalankan di web browser dengan menggunakan HTML. browser dengan menggunakan HTML.

� Servlet: program yang melakukan generating isi webpage namun berjalan di java-enabled web server yang kemudian akan dikirimkan hasilnya ke client.

� JSP / JSF: aplikasi web yang berjalan di sisi server.

J2EE Server Technologies

� Servlets

� Server side Java code

� Java Server Pages (JSP) dan Java Server Faces

� Server side Java code

� Enterprise JavaBeans (EJB)� Enterprise JavaBeans (EJB)

� Java server components that encapsulate business logic to be shared across the enterprise

Database Access in Java

� Java provides JDBC to access relational data

Application

ODBCDB

ODBC Driver

JDBC/ODBC Bridge

Driver ManagerConnection

Statement

PreparedStatement

CallableStatement

Resultset

Java Server Pages and Servlets

� Java also allows for server-side scripting

� JSPs are based on Servlets

WebServer

Client

(1) get a.jsp(1) get a.jsp(1) get a.jsp(1) get a.jsp (2) process(2) process(2) process(2) processJSP

OtherComponents

Server

JVM

Database

(4) result(4) result(4) result(4) result

(5) HTTP file(5) HTTP file(5) HTTP file(5) HTTP file

Servlet

(3) gen. Servlet(3) gen. Servlet(3) gen. Servlet(3) gen. Servlet ServletImpl.

Perbandingan J2EE dan .NET

Framework

A typical .NET Enterprise Solution

IIS on W2k Server

SQLServer

IIS on W2k Server

.NET managed

componentASP.NET

WindowsClient

Browser

A typical J2EE Enterprise Solution

Java App

DB Server

Java App Server

EJBServlet

JSP

Java Client

Browser

The .NET Framework

BrowserApps

Web ServicesApps

OtherApps

LocalApps

.NET Framework Class Library

Windows Forms

Enterprise Services

ASP.NET ADO.NET More

Windows

Common Language Runtime

The Java Environment

BrowserApps

OtherApps

LocalApps

Web ServicesApps

Standard Java Packages

Swing Enterprise JavaBeans

JavaServer Pages

JDBC More

Windows, Solaris, Linux, others

Java Virtual Machine (VM)

J2EE Server

CORBAServer

RDBMS

MessageQueueJMS

EJB ContainerRMI

Client

EJB Container

IIOPClient

JSP ServletServlet Container

HTTPClient Other

Resource

HTTP Engine

CLR Platform

OtherServer

RDBMS

Messagequeue

SOAPClient

HTTPClient Other

Resource

Comp. Services

ComponentComponentComponent

ASMXASPX

ASP.NET

Controls

.NETApp

CLR Host

ComponentComponentComponent

CLR Host

IIS –

HTTP Engine

J2EE Solutions

vs Microsoft .Net Solutions

� Both multi-tiered, similar computing technologies

� Both support “standards”

Both offer different tools & ways to � Both offer different tools & ways to achieve the same goal.

� Very difficult to compare and qualify the comparison because each has its own advantages & disadvantages.

Python

Visual S

tudio.net

ASP.NetASP.Net

P&P blocksP&P blocks

Third party extensionsThird party extensions

Comparing the stacks

JSP JSP

StrutsStruts

ExtensionsExtensions : : Phoenix, Tiles, Java FacesPhoenix, Tiles, Java Faces

Enterprise solutionsEnterprise solutionsW

ebshpereE

clipse…

VB

C++

C#

Perl

Visual S

tudio.net/ M

ono

Win32 / Linux

MSMQ, COM+, IIS, WMI, AD, ADAM,Indexing, UDDI, etc.

CLRCLR

Base Class LibraryBase Class Library

ADO.NETADO.NET

Win32, Unix, Linux

JMS Apache

J2EE App Servers Websphere, Weblogic, Tomcat, etc.

Java runtimeJava runtime

J2EE Class LibraryJ2EE Class Library

JDBCJDBC

Servlets Servlets

BE

A W

eblogicW

ebshpereS

tudio

Java

CLR vs JVM

C# ManagedC/C++

Lots of otherLanguages

VB.Net

CLR

CTS GC Security

MSIL

Java

JRE (JVM)

GC Security

Byte Codes

CTS GC Security Runtime Services

Windows OS

GC Security Runtime Services

Mac Unix LinuxWin

Both are ‘middle layers’ between an intermediate language & the underlying OS

JVM vs. CLR

JVM CLR

Managed execution

environmentX X

Garbage Collection X X

Metadata and

BytecodeX X

Platform-abstraction

class libraryX X

Runtime-level

securityX X

Runs across

hardware platformsX ?

Choosing between Java/J2EE and .Net

� The ultimate choice usually depends not on technical superiority, but on:

� cultural/”religious”/political preferences

� Customer preference

� Vendor relations

� Skill set of your developers

� You are most likely to be developing in both environments for the foreseeable future

� Look out for “The third way”: Linux, Apache, MySQL, PHP, …

NEXT

� Database for Enterprise: JDBC, ADO.NET dan LINQ

top related