Coming Up for Air

Custom Maven Packaging Type

As I’ve noted in a previous post, I recently moved my blog from Awestruct to JBake. This also allowed me to migrate the building and publishing of the blog contents to the toolchain that I know pretty well (Maven). What bothered me, though, was that my POM defined the project as a jar packaging type: the build produces no jar file and, in fact, doesn’t process any Java at all. What I wanted, then, was to be able to define the lifecycle in such a way the the compile phase didn’t try to compile anything, and the install phase didn’t try to put anything in my local repo. Unfortunately, either I’m a bit dense, or the documentation wasn’t very clear (it’s likely a combination of both :). At any rate, I finally had a eureka moment late last night and figured it out. Here is a distillation of my findings.

From Awestruct to JBake

For some time now, I have been using awestruct to power my blog, and, for the most part, I’ve been happy. However, I have found, especially on the Mac, the Ruby-based environment more difficult to setup than I would like. While I have solved this problem before, it presented itself once again when I was issued a Mac upon joining NetSuite. I can, of course, muddle through it, but I’m tired of fighting it, so I started looking around for an alternative and found JBake.

Multitenant PostgreSQL

As more and more of our applications move into "the cloud", multi-tenancy has become a pretty big thing these days. In a nutshell, "multi-tenancy" means handling multiple customers data using, say, a single server. This concept scales, of course, to clusters, etc., but the concept is the same: a bunch of people’s data all mixed together in one big bucket. The problem, then, for the development team is isolating one customer’s data from another’s, disallowing, for example, the viewing or editing of another customer’s information. There are a myriad of ways to accomplish this, but I’d like to discuss here a way to accomplish this using a single database.

Merry Christmas

To all of my readers, I wish you all a very Merry Christmas. My hope, as always, is that even in the busyness and the hustle of the Christmas season, you will find the peace and joy of God brought to us so many years ago in the birth of the Christ child.

Contract-First REST APIs with RAML

Yesterday, at the OKC JUG, I presented on the topic of Contract-first REST API development with RAML. This post is a rough blogification of that discussion. For those of you who were at the meeting, the preamble to the source demo (introduction, background, options discussion, etc) have been not been reproduced here.

tl;dr: You can find the demo source here and play around with it.

So long, and thanks for all the fish

thanksforallthefishAs so many of my friends and peers have done before me, it’s time to use that admittedly overplayed Douglas Adams quote and announce my departure from Oracle.

I joined Sun Microsystems in July of 2008 as a member of the GlassFish team, working primarily on the Administration Console. Over time, I would add REST to my work load, which has been my primary responsibility for the past few years.

I’ve had the opportunity and honor to work with some very smart and talented people over the last six years. I’ve learned a lot from them, and made some great friends. While it’s nothing as drastic as the destruction of the Earth to make way for an intergalactic highway, the time has come, though, to bid farewell to those friends and the job that’s offered me so much opportunity and growth and move on to a new venture and more great opportunities and chances to learn and grow.

It’s been a pleasure.

Can I Use Dropwizard for This?

I’ve been toying with using DropWizard as my…​ deployment platform for a personal project, but I need/want JAX-RS 2 and CDI, which is a problem for the the stable DW. There is a branch that is migrating to JAX-RS 2 (and Jersey 2.9), and it sort of works, but trying a simple injection is causing a failure I can’t quite figure out:

Caused by: A MultiException has 1 exceptions.  They are:
1. org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee(requiredType=SayHelloService,parent=HelloWorldResource,qualifiers={}),position=-1,optional=false,self=false,unqualified=null,288169102)

    at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(
    at org.jvnet.hk2.internal.Utilities.justInject(
    at org.jvnet.hk2.internal.ServiceLocatorImpl.inject(
    at org.jvnet.hk2.internal.ServiceLocatorImpl.inject(
    at org.glassfish.jersey.server.ApplicationHandler.initialize(
    at org.glassfish.jersey.server.ApplicationHandler.access$500(
    at org.glassfish.jersey.server.ApplicationHandler$
    at org.glassfish.jersey.internal.Errors$
    at org.glassfish.jersey.internal.Errors$
    at org.glassfish.jersey.internal.Errors.process(
    at org.glassfish.jersey.internal.Errors.process(
    at org.glassfish.jersey.internal.Errors.processWithException(
    at org.glassfish.jersey.server.ApplicationHandler.<init>(
    at org.glassfish.jersey.server.ApplicationHandler.<init>(
    at org.glassfish.jersey.servlet.WebComponent.<init>(
    at org.glassfish.jersey.servlet.ServletContainer.init(
    at org.glassfish.jersey.servlet.ServletContainer.init(
    at javax.servlet.GenericServlet.init(
    at org.eclipse.jetty.servlet.ServletHolder.initServlet(
    ... 36 more
Caused by: org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee(requiredType=SayHelloService,parent=HelloWorldResource,qualifiers={}),position=-1,optional=false,self=false,unqualified=null,288169102)
    ... 55 more

If I create the Weld runtime and request the beans specifically, I get to good objects (instances of both A and B, with B having an injected instance of A), but once I tell DW to fire things, the app dies:

        Weld weld = new Weld();
        WeldContainer container = weld.initialize();
        SayHelloService service = WeldContext.INSTANCE.getBean(SayHelloService.class);
        final HelloWorldResource resource = container.instance().select(HelloWorldResource.class).get();

        final TemplateHealthCheck healthCheck
                = new TemplateHealthCheck(configuration.getTemplate());
        environment.healthChecks().register("template", healthCheck);

It seems, then, my deployment environment will be, at least for now, a Java EE app server. They’re small enough these days that it really shouldn’t matter. I was just curious to see if DW might be viable for me, and it appears that the answer is "not yet".

I’ll check back later.

LiveJournal Export

I have a personal LiveJournal blog that I’d like to migrate to Awestruct. Unfortunately, LiveJournal’s export tool is really limited, allowing the export of only one month at a time. There are tools to work around that, but the only ones I’ve seen require Windows, which rules me out. In typical geek fashion, then, I wrote my own tool, ljexport, a very quick-and-dirty JavaFX 8 application. All this does is export each month to its own file. Once you have the data, you’re on your own. :)


Sample quote

Quote source