Errai: The browser as a platform

Thursday, August 19, 2010

"Fueling the rocket" - Approaching 1.1-Final







Ready for lift-off? The 1.1 Candidate Release has been released today. We got plenty of goodies baked into this one:

  • Serialization
    Plenty of bugfixes and performance improvements.
    Up to 40% performance gain and a much better memory footprint.

  • Deployment
    Complete replacement for the meta data facilities and deployment hooks. This a fixes a lot of problems with nested deployment artifacts (i.e. WAR inside EAR)

  • Monitoring
    Improvement activity monitoring tools. Added capabilities to query for certain message types/payload patterns.

  • CDI Integration
    Seamless integration of CDI backend components with GWT client applications.

  • And much more ...
    Check the Userguide for a complete reference of new features.


Download it now.
Browse the Userguide.
Get the sources.

Have fun,
the Errai Team





Image from "Fortress on a Skyhook" written and illustrated by Frank Tinsley, Mechanix Illustrated April, 1949

Monday, July 19, 2010

Dependency Injection in the Browser!

One of the things that will be coming in Errai 1.1 is our new IOC module which provides a dependency injection framework, based on JSR-330 in the browser. Now, this is not just Gin packaged with Errai. Rather, it's an implementation which has been built specifically to intermix with Errai's code generation infrastructure and provide a boiler-plate free experience.

When we release 1.1, gone will be the days of having to access the bus or the dispatchers through static factories. Rather, your client-side code will look even more like your server-side code.

Check out our new HelloWorld example built atop our new DIfoundations.

@EntryPoint @Service
public class HelloWorld extends VerticalPanel implements MessageCallback
{
    private Button sayHello;
    private Label label;

    private MessageBus bus;

    @Inject
    public HelloWorld(MessageBus bus) {
        this.bus = bus;
    }

    public void callback(Message message) {
        label.setText(SimpleMessage.get(message));
    }

    @PostConstruct
    public void init() {
        sayHello = new Button("Say Hello!");

        /**
         * Register click handler.
         */

        sayHello.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                MessageBuilder.createMessage()
                        .toSubject("HelloWorldService")
                        .with(MessageParts.ReplyTo, "HelloWorld")
                        .done().sendNowWith(bus);
            }
        });

        label = new Label();

        add(sayHello);
        add(label);

        RootPanel.get().add(this);
    }
}


Notice use of the @EntryPoint annotation. When you use @EntryPoint you don't need to implement your own GWT EntryPoint class, we build that for you.

You're probably already wondering if you can provide your own arbitrary providers to inject custom services, widgets and other components. And the answer is yes. We've provided a simple Provider interface that you can annotate to be discovered by the container at compile time to provide an injectable dependency. In fact both MessageBus and RequestDispatcher plug-in using this mechanism. Here's the provider for MessageBus:

@Provider
@Singleton
public class MessageBusProvider implements TypeProvider<MessageBus> {
    public MessageBus provide() {
        return ErraiBus.get();
    }
}


Pretty cool, huh? Doing more sophisticated things requires tying into the code generator which is used to generate the wiring code, and there will be documentation on how to do that. But the code generation interfaces will be surprisingly easy to use if you want to do anything particularly advanced, such as provide custom annotations for the container to process during the bootstrap process.

This is just one of the many cool features coming to Errai 1.1. Stay tuned for more!

Sunday, May 30, 2010

GWT, CDI and Errai at Jazoon

If you happen to be at Jazoon this year and you are interested in GWT, CDI and Errai then these sessions may be interesting to you:

Patterns and Best Practices for building large GWT applications
Tuesday, 1 June 2010, 14:00-14:50, Arena 3

In this presentation we’ll see how to organize a nontrivial GWT application. We’ll go through the lessons learned in a real world project and take a look the complete development lifecycle and best practices that go beyond what GWT has to offer out-of-the-box. This talk does focus on modularity of GWT applications and how to overcome the burdens of compile-time linking. We’ll talk about client side patterns and server side implementation options and explore different approaches that allow for quick turn around times without sacrificing maintainability.

GWT, CDI and JAX-RS: A match made in heaven
Tuesday, 1 June 2010, 15:00-15:50, Arena 3

Every non-trivial GWT application requires integration with the server side. While GWT itself ships with the integration capabilities (i.e GWT RPC) it doesn't go beyond that. Developers have to decide how to build the backend to their GWT applications. While freedom of choice is a good thing, it doesn’t always lead to a good decision. In this session we’ll look at two options, JSR-299 [1] and JSR-311 [2], both part of the EE6 specification and see how they interplay with GWT. We'll discuss the use cases and justifications for each technology see how they are applied in practice by looking at some code examples.

[1] JSR-299: Java Contexts and Dependency Injection for the Java EE platform (CDI) is the new Java standard for dependency injection and contextual lifecycle management.

[2] JSR-311: A that specification defines a set of Java APIs for the development of Web services built according to the Representational State Transfer[1] (REST) architectural style.



The complete schedule can be found here.

Wednesday, May 12, 2010

Hello, 1.1 Milestone 1!

Today, we’re pleased to announce our first step towards version 1.1, which sets us solidly on a course with 1.1 destiny.

This milestone release is a big step towards honing the concepts that we introduced in 1.0, driving someone them towards their logical conclusions, and smoothing out the rough edges. Community feedback was important to us, and we’ve worked diligently to respond to it.

This release brings a range of new features, including (but not limited to):

* Support for more servlet containers.
* New Async Task API
* A new bus monitor to make troubleshooting easier
* A new RPC API, that leverages the bus architecture, and provides an alternative to GWT-RPC.
* Better error handling.
* Better documentation.
* Bug fixes galore!

We think you should take a look. And we hope you have as much fun using it as we did building it.

Remember, Errai is always looking for community contributions. So if you’re interested in becoming a contributor, drop us a line. Download it before it gets cold.

Wednesday, May 5, 2010

Best Practices

Fellow JBoss core developer, and lead engineer for JBoss's security initiatives, Anil Saldhana took a deep dive into Errai in recent weeks, and he's documented some best practices here.

He offers some valuable advice worth checking out.