ASP.NET Front-End Architecture for J2EE Enterprise Applications

Reviews
Shared by: Amna Khan
Stats
views:
119
rating:
not rated
reviews:
0
posted:
4/2/2008
language:
pages:
0
ASP.NET Front-End Architecture for J2EE™ Enterprise Applications A case study of the Visual MainWin® Pet Store application developed with ASP. NET for standard J2EE application servers December 2004 www.mainsoft.com ASP.NET Front-End Architecture for J2EE Enterprise Applications A case study of the Visual MainWin Pet Store application developed with ASP. NET for standard J2EE application servers INTRODUCTION ........................................................................................................................................ 3 FEATURES AND BENEFITS .................................................................................................................... 3 HOW IT WORKS ........................................................................................................................................ 5 CREATING A VISUAL MAINWIN J2EE APPLICATION ................................................................................... 5 ADDING REFERENCES TO JAVA COMPONENTS ............................................................................................ 6 THE BUILD PROCESS ................................................................................................................................... 6 DEPLOYING ON A J2EE APPLICATION SERVER ............................................................................................ 7 DEBUGGING A VISUAL MAINWIN J2EE APPLICATION ................................................................................ 8 THE RUNTIME LIBRARIES ............................................................................................................................ 8 ASP.NET FRONT-END FOR J2EE APPLICATION SERVERS......................................................... 10 THE VISUAL MAINWIN CO-DEVELOPMENT STRATEGY ............................................................................ 10 THE VISUAL MAINWIN PET STORE CASE STUDY........................................................................ 11 A NEW KIND OF PET STORE ...................................................................................................................... 11 DEVELOPING THE VISUAL MAINWIN PET STORE ...................................................................... 13 DEFINING THE J2EE ENVIRONMENT.......................................................................................................... 13 CREATING A NEW VISUAL MAINWIN PROJECT ......................................................................................... 13 DEVELOPING THE ASP.NET FRONT-END ................................................................................................. 14 ADDING EJB REFERENCES ........................................................................................................................ 15 CALLING EJB BUSINESS METHODS FROM C#............................................................................................ 16 BUILDING AND DEPLOYING THE APPLICATION .......................................................................................... 17 DEBUGGING THE APPLICATION ................................................................................................................. 18 SOURCE CODE ........................................................................................................................................... 18 BENCHMARKS......................................................................................................................................... 19 CONCLUSIONS......................................................................................................................................... 19 ABOUT MAINSOFT ................................................................................................................................. 20 ▌ Page 2 Introduction This white paper demonstrates how development managers and software architects can accelerate the creation of J2EE Web applications and Web services significantly using Visual MainWin for the J2EE platform, Mainsoft’s newest cross-platform development tool. It includes a technical review of Visual MainWin, which brings the Visual Basic® .NET and C# programming languages to the J2EE platform, and enables more than 2.5 million .NET developers to rapidly create J2EE Web applications and Web Services. This paper also demonstrates how IT organizations can use Visual Studio® and Java™ developers to co-develop enterprise-class J2EE Web applications. Each development team focuses on its core competency: .NET developers rapidly create an ASP.NET front-end within the Visual Studio .NET IDE, while Java developers provide the back-end business logic as J2EE components using Java development tools, such as WebSphere® Studio, WebLogic® Workshop™, or JBuilder®. The applications can be deployed directly on standard J2EE application servers, such as IBM WebSphere, BEA WebLogic, or JBoss. The paper concludes with benchmarks that summarize the productivity advantages of the Visual MainWin co-development model versus programming exclusively in Java. Features and Benefits Mainsoft designed and developed Visual MainWin to deliver the productivity advantages of the Visual Studio IDE, and provide native deployment of Web applications and Web services on J2EE. The product adheres to the following principles: • Preserve the Visual Studio developer experience – Visual MainWin works seamlessly within the Visual Studio .NET development system and fully preserves the Visual Studio developer experience. Visual Basic .NET and C# developers can code, compile, run and debug J2EE applications using Visual Studio .NET, without having to learn to use a new development tool. Support leading .NET development tools on J2EE - Visual MainWin rehosts ASP.NET elements from Infragistics™ • ▌ Page 3 NetAdvantage™ 2004 Volume 2 presentation layer development toolset on the J2EE platform, offering .NET developers the unprecedented ability to quickly develop commercial-quality J2EE Web applications and Web services using NetAdvantage's easy-to-use designers and style presets. All the user interface richness and drag-and-drop productivity are maintained. • Comply with Java standards – Visual MainWin generates pure Java bytecode, which can be executed on any Java Virtual Machine. Because the output is fully compliant with J2EE standards, Visual MainWin applications can be installed, deployed and managed from the application server administration console as a standard J2EE application. Be open to other Java development components – Java classes and components such as Enterprise JavaBeans™ (EJBs™), which have been developed with a Java development tool, can be imported into Visual Studio projects and used in applications written in Visual Basic .NET or C#. This powerful capability enables Visual Studio developers to leverage Java components for new applications. Simplify .NET to J2EE porting - Visual MainWin supports robust porting capabilities, including support for single-source code development for the .NET and J2EE platforms and a Visual Studio-integrated project conversion tool, which guides enterprises and independent software vendors (ISVs) in quickly porting existing .NET code to the J2EE platform. • • ▌ Page 4 How It Works Visual MainWin enables developers to create applications for the J2EE platform using Visual Basic .NET or C# as well as ASP.NET and ADO.NET class libraries. Visual MainWin is a complete development solution for J2EE that includes: • A development environment integrated into Visual Studio .NET that can be used to develop, deploy, and debug J2EE applications. A set of Java runtime libraries that enable applications developed in Visual Basic .NET and C# to run on a J2EE application server. • Visual MainWin introduces a patent-pending technology, enabling the binary compilation of Microsoft Intermediate Language (MSIL) into standard Java bytecode (JBC). Developers can write programs in their favorite language, such as C# and Visual Basic .NET, and then compile their source code directly into standard Java bytecode. Figure 1 - Binary compilation from MS Intermediate Language to Java bytecode A member of ECMA, the international standards organization governing the standards for C# and the Common Language Infrastructure (CLI), Mainsoft is the first to develop an ECMAcompliant C# compiler for the J2EE platform. Creating a Visual MainWin J2EE Application Visual MainWin is seamlessly integrated into Visual Studio .NET and incorporates all the productivity features that make the Visual Studio .NET IDE such a popular development tool. .NET developers can create applications for J2EE without additional training. ▌ Page 5 Visual MainWin provides projects for the Visual Basic .NET and C# languages, including templates for ASP.NET Web applications, ASP.NET Web services, Web controls, class libraries, and console applications. Adding References to Java Components With Visual MainWin, .NET developers access Java components such as EJBs that have been developed with Java development tools. From Visual MainWin’s Solution Explorer, developers can add references to Java components and use them as native .NET objects anywhere in the project. • Any Java class that is part of a Java library can be accessed from Visual Basic .NET or C#. The class is mapped to a .NET class, and the class methods, properties, and types are exposed with the same names in the .NET class. Any Java class from the J2SE 1.4 class libraries can be accessed from Visual Studio .NET, enabling developers to access the rich functionality of the Java APIs. Visual MainWin integrates the documentation of the J2SE classes into the Visual Studio .NET help system. Any EJB component running on a J2EE application server can be accessed from the Visual MainWin application. Visual MainWin automatically generates a class wrapper that encapsulates the EJB and displays it as a native .NET object. The class wrapper also handles the Java Naming and Directory Interface (JNDI®) lookup and the creation of an EJB interface. Because developers can directly access EJB business methods within Visual Studio .NET, they do not need to deal with component lifecycle and method invocation issues. • • Visual MainWin automatically “senses” Java entities in the source code and provides name completion and dynamic help as the user types the name of a Java class or a method. The Build Process The binary compiler is integrated seamlessly into the build process. When a developer builds a project, Visual MainWin calls on Visual Studio .NET to compile the source code and generate the .NET assemblies containing the MSIL. For ASP.NET applications, it also calls the ASPX parser to generate MSIL for the ASPX tags1. The binary compiler then reads the .NET assemblies and generates Java bytecode as it applies code analysis and generation algorithms. The 1 In Microsoft .NET the parser is called at runtime by the Internet Information Server (IIS) ▌ Page 6 Java class files are then packed in a JAR or WAR file. Visual MainWin supports an incremental build development method, compiling only the files that have changed since the previous build. 1. Visual Studio Native Compilation 2. Binary Compilation Parse .NET Assemblies (DLL) Parse .NET Assemblies (DLL) Visual Basic .NET or C# Source Code Apply Code Generation Analysis Algorithms Apply Code Generation Analysis Algorithms Visual Studio .NET Compiler Visual Studio .NET Compiler Generate Java Bytecode (class files) Generate Java Bytecode (class files) .NET Assemblies .NET Assemblies (MS IL) (MS IL) Validate all Java References Validate all Java References JAR / WAR / EAR File Figure 2 – The binary compilation process Both MSIL and Java bytecode are formats that represent executable code, and they share conceptual similarities. The binary compiler maps .NET capabilities to the corresponding Java features and maps .NET classes and types to their Java equivalent. Where there isn’t a one-to-one correspondence between MSIL and Java bytecode, the binary compiler bridges the semantics gap using Java bytecode that implements the .NET capabilities within Java. For example, to address .NET attributes that do not have a Java equivalent, Visual MainWin implements the functionality in a dedicated Java runtime library. The binary compiler resolves attributes at compile-time by introducing Java code that calls the appropriate Java runtime. Similar techniques will be used to incorporate future enhancements to C# such as generics. Deploying on a J2EE Application Server Developers can deploy Visual Basic .NET and C# applications on leading application servers such as IBM WebSphere, BEA WebLogic, and JBoss. For rapid prototyping or deployment of servlet-based applications, developers can use the Tomcat servlet container that is bundled with Visual MainWin. ▌ Page 7 Deployment on a J2EE application server occurs automatically: when creating a new project, the user simply specifies the URL of the application. Visual MainWin creates a new project on the application server and handles all the deployment processes, including the creation of a J2EE compliant web.xml file. Before running the application, Visual MainWin creates and uploads a WAR or EAR file to the application server. It then launches a browser that is pointed at the application start page. Debugging a Visual MainWin J2EE Application Visual MainWin provides the ability to debug applications at the source level while fully preserving the Visual Studio .NET developer experience. Visual MainWin’s debugger enables .NET developers to debug applications running on a Java Virtual Machine within Visual Studio .NET, without seeing the actual runtime Java symbols. The debugger is based on the Java Platform Debugger Architecture (JPDA). The debugger connects to the Java Virtual Machine running the application and sends debugging commands such as breakpoints, starts, and continues. The debugger features a powerful expression evaluator that translates expressions in Visual Basic .NET and C# to Java and sends them to the Java debugger for processing. Data received from the debugger is translated back into the original source language and displayed in the Visual Studio .NET debugger user interface. Visual MainWin allows developers to debug across C#, Visual Basic .NET, and Java code using the Visual Studio .NET debugger. When the Java source code is available, developers can step through Java code and follow the execution flow of native Java modules within a single execution stack. The Runtime Libraries Visual MainWin provides a Java implementation of the ASP.NET and ADO.NET class libraries. The class libraries are based on the Mono project, a high-quality open source implementation of the .NET framework. Mono includes a C# compiler, an implementation of the CLR for Linux® and other platforms, and the .NET class libraries implemented in C#. Rather than implementing the .NET CLR on multiple platforms, Visual MainWin relies on the industry-proven J2EE platform. Visual MainWin re-hosts the Mono implementation of ASP.NET and ADO.NET on J2EE by compiling the Mono libraries from C# to Java bytecode using Visual MainWin’s binary compiler. Mainsoft ▌ Page 8 developed a thin hosting layer on top of J2EE in order to “bind” the Mono class libraries to the services supplied by the J2EE platform: • • • • ASP.NET HTTP layer uses servlets ADO.NET database connectivity uses JDBC Web service clients use Java sockets Web services use servlets Visual Basic .NET / C# Mono classes ASP.NET, ADO.NET Hosting Layer Servlets JDBC EJB Mainsoft classes WebSphere WebLogic c JBoss Tomcat J2SE/J2EE API Java Virtual Machine Figure 3 – Runtime libraries stack Mainsoft is an active contributor to the Mono project and licenses the Mono class libraries under the MIT licensing terms. ▌ Page 9 ASP.NET Front-End for J2EE Application Servers The Visual MainWin Co-Development Strategy The Visual MainWin co-development strategy accelerates the development of multi-tier J2EE applications and reduces maintenance costs by enabling .NET and Java development teams to co-develop a J2EE application, with each team focusing on their core competencies. 1. The front-end team consists of .NET developers who use Visual MainWin and ASP.NET to rapidly develop the presentation layer within Visual Studio .NET. These developers have mastered rapid application development techniques and can leverage the superior productivity of Visual Studio .NET software to develop presentation functions including the user interface, Web presentation, page navigation, and session management. They can also accommodate changing business requirements quickly. 2. The back-end team includes J2EE architects, developers, and database specialists who have extensive experience in object modeling, transaction management, resource pooling, and enterprise services. They focus on defining the object model and implementing the core business components using J2EE technologies such as Enterprise JavaBeans. .NET developers use Visual MainWin to integrate the front-end and back-end tiers by referencing J2EE components in the ASP.NET front-end. The application is then compiled to Java, debugged, and deployed on a J2EE application server. Visual MainWin’s integrated debugging capability across Visual Basic .NET, C#, and Java languages enables the .NET and Java development teams to work closely together throughout the project lifecycle. When changes to the presentation layer are required, .NET developers can make the changes quickly using Visual MainWin through additional cycles of compile, debug, and deploy. ▌ Page 10 The Visual MainWin Pet Store Case Study The Pet Store Web application is the de-facto reference for designing and benchmarking Web applications. Originally published by Sun Microsystems as part of the Java BluePrint program, it provides best practices guidelines and recommendations for developing portable, scalable, and robust applications using J2EE technology. The Pet Store case study is designed with an EJB-centric architecture and consists of three tiers: • Presentation tier – implemented through JavaServer Pages™ (JSP), servlets and using a Model View Controller (MVC) design. Business logic tier – implemented through stateful and stateless session EJBs, which expose the business logic and function as facades. Data tier – accessed through Container Managed Persistence (CMP) and Bean Managed Persistence (BMP) entity EJBs. • • Soon after Sun’s publication of the J2EE Pet Store, Microsoft published the .NET Pet Shop to demonstrate the power and productivity of the .NET Framework. The .NET Pet Shop uses .NET technologies to implement the Pet Store application for Windows. A New Kind of Pet Store The Visual MainWin Pet Store application demonstrates how Microsoft-skilled developers can develop the front-end of the J2EE Pet Store application using Visual Studio .NET and ASP.NET while leveraging the Sun Pet Store’s J2EE back-end. The following table provides a summary of the Pet Store application’s IDEs and runtimes: Application Sun Pet Store Microsoft Pet Shop Visual MainWin Pet Store IDE Any Java IDE Visual Studio .NET Runtime J2EE application server Windows .NET Framework Visual Studio .NET J2EE application with Visual server MainWin ▌ Page 11 The front end of the Visual MainWin Pet Store application is created in Visual Studio .NET using ASP.NET and C#. The back-end business logic consists of Enterprise JavaBeans from the original SUN J2EE Pet Store. The Visual MainWin Pet Store front-end has the following components: • ASP.NET pages – implements all the Web pages. The codebehind sections call the Model View Controller classes for page flow as well as the Business Logic Layer classes for business logic. Model View Controller (MVC) – two C# classes that determine the page flow. Shopping cart – the session-persistent shopping cart is implemented in the presentation layer where the session lifecycle is controlled. Business Logic Layer (BLL) – the business logic classes that call the EJBs to execute the back-end business logic. • • • The following diagram illustrates the partitioning of the application and these components: Servlet Container EJB Container <> <> Model Model ASP asp <> < Process Process Flow Flow BLL BLL < < EJB EJB Wrappers Wrappers <> <> Session Session Beans Beans Entity Entity Beans Beans .NET Front-End J2EE Back-End Figure 4- The Visual MainWin Pet Store design ▌ Page 12 Developing the Visual MainWin Pet Store Defining the J2EE Environment Before creating a new Visual MainWin project, the developer must define the J2EE development environment. This process includes defining the J2EE application server and the Java Development Kit (JDK™). In this example, we assume that we are using a WebLogic application server. Figure 5 – Defining the J2EE environment Creating a new Visual MainWin Project Visual MainWin offers several types of projects. For the Pet Store front-end, we select an ASP.NET Web Application project. ▌ Page 13 Figure 6 - Creating a new Web application project Developing the ASP.NET Front-End In the Pet Store application, the ASP pages make extensive use of Web Forms such as data grids and apply data binding to the collections returned by the EJBs. The shopping cart and the user information are stored in the session. ▌ Page 14 Figure 7 – Designing the order form with Visual Studio .NET Adding EJB References In the Pet Store application, the stateless session beans encapsulate the business actions, including functions such as listing the items in a category, adding an item to the cart or processing an order. Using the ‘Add EJB reference’ dialog from the Solution Explorer, the developer can add an EJB to the project within Visual Studio .NET. Figure 8 – Adding an EJB reference ▌ Page 15 Calling EJB Business Methods from C# Visual MainWin generates a C# wrapper class that provides easy access to the EJB. The user can create an instance of the EJB as if it were a native .NET object and call its business methods. Create an EJB wrapper instance Invoke a business method Call Java classes from C# Return .NET types Figure 9 – Calling the business method of the EJB In this example the C# developer populates a C# IList by extracting the data returned by the EJB from a Java Collection. ▌ Page 16 Building and Deploying the Application The Visual Studio .NET developer builds the project for J2EE with a single stroke of the F5 key. Visual MainWin compiles the code and generates the Java class files. Every time the user runs the application, Visual MainWin will automatically deploy the necessary files to the application server and launch a Web browser at the application default page. Once an application is ready for deployment, it is treated as a standard J2EE application and managed via the management console of the J2EE application server. Deployed EJB back-end Deployed Visual MainWin front-end Figure 10 – Managing the Visual MainWin Pet Store from the WebLogic console ▌ Page 17 Debugging the Application Once the application is running, the application can be debugged anywhere in the program. The Visual Studio .NET developer can insert breakpoints in the C# code. When the debugger stops execution, developers can inspect native C# variables just as they would any standard .NET application. Figure 11 – Execution has stopped at a breakpoint While debugging, the developer can, at any time, inspect C# variables and objects. Here a C# Item object is viewed in a Visual Studio .NET QuickWatch window. Figure 122 – Displaying a the value of a C# variable Source Code The source code for the Visual MainWin Pet Store is available with the evaluation copy of Visual MainWin from the Mainsoft Web site, upon request. ▌ Page 18 Benchmarks The Visual MainWin Pet Store boosts developer productivity significantly in comparison with the Sun Pet Store, as measured in developer-generated lines of code (e.g., excluding generated source code). Application Java Pet Store 1.1.2 (from The MiddleWare company) Microsoft Pet Shop 3.0 Visual MainWin Pet Store Front-End JSP and Servlets ASP.NET ASP.NET with Visual MainWin Lines of Code 8530 2582 2534 We can see from the table that Visual MainWin allows Microsoftskilled developers to preserve the high-level productivity of Visual Studio .NET when developing for J2EE2. Conclusions Visual MainWin offers a new development model for J2EE applications. Instead of relying solely on Java experts, enterprises can now leverage Microsoft-centric development teams to develop applications for their J2EE application server of choice. Visual MainWin is the first development environment that allows .NET and J2EE developers to co-develop J2EE applications and reuse J2EE components within Visual Studio .NET. Visual MainWin enables IT organizations to capitalize on existing Visual Studio and Java skills and existing J2EE application server investments, significantly reducing development costs and time-todeployment for business-critical J2EE applications. 2 There is a small difference of less than 2 percent in the lines of code between the Microsoft Pet Shop and the Visual MainWin Pet Store. It is a result of the differences in the integration of the ASP.NET front-end with the .NET back-end in the Microsoft version, and with the J2EE back-end in the Visual MainWin version. This difference does not impact the conclusions of this paper. ▌ Page 19 About Mainsoft Founded in 1993, Mainsoft Corporation, the cross-platform development company, enables businesses to develop missioncritical applications with the Visual Studio development system and deploy them natively on J2EE, UNIX® and Linux platforms, dramatically reducing development costs and time-to-market. The company is a first-mover in cross-platform development. Its worldclass research and development team has created patented crossplatform products that solve critical problems facing ISVs and IT organizations. Many of the world’s largest ISVs, including Siebel, Computer Associates and IBM Rational, use Mainsoft’s products to extend the productivity of Microsoft Visual Studio software, deploying more than $1 billion worth of software annually on multiple operating systems. For more information, visit www.mainsoft.com. ©Copyright 2004, Mainsoft Corporation Mainsoft, Mainwin, and Visual MainWin are trademarks or registered trademarks of Mainsoft Corporation in the United States and/or foreign countries. All trademarks, trade names, service marks, and logos referenced herein belong to their respective companies. ▌ Page 20

Related docs
asp.net tutorials
Views: 689  |  Downloads: 147
ASP.net Web Developer's Guide
Views: 1983  |  Downloads: 290
Developing Web-Applications with ASP.NET
Views: 101  |  Downloads: 27
ASP.Net Bible
Views: 1458  |  Downloads: 183
ASP.Net 4 all
Views: 56  |  Downloads: 20
An Introduction to ASP.NET 2.0
Views: 147  |  Downloads: 46
An Introduction to ASP.NET MVC
Views: 19  |  Downloads: 5
ASP.NET documents
Views: 313  |  Downloads: 28
premium docs
Other docs by Amna Khan
Wandering spleen
Views: 821  |  Downloads: 34
Variation of Spleen Size in College Age Athletes
Views: 618  |  Downloads: 2
THYMIC TUMORS - General Thoracic Surgery
Views: 642  |  Downloads: 32
Thymic malignancies and other mediastinal tumors
Views: 895  |  Downloads: 57
TCVM Food Therapy for Gastrointestinal Disorders
Views: 623  |  Downloads: 13
Stomach and spleen
Views: 1516  |  Downloads: 47
Spleen Injuries Contusion and Laceration
Views: 2680  |  Downloads: 36
Spleen - Ultrasound Technique.
Views: 921  |  Downloads: 44
She has tuberculosis of peripheral lymph nodes
Views: 533  |  Downloads: 9
Platelet Disorders in Companion Animals
Views: 435  |  Downloads: 5
Osseous Tissue and Bone Structure
Views: 1541  |  Downloads: 29