|
The MinCor.NET Java Connectivity feature offers an easy and high performance solution to get interoperability between the .Net Compact Framework and Java. You can access EJB or Java objects implementing RMI remote interfaces. It is also possible to use and exchange Java serializable objects, catch exceptions thrown in Java or throw exceptions in .Net. If you have a running Java system all this is possible without any changes on the Java side. Many Java types are directly mapped to .Net types, e.g. java.util.Hashtable is mapped to System.Collections.Hashtable The mapping is performed in two steps. During the first step Java is mapped to IDL and during the secound step IDL is mapped to .Net. IDL means Interface Definition Language. It is a specification published by the Object Management Group (OMG). In our main Demo we show the mapping of core IDL Types like: short, long, union, enum and so on. In the examples listed below we show how the mapping between .Net and Java works in a more general view with a focus on the Java language types. In all the following examples we use Java as server and .Net as client. The Java server is written as RMI server. The mapping is the same no matter which environment you are using: RMI on a Java server or EJBs on a J2EE server.
- Requirements - Remarks - Mapping for Java primitive types - Mapping for Java types First steps - Getting started - A simple "Hello" example Language mapping - Attributes - Java Attributes (set/get/is) - JavaNames - Java Names starting with $, _, ... - OverloadMethods - Method Signatures overloaded in Java - ObjectByValue - Java Serializables - Arrays - Multi Dimensional Array - Collections - HashTable, ArrayList,... - InnerClasses - A Java Serializable with an Inner Class - Exceptions - Java User Exceptions Common patterns - Callback - Callbacks from Java to .Net
- Sun J2SE JDK 1.4.2 (www.java.sun.com) - Start the Sun name service (orbd). Use the batch 'MinCor\DemoJava\startNameService.bat' - Add 'MinCor\bin\MinCorCF.Dll' as reference to your .Net projects. - Add 'MinCor\bin\JavaBuildinTypesCF.Dll' (MinCor.Java-Feature) as reference to your .Net projects.
Each example is located in a separate folder named 'MinCor\DemoJava\<NameOfExample>'. This folder comprises three subdirectories: 'JavaServer': contains 2 batches: - 'buildServer.bat' Allows to create the 'server.jar', the IDL files and the .Net stub/skeleton code. - 'startServer.bat' Allows to start the server. Please, ensure that the Sun naming service is running (s.f. section requirements). 'DotNetClient': contains the .Net project for the client. The client does not need any startup parameter, hence there is no startup batch. 'IDL': contains the IDL file. The IDL files are created by the 'buildServer.bat' batch.
Java OMG IDL .Net ----------------------------------------------- void void void boolean boolean bool char wchar char byte octet byte short short short int long int long long long long float float float double double double string WStringValue string
Java .Net ----------------------------------------------- java.rmi.Remote Middsol.CORBA.Object java.math.BigInteger Middsol.java.math.BigIntegerHolder java.net.URI System.Uri java.net.URL System.Uri java.sql.Date System.DateTime java.sql.Time System.DateTime java.sql.TimeStamp System.DateTime java.util.ArrayList System.Collections.ArrayList java.util.Calender Middsol.java.util.CalenderHolder java.util.GregorianCalender Middsol.java.util.GregorianCalenderHolder java.util.Date System.DateTime java.util.Hashtable System.Collections.Hashtable java.util.HashMap Middsol.java.util.HashMapHolder java.util.HashSet Middsol.java.util.HashSetHolder java.util.IdentityHashMap Middsol.java.util.IdentityHashMapHolder java.util.LinkedHashMap Middsol.java.util.LinkedHashMapHolder java.util.LinkedHashSet Middsol.java.util.LinkedHashSetHolder java.util.LinkedList Middsol.java.util.LinkedListHolder java.util.Locale System.Globalization.CultureInfo java.util.Properties Middsol.java.util.PropertiesHolder java.util.Random System.Random java.util.SimpleTimeZone Middsol.java.util.SimpleTimeZoneHolder java.util.Stack Middsol.java.util.StackHolder java.util.TreeMap Middsol.java.util.TreeMapHolder java.util.TreeSet Middsol.java.util.TreeSetHolder java.util.Vector Middsol.java.util.VectorHolder