Andrej Koelewijn

7/9/2005

More posts on the IT-eye weblog

Filed under: — andrejk @ 12:48 pm

Some of the posts i’ve written on the IT-eye weblog this last week: Finding jar library dependencies using JarJar, Productivity, choice and ADF metadata and Jwebunit, untrusted certificates, https and proxies.

6/24/2005

JDeveloper free as in beer

Filed under: — andrejk @ 7:23 am

Infoworld is reporting that JDeveloper will be gratis: Oracle to offer JDeveloper tool for free.

Out of the box, JDeveloper has a lot more functionality than Eclipse in many areas. Visual JSP editing, visual support for JSF, support for some of the UML diagrams, wizard support for it’s ORM frameworks ADF Business components and Toplink. It’s a good IDE, so if you haven’t tried it yet, you should.

It’s good to see all the effort Oracle is putting into Java these days: EJB 3.0 support in OC4j since last year, BPEL plugin for JDeveloper, BPEL engine, a really good set of JSF components, a Toplink plugin for Spring, support for xdoclet in JDeveloper.

6/15/2005

Executing PL/SQL from ANT - how to get the output

Filed under: — andrejk @ 9:50 am

Javaddicts and the Amis blog are reporting about executing pl/sql statements from Ant: Executing Oracle PL/SQL from Ant, Executing PL/SQL from ANT – how to keep the format straight.

I’ve also written an Ant target for my current project where we execute pl/sql. The pl/sql queries domain values from some tables and outputs an xml document containing these domains. The problem with Ant’s sql task is that it doesn’t display the output created using dbms_output. So i’ve extended the SQLExec class, to copy all the output created using dbms_output to standard out. This is done in the printDbmsOutputResults method:

protected void printDbmsOutputResults(Connection conn, PrintStream out) throws java.sql.SQLException {
/**

  • Print dbms_output results

    */
    String getLineSql = “begin dbms_output.get_line(?,?); end;”;
    CallableStatement stmt = conn.prepareCall(getLineSql);
    boolean hasMore = true;
    stmt.registerOutParameter(1, Types.VARCHAR);
    stmt.registerOutParameter(2, Types.INTEGER); while (hasMore) {
    boolean status = stmt.execute();
    hasMore = (stmt.getInt(2) == 0); if (hasMore) {
    out.println(stmt.getString(1));
    }
    }
    stmt.close();
    }

6/11/2005

Java 1.5 new features

Filed under: — site admin @ 4:43 pm

Interesting read about some new features in j2se 1.5: Five Favorite Features from 5.0. Good timing, as i started using jdk 1.5 this week: i’ve been trying Hibernate 3.0 with annotations. I’ve used Hibernate in the past in combination with xdoclet, switching to annotations is pretty straight forward.

Something you might run into when starting with annotations is the following error message:

Error(8):  cannot find symbol

It’s not a very helpfull error message, but you can solve it by importing the class for the annotation you are using:

import javax.persistence.*;
@Entity
@Table(name="EMP")
public class Emp {

5/2/2005

Native SQL support in C#

Filed under: — site admin @ 12:38 pm

There’s a discussion on the serverside: what if java had native support for SQL? It discusses a proposal by microsoft about embedding sql in C#. Somehow most people seem to be missing the point on what microsoft is doing. Most of the postings are comparing microsoft’s solution to sqlj or one of the many available ORM solutions.

The thing is, these solutions offer solutions of interfacing with a database. If you look at some of the examples on msdn, you’ll see that microsoft is proposing something more radical: completely replacing the database. You can actually use sql statements to query data from structs and arrays in your application. This means that your application will handle the parsing and executing of your sql.

This might actually make a nice solution for stand alone applications, where no central database is being used.

Update: This could be very usefull if you’re creating Occasionally Connected clients, where you want coarse grained communication with the server. For example, you could have a web service which returns all lookup/domain data (used by dropdown components, etc). This info you keep in memory in an array, but when you need it for a component in your gui, you can query the data using sql.

4/15/2005

Oracle and MS lead appserver platforms

Filed under: — site admin @ 12:10 pm

The serverside is reporting on a Forrester report: The Forrester Wave: Application Server Platforms Q1 2005. Basically Forrester is saying that both MS and Oracle offer the most complete solution with their application servers. Not many people seems to agree with this on the Serverside, most people think either Oracle or Microsoft payed for this report.

That may or may not be true, but fact is that Oracle is working hard on offering a good and complete application server. Some examples: BPEL support in the application server, and Oracle is already offering a developer preview of EJB 3.0. They’re also working pretty hard on their IDE: see for example the JSF support in JDeveloper.

4/13/2005

Oracle to provide plugins for Eclipse

Filed under: — site admin @ 10:22 pm

Read the CNET article: Oracle warms to Eclipse with open-source project.

4/4/2005

The speed of SWT

Filed under: — site admin @ 9:15 am

Some strange contradiction happened this week. Joshua Marinacci is asking in his blog why people aren’t shipping Swing applications. His post has generated a lot of reactions, and many people are saying that Swing isn’t fast enough, and that’s why they prefer SWT. Infoworld published an article comparing the four major Java IDE’s: Four Java IDEs duke it out. The article compares Borland JBuilder, IBM Rational Software Architect, Oracle JDeveloper, and Sun Java Studio Enterprise 7. IBM Rational Software Architect is based on Eclipse, so it uses SWT. According to the article the IBM IDE is the slowest of the four, and Oracle Jdeveloper is the fastest. Oracle’s JDeveloper is based on Swing. So it seems like using SWT for performance isn’t really that important, performance probably has to do with a lot of other issues as well.

3/14/2005

Testing swing/jclient applications with Marathon

Filed under: — site admin @ 10:03 am

Marathon is a very nice tool to test swing applications. You can write test scripts using python, or you can have Marathon record your actions. The result of this is a python script which looks like this:

useFixture(default)
def test():

window('My Application') click('JTree', '/Someone/Contact Data') select('sexComboBox', 'F') select('weightFormattedTextField', '90') assertText('statusLabel','') select('dateOfBirthFormattedTextField', '01.01.1900') close()

You specify which components you’re using by refering to the component name, which you can set using setName() on every component. In jdeveloper you’d expect that if you specify name in the property sheet of a component that jdeveloper would generate a setName call in your code. This is not the case however. Instead it changes the instance name of the component, which isn’t bad either, but not very helpfull if you’re creating marathon scripts. You’re test scripts will be a lot less readable. In the example above, i didn’t manually call setName for the JTree component. If i’d had 3 JTree components they would have referred to as JTree, JTree1, JTree2.

I’ve created a small utility which will set the name of a component and it’s child components by taking the instance name and calling setName on the component. Might be usefull if you’re using Marathon.

package nl.iteye.swingtest;

	

import java.awt.Component;
import java.awt.Container;
import java.lang.reflect.Field;
import javax.swing.JFrame;
import javax.swing.JPanel;

/**

* @author Andrej Koelewijn */
public class TestHelper { public TestHelper() { } public static void setComponentNames(Component parent) { if (parent instanceof Container) { Component[] childs = ((Container) parent).getComponents(); Field[] fields = parent.getClass().getDeclaredFields(); for (int i = 0, n = fields.length; i < n; i++) { if (Component.class.isAssignableFrom(fields[i].getType())) { try { fields[i].setAccessible(true); Object o = fields[i].get(parent); if (o != null) { ((Component) o).setName(fields[i].getName()); } } catch (IllegalAccessException e) { } } } for (int i = 0, n = childs.length; i < n; i++) { if (childs[i] instanceof Container) { TestHelper.setComponentNames(childs[i]); } } } }
}

3/3/2005

Swing embedded browser

Filed under: — andrejk @ 11:34 pm

Over on javalobby Sebastian Ferreyra is wondering why the embedded browser hasn’t caught on. He thinks embedding a webbrowser in java Swing applications could be really usefull.

I Agree. On my current project we’ve implemented the reporting part of a swing application using an embedded browser.

My first thought for reporting was to use one of the existing reporting components, e.g., jasperreports. So i downloaded jasperreports and a visual report builder, ireport, to see how it worked. I didn’t like it: another xml language to learn, no separation of content and layout, and a visual designer which was a pain to work with. All in all, not a very productive way to create reports.

Actually, i’ve never liked visual reporting tools. I’ve used Oracle Reports in the past, and i found it rather frustrating: it feels like you’re forever moving your elements to get the layout just right.

Html is so much easier, nice separation of content and layout, with easy to use css style. I thought we’d be much more productive by just creating html reports and showing these using an embedded browser.

So first question is, which browser component? I tried the jdic browser component. It works, next question. How do we print? Jdic allows you to print documents by asking your desktop to print the document. Again, this works sufficiently, on windows that is. Your mileage may vary on other platforms, but this is not an issues for us.

How to generate the Html documents? Our solution is to use velocity. Embedding the velocity templating engine in your swing application is pretty easy. We simply put our javabeans based domain model in the velocity context, and can access all our data in our templates. Designing the html pages is pretty productive using the visual html editor in jdeveloper.

So what are the problems? Css support for printing. Well not really the css support, it’s more that the browser support for css for printing is lacking.

Our biggest problem is controlling the page margins and the page header and footer. Your browser controls the page margins and headers and footers. If you want to change this you have to change the page setup using the browsers options, you cannot do this in your css stylesheet.

Another problem is that current browsers do not support specifying page orientation through css. So if you want some reports printed in landscape and some reports using portrait, you have a problem.

Anyway, we can live with these problems and find that using html to create reports is a lot more productive than using an existing reporting component. And the situation will only improve when browsers will finally start supporting the newer css standards.

1/28/2005

Oracle BPEL jDeveloper plugin

Filed under: — andrejk @ 8:02 am

Yesterday i attended the Amis query on Oracle BPEL, to see how Oracle’s BPEL plugin for JDeveloper is progressing. Both the Eclipse version and the new JDeveloper version were demoed, and we had a chance to try them. I must say Oracle’s making good progress on the plugin and according to Oracle’s Sandor Nieuwenhuijs a production release should be available in a couple of months. A beta release will be available soon.

Some points discussed yesterday:

  • Oracle is going to include a Web services gateway in Oracle Application server 10.1.3. The gateway will allow you to add security in the application server to already existing services, so you won’t need to modify all the existing services.
  • Oracle is is not yet going to provide a tool to convert high level business process diagrams to BPEL. The question is what should such a tool do and do you really want it: do you really want to automatically translate process diagrams generated by non technical people into an executable process? My opinion is that it’s not very important. I think it would be more usefull if there was a tool to convert complex BPEL diagrams into easy to read high level process diagrams (e.g., UML activity diagrams) so that you have a tool for explaining to business what your BPEL processes are doing.
  • Sandor discussed the various Oracle process management/workflow/integration tools and their future. Oracle Workflow is here to stay as it’s heavily used in Oracle Applications, but if you don’t use Oracle Applications then you’re probably better of using a standards compliant tool, ie., Oracle BPEL.
  • The BPEL plugin now has a service adapters plugin wizard. This wizard will create all the configuration files you need to use existing services through WSIF. Using this wizard you can using Oracle AQ (advanced queueing), ftp services, and detect and read files. This last option was pretty nice: it allows you to specify the structure of text files (fixed column, comma separated, etc), and the text files will be converted to Xml by the BPEL process manager. One important option missing in this wizard was the option to generated configuration files for EJB services. But this option is comming according to Sandor.
  • The BPEL plugin now also contains a xml transformations tool, which enables you to graphically specify how xml files should be transformed to other xml formats. In other words, it’s a visual xslt editor.

1/3/2005

Jdeveloper 10.1.2 is available

Filed under: — site admin @ 11:02 pm

It’s not very obvious, but version 10.1.2 is a bug fix release for jDeveloper 9.0.5.2. It contains over 1000 bug fixes, so if you’re using jDeveloper 9.0.5.2 start downloading now. I know i am.

12/16/2004

Jdeveloper 10.1.3 preview

Filed under: — site admin @ 10:14 pm

I just downloaded and installed the 10.1.3 preview. One of the problems i have with jdeveloper 9.0.5.2 is that the projects in the application navigator do not show the directory structure under the projects. Instead it categorizes all files and under the project category folders are displayed instead of directories. For example, all xml files are considered one category, and are usually displayed under one category, even if you put them in different directories. This is a pain if you have a lot of different xml files for different purposses in different directories, especially if some of these files have the same name.

Now, jdeveloper 10.1.3 doesn’t store a reference to every files in the project file. This makes it easier to put project files in cvs, you’ll have less conflicts. In the project properties you can specify which files need to be displayed as part of the project, you can filter on directories and on files. This is configured in so called working sets.

To test this I created a new workspace and a new project, and then i created one new file in this project: a file called config.cfg in a folder conf. The first thing i do in this new jdeveloper version, and immediately i seem to experience a bug or a misunderstanding on my part: the project doesn’t show config.cfg. I’ve edited the working set (which shows the conf directory), i added a *.cfg pattern to the working set. I’ve also added the extension .cfg under File Types in the preferences windows, but nothing helps. Config.cfg is not displayed as part of my project…

7/21/2004

Creating a custom tag for use with ADF data bindings

Filed under: — andrejk @ 9:16 am

Here’s how you can create custom tags that support JSTL’s expression language. This example applies to JSP 1.2. In JSP 2.0 is has become a lot easier, as JSP 2.0 already supports EL, so you don’t need JSTL for that.

I wanted to create a tag that can be used with ADF’s data bindings, for example:


<taglib1:Tag1 attr1="${bindings.TabDonorView1}" ></taglib1:Tag1>

In you tag implementation code you’ll need to import apache jstl’s ExpressionEvaluatorManager. Here’s how you can use it:


import oracle.adf.model.binding.DCControlBinding;
import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
...
binding = (DCControlBinding) ExpressionEvaluatorManager.evaluate("attr1",attr1,Object.class,this,pageContext);

Using VPD with BC4J

Filed under: — andrejk @ 9:14 am

On OTN you’ll find a document outlining how to use VPD with BC4J: How To Create Secure BC4J Applications with Oracle9i VPD and Oracle 9iAS JAAS Provider.

I’ve tried the method described, but couldn’t get it to work properly. The afterConnect method is called only once, if you do not use connection pooling. I tested this by setting the max application module pool size to 1, and starting 2 browser sessions. Logging in with the first browser, afterConnect is called, setting the application context for VPD. After logging in with the second browser, afterConnect is not called as the application module already has a database connection.

You need to use afterActivation instead of afterConnect to make this work. AfterActivation is called every time an application module is activated from the pool. Now you can set your VPD context in the database before doing any work in the application module.

Update: Steve Muench has commented that it’s better to implement this using prepareSession(), instead of afterActivation().

7/15/2004

First impression Oracle BPEL Process Manager

Filed under: — andrejk @ 9:13 am

On my previous post about Oracle BPEL process manager Dave Ruzius asks:

Hi, we’re also busy investigating BPEL Process Manager options. Did you perform some own testing / developing yet ? Whats your opinion on the tool and future of it within the Oracle product stack ?

Oracle BPEL process manager look really complete. It has a full implementation of BPEL 1.1, can handle user interaction through the TaskManager service. This allows you to create workflow like solutions.

The designer plugin for Eclipse makes it easy to create new BPEL processes (although you’ll still need to know about xml, xpath, xml schema’s, etc. So i think there’s still a big learning curve). Also deployment to different environments (test,development,etc) has been handled in an Ant build file, which is very developer friendly.

I also like the BPEL console, it gives you insight into a lot information about your BPEL processes and their instances. It provides statistics, so you can optimize the runtime of your processes. Also usefull is that all information in the BPEL console is also available through a Java API. I’m not sure though if the BPEL console is very usefull if you have thousends of processes running daily. Maybe then you’ll need to implement your own management console using these API’s. One point of dissapointment is that the BPEL console doesn’t work correctly in firefox, hopefully this will be fixed in the next version.

My guess is that the Oracle BPEL process manager will replace Oracle ProcessConnect and maybe Oracle Workflow, probably somewhere next year. It will take Oracle some time to integrate BPEL process manager into Application Server Integration and BPEL designer into JDeveloper.

6/30/2004

Oracle releases BPEL Process Manager

Filed under: — andrejk @ 12:00 pm

Oracle just released it’s BPEL Process Manager. Mark Rittman has more background information.

6/28/2004

Oracle 10g jdbc connection caching

Filed under: — andrejk @ 8:19 am

OTN has an article on new connection caching features in 10g jdbc: Keep Your Connections.

6/27/2004

Eclipse 3.0 has been released

Filed under: — andrejk @ 10:24 am

Eclipse version 3.0 has been released. Downloads are here , all the changes are documented in on the new and noteworthy page.

6/22/2004

ADF and JAXB

Filed under: — andrejk @ 11:07 pm

I’m currently working on a prototype for a mobile java application. It’s going to run on a laptop, so i can just use swing and j2se, nothing exciting there. The biggest challenge is to use ADF for a mostly offline jclient application. The current idea is to use xml for ofline data storage. When a network connection becomes available we’ll use a web service to send the xml document to a server.

Some weeks ago I saw Oracle’s Steven Davelaar demo ADF in combination with xml. He was using castor to create java bindings for his xml document. He showed that it’s pretty straightforward to use these castor generated classes with ADF. Now castor is OK, but i’d rather go with something standard, like JAXB. So i first tried using that. But it looks like ADF doesn’t like JAXB generated java.

The difference between JAXB and castor is that JAXB uses interfaces. It generates Interfaces for all your elements and types in an xml schema. Castor doesn’t use interfaces. So my guess is, ADF doesn’t like interfaces. You can only create data controls for javabeans (i.e., classes), not for interfaces.

Bad luck. So now we are also using castor. I also briefly looked at apache’s xmlbeans, but i think they have the same problem.

On the server side we’re using the readXml method provided by ADF’s business components to read the xml document into tables. Works really nice, sofar. I couldn’t find a lot of documentation on the readXml method, but Steve Muench has some usefull entries in his blog: Writing XML Using View Objects and Code Sample Illustrating Various BC4J Programming Techniques.

Powered by WordPress