The Punk Image Gallery

Introduction

Unlike most framework samples, PIG is a real-world application. Our social group needed a way of storing and presenting the thousands of images in our various personal archives, and none of the public services provided the right set of features. Furthermore, there are serious privacy concerns with the upload of our personal pictures to a site out of our control.

PIG was written in a whirlwind couple of weeks by Jeff Schnitzer, with some help from Scott Hernandez and Shawn Jacques. The three of us are continuing to develop new features; this is not a static example.

Requirements

There were only a few requirements for PIG:

Non-requirements are:

Installing PIG

PIG stores images in an entity bean (read: database) as a byte[] (read: BLOB). This means you will need to use a database and a JDBC driver that supports BLOBs. This means you will not be able to use:

The following databases are known to work:

IMPORTANT! In order to retreive image size information, PIG makes JDBC calls which use the SQL function "datalength()". While most RDBMSes offer this facility, none seem to agree on what to name the function. MS SQL Server calls it "datalength()", but others call it "length()" or "octet-length()". If you are not using MS SQL Server, you must create a function alias or user defined function "datalength()" to map to your equivalent function.

The secret word for creating accounts is an environment context parameter set in the ejb-jar.xml deployment descriptor. The default value in the prepackaged ear is "default". You can either edit the deployment descriptor or you can rebuild the project after creating a properties file called "deployment.properties" in the same directory as the build.xml buildfile. The contents of this properties file should be "secretWord=your_secret_word"

Limitations

This section is an enumeration of PIG's "warts". Some of these limitations may be removed in future revisions, but proabably not unless someone makes a request :-)

PIG requires the Orion server. Unfortunately, there are a couple good reasons for this:

There is currently a race condition in the code which generates primary keys for Members, Media, and Galleries. Primary key generation in CMP EJBland is notoriously troublesome, and we have decided to punt the issue. It is highly unlikely that this race condition will ever show up without massive loads, and the failure mode will be an exception to the user, not corrupted data. If you ever happen to meet one of the EJB spec leads, please grab them by the neck and throttle them until they consent to allow for autogenerated primary keys in the next specification revision.

More Information

PIG falls under Maverick's license; you can do pretty much anything you want with it, including use it in a commercial product.

The Maverick web page (where PIG lives) is here. Downloads are available on the SourceForge project page.

You can discuss PIG on the mav-user mailing list.

SourceForge Logo