Everything Java Apache Geospatial Open Source. Hello Shinning Stars!!! Vincent Massol, Raphael Luta, Santiago Gala, Carsten Z.

Friday, September 24, 2004

The xsi:type attribute of a complexType implies that the complexType has been extended to contain new properties. See Doing More With XML Schemas (part 1): "xsi:type"
This article recommends naming(typing) all xsd:complexTypes maximizing the ability to reuse the type. Doing More With XML Schemas (part 1)
Major flaws in software can be related to file location and syntax validation. Which is why XML was created.

Tuesday, September 21, 2004

I have been looking for cvs firewall and I just found it.
Access cvs using http proxy.
CVS from behind a firewall.
Of all places I found this on msdn.

http://blogs.msdn.com/robmen/archive/2004/08/09/211126.aspx

Monday, September 20, 2004

My successful use of CVSGrab :

%CVSGRAB_HOME%\cvsgrab -rootUrl http://cvs.apache.org/viewcvs.cgi -packagePath xml-xmlbeans -destDir . -prune true -proxyHost 201.3.3.35 -proxyPort 8080 -proxyUser FR999925 -proxyPassword "lopign@"

Thursday, August 05, 2004

The Comparable inteface requires that the compareTo(Object) method is implemented.
The difference between a Statement and a PreparedStatement is that the PreparedStatement is precompiled, therefore faster.

Monday, August 02, 2004

Thursday, July 29, 2004

XML Data Binding Resources - A resource archive of xml binding tools.

Thursday, July 22, 2004

HowTo get the most out of open source database mapping tools. Which one should I choose? Castor, Hibernate, Ojb, Torque.

Tuesday, July 06, 2004

Up until now I am putting in practice XMLBeans, Ojb, and Castor. Let's just say I like diversity. So from the bottom up it would be described this way. We have a database schema which I need to represent in xml. So I use Ojb 1.0.0 ReverseDB tool (org.apache.ojb.tools.mapping.reversedb.Main in the db-ojb-1.0.0-tools.jar) to create a xml and all the JavaBeans that I need for Castor. This xml is very nice, it describes all the tables, columns, primary and foreign keys, relations, collections that exist in our database schema. This will help me when using Castor.

I need a mapping file for Castor so I wrote a small xslt to convert my database xml into a mapping xml. Here it is :

<?xml version="1.0" encoding="UTF-8"?>
<!-- Warning the key-generator="SEQ" has to be added manually to mapping.xml -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<mapping>
<key-generator name="SEQUENCE" alias="SEQ">
<param name="sequence" value="seq_id"/>
</key-generator>
<xsl:apply-templates/>
</mapping>
</xsl:template>
<xsl:template match="class-descriptor">
<xsl:if test="field-descriptor[@primarykey='true']">
<class>
<xsl:attribute name="identity"><xsl:for-each select="field-descriptor[@primarykey='true']"><xsl:value-of select="concat(@name, ' ')"/></xsl:for-each></xsl:attribute>
<xsl:attribute name="name"><xsl:value-of select="concat('db.finaixm.', @class)"/></xsl:attribute>
<map-to>
<xsl:attribute name="table"><xsl:value-of select="@table"/></xsl:attribute>
</map-to>
<xsl:apply-templates/>
</class>
</xsl:if>
</xsl:template>
<xsl:template match="field-descriptor">
<field>
<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
<xsl:attribute name="type"><xsl:choose><xsl:when test="@jdbc-type = 'DECIMAL'">long</xsl:when><xsl:when test="@jdbc-type = 'VARCHAR'">string</xsl:when><xsl:when test="@jdbc-type = 'TIMESTAMP'">timestamp</xsl:when></xsl:choose></xsl:attribute>
<sql>
<xsl:attribute name="name"><xsl:value-of select="@column"/></xsl:attribute>
</sql>
</field>
</xsl:template>
</xsl:stylesheet>

Here is a quick Ant task to run it,

<target name="finaixm-mapping">
<echo>Building Castor mapping file</echo>
<xslt style="xslt/oracle2mapping.xslt" in="oracle.xml" out="etc/mapping.xml" />
</target>

I also want to manipulate xml files that conform to a given xml schema. So I use XMLBeans to read the schema and create a parser and custom API for the given schema. Practical! So I've got JavaBeans on both sides, all I need to do now is apply business logic to some Velocity templates that can import xml to the database and export from the database to xml. Thanks to the Open Source community.

Friday, July 02, 2004

Hierarchial database inserts can be made using Castor. The difficulty becomes creating the hierachial object.
An interesting trend is to see Open Source binaries distributed with the code source CVS tree. Velocity 1.4 is an example.

Wednesday, June 16, 2004

This is my patch for my bug.

modules/core/src/java/org/openejb/deployment/OpenEJBModuleBuilder.java
TransactionPolicyHelper transactionPolicyHelper = new TransactionPolicyHelper(ejbJar.getAssemblyDescriptor());

modules/core/src/java/org/openejb/deployment/TransactionPolicyHelper.java
public TransactionPolicyHelper(AssemblyDescriptorType assemblyDescriptor) {
if (assemblyDescriptor != null) {
processContainerTransactions(assemblyDescriptor.getContainerTransactionArray());
}
}

public TransactionPolicyHelper(ContainerTransactionType[] containerTransactions) {
processContainerTransactions(containerTransactions);
}

private void processContainerTransactions(ContainerTransactionType[] containerTransactions) {
for (int i = 0; i < containerTransactions.length; i++) {
ContainerTransactionType containerTransaction = containerTransactions[i];
String transactionAttribute = containerTransaction.getTransAttribute().getStringValue();
MethodType[] methods = containerTransaction.getMethodArray();
for (int j = 0; j < methods.length; j++) {
MethodType method = methods[j];
String ejbName = method.getEjbName().getStringValue();
MethodTransaction methodTransaction = new MethodTransaction(method, transactionAttribute);
putMethodTransaction(ejbName, methodTransaction);
}
}
}
Keep an eye on the Overview (Geronimo :: System 1.0-SNAPSHOT API)
ejbJar : <xml-fragment version="2.1" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee">
<j2ee:display-name>ConverterJAR</j2ee:display-name>
<j2ee:enterprise-beans>
<j2ee:session>
<j2ee:ejb-name>ConverterBean</j2ee:ejb-name>
<j2ee:home>converter.ConverterHome</j2ee:home>
<j2ee:remote>converter.Converter</j2ee:remote>
<j2ee:ejb-class>converter.ConverterBean</j2ee:ejb-class>
<j2ee:session-type>Stateless</j2ee:session-type>
<j2ee:transaction-type>Bean</j2ee:transaction-type>
<j2ee:security-identity>
<j2ee:use-caller-identity/>
</j2ee:security-identity>
</j2ee:session>
</j2ee:enterprise-beans>
</xml-fragment>
java.lang.NullPointerException
at org.openejb.deployment.OpenEJBModuleBuilder.addGBeans(OpenEJBModuleBuilder.java:426)
at org.openejb.deployment.OpenEJBModuleBuilder$$FastClassByCGLIB$$11bd7b20.invoke()
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:87)
at org.apache.geronimo.gbean.jmx.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
at org.apache.geronimo.gbean.jmx.GBeanMBeanOperation.invoke(GBeanMBeanOperation.java:141)
at org.apache.geronimo.gbean.jmx.GBeanMBean.invoke(GBeanMBean.java:740)
at org.apache.geronimo.gbean.jmx.RawInvoker.invoke(RawInvoker.java:89)
at org.apache.geronimo.gbean.jmx.RawOperationInvoker.invoke(RawOperationInvoker.java:34)
at org.apache.geronimo.gbean.jmx.CGLibMethodInterceptor.intercept(CGLibMethodInterceptor.java:110)
at org.apache.geronimo.j2ee.deployment.ModuleBuilder$$EnhancerByCGLIB$$9e45a280.addGBeans()
at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:225)
at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:148)
at org.apache.geronimo.j2ee.deployment.EARConfigBuilder$$FastClassByCGLIB$$38e56ec6.invoke()
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:87)
at org.apache.geronimo.gbean.jmx.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
at org.apache.geronimo.gbean.jmx.GBeanMBeanOperation.invoke(GBeanMBeanOperation.java:141)
at org.apache.geronimo.gbean.jmx.GBeanMBean.invoke(GBeanMBean.java:740)
at org.apache.geronimo.gbean.jmx.RawInvoker.invoke(RawInvoker.java:89)
at org.apache.geronimo.gbean.jmx.RawOperationInvoker.invoke(RawOperationInvoker.java:34)
at org.apache.geronimo.gbean.jmx.CGLibMethodInterceptor.intercept(CGLibMethodInterceptor.java:110)
at org.apache.geronimo.deployment.ConfigurationBuilder$$EnhancerByCGLIB$$7a1ca0ae.buildConfiguration()
at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:132)
at org.apache.geronimo.deployment.Deployer$$FastClassByCGLIB$$734a235d.invoke()
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:87)
at org.apache.geronimo.gbean.jmx.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
at org.apache.geronimo.gbean.jmx.GBeanMBeanOperation.invoke(GBeanMBeanOperation.java:141)
at org.apache.geronimo.gbean.jmx.GBeanMBean.invoke(GBeanMBean.java:761)
at mx4j.server.interceptor.InvokerMBeanServerInterceptor.invoke(InvokerMBeanServerInterceptor.java:218)
at mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:121)
at mx4j.server.interceptor.SecurityMBeanServerInterceptor.invoke(SecurityMBeanServerInterceptor.java:86)
at mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:121)
at mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:121)
at mx4j.server.interceptor.ContextClassLoaderMBeanServerInterceptor.invoke(ContextClassLoaderMBeanServerInterceptor.java:205)
at mx4j.server.MX4JMBeanServer.invoke(MX4JMBeanServer.java:1079)
at org.apache.geronimo.kernel.Kernel.invoke(Kernel.java:231)
at org.apache.geronimo.system.main.CommandLine.main(CommandLine.java:82)

Seems to be that this bug is due to the fact that the builder is looking for the assembly-descriptor element. This element is optional according xml schema descriptor file http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd


Friday, June 11, 2004

java.lang.NullPointerException
at org.openejb.deployment.OpenEJBModuleBuilder.addGBeans(OpenEJBModuleBuilder.java:409)
at org.openejb.deployment.OpenEJBModuleBuilder$$FastClassByCGLIB$$11bd7b20.invoke()
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:87)
at org.apache.geronimo.gbean.jmx.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
at org.apache.geronimo.gbean.jmx.GBeanMBeanOperation.invoke(GBeanMBeanOperation.java:141)
at org.apache.geronimo.gbean.jmx.GBeanMBean.invoke(GBeanMBean.java:740)
at org.apache.geronimo.gbean.jmx.RawInvoker.invoke(RawInvoker.java:89)
at org.apache.geronimo.gbean.jmx.RawOperationInvoker.invoke(RawOperationInvoker.java:34)
at org.apache.geronimo.gbean.jmx.CGLibMethodInterceptor.intercept(CGLibMethodInterceptor.java:110)
at org.apache.geronimo.j2ee.deployment.ModuleBuilder$$EnhancerByCGLIB$$9e45a280.addGBeans()
at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:209)
at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:142)
at org.apache.geronimo.j2ee.deployment.EARConfigBuilder$$FastClassByCGLIB$$38e56ec6.invoke()
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:87)
at org.apache.geronimo.gbean.jmx.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
at org.apache.geronimo.gbean.jmx.GBeanMBeanOperation.invoke(GBeanMBeanOperation.java:141)
at org.apache.geronimo.gbean.jmx.GBeanMBean.invoke(GBeanMBean.java:740)
at org.apache.geronimo.gbean.jmx.RawInvoker.invoke(RawInvoker.java:89)
at org.apache.geronimo.gbean.jmx.RawOperationInvoker.invoke(RawOperationInvoker.java:34)
at org.apache.geronimo.gbean.jmx.CGLibMethodInterceptor.intercept(CGLibMethodInterceptor.java:110)
at org.apache.geronimo.deployment.ConfigurationBuilder$$EnhancerByCGLIB$$7a1ca0ae.buildConfiguration()
at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:132)
at org.apache.geronimo.deployment.Deployer$$FastClassByCGLIB$$734a235d.invoke()
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:87)
at org.apache.geronimo.gbean.jmx.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
at org.apache.geronimo.gbean.jmx.GBeanMBeanOperation.invoke(GBeanMBeanOperation.java:141)
at org.apache.geronimo.gbean.jmx.GBeanMBean.invoke(GBeanMBean.java:761)
at mx4j.server.interceptor.InvokerMBeanServerInterceptor.invoke(InvokerMBeanServerInterceptor.java:218)
at mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:121)
at mx4j.server.interceptor.SecurityMBeanServerInterceptor.invoke(SecurityMBeanServerInterceptor.java:86)
at mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:121)
at mx4j.server.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:121)
at mx4j.server.interceptor.ContextClassLoaderMBeanServerInterceptor.invoke(ContextClassLoaderMBeanServerInterceptor.java:205)
at mx4j.server.MX4JMBeanServer.invoke(MX4JMBeanServer.java:1079)
at org.apache.geronimo.kernel.Kernel.invoke(Kernel.java:231)
at org.apache.geronimo.system.main.CommandLine.main(CommandLine.java:82)

Thursday, June 10, 2004

How does the demo application work?
Check out Cactus, Clover.

I just had the idea to write a Getting Started guide to Geronimo.
Trying this in Geronimo :

java -jar bin/server.jar org/apache/geronimo/Demo

TIP : Before building Geronimo modify the file modules/assembly/src/plan/system-plan.xml changing INFO to DEBUG. This will tell Log4j to output debug statements.