Project Introduction: Quoll Shop Engine
Today I want to tell something about a new project I'm working on. Actually it is not that new because I'm working on it since september but I haven't mentioned it here. The idea comes from two students from the university of applied science in Görlitz. The like to build an online shop for other students at the students dorm in Görlitz. The idea is that people not only buy things one time but choose products that they like to get regularly like milk, vegetables or beer.
I'm developing the software system for this shop as a Java Web Application. Some buzzwords for technologies that I'm using for this software are JSF2.0, CDI, maven, JPA2.0 with Eclipselink and some more.
At the moment I have done the most part of the user authentication and management. The handling of products will come next. Of cause the code will be available as open source. You can get it on github.com. In the future I will bring more updates on this project to track my development process.
If you are asking what the name "Quoll" means and why I'm using it: "Quoll" is an australien marsupial. We thought that an animel with a bag would be a good mascot for a shop.
Problem with el-api in Eclipse/Maven/Tomcat
Recently I have worked a lot on Java Web Projects and today I got strange exceptions like this:
java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.addELResolver(Ljavax/el/ELResolver;)V" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, com/sun/faces/config/ConfigureListener, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ELResolver used in the signature
The origin was a little helper method that should lookup an String value in the ExpressionLanguage-Context:
1 2 3 4 5 6 7 8 9 10 11 12 13 | private String getStringELValue(final String el) { String result = ""; FacesContext fc = FacesContext.getCurrentInstance(); if (fc != null) { String value = fc.getApplication().evaluateExpressionGet(fc, el, String.class); if (value != null && !value.isEmpty()) { result = value; } } return result; } |
This methods depends on classes in that are present in the el-api.jar. This jar is provided by tomcat per default so you don't have to provide it with you application but to be able to compile (and test) the code with maven you have to specify the dependency in you project's pom.xml:
1 2 3 4 5 6 | <dependency> <groupId>javax.el</groupId> <artifactId>el-api</artifactId> <version>2.2</version> <scope>provided</scope> </dependency> |
Line 5 is important in this dependency definition as it tells maven to use the el-api.jar to compile and test the application but not to put it in the WEB-INF/libs folder of the resulting web-application because this jar is already provided by the server.
After a lot of investigation I found out that the maven-plugin of eclipse doesn't care about this scope declaration. The result is that there are 2 copies of some classes on the classpath which causes the exception mentioned above.
The solution was to install the m2e-wtp plugin. As the name suggests this plugin does some kind of integration between maven and the web tools platform (wtp). After installing this plugin you have to choose "Update Project Configuration" in the maven sub-menu of your project. After this everything was working perfectly. Maven was able to build the application and run all tests and tomcat was able to deploy and run the application without any exceptions.
After installing the plugin I got some red crosses on my projects telling me that there are still some problems. The reason for this was a wrong compiler setting. It seems that the new maven plugin tells the projects that they are of java version 1.5 and not 1.6 as it should be. The solution was to explicitly configure the compiler setting in the pom.xml:
1 2 3 4 5 6 7 8 9 10 11 12 | <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build> |
Talk at the JavaUserGroup Görlitz about JavaServer Faces 2
On November the 30th I gave a talk about "JavaServer Faces 2" and "Context and Dependency Injection (CDI)" at the Java User Group Görlitz. I talked about some of the main features and concepts of JSF2 like ManagedBeans, Facelets and the Expression Language. After that I gave a little introduction to CDI because in my opinion it harmonizes very good with JSF2.
After the talk I developed a little application that uses JSF2 and CDI on the projector. In this application the user can input and store notes. The project uses maven for the dependency management.
You can download the slides and the project here:
Interesting Blogs of two fellows of mine
Today I want to recommend the Blogs of two fellows of mine. First the blog of Max Wielsch in which he writes about his experiences related to computer science and software development. He is working at the same company as me and is proceeding a project I started implementing at the beginning of the year which is called the "Human Task Service". This is a Software which integrates human interactions in Service Oriented Architectures (SOA). This is necessary because BPEL, the standard to orchestrate webservices to SOA's doesn't come with build in support for human interactions. Amoung other things, in his blog Max describes one component of this Human Task Infrastructure in detail which is used to monitor the hole application.
The second blog I like to recommend is the blog of Raik Bieniek. He is also one of my fellows and in his blog he writes about Acceptance Tests with internal DSLs. "DSL" stands for "Domain Specific Language" and means that there is a language (similar to programming languages) with which a customer can write acceptance tests in his own words. He doesn't need to know technical things and terms but can use terms from his own subject area. Raik developes a framework with which you can create such DSLs for your desired subject. "Internal DSL" means that you use an existing programming language to build your DSL on top of it. The benefit is that you can use features of this existing programming language. He uses for his framework the programming language "Groovy" which runs on the Java Virtual Machine.
Hiding Toolbars for App-Tabs in Firefox
Some weeks ago I have written a little Addon for Firefox which lets you hide the toolbars for domains. This was mainly aimed at App-Tabs introduced in Firefox4. The Addon was working for me and some friends but sadly the people on Firefox's Addonsite obviously couldn't get it to work and so it wasn't hostet on there.
Today I have read a wikipage which stated that the Firefox developers are working on a similar functionality for a future release of Firefox. I think that's great because this feature is really usefull. In the past I haven't had enough time to fix bugs on my Addon and had an bad conscience about this. But now that they implement it on there own I feel all right to not support my Addon anymore because you will get the functionality by default. That's why I love Firefox. They put interesting features in the browser but you have the choice to use it or not.
YouPay: Android/IPhone app for roommates and everyone else
If you have ever lived in a flat-sharing community you probably know this situation: Everyone has a turn to do the shopping from time to time. Today you go shopping for 12 € and the next time your roommate goes for only 8 € and tells you that you are the next in line. That's not fair, isn't it?
Some friends of mine and me have thought of a solution for this problem: YouPay - An App where you and your friends can enter your expenses and the App tells you who is the next in line. There is already an IPhone-App available, last week the Android version was released and I'm working on an web version of this App. At the moment I can't say when the webapp will be ready because I have also some other projects I'm working at and there is some additional planing to do because the web version will have some extra functionality compared to the both smartphone apps (of cource I don't tell you more about this at the moment).
Please check out the Apps if you are a IPhone or Android user and give feedback. Both Apps are free (this time only free as in free beer
).
New LinuxMint 11 released
Although I am a big fan of Linux, sometimes I "have to" install a Windows for some reasons (like joining in a lan party like in the good old days). But because Windows still ignores the fact that there are other operating systems existing besides itself, it overrides the bootloader so that a prior installed Linux can't be started after the Windows installation. And so I was running Windows the last couple of days.
But the more days have passed, the more I missed my linux. So I thought this would be a good opportunity to install a fresh linux on my desktop. And the beginning of summer is also a time where many linux distributions are released in a new version and so I wanted to think outsider the box (I'm a Linux Mint fan since about 2 years) and tried out the new Ubuntu 11.04, Fedora 15 and today the fresh Linux Mint 11.
Ubuntu 11.04 - Natty Narwhal
First I tried out the new Ubuntu. In the past I was an Ubuntu user for some time and I liked it very much. But with the release of Lucid Lynx a year ago, the first time I got this feeling that they go the wrong way with there distribution. After trying out the new version I felt vindicated about this. In the new release Ubuntu uses Unity as the desktop environment which feels completely different to the old Gnome2.3 used in the prior release. But being different is not necessarily a bad thing - but also not always a good thing.
In my opinion, unity makes it more difficult to work with the computer. The biggest drawback is the new sidebar. When I want to switch to another application I have to click on the symbol in the panel. But when there is an application in fullscreen mode, the panel is hidden. You have to hold the mouse on the left for some seconds to get to the panel. This was really annoying. Another disadvantage was the limitation of symbols that can be placed on the panel. I like to put icons for all my often used applications on the panel but this isn't possible with unity.
Another annoying thing was the way unity displays menus of applications. A menu is now displayed at the panel in the top left corner of the screen. Normally the menu is hidden. It only shows up when you go there with your mouse.
Of course there is always a way to change this behavior but there was no simple settings dialog for this (at least I haven't found it). And so I have removed Ubuntu 11.04 from my computer. In my opinion there was no real advantage but some disadvantages.
Fedora 15
Fedora 15 is really beautiful. It comes with the new Gnome3 and its Gnome-Shell as desktop environment and the design is really nice. Like in Unity there is also a panel on the left side where you see your applications
The problem with Fedora for me was a strange bug with the software center. I tried to install new software but this wasn't possible because there was always a window that was asking me for more permissions or a confirmation. The problem was, that there was no button to confirm - at least I couldn't find it because the window was bigger than the screens horizontal size and so the window didn't fit into the screen. I had no possibility to press this button and so I couldn't install any new software.
This was the first contact with fedora for me and it was not really cool. But I know that there are always bugs in software and so I know that Fedora probably will be cool when this bug is fixed. I don't think low of the Fedora project only because of this single bug. But of cause I can't use a operating system without installing new software to it. But I will test Fedora another time and hopefully this bug will be fixed until then.
Linux Mint 11 - Katya
I was waiting for the new Linux Mint for a long time and yesterday it was finally released. And it's great. It works the way I like it and It looks the way I like it. Of course the most parts are from Ubuntu. But the configuration is more suitable for my needs. And I like the Mint specific software. Things like the MintMenu or the software center are great and I don't want to miss them. Also the backup tool is really helpful when you update from an old version or simply want to backup your files and settings.
I'm really happy with Linux Mint. But sometime I will try out Fedora again. Maybe then my strange bug will be fixed. But I'm also interested in the future of Ubuntu. Probably in the future their Unity-Shell will be more usable than today. And of course the cool think of all of this Linux distributions is the fact, that you can try them out for free.
OSGi and SpringDM workshop for the JavaUserGroup Goerlitz
Last wednesday I have done a workshop for the Java User Group Goerlitz with the topic "OSGi Serviceplatform und Spring DM". The workshop was done in german.
OSGi is a specification for a service-based application framework for Java. While in pure Java you use packages to capsulate code with OSGi you have another abstraction layer called "bundles". These bundles can contain many packages and you can define that the bundle "exports" some of these packages. Other bundles can than "import" these exported packages to use that code. You can encapsulate different functionalities into different bundles.
One of the main features of OSGi is the ability to load a bundle at runtime. While the hole application is running you can install, update, start, stop or uninstall a bundle. So when you change some code inside a bundle or you fix a bug, the application don't have to be redeployed to get the newly code running.
With Spring DM you can combine the features of OSGi with the Spring framework. This is a great combination to build modular business applications in Java.
Workshop OSGi und Spring DM (pdf)
Component diagram for ProtistPlayer
It's a lot of fun to work on graphical user interfaces - especially when you use XUL like I do with my ProtistPlayer project. And so the GUI is well advanced in my opinion. But still there is not a single when you press the play button. In fact there is virtually nothing but the gui at the moment.
Its time to change this but that's easier said than done. You have to think of some sort of software architecture which suits all needs and is still flexible enough for future changes and improvements. I have made a first draft and want to describe it a little. Of cause this isn't the final version. In fact there will be never something like a "final" version because I like the idea of agile software development with its continuous improvements and code refactoring. And so this diagram also shows only my thoughts at this moment. When I find out that this is not suitable in the future I will change it. Also notice that this is not a valid UML diagram but only some rectangles with arrows.
First there is the view layer in green. Below the xul-file is a view.js with all the code in it that is directly connected to the xul file. An example is the volume symbol which changes when the volume change. This file is also the interface to the "real" logic of the player. When you press a button the view.js takes care that the right function on the right component gets called.
The PlaylistManager takes care for the music files. At the moment I don't really know how I will implement this component. Most likely I will use a SQLite database in the background because it is already built-in in mozilla and I have already tested it in my last extension. The small dotted line to the protistplayer.xul signifies the possibility to directly connect the database in xul but currently I don't know if this is a good idea.
The yellow box shows the player. This is probably the most important component because it plays the music. Unfortunately this is also the component where I have the least knowledge how I will implement this. I have many ideas how this possibly could work and I will test the different approaches. To do this I will make some sort of player interface with different implementations. I know, this is a really "java driven" mentality but I think this will work in JavaScript just as well.
At least there is the "controller". This component pulls all the strings and connects all the other components.
Fixed wrong behaviour in log4xul
Last week I was coding a little bit on my music player and as everytime I used my little logging-library log4xul. While the most time I have the Level of the logger so that it prints every message. Because of this I haven't noticed that I have made a really embarrassing mistacke with the logging-levels in Log4xul. I have mixed the hierarchy of the levels so that with the logging level set to "DEBUG" the logger only prints this debug-messages while when set to "ERROR" it prints everything.
Of cause this is wrong because you want the exactly reverse thing: When the level is set to "DEBUG" you want to get every message and with level set to "ERROR" you only want to get the error messages.
Now I have fixed this so the Log4xul should now work as expected.
Log4Moz
I have also found out that I have not searched enought for other logging frameworks at the time when I started to write Log4xul. In the meantime I have found the Log4Moz framework which is made for logging within firefox-extensions. It is a lot more similar to the "original" Log4J and gives you the possibility to create hierarchically structured loggers for your files.
When I first used Log4Moz I was impressed and intended to use it in the future. But then I switched back to my own logger because Log4Moz has no ability to print the messages in a textbox but only to the JSConsole and to a logfile.
I have tried to write my own TextboxAppender for Log4Moz but it only worked till I hit the reload-button. After this it crashed. I don't know if it even would be possibile to write this kind of appender with the achitecture of Log4Moz.





