Turbine

Friday January 08, 2016

Using annotations in Turbine 4

The Milestone 2 release of Turbine 4 has added support for dependency injection into modules and valves using annotations. This can simplify your code a lot. Consider a screen template thats uses some Turbine service:

...
protected void doBuildTemplate(RunData data, Context context)
{
    // Get service instance
    MyService myservice = (MyService) TurbineServices
      .getInstance().getService(MyService.SERVICE_NAME);

    // do something
    myservice.doSomething(...)
    ... 
}

Looks a bit complicated, doesn't it? Now with Turbine annotations, you simply do

...
@TurbineService
private MyService myservice;

protected void doBuildTemplate(RunData data, Context context)
{
    // do something
    myservice.doSomething(...)
    ... 
}

In addition to services, the annotations @TurbineConfiguration and @TurbineLoader inject instances of the Turbine configuration or subsets of it and the Assembler loaders for a certain page, screen or action.

See the 

 for the documentation of these features.

Apache Turbine 4.0 Milestone 2 released

The Apache Turbine team is pleased to announce the 4.0-M2 milestone release!

Apache Turbine is a servlet based framework that allows experienced Java developers to quickly build secure web applications. Parts of Turbine can also be used independently of the web portion of Turbine as well. In other words, we strive to make portions of Turbine easily available for use in other applications.

Apache Turbine is a long time citizen of the Apache Software Foundation, the first commits date back to 2000 and 2001. The project has influenced quite a number of other projects such as Apache DB Torque, Apache Maven and a number of Apache Commons components.

This milestone release is made for verification of the new security implementation, the quartz scheduler and the new annotations. Many deprecated methods have been removed. The milestone release is not meant for production use. We hope to get lots of feedback from you.

Note that this version requires JDK 1.6+ to run.

New features

  • Add QuartzSchedulerService
  • Add Annotation @TurbineActionEvent to annotate action methods with arbitrary event names.
  • Add Annotation @TurbineLoader to inject a loader instance into objects.
  • Add Annotation @TurbineConfiguration to inject a configuration instance into objects.
  • Add Annotation @TurbineService to inject Turbine service instance into assemblers such as screens, actions, navigations etc. and pipeline valves. See VelocityActionWithServiceInjection for an example.
  • Add class cache for TurbineRunDataService

Fixed Bugs

  • Fix Velocity logging.
  • Fix possible NPE in TurbinePullService.
  • Use lastIndexOf() to get the template extension in TurbineTemplateService. Issue: TRB-82.
  • Fix TurbineYaafiComponentService to set its applicationRoot properly.
  • Fix TurbineMacros to comply with the implementation of HtmlPageattributes
  • Port the handling of template encoding from Turbine 2.3.3

Changes

  • Update dependencies
    • commons-codec to 1.10
    • commons-collections to 3.2.2
    • commons-logging to 1.2
    • commons-beanutils to 1.9.2
    • jython to 2.7.0
    • log4j to 1.2.17
  • Update dependencies
    • fulcrum-security to 1.1.0
    • fulcrum-intake to 1.2.0
  • Update to Torque 4.0.0
  • Update dependencies
    • servlet-api to 2.5 (Tomcat 6.0)
    • commons-codec to 1.8
    • commons-configuration to 1.9
    • commons-email to 1.3
    • fulcrum-parser to 1.0.3
  • Update Turbine Parent POM to version 3
  • Switch to Fulcrum Security API
  • Refactor handling of annotated fields into AnnotationProcessor.
  • Reintroduce VelocityCachedLayout/Screen classes
  • Adjust site for Apache Turbine Parent POM version 2
  • Use Apache Turbine Parent POM version 2
  • Remove duplicate data storage in DefaultTurbineRunData and DefaultPipelineData
  • Services that implement TurbineServiceProvider are inited early by default Issue: TRB-72.
  • Switch from String keys to Class keys for AssemblerBrokerService
  • Refine interface of PipelineData and add user and acl objects to pipelineData.
  • Continue generification

Removed

  • Remove all deprecated methods using RunData as a parameter to clean up the API. Further cleanup is needed.

Have fun!
-Apache Turbine team

Calendar

Search

Hot Blogs (today's hits)

Tag Cloud

Categories

Feeds

Links

Navigation