Life after JavaReusing code and skills in a .NET world
AgendaJava- OOP language vsplatformJava vs C#Components & Controls vs JavaBeansPME (Property – Method – Event) modelJUMP & J#Java – COM bridgesIKVM.net Web ServicesWSRP : Web Services for Remote Portlets
Java as an OOPlanguageInheritance, Polymorphism, Dynamic Class Loading, Exceptions...Great esteem and proved record at academiaMultitude of related libraries and software, mainly OpenSourceLots of new programmers introduced to the Java language during their studies
Java as a platformJava 1.x –command line, AWT andAppletsJava 1.2, 1.3, … = Java 2 (JFC/Swing, …)JavaSE (= Standard Edition – Desktops)JavaEE (= Enterprise Edition – Servers)JavaME (= Micro Edition – Mobiles)(Re)focus  JavaFX (Java vs JavaScript)
The future of Java?Change in prioritiesSun Microsystems  OracleJDeveloper vs NetBeans IDEJava Cloud, Java.net  Kenai Java.netCopyright issuesSun vs Microsoft (MSJVM)Oracle vs Google (Android Dalvik VM)No standardization by established international organisations (ISO pull-out)
Economics & work conditions:CompetitiveFluctuating Worker mobilityReuse:CodeSkillsFlexibility = invaluable ally
Java vs C#Anders Hejlsberg original author ofTurbo Pascalchief architect of DelphiJ++, WFC (Windows Foundation Classes)lead architect ofC#LINQ (Language Integrated Query)C# = Java + Object Pascal (Delphi) + VB ++
ComponentsUnstructured DataRecord = Structured, Addressable (Name, Pos) DataObject = Record + Methods to manipulate its dataComponent = Object + PME + Resources (Packaging) Agent = Component + (Internal) Logic / Program Loop
Controls / WidgetsControl / Widget = User Interface ComponentJavaBeans:Components (non visible)Controls (usually JFC/Swing /Model-ViewController [M-VC])Enterprise JavaBeans “similar” toCOM+ components (not much related to typicalJavaBeans)for J2EE
PME (Property-Method-Event)Properties (get/set accessors, metadata)Methods (OOP)EventsJava: initially tightly-coupled (base classes / abstract methods), later on callback interfacesVB: method signatures (WithEvents)Object Pascal / Delphi: method variablesC#: delegates
JUMP & J# (Microsoft)JUMPImport Java “projects” from Visual StudioConvert Java code toC#J#Java compiler  IL code, not Java bytecodeJava datatype boxingJava 1.x class library, Swing & Collections APIUp until Visual Studio 2005
Java – COM/.NET bridges (1)JACOB (OpenSource)COM Automation from Java via JNI wrappersjacoZoomActiveX Controls / Servers ([D]COM / Automation)J-Integra .COMDCOM wire protocol (ORPC) topure JavaJ-Integra .NET.NET Remoting wire protocolto pure Java, Visual Studio & Eclipse plugins
Java – COM/.NET bridges (2)COMConnectJava  COM/.NET – stateful TCP, low latencyJni4net (OpenSource)intra-process, object oriented, JNI implementationJNBridgeProVisual Studio & Eclipse plugins, shared memory, sockets, network binary protocol, HTTP/SOAPEZ JComJavaCOM/.NET, drag-drop Swing components
Java – COM/.NET bridges (3)Java Plug-in (JavaBeans Bridge for ActiveX)Sun/Oracle Java VM, Web Browser integration, JavaBeans ActiveX controls (typelibrary)Java C# Bridge (OpenSource)Serlializing/DeserlializingJava - C# objects, manual authorC# object or use generic JavaObject and dynamic queryCaffeine (OpenSource)Hosting JVM in .NET Runtime,JNI OOP wrapperR-JAX (pioneering, RMI/HTTP, obsolete)
JNBridgePro – Call Java from .NET
JNBridgePro – Call Java from .NET (1)
JNBridgePro – Call Java from .NET (2)Start Proxy Generator
JNBridgePro – Call Java from .NET (3)Edit Classpath
JNBridgePro – Call Java from .NET (4)Class Path Entries
JNBridgePro – Call Java from .NET (5)Load Classes
JNBridgePro – Call Java from .NET (6)Load Classes Progress
JNBridgePro – Call Java from .NET (7)Choose Proxies
JNBridgePro – Call Java from .NET (8)Generate Proxies
JNBridgePro – Call Java from .NET (9)Use the Proxies
JNBridgePro – Call Java from .NET (10)Call Java Methods
JNBridgePro – Call Java from .NET (11)Run the Program
JNBridgePro – Call Java from .NETVisually generate proxies: allow .Netaccess Java classesLink .NET proxy assembly to .NET development project (Add Reference)Write .NET code to access Java classes(with IntelliSense)Edit configuration - specify communications mechanism (from in-process on same machine to cross-network)Run integrated .NET and Java code (managed lifecycles)
JNBridgePro – Call .NET from Java
JNBridgePro – Call .NET from Java (1)
JNBridgePro – Call .NET from Java (2)Start Proxy Generator
JNBridgePro – Call .NET from Java (3)Add Assembly
JNBridgePro – Call .NET from Java (4)Assembly List Entries
JNBridgePro – Call .NET from Java (5)Load Classes
JNBridgePro – Call .NET from Java (6)Load Class Progress
JNBridgePro – Call .NET from Java (7)Choose Proxies
JNBridgePro – Call .NET from Java (8)Generate Proxies
JNBridgePro – Call .NET from Java (9)Use the Proxies
JNBridgePro – Call .NET from Java (10)Call .NET Objects
JNBridgePro – Call .NET from Java (11)Run the Program
JNBridgePro – Call .NET from JavaVisually generate proxies: allow Java access .NET  classesReference Java proxy .JAR file from Java development project (place in build CLASSPATH)Write Java code to access .NET classesEdit configuration - specify communications mechanism (from in-process on same machine to cross-network)Run integrated .NET and Java code (managed lifecycles)
JNBridgePro – Visual Studio plugin
JNBridgePro – Eclipse plugin
JNBridgePro – Communications
IKVM.net (Jeroen Frijters)JavaVirtual Machine (JVM) implementation:Microsoft .NET FrameworkMonoComponents:Java Virtual Machine in .NETJava class librariesin .NETJava-.NET interoperability tools
IKVM.net – usage scenariosUse as typical Java Virtual Machine (JVM)Use Java libraries in .ΝΕΤ applicationsDevelop .NET applications in Java language
IKVM.net – usage scenariosUse as typicalJava Virtual Machine (JVM)Drop-in replacement:java -jar myapp.jarikvm -jar myapp.jar
IKVM.net – usage scenariosUse Java libraries in.ΝΕΤ applicationsikvmc  = Java bytecode  .NET ILikvmc -target:library mylib.jarmylib.dllπ.χ. Apache FOP  = XSL-FO  processor (XML  PDF)
IKVM.net – usage scenariosDevelop .NET applicationsin Java languageikvmc  = Java bytecode  .NET ILikvmc -target:exe myapp.jarmyapp.exe
IKVM.netCall .NET API from Java(inIKVM.net JVM)ikvmstub = Java stubs from .NETAPIikvmstub mscorlib.dll mscorlib.jarikvmstub c:\lib\mylib.dll
IKVM.net – integration / toolsMono (OpenSource .NET by Novell)MonoDevelop (IDE)Ant (task for ikvmc)Jar2ikvmc(folder of dependentJARs)
IKVM.netintegrationAnt task for ikvmc <ikvmc target="exe" out="hello.exe"         home="c:/ikvm-0.36.0.11" version="1.0.0.0“       debug="true“ main="net.sf.ant-ikvmc.Hello">   <fileset dir="${build}">       <include name="**/*.class"/>    </fileset>   <fileset dir="${lib}">       <include name="**/*.jar"/>   </fileset></ikvmc>
IKVM.netintegrationJar2ikvmc(folder of dependentJARs)jar2ikvmc.exe JFreeChart JFreeChart2Net.cmd ikvmc swtgraphics2d.jar -target:library ikvmc servlet.jar -target:library ikvmc junit.jar -target:library ikvmc jcommon-1.0.10.jar -target:library ikvmc gnujaxp.jar -target:library ikvmc itext-2.0.2.jar -target:library -r:gnujaxp.dllikvmc jfreechart-1.0.6.jar -target:library -r:jcommon-1.0.10.dll->-r:servlet.dll -r:gnujaxp.dll...
Web ServicesRestlet (Java web framework)Expose/Consume RESTful web APIsJava Web Services Stack (Metro)JAX-WS (Java API for XML Web Services)JAXB (Java Architecture for XML Binding)WSIT (Web Services Interoperability Technologies [aka Project Tango])WSIT (Tango) corresponds to WCF (Indigo)
Web Services for Remote PortletsPortlet = interactive application component, produces markup segments, aggregated and presented inportalsWSRP = interactive web servicesfocused to presentationcontent & apps: discoverable & pluggable
Web Services for Remote PortletsWhy WSRPinstead of simple Web Services?LocalizationMime typesPortlet modes (edit, help, view, custom)Window states (minimized, maximized, solo, normal)
Web Services for Remote PortletsWhy remoteportlets?Ease of configurationPlatform independenceScalability
Web Services for Remote PortletsWSRP ProducerWeb ServiceProvides 1 or morePortletsImplements WSRP interfaces/operationsCan provideruntime (container) fordeploying/management of>1 portlet
Web Services for Remote PortletsWSRP ConsumerWeb Service clientUsually aportalCalls producer WSRP web servicesProvides environment to interact withportlets theProducers provide
Web Services for Remote PortletsProducers (.NET  WSRP)NetUnitySharePoint WSRP ProducerOracle WebCenter .NET AcceleratorConsumers (WSRP  .NET)Microsoft WSRP Toolkit - SharePoint 2007NetUnity WSRP Consumer for SharePointNetUnity WSRP .NET Consumer
References (1)C# andJava comparison (Wikipedia)http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_JavaAnders Hejlsberg (Wikipedia)http://en.wikipedia.org/wiki/Anders_HeljsbergJava ISO pull-out (ECMA fast track to ISO)http://www.crn.com/news/channel-programs/18806978/sun-drops-iso-java-standards-effort-for-good.htmOracle vs Google Android (Dalvik VM)http://www.businessweek.com/news/2010-08-13/oracle-says-google-android-violates-its-java-patents.htmlReferences (2)Java Native Interface (JNI)http://download.oracle.com/javase/6/docs/technotes/guides/jni/spec/jniTOC.htmlJACOBhttp://sourceforge.net/projects/jacob-projectjacoZoomhttp://www.infozoom.de/en_jacoZoom.shtmlJ-Integrahttp://j-integra.intrinsyc.comReferences (3)COMConnecthttp://sourceforge.net/projects/comconnectjni4nethttp://jni4net.sourceforge.netJNBridgeProhttp://www.jnbridge.com
http://www.jnbridge.com/jnbpro.htmEZ JComhttp://www.ezjcom.com
http://www.ezjcom.com/java.net.htmlReferences (4)Java Plug-in (JavaBeans Bridge for ActiveX)http://www.oracle.com/technetwork/java/index-jsp-141438.html
http://download.oracle.com/javase/1.4.2/docs/guide/beans/axbridge/developerguide/index.html
http://download.oracle.com/javase/1.4.2/docs/guide/beans/axbridge/developerguide/examples.htmlJava C# Bridgehttp://java-cs-bridge.sourceforge.netCaffeinehttp://caffeine.berlios.de/site
http://www.codeproject.com/KB/dotnet/Espresso.aspx
http://lsd.luminis.nl/java-net-interoperability/References (5)IKVM.nethttp://www.ikvm.net
http://sourceforge.net/apps/mediawiki/ikvm
http://ant-ikvmc.sourceforge.net

It pro dev_birbilis_20101127_en