Monday, November 22, 2004

Introducing Galvanium Framework

Galvanium Framework
Introduction
Integrating.NET with J2EE via Web Service framework may encounter something that is not smooth. For example, Axis cannot serialize java.util.List, and this type of collection cannot be consumed, directly, by .NET. Moreover, using Web Services to interoperate in LAN dramatically decreases performance of the system.

Hessian protocol introduced by Caucho Technogy is a kind of binary transportation over HTTP. Its Java implementation as Servlet provides lightweight communication comparing to SOAP. Hessian came with a complete set of serializers/deserializers that work smoothly for Java types. Additionally, it is small enough to be compiled with IKVM, and used in the .NET side via IKVM runtime. Using IKVM and Hessian lead to a fast and flexible way to interoperate .NET with Java. It eliminates a lot of type mapping issues, and works through firewall.

Galvanium framework is built on this idea, plus the get/set simulator of Java Bean for .NET. The get/set simulator utilizes the data binding feature of .NET to display data from enterprise J2EE backend in .NET GUI.

Features

  • Fast, and Lightweight Protocol
  • Seamless Integration of J2EE objects and .NET GUI
  • Direct .NET/Java type mapping
  • Display/Edit Java objects in Databinding Controls of .NET
  • Works behind Firewall
  • Support Mock Object technique via ClientProxyFactory

Components
  • ClientProxyFactory
  • BeanDescriptor
  • BeanCollection
  • GxControl

Software Architecture


License
Galvanium Framework itself is ASF's Apache License 2.0. However, if it is used by GxControl which is based on MyXaml, it will be GPLed.

Download
Galvanium framework is hosted as a part of BoldSoap project. It can be donwloaded form SourceForge’s CVS repository.

cvs -d:pserver:anonymous@cvs.sourceforge.net:
/cvsroot/boldsoapserver login

cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:
/cvsroot/boldsoapserver co galvanium

Friday, November 19, 2004

Hessian Client for .NET

In order to interoperate with J2EE, I port Hessian (client classes) to be .NET library.

Hessian is small, and not complex enough to be compiled with IKVM. After removing its server-side part, and working around regarding GNU Classpath's URLConnection bug, Hessian works for me from .NET side. This library will be used as a transport to communicate with JBoss, and Hibernate. I'll have a complete tutorial soon.

Surely, my GUI client is scritable MyXaml :)

Tuesday, November 16, 2004

Expose Single Bean

Again with Java-style Bean properties in .NET. Now I have a class to help one exposing Jave setter/getter as a .NET property.

For example, I have a bean:


public class Bean {
private string _name;
public string getName() {
return _name;
}
public void setName(string value) {
_name = value;
}
}


I can expose a single Bean to the Text property of a TextBox txtTestProp using the BeanDescriptor as follows:


Bean b = new Bean();
b.setName("ck");
BeanDescriptor bd = new BeanDescriptor(b);
txtTestProp.DataBindings.Add("Text", bd, "Name");


Sunday, November 14, 2004

Scriptable MyXaml with NVelocity

I'm very impressed by MyXaml at first sight. Creating GUI with its declarative programming style is very useful for me. My idea is to generate .NET GUI of Hibernate's Beans via reflection (see last post). After surveying some template generators, I've found CodeSmith, TahoGen, and NVelocity. I've selected NVelocity because it's under Apache license. CodeSmith cannot be distributed with MyXaml (because of it's GPLed). Alternatively, you can wait for TahoGen. But now I have a working .NET UserControl of MyXaml that dynamic. :)

Here is a screenshot(click to enlarge):




Code snippet:


<GroupBox def:Name="grpNavBar" Text="test"
Location="8,8" Size="150,150">
<Controls>
#foreach ( $item in [1..3] )
#set( $loc = $item * 25)
<LinkLabel def:Name="lnkTest${item}"
Text="test" Location="8, $loc"
Tag="Test" />
#end
</Controls>
</GroupBox>

Tuesday, November 09, 2004

Java Bean-style Property binding in .NET

I have a problem with the Bean properties when I use .NET classes (of Java Beans) that are compiled by IKVM. Searching with google for a few days, I found some sources that describe how to create custom property descriptors. Now I have my beans working with .NET databinding. This is a Bean-style class that I've used in testing:


public class Bean {
private string name;
public Bean() {
}
public string getName(){
return name;
}
public void setName(string value) {
name = value;
}
}


In the code below, BeanCollection is the class that implements ITypedList to simulate Bean getter/setter.


private void button1_Click(object sender,
EventArgs e) {
Bean[] b = new Bean[2];
b[0] = new Bean();
b[0].setName("hello");
b[1] = new Bean();
b[1].setName("Bean Binding in C#");
BeanCollection c;
c = new BeanCollection(b, typeof(Bean));
listBox1.DataSource = c;
listBox1.DisplayMember = "Name";
textBox1.DataBindings.Add("Text", c, "Name");
}


Here is the screenshot: