Platform Unification Strategy


The goal of interoperability solutions is to enable point-to-point integration between components on both platforms, while preserving the object calling syntax of each platform and without introducing additional performance or management overhead. Solutions such as bridging can to some degree preserve the native object calling semantics used by the .NET and Java EE developers. Web services provide a well-supported and standards-based interface. However, interfacing using Web services changes the object calling semantics and introduces significant performance and management issues.

These solutions do not address the management complexities of a mixed-system. .NET and Java EE have fundamentally different models for management and security that are not resolved by point-to-point solutions. This requires not only preserving .NET and Java EE calling semantics for component developers, but deployment of all of the components on a homogenous platform with a single management and security model. Managing interoperability solution incorporates two elements: a solution for development timerequiring multi-language support, and a solution for runtime and deploymentrequiring the hosting of multiple environments on a single platform. In the case of this reference application, it would require seamless development of the front end in the .NET environment in C# or VB.NET and deployment of both the front end and the back end on Java EE.

Before delving into details of Java and .NET manageability, it is important to understand the fundamentals of the Unification strategy.

Platform Unification Overview

In the Platform Unification approach, the code and runtime environment run on one platform, for instance .NET, that is fully hosted on the interoperating system such as Java EE. This approach preserves the integrity of the .NET application and enables .NET developers to continue to develop their code, while providing deployment on a single, homogenous platform. Mainsoft's implementation of this approach in their Visual MainWin for the Java EE Platform product provides the infrastructure to use Java EE as a cross-language platformsupporting .NET languages and Java on a common Java EE platform. This allows for a unified runtime deployment environment.

The Mainsoft implementation provides platform unification through cross-compilation, a Mono-based .NET environment implemented on Java EE, and integration with the development environment.

Cross Compilation

For .NET code to execute in the Java EE environment, the code must be executable as compliant Java bytecode that can execute in a Java virtual machine. The Mainsoft binary compiler converts Microsoft Intermediate Language code into pure Java bytecode. The conversion must bridge the difference in .NET and Java semantics, while producing efficient and compliant code. The key elements of the conversion are

Direct Mapping The compiler directly maps object structure, classes, interfaces and types, and the flow of control semantics from .NET to the equivalent Java semantics.

.NET Semantics The compiler handles .NET semantics not present in Java. These semantic gaps include

  • .NET unsigned type Unsigned type variables and fields are represented by their signed equivalent (that is, a uint parameter will be an int parameter in the Java method). Unsigned semantics are provided by handling the unsigned opcodes of .NET and implementing them on top of Java.

  • .NET value types Struct is supported by creating a class for the struct, by implementing copy on assignment semantics, and by specially initializing structs (fields and local variables) before their first use.

  • .NET Delegates The delegate type is implemented by a class that defines an Invoke method with the delegate parameters and return value. Each creation of specific delegates (that is, new MyDel(this.MyFunc)) is implemented by creating a class for each case that inherits from the class of the delegate type and that implements Invoke to call the function passed to the delegate constructor. (in the case of new MyDel(this.MyFunc), the created class Invoke simply calls MyFunc).

  • .NET basic type mapping to Java Native Types The compilation maps the most basic .NET types to their native Java equivalents. This maintains the Java VM's special handling of the basic object types. System.Object is mapped to java.lang.Object, System.Exception to java.langThrowable, and System.String to java.lang.Stringand arrays are mapped to Java arrays. This is essential for conversion to generate efficient code.

Implementing this approach requires use of a cross compiler as shown in Figure 15-6. The cross compiler resolves differences in the .NET and Java platforms and produces Java bytecode output from the .NET code that is part of the application. The output of the cross compiler is Java class files that are packaged as a Java Archive File (JAR).

Figure 15-6. Visual MainWin Compiler


.NET Runtime Environment on Java EE

.NET code is hosted in a .NET environment running on Java EE. The Mainsoft implementation of the .NET environment is based on the open source Mono project.

The Mainsoft .NET runtime environment hosts the Mono libraries by cross-compiling these libraries to Java bytecode. Mainsoft classes provide the connection between the .NET namespace provided through Mono and the underlying Java SE and Java EE runtime. The Mainsoft integration of the Mono classes includes

  • Support for .NET-based namespaces, such as System, System.IO, System.Reflection, and System.Serialization. These namespaces are implemented in libraries such as mscorlib, which provide integration with Java SE JDK classes.

  • Support for connecting the .NET System.Web assembly, which is responsible for browser-server applications, with the Java EE Servlet API. The Mainsoft implementation provides a thin layer of classes that provide the connection and allow hosting the Mono implementation of the System.Web namespace.

  • Support for OleDB and SqlClient the .NET data provider (part of System.Data assembly) implemented on top of the JDBC API, which enables components to access data from multiple data sources.

The structure of the runtime stack is shown in Figure 15-7.

Figure 15-7. Visual MainWin technology stack


Interoperability of .NET and Java Code

Interoperability of Java code from .NET is supported natively. Because the runtime environment for all code, .NET and Java, remains the Java VM, all compliant Java code will run. The .NET programmer can access Java classes and namespaces transparently as from the .NET environment as if these classes were .NET classes. The JDK and Java EE classes are made available to the .NET developer as well.

.NET classes can be called by Java code as well, provided that the .NET classes expose interfaces that can be directly mapped to Java.

In a distributed environment, .NET code can reference Java components deployed either as EJBs or as Web services. Because the runtime environment is Java, point-to-point integration with EJBs is available over RMI. The .NET programmer sees the EJB as a .NET class with a .NET namespace. Additional tools in the provided development environment extensions generate wrapper code, which implements a service location pattern to map the EJB semantics of JNDI lookup and invocation of the home interface methods .NET class semantics [CORE]. .NET code can invoke Web services and implement Web service endpoints through the supported Mono implementation of the .NET System.Web.Services namespace.

The Visual MainWin environment provides an API for allowing .NET programmers to access the Java EE server context. This is necessary for programmatic security and for manipulating JNDI objects such as Data Sources. Additionally conversion routines are provided to allow conversion between Java types, such as java.math.BigInteger and functionally equivalent .NET types, such as Decimal and DateTime.

With this background on platform unification, the next sections elaborate on how to achieve management of .NET and Java EE applications.

Interoperability Management Solution

The Platform Unification approach enables .NET and Java EE code to interoperate by deploying all of the application components on a homogeneous Java EE environment. This achieves a cross-language/cross-environment platform with a uniform Java EE management model. Thus the challenges posed by the mixed management models described here are significantly reduced. In this model, the inter-component communications are based on native protocolseither Java method calls or RMI, and there are no additional marshaling or protocol interpretations. The platform unification model does not impose an architectural model on the components. It allows the components to be tightly or loosely coupled through .NET and Java EE Web services implementations deployed on Java EE. This architectural flexibility allows a .NET Java EE system to be designed to meet the organization structure, rather than be constrained by the interoperability technology. Additionally, the .NET semantics are preserved for the developer, but the manager has a coherent Java EE management view of the system. The management functionality leverages the Java EE platform and is not limited to the cross-platform implementation of Mono.

Platform Unification ISO Management Characteristics

There are significant benefits in meeting the management requirements just defined.

  • Fault Management Monitoring, event handling, and logging are implemented through the underlying Java EE mechanisms. The .NET System.Diagnostics APIs for logging can be implemented through Java logging APIs, java.util.logging, and those provided by the application server. The JMX and logging APIs are also available to the .NET environment.

  • Configuration Management System management is greatly simplified by deployment of a homogeneous Java EE platform. Tuning, updates, and patch management can be performed for a homogenous system configuration. As described here, all components are deployed as Java EE modules. This simplifies application management and update deployment as well. Application management is typically done through the Java EE administration console across the platform, including for the .NET components. This is more efficient than a mixed-platform system, which requires multiple consoles. Resources, such as DataSources and Enterprise services, are managed uniformly through the Java EE console.

    The Mainsoft Visual MainWin tool set is tightly integrated with the Visual Studio IDE, allowing .NET developers the full cycle of development and deployment on Java EE application servers.

  • Accounting Management Application deployment on a unified platform is managed through a single accounting management system running on Java EE. This reduces the complexity in managing SLAs across different accounting systems on different platforms.

  • Performance Management A key benefit of the Platform Unification approach is that inter-component communications do not incur the additional overhead of wire protocol conversions such as bridging or the overhead of SOAP/HTTP as in Web services. The performance of applications deployed on the unified platform should approach the expected performance of a native Java EE application. Statistics can be collected across the application through the Java EE metering facilities.

  • Security Management Under the Platform Unification model, the security model is provided through Java EE. The homogenous Java EE security model across the application, using either JAAS or Java EE security, allows for management of users and authorizations in a single domain. This greatly simplifies the management of security and eliminates the need for IT managers to synchronize users and authorizations across multiple domains.

This model allows the .NET components to benefit from the Java EE security model, allowing the use of Java EE declarative security. The access to the Java EE APIs also allows the use of programmatic security.

Benefits and Limitations

The Platform Unification approach, by design, assumes that the target deployment platform for both the Java EE and .NET components is Java EE. This strategy does not explicitly facilitate management of Java and .NET applications deployed on the Java EE platform. There is no added management functionality such as service lifecycle monitoring or metering provided with this solution. The Java EE application server typically provides management facilities that can be used along with commonly deployed enterprise management solutions such as CA Unicenter.

The Platform Unification approach is not appropriate where Microsoft-specific applications, such as Exchange or BizTalk-based applications, are necessary. Integrations with other applications that require native Windows functionality are also not suitable for this approach. The integrated development process requires access to the .NET source, in order to support the develop/compile/cross-compile/debug cycle. Thus this approach would not be applicable where the .NET source is not available to be recompiled.

The Co-Development Experience

The diversity of expertise of developers in a mixed platform development contributes to the productivity of the IT organization. However, the divergence of the development environment, such as the .NET and Java EE environments, presents a challenge for organizations with both .NET and Java EE development teams. The Visual MainWin tool set for platform unification provides the .NET development team with full integration for the Visual Studio .NET development environment. This preserves the development experience for each team and allows the .NET developer to continue to develop .NET code while deploying components on Java EE.

The developer builds a .NET project configured for Java EE servers and the complete build process from C# or VB.NET compilation through binary compilation to Java bytecode validation of Java references, as well as the packaging as Java EE JAR and WAR files, is performed within Visual Studio. Application deployment on Java EE servers is managed, again, from within Visual Studio .NET. The Visual MainWin integrated debugger enables C# or VB.NET programmers to debug applications running in the Java EE application server at the .NET source code level. The Visual MainWin environment simplifies the integration of Java and EJB components into the .NET code, as just described. This model allows the .NET team on-going integrated development with the Java EE team.




Java EE and. Net Interoperability(c) Integration Strategies, Patterns, and Best Practices
Java EE and .NET Interoperability: Integration Strategies, Patterns, and Best Practices
ISBN: 0131472232
EAN: 2147483647
Year: N/A
Pages: 170

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net