Posts Tagged “Software development”

I was recently writing a program to find classes that had a certain annotation on them:

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This annotation works similarly to the @WebMethod
 * annotation. It is used to indicate that the annotated method is allowed to be
 * made visible on a generated facade, and how to do it.
 *
 */
@Target(ElementType.METHOD)
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface FacadeMethod
{
	/**
	 * This is the operation name that the annotated object will have on the
	 * generated facade. This will be used as the value for
	 * operationName in the @WebMethod
	 * annotation as well as the name of the method in the facade.
	 *
	 * @return the name that the annotated object will have on the generated
	 *         facade
	 */
	String operationName();

	/**
	 * This is a description of the method which will be used to generate
	 * javadoc on the facade.
	 *
	 * @return a description of the method
	 */
	String description() default "";
}

Methods annotated with this method look something like this:

@FacadeMethod(operationName = "effectivelySame",
              description = "Return true if the two strings are identical, both null, "
                            + "or equivalent after converting to same case and trimming")
public static boolean effectivelySame(String s1, String s2) {
...

What I needed to do was look through a whole mess of jar files that weren’t in the classpath, looking for classes with methods annotated with this annotation, so I could read the operationName and the description properties of the annotation.

Read the rest of this entry »

Comments No Comments »

I’ve done something simple, yet cool and useful in our Ant builds to make them work a little nicer with Hudson.  I’ve modified things so our Jars/Wars get stamped with version control information from Hudson.  To do this, I take advantage of the fact that when Hudson starts an Ant build, it puts certain key values in the environment variables, so I grab them and stuff them into the manifests for the jars.

Read the rest of this entry »

Comments No Comments »

Well, this may turn a number of you off and make you think I’m some sort of Luddite or something, but I have come to a considered opinion:  I don’t really like Hibernate.

Before you consider me an ignorant fool, here are some of my reasons for you to consider (and I may add to this list over time): Read the rest of this entry »

Comments No Comments »

I was looking at some of the core language enhancements being considered for JDK 7.  Some of them look pretty good, others, meh.  Here are a few of the ones I’m looking forward to:

Constructor Inference for Generics

Using generics, your currently have to type both sides of an assignment when doing a constructor:

Map<String, List<String>> anagrams = new HashMap<String, List<String>>();

Being considered is the ability to omit the types and infer them, such as:

Map<String, List<String>> anagrams = new HashMap<>();

which would be equivalent to the first line.  I like this - improves readability, loses nothing but typing.

Relational operators for Enums

Currently, the only relational operators that you can use for constants in an Enum are == and !=.  Since all enums implicitly implement Comparable, theres no good reason why you should not be able to use <, >, <= and >= on enums.  As it stands now, you need to explicitly invoke compareTo().

Switches on Strings

Sure would be nice if instead of if-else if-else constructs to branch on string values, you could do

switch(someString) {
   case CONST_1:
      return true;
   case CONST_2:
      return false;
   default:
      throw new IllegalArgumentException("Bad value: " + s);
}

Comments No Comments »

Here is a great article from CIO magazine, in which Grady Booch (among other things, one of the Three Amigos who developed UML) discusses five things he has learned over his career about developing complex software systems.  Definitely worth a read.

Comments No Comments »

This past week I burned up dozens of hours trying to make JBoss AOP work in my .WAR file.  Then I realized that I didn’t have to.

I have this application that is a WAR file full of web services.  What I wanted to do was create an aspect that I could weave in to gather usage statistics on every web service called — the user, the amount of time spent, whether it was successful or not, that sort of thing — and write it to a table for analysis and reporting.  Since we use JBoss as our application and web server (and a paid support contract), I decided to try JBoss AOP which is bundled with the Enterprise Application Platform.

So, I wrote my aspect, and started trying to hook it in.  Man, what an ordeal. Read the rest of this entry »

Comments 2 Comments »

As a contrast to my previous post regarding securing Subversion, I thought I would go through how to secure a Hudson installation using Active Directory for authentication and authorization.

Steps:

Read the rest of this entry »

Comments 2 Comments »

I just got made a committer to the Hudson project.  Of course, it’s not like I’m a bigshot or anything, but still, you don’t get to do this every day, so I gotta take my bragging rights when they come…

Comments 1 Comment »

One of my favorite books on UI Design is Don’t Make Me Think by Steve Krug. While this great book is focused on Web UI design, the central theme is universal: As much as possible, software should be so self-obvious how to use it that no manual is necessary.

As I see it, at least one of three things is possible:

  1. The creators of AnkhSVN should read this book
  2. AnkhSVN cannot create branches
  3. I’m an idiot.

Read the rest of this entry »

Comments 3 Comments »

In an earlier post I wrote about my experiences trying to write a plugin for Hudson. In that article, I wrote about how I basically gave up because I was having too hard a time wrestling with Maven for the small amount of code I was writing.

Well, time passes, and I decided to try again, but this time I decided to look into what it would take to fix an issue I’ve had with Hudson. (For the curious: at the time of this writing, Hudson cannot verify that your LDAP settings are correct if your server does not allow anonymous binding - issue 1589).

Read the rest of this entry »

Comments 1 Comment »