JBoss Forge 2.0.0.Alpha13 is now available!

We are pleased to announce the release of “Lucky Thirteen”, a Forge Runtime that features a streamlined programming model for Addon developers (no more @Exported annotation,) as well as a wide array of new Commands for developing Java EE applications.

Resource Transactions and Resource Change Monitoring

There are a lot of exciting features (as you can see by the release notes below); however, there are some outstanding features that we are proud to present. The first of which are resource transactions and monitoring.

Resource Transactions:

If you are familiar with UserTransaction in Java EE applications, this should feel pretty comfortable.

ResourceTransaction transaction = factory.getTransaction();
try {
   // Starts the transaction
   FileResource<?> resource = factory.create(...);
   // The file won't be updated until commit is performed
   resource.setContents("Hello World");      
   String contents = resource.getContents(); // Returns "Hello World"
   FileResource<?> anotherResource = factory.create(...);
   // The file won't be deleted until commit is performed
   FileResource<?> newResource = factory.create(...);
   // The file won't be created until commit is performed
} catch (Exception e){
    // Discard all changes since the beginning of this transaction 

Additionally, transactions support change-set inspection, so you can compare file contents before deciding whether or not a given transaction should be committed or rolled back:

   Collection<ResourceEvent> changeSet = transaction.getChangeSet();

Following the example above, this change set contains the following entries:

Collection [
    ResourceCreated: <FileResource<?>>, 
    ResourceModified: <DirectoryResource>, 
    ResourceModified: <FileResource<?>>, 
    ResourceDeleted: <FileResource<?>>, 
    ResourceCreated: <FileResource<?>>

Resource Monitors:

private ResourceFactory factory;
Resource<?> resource = factory.create(...);
ResourceMonitor monitor = factory.monitor(resource);
monitor.addResourceListener(new ResourceListener() {
    public void processEvent(ResourceEvent evt) {

Once a monitor is no longer needed, it must be manually disposed of by calling the cancel() method:


@CommandScoped support:

You may now use the @CommandScoped annotation to share data between pages in UIWizard implementations. No more context attribute passing!

Release Notes – Check out all the new stuff!



Feature Request