Session 6 - Main Theme J2EE Component-Based Computing Environments
Total Page:16
File Type:pdf, Size:1020Kb
Application Servers G22.3033-011 Session 6 - Main Theme J2EE Component-Based Computing Environments Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences 1 Agenda Component Technologies Database Technology Review EJB Component Model J2EE Services JNDI, JMS, JTS, CMP/BMP/JDBC, JavaMail, etc. J2EE Web Architectures Security in J2EE Application Servers Structured Applications Design Tips Summary Readings Assignment #5 2 1 Summary of Previous Session COM and COM+ Introduction to .Net Component Technologies Object Management Architectures Java-Based Application Servers Windows Services Summary Readings Assignment #5 3 Additional References Intranet Architectures and Performance Report http://www.techmetrix.com/lab/benchcenter/archiperf/archiper ftoc.shtml#TopOfPage RMI FAQ http://java.sun.com/products/javaspaces/faqs/rmifaq.html CORBA beyond the firewall http://www.bejug.org/new/pages/articles/corbaevent/orbix/ Web Object Integration (vision document) http://www.objs.com/survey/web-object-integration.htm 4 2 Application Servers Architectures Application Servers for Enhanced HTML (traditional) a.k.a., Page-Based Application Servers Mostly Used to Support Standalone Web Applications New Generation Page-Based Script-Oriented App. Servers First Generation Extensions (e.g., Microsoft IIS with COM+/ASP) Servlet/JSP Environments XSP Environment Can now be used as front-end to enterprise applications Hybrid development environments Distributed Object Computing Platforms Provide an infrastructure for distributed communications enabling Still need to merge traditional web-oriented computing with object computing Object Management Architectures DOC Platform + APIs to reusable services and facilities 5 OMAs + Component Models -> J2EE, CCM, DNA Part I VMs and Component Technologies JVM and .Net CLR 6 3 Virtual Machines (VMs) • Provide level of abstraction on top of OSs • Support binary compatibility between components (language independence / requires language translators) • Support for data marshalling between components and clients • Streamline component installation and deployment • Work at finer granularity level than component infrastructure for deployment (e.g., classes) • Compliance with definition of component infrastructure not required • VM is integral part of component infrastructure • VM is not a component technology by itself • Component infrastructure = VM with component support? 7 Java Virtual Machine (JVM) • Provides OO environment for compiling Java classes and executing compiled bytecodes locally and remotely • Provides an execution environment where Java classes in binary format are loaded, verified, and executed • Hide the platform dependency for developers (WORA) 8 4 .Net • Provides OO environment with local and remote execution capabilities • Provides an execution environment with additional support for deployment and versioning of object code • Improves the performance of scripted and interpreted code • Hides the specifics of the underlying platform architecture • Provides full code compatibility allowing vendors to add language compilers which produce MSIL format • .Net provides a Common Type System (CTS) that allows introspection of managed code 9 .Net (continued) • .Net provides memory management, threading, and synchronization models similar to the Java environment • .Net provides a set of base classes and libraries called .Net framework, a virtual machine called CLR, and development languages (e.g., Jscript, Visual Basic, C#, C++, IL Assembler) • .Net compilers generate Portable Executable code that incorporates MSIL (PE-MSIL) that looks like DLL or EXE • CLR uses a JIT to translate MSIL modules (assemblies) into native executable code 10 5 Java Platform vs. .Net • Java runs on any platform with JVM while C# only runs in MS Windows • Java is the primary language for the JVM while .Net allows unification of PLs under the .Net framework • Scripting languages are interpreted on the Java platform, while they are compiled on .Net • Resulting code is bytecode interpreted by JVM, while IL is always translated into native code that is not interpreted 11 Java Virtual Machine Write Once Run Anywhere (WORA) Architecture 12 6 Java Virtual Machine (JVM) (continued) • Byte Code Verifier • Class Loader (dynamic operation) • Runtime Execution Engine • Performance bottlenecks: • Byte Code Execution, garbage collection, thread management, dynamic operations (i.e., class loading, bounds checking, security measures, dynamic class loading, exception handling, reflection, and native method translation) • Just-in-time compiler • Reduces byte-code interpretation and causes the execution workload to shift to native compilation and caching of native methods. • Precompiler 13 Open JVM Interface (OJI) • Allows any Sun-Compliant JVM (implementing OJI) to become the default JVM for a browser • Supports Applet, Embed, and Object tags • Supports Java-JavaScript bidirectional communication • Supports RSA signed applet verification 14 7 .NET Framework Common Language Runtime (CLR) Accessible to any compiler that produced Microsoft Intermediate Language (IL) code Runtime Classes Visual Studio.Net (VS.Net) Includes VB.Net, VC.Net (C#), and Visual C++.Net 15 .Net Remoting (http://www.dotnetremoting.cc/) Native .Net Remote Object Invocation Allows Object Invocation and Communications Across Processes and Machines Wire Protocol and Format Independent Extensible via Custom Formatters (SOAP, Binary, etc.), Channels (HTTP, TCP, etc.), and Sink Chain (i.e., Channels + Formatters) Steps Flexible as Configuration can be Changed after Deployment with Little or no Code Changes Flexible (IIS not required on server) but more Complex than Web Services 16 8 .Net Remoting Vs. DCOM Not as Transparent as DCOM Has no COM Interop Involved Offers More Deployment Options Not Tied to a Specific Wire Protocol or Format Firewall Friendly Allows you to Specify which Objects are Remoted 17 .Net CLR and COM+ CLR Introduces a Newer and Easier Programming Model for COM+ The COM+ Services are still Available only at the OS/Unmanaged World Transitions Between Managed/Unmanaged Layers are Taken Care of by “System.EnterpriseServices” Namespace System.EnterpriseServices.ContextUtil class provides access to contexts (as did CoGetObjectContext) Services are Made Available to Components Using Attributes 18 9 .NET, Win32, COM, and COM+ .Net applications can call functions that reside in Win32 DLLs via the DllImport attribute of System.Runtime.InteropServices’ platform invocation (PInvoke) services .Net applications can call traditional COM components using Runtime Callable Wrappers (RCWs) which uses interop assemblies (i.e., .Net components) created via COM Interop using the TLBIMP utility COM+ services (transactions, object pooling, JIT activation) can be used from .Net (via System.EnterpriseServices namespace) .Net runtime uses COM+ to support some of its services (e.g., transactions for managed classes) 19 ContextUtil Class Useful Static Members ActivityId IsSecurityEnabled TransactionId DesactivateOnReturn MyTransactionVote Rich Set of Member Functions SetComplete SetAbort EnableCommit DisableCommit IsCallerInRole GetNamedProperty 20 10 .Net and ServicedComponent COM+ Class Derives from “ServicedComponent” [ComVisible(true)] [ObjectPooling(MinPoolSize=2, MaxPoolSize=5)] [Guid(“57F01F20-9C0C-4e63-9588-720D5D537E66)] [Transaction(TransactionOption.Required)] public class SVCCompClass : ServicedComponent In COM+ 1.0, the List of Services Are not Changed In COM+ 1.5 (Microsoft Windows XP Professional and .Net server), Newer Services are Available to Leverage CLR Features 21 MDA • OMG's MDA (Model-Driven Architecture) specification describes: – a PIM - platform-independent models (i.e. business design) – PSMs - the mapping of a PIM to one or more platform-specific model • MDA => Model Once, Generate Everywhere • Review MDA presentations: 22 – http://www io-software com 11 MDA UML Model (PIM) (continued)XMI Document (PSM) Auto <Auto> <Color> Red </Color> Color : String XMI Door : Integer <Door> 4 </Door> Engine : Integer <Engine> 2 </Engine> M O </Auto> X F M I IDL, Java… (PSM) XMI DTD, Schema (PSM) interface Auto { Class Auto <!Element Auto }; {public String color; (Color*, public int Door; Door*, public int Engine; Engine*)> } 23 The first level of automation ~ 30 Years (Platform independent to platform specific model projection) Programming IDEs (e.g. JBuilder, Visual Age, NetBeans) Environment •Higher level of expression PIM Programming Language •Easier to understand •Portable •Standardized •Dependable Generator, •Flexible Projection Compiler Engine •Configurable •Optimizing •Complete: Linker, Debugger, Etc. PSM Diverse HW/OS Platforms 24 12 MDA= New automation levels ~ Last 8 Years http://www.omg.org/mda Architectural IDEs Environment •Higher level of expression PIM Model (UML, BOM…) & •Easier to Modeling Style (J2EE, eEPC, COBOL, .NET…) understand •Portable •Standardized •Dependable Generator, •Flexible Generator Engine Projection •Configurable •Debuggable •Optimizing Models to Code •Complete Models to Models P-Stack: A Level of Automation PSM 25 Architectural IDEs http://www.io-software.com, The Unified Process Std. MDA Projections ArcStyler Core Modules J2EE/EJB, .NET BEA WebLogic Open MDA/UML/XML Repository MDA Cartridges Business Pattern UML MDA-Engine Build, IBM WAS NT, z/OS Object Refinement Refinement Engine Deploy & Test with