Wednesday, December 31, 2008

P2 deployment in enterprise applications

So many times I asked people I met, why they have choosen a browser based solution for their business applications that are never meant to appear on the internet. And, as was to be expected, most of the time I didn't hear many meaningful arguments. One of the arguments that people tell in almost any cases is "no trouble with deployment".

I remember trying different strategies for rich client apps deployment. Some years ago we used webstart with a Windows shortcut, which sometimes made some trouble (I never made it deeper into it) when it didn't get the changes and started from its cache instead of downloading the updates.

In a client server environment it's critical that clients are synced when service api breaking changes are made on the server side. So after many years I came back to the problem with my project Mango (its about publishing business btw.) which is implemented on Eclipse RCP for the sake that I believe its the best platform we have in java-land. For sometime (as with many projects) we had only a single production installation and I didn't put much effort in installation issues. I told the admins what was to do to get it running.

But times changing and installation count is rising, I noticed that I had to improve things around deployment. Typical update scenarios that eclipse mechanisms adress don't match truly what we need, because we can't update from a central point since client and server updates must be synced. As for now I decided against an automated server update (which I may rethink...).

But with some effort (had to do some minor but hard to find tweaks on the current p2 implementation) we now install the p2 repository for our client on an embedded webserver in our server installation. With again some tweaking I made the p2 installer app webstartable and you guess, it too comes with the server installation.

Now its a single selfextracing jar, that updates the server platform, and runs all needed changes (database schema changes, sometimes data needs to be converted etc). For a single turn users need to be emailed the link to the installer jnlp to get the current client installed on their boxes. From now on (it cost me some days, my wife can tell it was tricky...) whenever one of our users decides to update his installation to the current release, its a simple one liner to update the whole scenario.

As I ran out of time its a little q&d trick on the client, as it simply starts up with a null perspective and disabled menus when server api has changed. It then updates itself from the p2 repository and needs to be restarted.

Things that still need to be done is notifing running clients when the server goes down for maintenance, but that could gives us room for new ideas in any way.

So to say, what I guess I will hear now is, that in big client installation count this will still need high network traffic when on monday mornings people fire up their clients and all request an update at nearly the same time. But without having scientific proof I guess that with p2 we can update to the point what needs to be updated. So actual download size (in our case, the client code is actually quite small compared to the base platform plugins it depends on) won't be more than some megs.

So next time I stumble across the above arguments, I think I'll have something up the sleeve.

Thursday, September 11, 2008

Modular JPA

I had some time thinking about modular databases. There comes wonderful modularity when we work with OSGi, but what about our databases. Think of a server plugin that will need some Tables. It should contribute them in eclipse style to the EntityManagerFactory. As this looks very static maybe we could have an extensible Configuration for the factory. Or has someone an idea how to achieve something like that ?

Friday, July 18, 2008

Hibernate & Lucene - a new ui experience

I was working on my little open source project Mango some months ago when I stumbled across hibernate search. Hiibernate search gives you the ability to manage a full-text lucene index on your relational database. This looked interesting to me so I gave it a try.

What can I tell you about my experiences ? First it came to me that I can handle the german umlaut problem with a special tokenizer. So searching for Müller gives you Müller as well as Mueller, something that is hard to to in plain HQL/SQL. But thats not the point. By having a fulltext index I could throw away all the UI parts where users could query the database for objects. They became completely obselete, because of now we have a central single database query that consists of a single text field as you know it from google for e.g. Thats all we need in the whole application to query the database. I needed to revamp the whole application ui, but it really was worth the effort in means of user experience. We all know UIs for database queries. We don't have them anymore because of the lucene index on the database. The user types in a keyword and lucene gives him all the objects, no matter what type that match his query.

I'm currently thinking of building a more sophisticated query assistant, so that users are more easily empowered of all the lucene query possibilities. For know I had to explain some of the core features of lucene queries to my users, but that could even be easier with a simple assistant.

For a second I wished that we had a relational database that has this ability built in, but that doesn't make sense because of the heterogenuous query results.

I really think that hibernate search should be much more popular, as it revolutionizes user experience on database centric applications. There are some features I still miss, but what we have up to now is ready for the real world.

Monday, May 19, 2008

Remote lazy loading in client server environments

I made some steps yesterday with hibernate in regards to realizing a remote lazy loading feature. I read Gavin Kings opinion on that in a forum entries, he arguments that remote lazy loading is a no go as it breaks transaction isolation. I came across h3t which uses jboss-aop and that comes which a javaagent thats not useful in the osgi environment (or does anyone know to make it). So I started off on my own and try to adopt an old example from the hibernate site. So far so good, the example expects that the remote call has access to the former calls session. Another no go. I dived into the hibernate code and all I found is that lazy loading is so tightly coupled to the hibernate session that theres no chance to make it in a day. I thought of Gavin's arguments and I cant see the point. In my environment there is no transaction cotext at all. I retrieve objects from the server side, mainpulate them and sen them back. Inbetween theres not a glimpse of a transaction, so I do not see why it shouldnt be allowed to split ob the fetch aka lazy load the object graph when desirable. Theres many situations and many people out there that broke their head upon that. Maybe I should head on to Eike Steppers CDO anyway.

Sunday, May 18, 2008

Distributed P2P EMF

What I write today is as ever truly iunfinished vision.
inspired by three things, JFace Databinding, Eike Steppers work on CDO
and some thougts I had while while reading Scott Rosenbergs Dreaming in code.

What if we had a distributed object model (based on EMF) thats connected through a peer to peer network, may with a central persistence repository like CDO is. It would be "quite" language neutral as we can think of an EMF implementation in other languages as Scala or even C#. (I have some trouble with NET4J there, have to think of that). What if we promote changes on the model as diffs in a p2p style to all the partial model instances out there ? I mean truly concurrent modification of an distributed object model. (I have some headache when you ask me for transactions, though) Wouldnt that be a nice programming model for multiuser applications ?

I know this is not really new, other have dreamed of that before. But we have almost everything to do it. And EMF is agood platform for domain object model. It would be a complete different approach to the conventional OLTP ideas. Let me know what you think of it.

Saturday, May 17, 2008

Open source for publishing companies

Today I can finally announce that Mango 0.5.2 ist out. Its a GPL'ed software suite based on Eclipse for the publishing industry. Current features include: Complete CRM and Document management, Book management, Catalogue generator and mailing list integration. Feel free to have a look at it on http://www.eiswind.de. Feel free to ask questions.

Friday, May 16, 2008

Do we need Transfer Objects ?

I came across http://www.agimatec.de/blog/2008/05/transferobjects-generieren/ today (in german). Roman (?) refers to http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html the old transfer object pattern in j2ee. I don't see why we need this anymore with JPA/EJB3. I think theres nothing up to using a consistent domain model on both client an server side. Its the same reason why I dont use GWT, because I cannot transfer my JPA enitites to the client and would agein have to use annoying transfer objects. Maybe it will get better if GWT can handle current Java versions. I would like to hear arguments why one still should use Transfer Objects in a client server environment. IMHO I think its completely unnecessary and overcomplicating things. Comments ?

Monday, April 7, 2008

Generic ValueLists and their defaults

I came across a typical problem yesterday: I have some domain objects modeled for hibernate/jpa. Above that I have a service layer. The domain objects shouldnt have access to the service layer. Now guess I have a generic model for ValueLists and Values. Everywhere in the model where I need a valueList I simply reference a generic Value. Now the model doesnt know wich ValueList ist references. Now I set the default values on each newly created entity with some generic code:
So each ValueList has a default Value which I want to be set in the UI o for e.g. on a combo. One way would be to make the different ValueLists different types ( I saw that before) but that means generating a new Type for every new ValueList. So I came to a different solution. I annotate each entity-to-value relation with the name of the corresponding ValueList as you can see. On each new entity I set the default values with some simple generic reflection code as you can see below.


for (Method m : o.getClass().getMethods()) {
Annotation a = m.getAnnotation(ValueListName.class);
if (a != null) {
ValueListName valuelistname = (ValueListName) a;
ValueList list = service.getValueList(valuelistname.name().name());
Value defaultValue = list.getDefaultValue();
if (defaultValue != null) {
String getterName = m.getName();
String setterName = "s" + getterName.substring(1);

Method setter = o.getClass().getMethod(setterName,Value.class);
setter.invoke(o, defaultValue);

}
}
}















Monday, January 28, 2008

Remote Collaboration

How many of us leave home on monday and stay in a dumb hotel for the week ? I can't believe it. When I set of in the morning all those business people on the train. I really wonder why its so hard for the customers to do remote contracts. All the open source projects demonstrate us that its working perfectly. And tool support (think of Jazz) is getting better all the time. I made some experience with remote collaboration last year and it was really great. We met every two weeks, we had phone conferences all the time and the rest was up to bugzilla. I do not understand why all those folks outside are willing to do this kind of job. No matter what, you cant give me enough money to stay away from my family all week long. Its just business I know, but if we would simply refuse to do it, maybe the market recognizes ... :)

Xtext first steps

Yep, this weekend I started out a prototype for my domain model generation with XText (part of openArchitectureWare). Up to now I have the JPA Entities/ JavaBeans (Databinding) generated with HiberObjects but as my model grew bigger it came to some limitations in performance and usability. So I had some experiments with UML model, but I was not satisfied as its very annoying to attach all those stereotypes and tagged values needed for JPA generation. So I came across XText and started to build my own DSL for this matter. I had some trouble getting started, as the generator doesn't alwas work nice,had to delete everything and start from scratch many times. Once I had some understanding of the BNF notation Xtext uses I quickly had a simple prototype for declaring JPA entities. As Xtext generates an EMF model from the model script, it easy to build a code generator on that, at least if you have an idea of the Xpand language. So I will put some more work in the language and if everything works as nicely as up to now I will model my domain with the new language and drop Hiberobjects.

Jupyter Kernel for Java9