I have no special talent. I'm only passionately curious - Albert Einstein
My take on running Java apps in the Cloud Comment on My take on running Java apps in the Cloud 0

  I recently began exploring the latest technology buzzword, the Cloud.  As a Java developer, I was most interested in learning how to run Java applications purely in the Cloud, or integrating Java applications with Cloud based services.  After some brief searching on Google, I began evaluating the Google App Engine (GAE), and the Amazon S3 (Simple Storage Services) and EC2 (Elastic Cloud Computing) products.  I wanted to learn what it takes to run a Grails application in the cloud, and how much it would cost me to do so.

  Continue Reading

Grails Integration Testing with the new Spring Security Core Plugin Comment on Grails Integration Testing with the new Spring Security Core Plugin 0

If you're not new to Grails, you'll understand that the system and it's plugins have been changing at a whirlwind pace.  I had written a previous article on how to get the Acegi Security plugin for Grails to work correctly.  Recently though, the Acegi Security plugin page advises that we use the Spring Security Core plugin instead.  So, I started using that plugin, and I wanted to find a way to write integration tests on services that rely on an authenticated user being present in the Spring SecurityContextHolder.  This article will outline two concepts; the first is adding createdBy and lastUpdatedBy user auditing to domain classes.  The second concept is how to test these services in integration or unit tests with the dependancy on an "logged in" or authenticated user.

  Continue Reading

Managing Application Configurations Comment on Managing Application Configurations 0

Most applications require configurations specific to the environment they are being deployed to. Java applications are meant to be written once, deployed anywhere, so developers need a mechanism that allows them to deploy a single WAR or EAR file to any environment, instead of packaging a deployment for each specific environment. Using Spring, a simple naming convention for properties files, and a single environment variable (either on the server or from the command line) we can achieve this feat.

  Continue Reading

Binding Indexed Properties in Grails Comment on Binding Indexed Properties in Grails 0

Here's an example of how to bind indexed properties to a Grails (or Spring) domain or command object without having to hand roll the parameter parsing and binding.  The  domain object graph is simple, and based on a project I'm currently working on, but this method can be applied to any sized object graph.

class LeagueMembersCommand implements Serializable{

	String[] types
String[] firstNames
String[] lastNames
String[] emails
Integer[] handicaps

static constraints = {
types(nullable:false)
firstNames(nullable:false)
lastNames(nullable:false)
emails(nullable:false)
handicaps(nullable:false)
}
}
  Continue Reading

Running a Jar file with Ant Comment on Running a Jar file with Ant 0

I recently attempted to run a jar file that has multiple third party dependancies from an ant build script.  I assumed that you could use a path element to define a path containing all of the external dependancies, and that you could use the built in java task in ant, pointing to my jar file, using the classpathref attribute to run the application.  I quickly discovered that I was wrong, and there wasn't a very straightforward explanation on the web (that I could find) as to why.

  Continue Reading

Acegi Security Plugin for Grails Comment on Acegi Security Plugin for Grails 0

I've been attempting to develop an application using Grails 1.2.1, and the Acegi Security plugin for Grails v. 0.5.2 (also known as the Spring Security Plugin).  Grails is still young, and so is it's group of plugins, so there are a lot of configurations that are flawed.  This article outlines how to get up and running with Grails and the Acegi Security plugin v. 0.5.2, including how to get the JavaMail configurations working for use with Gmail

  Continue Reading

Apache CXF on WAS 7.0 Comment on Apache CXF on WAS 7.0 0

Apache CXF is an agile, open source web services framework that integrates out of the box with the Spring framework. This framework utilizes JAXB, and the new JAX-WS APIs, and does not require developers to use any proprietary APIs or annotations. CXF provides multiple transports - you can write a single service, and reuse it as a SOAP based web service, or a RESTful web service. The project, at the time of this writing, is very active, with new versions being released on a regular basis.

  Continue Reading

Developing jsonp Services for jQuery Comment on Developing jsonp Services for jQuery 0

The documentation for successfully developing jsonp services for use with jQuery is not very straightforward.  The examples consist of a number of ajax calls using jQuery's .ajax and .getJSON functions, but until recently did not contain any examples of performing remote calls to jsonp services.  If you read the documentation for using the jsonp dataType with their ajax function, you will see a link to an article by Bob Ippolito outlining the first proposed jsonp format, and how to use it.  The format documented on Bob's article is not valid when used with jQuery's functions (jQuery doesn't error out, it just doesn't do anything at all).  Their most recent example of using the new Flickr jsonp API sheds light on the format that jQuery really expects for json returned by remote jsonp services.

  Continue Reading

Unit Testing Comment on Unit Testing 0

Unit testing not only ensures that application code runs the way the developer intends it to, but can also provide a sort of guide for other developers. Unit testing helps to make an application more robust - running existing unit tests assists in revealing impacts changes may have on an application, assuring against defects. Any applications that don't have unit tests are considered Legacy Applications, and are usually more expensive to change, and have experienced more defects, adding into the break/fix cycle in production deployments. I prefer to implement unit tests using JUnit, since there is plenty of extensions and frameworks that support writing and running JUnit tests. EasyMock is a JUnit library that allows developers to unit test code which contains many dependancies, and provides a means to focus on actual unit tests instead of functional or integration testing. An excellent Unit test code coverage tool exists as a plugin for Eclipse, EclEmma, which provides package level, class level, and line by line statistics of unit test coverage in Java classes. The Spring Framework provides many utilities to unit test Spring configured code as well. Here are some example unit tests

  Continue Reading

Tools of the Trade Comment on Tools of the Trade 0

When you begin your journey as a developer, either fresh out of college, or as an individual experimenting with technology, you'll soon discover a plethura of tools available to assist you in your development.  I've encountered a lot of tools in my few short years of experience, but few remain in my arsenal today.  Those few have proven to be the best, with the most available features, active open source communities, and fewest bugs.

  Continue Reading

Character Encodings: Get rid of the question marks Comment on Character Encodings: Get rid of the question marks 0

Have you ever been to a web site and seen question marks where you would expect to see a single or double quote (even other characters)?  Have you had to deal with the problem yourself?  It was very frustrating for me to resolve this problem.  After a lot of research, and configuration changes, I finally have it pinned down.

  Continue Reading

About

David Malone is a Java developer residing in the Twin Cities area.  He has been developing enterprise applications since 2004.  This is his personal blog, as well as his design and development workspace.