CARVIEW |
![]() Get Involved
Get Informed
Get Connected
Search
|
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
Felipe Gaucho's Blog
A Generic CRUD Facade for your @Entity BeansPosted by felipegaucho on April 19, 2009 at 03:54 PM | Permalink | Comments (6)CRUD (create-read-update-delete) is a repetitive code in Java EE projects but it can be isolated in a unique class through the usage of JPA annotations and Generics - a class I call CRUDEntityFacade. This is not a new pattern and the goal of this blog entry is just to prepare you to read my next entries about JAXB and JPA together. I am doing really nice things with Jersey and Glassfish, and before to expose complicated inventions I decided to register the basics of the persistence layer (also very nice for my own future reference). Complete sample projectsThe code I am publishing here is just to avoid you to checkout a full project and to dig to inspect my CRUD strategy. But if you want to see this technique in action, please be my guest to checkout one of my open-source projects. The projects are built by Maven and were created in Eclipse - but you should be able to run it on your preferred IDE without any problems. Both projects requires minimum Java 6.
The generic CRUD implemented with generics and JPA annotations
In my next entries I will show you how to use dual annotation (JAXB + JPA) in order to minimize the impedance mismatch between the persistence layer and the serialization of element used in the services endpoints - REST or SOAP. JavaONE 2009: here we go...Posted by felipegaucho on April 16, 2009 at 04:51 AM | Permalink | Comments (0)Hard financial times are also times for investments in our personal education in order to mitigate whatever situation the future bring to us. In this FUD scenario, nothing better than joinning the most influent Java conference in the world: Java ONE 2009. No much to explain about the well known Java One, except this year I expect a lot from the java EE 6, fancy JavaFX demos and a lot of OSGi and RESTful (Jersey) services. From the pavilion I expect 101% of networking, amazing new gadgets and a few nice gifts as hunt trophy :) I will take with me the Footprint, the Cejug-Classifieds and some other ideas to share over there... and, as usual, an open mind to listen your ideas and to discuss Java. See you at California. Google App Engine to support Java applicationsPosted by felipegaucho on April 08, 2009 at 12:36 AM | Permalink | Comments (1)
I just registered my account here, and I can't tell much about the new possibilities of Java App Engine, but I am quite optimistic about it and I recommend you to give it a try - let's see. Kudos to Chris AdamsonPosted by felipegaucho on March 31, 2009 at 02:27 AM | Permalink | Comments (2)Few years ago, I was teaching Java in universities in Brazil, spending all my days and nights studying and thinking on how to become a better teacher and how to become a better Java professional. I was not much than an enthusiast Java developer full of dreams on how to transform the world through the Java technology.... a lot to say, a lot to discuss and to learn and to teach..
QTI 2.1 draft specification has been removed from the IMS websitePosted by felipegaucho on March 30, 2009 at 08:02 AM | Permalink | Comments (0)In the last few days the QTI 2.1 draft specification has been removed from the IMS website, citing a lack of participation: The IMS QTIv2.1 draft specification has been removed from the IMS website. Adequate feedback on the specification has not been received, and therefore, the specification has been put back into the IMS project group process for further work.
Update: a forum was created to discuss this issue. Footprint Project adopts Maven 2Posted by felipegaucho on March 25, 2009 at 08:37 AM | Permalink | Comments (0)What is Fotprint Project?
From the technical point of view Footprint is a wrapper for iText, facilitating the configuration of the basic features demanded by conference managers: to fill out PDF diplomas, to sign them with a digital certificate and to send them by email. You can perform those steps using the standard distributions of iText, JavaMail api and some encryption library, but in order to do that you will need to hack a bit around the Java code - and conference organizers are not expected to be Java developers. Despite the simplicity of the Footprint features, the library contains all you need to fill PDF forms, sign and distribute them by an SMTP server. It also supports JDBC connection, what give you a chance to connect the certificates generator to any Java compatible database - and it comes with a pre-bundled CSV driver, what allows you to use CSV files instead of database. So, if your project uses Maven and requires PDF manipulation, there is a chance that Footprint library reduces a lot your efforts. * If you are not interested in Java code, and you only want to generate certificates for your JUG meeting or conference, you can visit the Footprint home-page and download the latest stable release - it is ready to go.
Footprint is available in the java.net Maven 2 repository. In order to use footprint in your project, you have two chances: to use the full bundled Footprint code with its dependencies or to use te Footprint core and declare the dependencies separately. The former option gives you simplicity and the later offers you a chance to use different versions of the footprint dependencies, like Bouncy Castle encryption library or JavaMail API. So, let's configure the pom.xml Using the full-bundled Footprint libraryJust include in your pom.xml the following elements: <repositories> <repository> <id>maven2-repository.dev.java.net</id> <name>Java.net Repository for Maven</name> <url>https://download.java.net/maven/2/ </url> </repository> </repositories> <dependencies> <dependency> <groupId>net.java.dev.footprint</groupId> <artifactId>footprint-core</artifactId> <version>1.0-SNAPSHOT</version> <classifier>jar-with-dependencies</classifier> </dependency> </dependencies> Using only the footprint-core codeThe core code of Footprint requires some dependencies declaration: <repositories> <repository> <id>maven2-repository.dev.java.net</id> <name>Java.net Repository for Maven</name> <url>https://download.java.net/maven/2/ </url> </repository> <repository> <id>maven-repository.dev.java.net</id> <name>Java.net Maven 1 Repository (legacy)</name> <url>https://download.java.net/maven/1 </url> <layout>legacy</layout> </repository> </repositories> <dependencies> <dependency> <groupId>net.java.dev.footprint</groupId> <artifactId>footprint-core</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>com.lowagie</groupId> <artifactId>itext</artifactId> <version>2.0.7</version> </dependency> <dependency> <groupId>csvjdbc</groupId> <artifactId>csvjdbc.jar</artifactId> <version>LATEST</version> <scope>system</scope> <systemPath>${project.build.directory}/../lib/csvjdbc.jar </systemPath> </dependency> </dependencies> Special attention to the csvjdbc.jar dependency - the CSVJDBC Project does not uses Maven, so you need to download the library manually and copy somewhere in your file system. This is the kind of boring step Footprint tries to hide from its users. Footprint code requires Java 6An important detail is about the Java version required by Footprint library: at least Java 1.6. In order to guarantee that, please include in your pom (or preferably in the parent pom) the following fragment: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> ... </plugins> ... </build> Checkout the Footprint codeFootprint is distributed under LGPL license, and if you are interested in checkout the project code, just follow these steps:
That's it, just open the project in your preferred IDE and have fun. If you find any problem or have a feature suggestion, be our guest to submit an issue in the Footprint Issue Tracker page. And if you want to follow the project continuous integration, please visit our Hudson. Eclipse Community Awards Winners Announced: NeTS is finalistPosted by felipegaucho on March 24, 2009 at 05:42 AM | Permalink | Comments (0)I usually don't publish any company related news here but this one is special: the NeTS project was announced finalist in the Best Commercial RCP Application category of the Eclipse Community Awards 2009. The great winner of this category was a project called Chord Scale Generator and the other finalist was the ECR - Enregistrement Centralisé en Réseau. The power of community recognition
What is NeTS?
The project has a lot of technical details, but the important message to remember from this blog is: if you are traveling by train in Switzerland, the timetable of your train was planned with NeTS :) Deploying artifacts to the java.net repository using Maven 2 on Ubuntu LinuxPosted by felipegaucho on March 21, 2009 at 12:33 PM | Permalink | Comments (4)One of the most useful features of the java.net portal is its Maven 2 repository, where project owners can publish their project artifacts using standard Maven features. Following the instructions of the maven2-repository project, you should:
Cannot find wagon which supports the requested protocol: java-netAfter following the java.net instructions, I got a strange error in the terminal: ~/svn/footprint$ mvn deploy Deploying artifacts to https://download.java.net/maven/2/ Deploying the main artifact pom.xml [INFO ] Retrieving previous build number from ERROR: Error deploying artifact: Failed to transfer file: https://download.java.net/maven/2//net/java/dev/footprint/footprint/1.0-SNAPSHOT/footprint-1.0-SNAPSHOT.pom Return code is: 401 [INFO] Error retrieving previous build number for artifact 'net.java.dev.footprint:footprint:pom': repository metadata for: 'snapshot net.java.dev.footprint:footprint:1.0-SNAPSHOT' could not be retrieved from repository: java.net-maven2-repository due to an error: Unsupported Protocol: 'java-net': Cannot find wagon which supports the requested protocol: java-net I double checked the The maven installed by the synaptic package manager of Ubuntu is not the latest apache maven distribution. You should remove the Ubuntu default maven package and manually install the Apache Maven for Linux. This detail is particularly difficult to figure out due to the fact that most of Java developers do not use Linux - so many of the responses in the mailing lists are something like never heard about it... did you follow the instructions properly? The first sign of something related to the OS configuration came from my Eclipse, because when I tried to run the same maven commands through the IDE, the maven started downloading again some libraries - on that moment I realized it was using a different repository. After that, a tip of Julio Viegas helped me to replace the default Ubuntu maven package by the latest Apache distribution - problem fixed! You can find the instructions to install the software here: If everything works, you should see something like this in the terminal: ~/svn/footprint$ mvn --version Maven version: 2.1.0-M1 Java version: 1.6.0_12 Default locale: en_US, platform encoding: UTF-8 OS name: "linux" version: "2.6.27-11-generic" arch: "i386" family: "unix" Special hint for Hudson installationIf your system hosts a Hudson application, be sure to update the installation folders of Maven and Java in the Hudson before starting your next build sessions - otherwise Hudson will get lost. Just login in Hudson, go to https://localhost:8080/hudson/configure and update the path of the applications. Hudson SVNCancelException: No credential to try. Authentication failedPosted by felipegaucho on March 12, 2009 at 12:55 PM | Permalink | Comments (1)As soon Fabrizio published his blog about the quality assurance of BlueMarine (blueCAT), I invited him to host his continuous integration in my personal Hudson lab. Everything nice and easy except for a strange error during the first attempt: started ERROR: svn: No credential to try. Authentication failed org.tmatesoft.svn.core.SVNCancelException: svn: No credential to try. Authentication failed at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.cancel(SVNErrorManager.java:37) at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.cancel(SVNErrorManager.java:32) at org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager.getFirstAuthentication(DefaultSVNAuthenticationManager.java:167) at hudson.scm.FilterSVNAuthenticationManager.getFirstAuthentication(FilterSVNAuthenticationManager.java:38) at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:518) at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:257) at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:245) at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.exchangeCapabilities(DAVConnection.java:454) at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.open(DAVConnection.java:97) at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.openConnection(DAVRepository.java:664) at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.testConnection(DAVRepository.java:96) at hudson.scm.SubversionSCM$DescriptorImpl.checkRepositoryPath(SubversionSCM.java:1519) at hudson.scm.SubversionSCM.repositoryLocationsExist(SubversionSCM.java:1620) at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:455) at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:418) at hudson.model.AbstractProject.checkout(AbstractProject.java:801) at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:314) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:266) at hudson.model.Run.run(Run.java:896) at hudson.model.Build.run(Build.java:112) at hudson.model.ResourceController.execute(ResourceController.java:93) at hudson.model.Executor.run(Executor.java:119) The authentication failure warning was useless because we tried our passwords some times without any luck. After few minutes of frustration, we figured out the problem was caused by a misconfiguration of the SVN repositories accessed by blueMarine. It is probably documented somewhere in the Hudson pages (the impedance between humans and manuals, you know :). The problem: SVNCancelException ... Authentication failedWhen you configure a module in Hudson, it offers you a text field where you type the SVN URL and it also gives you a chance to type the user/password required to access the repository. Problem is: it only asks you 1 svn credential, but sometimes your module and its submodules access different repositories - what was exactly the case of blueMarine. Solution:The solution is simple but the useless error message and the lack of information in the Hudson GUI didn't helped at the first moment. Hudson allows you to map diverse SVN URL to user/password credentials (or other authentication mechanism) - and not only the one asked by Hudson after you leave the text field. In order to do that, you need to click on the Help icon beside the text field and then to map all SVN repositories used by your application to the respective credentials. After clicking the above buttons, an authentication mapper is shown and you have a chance to type how many repositories and password you need. Nothing else to say, it is really simple to fix the problem as soon as you know what is about :) A last hint: for java.net projects you can use guest as user and leave the password blank - what is recommended to protect your password and also to guarantee the code downloaded in the host machine will have read-only access to the SVN - protecting also the code in case a hacker comes for a visit... Hudson rocks ! Jazoon Rookie deadline: 15 March 2009Posted by felipegaucho on March 10, 2009 at 12:28 PM | Permalink | Comments (0)
Important: this is a speech competition, Jazoon is looking for creative, exotic, smart and captivating speakers - the best you perform on a stage, better your chances to win - a good English and a technical background in Java also helps :) GO FOR IT - take your camera and record today your Java Holidays at Switzerland (it is a global wide promotion) Google Summer of Code 2009Posted by felipegaucho on March 08, 2009 at 12:21 PM | Permalink | Comments (1)Few days ago I was prospecting collaborators to my open source project when Björn Jensen - JUG leader of Hamburg - called my attention to the Google Summer of Code 2009 . After a brief reading of the program rules, my teacher vein started to pulse - yes, that's exactly what I was looking for.
java.net participation?Reading the program documentation and asking the program organizers, I've soon realized the role of open source organization as an important criterion for the selection of the participating organizations. It is hard for Google to check the quality of the mentoring provided by individuals or projects without much visibility. The natural selection of the applying organizations points to the big players of the open source community. Discussing that issue with other JUG leaders, we quickly target java.net as our best representative organization. The idea is simple: Java.net projects would be nominated by SUN/java.net to participate in the Google Summer of Code. It is just an open suggestion but the first feedback from SUN was quite positive. Important disclaimer: I do not represent SUN, it is just a personal wish to see that idea implemented in the next few years. Congratulations Google !What else can I say, I am following the mailing list of the program since last week and I have only claps for the Google initiative. Other positive point is the professionalism demonstrated by the managers of the program and the excitement around the open possibilities - a lot of young students eager for a chance, and a set of companies looking for the clever minds ... Don't miss that :) ![]() |
![]() |
April 2009
Search this blog:CategoriesBusinessCommunity Community: Embedded Java Community: Global Education and Learning Community Community: Java Patterns Community: Java Specification Requests Community: Java User Groups Community: Java Web Services and XML Community: JDK Community: linux.java.net Community: NetBeans Community: Robotics Deployment J2EE J2SE JavaOne Linux Mobility Open Source Patterns Performance Programming Security Tools Web Applications Web Services and XML Archives
April 2009 Recent EntriesA Generic CRUD Facade for your @Entity Beans Google App Engine to support Java applications ArticlesThe Requisites of a Question-Management System All articles by Felipe Gaucho » ![]() |
![]()
|