Jun
21
2009
2

Spring Web Flow 2 Web Development

Spring Web Flow 2 Web Development is a great read for developers who want to take a hands-on approach to learning a great technology. By following and working with the examples, you can experience the basic principles of Spring Web Flow 2 and how it integrates with JSF, Spring Security and AJAX. This book is great for Java developers who are already using the core Spring Framework and now want to involve Spring in the presentation tier of a Web application.

Within the first few chapters, the authors present a good overview of Spring Web Flow 2. Chapter 2 starts with the installation of Spring Web Flow 2 and some help with running the examples packaged within the distribution. Chapter 2 also goes over putting together a development environment that is based on some pretty standard open source technologies like Ant, Maven, Ivy, Eclipse (Spring IDE) and NetBeans. The “Support for Developers” section of chapter 2 is a great feature of this book because if you are not already familiar with the aforementioned technologies, you get exposure to some great open source development tools. After learning a little more about how everything works together, the authors throw in a little JPA and by the end of chapter 2, you have completed your first example.

The focus of chapter 4 is Spring Faces. In my opinion, if you are going to work with JSF, focus on this chapter because Web Flow 2 is what is missing from JSF. I am not a big fan of some of the JSF implementations I have used in the past, but Web Flow 2 makes working with JSF and Facelets a bit nicer and the Spring Faces tag library is very helpful. Combine chapter 4 with chapter 5’s sections on Subflows and AJAX and you will have a good foundation for creating rich Web applications with Web Flow 2.

Chapter 6 illustrates Spring Web Flow 2’s testing support. A very important part of the development process is testing. Too many developers overlook the importance of testing especially when it comes to Web applications. Web Flow 2 comes with great testing support and as the book points out, testing support is part of the framework rather than an after-thought for developers.

Some Web applications require some level of security and most enterprise Web applications have to incorporate support for authentication and multiple levels of authorization. Chapter 7 discusses the integration of Web Flow 2 with Spring Security, formerly Acegi Security. This chapter provides a great high level view of Spring Security configuration and how to lock down access to parts of a Web page and even method level security.

Overall I enjoyed reading this book and learning Spring Web Flow 2. The authors, Markus Stäuble and Sven Lüppken, did a great job in presenting the core concepts of the technology in only 200+ pages. Prior to reading the book, I had little knowledge of the technology, but now I would be comfortable working on a project that is utilizing Spring Web Flow 2. More information about the book and authors can be found at www.packtpub.com.

Written by R.J. Salicco in: Commentary | Tags: ,
Jun
11
2009
0

SpringOne & 2GX Groovy/Grails Experience 2009

Hopefully I will be in New Orleans, LA for the SpringOne & 2GX Groovy/Grails Experience October 19th - October 22nd. I went to the 2GX Groovy/Grails Experience in 2008 and it was a great conference with great sessions. This time attendees will have the option to attend SpringOne sessions as well. 4 straight days of sessions; I will probably only sleep a couple hours a night! For more information check out www.springone2gx.com.

Written by R.J. Salicco in: Commentary |
May
28
2009
6

Are You Learning Java? Why?

The other day, I began thinking about how to learn to become a programmer/software developer. Then I began thinking about learning C, C++, Java, Groovy, Ruby, Scala, PHP, Coldfusion, Perl, Python JavaScript and so on. I started thinking about beginning programmers because my youngest brother has started learning C in school. He has started with the standard:

#include<stdio.h>
main()
{
    printf("Hello World");
}

I started programming in a similar fashion and then I would eventually begin to learn PHP then Coldfusion, Java, Groovy, Ruby, Python…I was wondering what sparked my interest to learn other languages. My biggest effort or concentration has been learning Java, that is what I do 9-5 and I even became a SCJP, why you ask? Good question. What if I was a COBOL programmer or RPG programmer, why would I start to learn Java? Here are some reasons I came up with:

* I am in school/fresh out of school and I want to learn Java because:

  • I took an intro to programming class and the professor/other students were talking about Java.
  • I have a few friends that are working for big companies that are learning Java.
  • I see a lot of Java jobs advertised on the job sites.
  • I have been working with Web scripting languages but I would like to see the Java approach.

* I am a COBOL, RPG or legacy programmer and I want to learn Java because:

  • My company is re-platforming legacy applications and moving to Java.
  • I see a lot of Java jobs advertised on the job sites.
  • Java developers at my company make more money.
  • I want to be able to put Java on my resume and become more marketable.

Maybe you have some other reasons to learn Java?

Written by R.J. Salicco in: Commentary |
May
11
2009
14

Groovy Prime Numbers

The other day I wanted to prove the power of Groovy to a few more core Java developers. I sat down and played with a little script that I think proves the power, or ease of use, of Groovy while having fun with number theory. My goal was to have a Collection that contains Prime Numbers calculated from a given range of numbers x to y, or in Groovy syntax x..y. I am taking a few things for granted with this script. For example, I know that 2 is the lowest Prime Number (it helps simplify the algorithm) and that 1 is not a Prime Number. So here’s the script:

def t = 1..100
def v = []

t.each { n ->
    (2..n).each { d ->
        if(n % d == 0 && n != d)
            v.add(n)
    }
}

println t - v - 1

We have our range of numbers t and we are capturing the non-Prime numbers and adding them to our Collection v. The final line of the script is doing a lot of groovy work for us that would take a few more lines of code with plain Java syntax. What is it doing for us? It is taking our range of numbers t and subtracting (removing) our non-Prime numbers collected in v. This line is also removing the number 1 because we know that 1 is not a Prime Number. Finally, it is printing the result like so:

[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

Very cool stuff. Now, I know that many of us are rarely building a Collection of Prime Numbers and I know this script does not do things in a timely manner with a range like 1..10000 (it took a couple of minutes), but I am sure this feature of Collections in Groovy can be utilized in many ways in my development.

Written by R.J. Salicco in: Development | Tags: ,
Apr
16
2009
0

Spring Web Flow 2 Web Development

Last night I got to spend a little time with a book I will be reviewing, Spring Web Flow 2 Web Development. I had a few other things going on last night, but I read through the table of contents and the preface to get an idea of what to expect. I think that Spring Web Flow is a great technology and I look forward to getting more intimate with the subject. I am not familiar with the authors, Sven Lüppken and Markus Stäuble, but I have read a little about them at the Packt Publishing Web site and I am excited to see how they present a great technology like Spring Web Flow 2. Chapter 4 is available as a sample chapter along with the code from the book and a few other resources at the publisher’s Web site.

Written by R.J. Salicco in: Commentary | Tags:
Apr
07
2009
0

axiomaticIT.com, axiomaticIT.org Running on Grails, Tomcat and MySQL

I am proud to say that axiomaticIT.com and axiomaticIT.org are now officially running on Grails, Tomcat and MySQL. It took about 2-3 hours to create and test this simple Grails application locally and then a few hours to get everything deployed and configured with Tomcat and MySQL on the server. The application is not too complex, but it does what it needs to do and I only spent a few evenings putting it all together. I basically took a small static site and made it dynamic so content could be updated a bit easier. Grails provided the productivity, no doubt about it.

Written by R.J. Salicco in: Commentary, Development | Tags: , ,
Apr
06
2009
1

Spring’s Dynamic Language Support Presentation

On March 31st, 2009 I discussed Spring’s dynamic language support with a focus on Groovy and JRuby at the Tampa JUG. There were quite a few people in attendance who were interested in leveraging the power and simplicity of Spring and Groovy. The presentation material can be found here and the demo Web application can be found here. Thanks to all who attended, the Tampa JUG’s sponsors GCA and Hudson and Vladimir Vivien.

Written by R.J. Salicco in: Presentations | Tags: , , ,
Apr
03
2009
0

IBM and Sun Microsystems

Although many people believe that IBM and Sun Microsystems are synonymous with Java, especially in the corporate environment, I do believe that there is a need for keeping things separate. The concept is somewhat similar to the separation of church and state here in the United States. On one side, we have the belief and ability to make changes and foster ideas to keep things open and less constrained. Then on the other side, we have walls and boundaries that limit when and where we can go. We don’t have to mix our beliefs with every aspect of what we do and we surely do not want our limitations to constrain our ideology and options. I appreciate what each company does within their own space but I am a bit weary about IBM purchasing Sun.

Written by R.J. Salicco in: Commentary | Tags: , ,
Feb
09
2009
1

Groovy Closure Currying

So I have been diving into Groovy a bit heavier lately and I was just checking out Closure currying. So let’s say I have a Closure, like myClosure below, that takes in 2 parameters, var1 and var2. Let’s look at the code:

...
def myClosure = { var1, var2 ->
    var1.call()
    var2.call()
}

def walk = { println "I am walking..." }
def run = { println "I am running..." }
def fly = { println "I am flying..." }

myClosure(walk, run)
myClosure(walk, fly)

def walkFirst = myClosure.curry(walk)
walkFirst(run)
walkFirst(fly)
...

When I call myClosure(walk, run) and myClosure(walk, fly) I get:

...
I am walking...
I am running...
I am walking...
I am flying...
...

Well what curry() does for us is take out some of the duplication that we may find when passing in parameters to our Closure. I notice that the Closure walk is passed in both times because we want to walk before we can run or fly. If we take advantage of curry() we can create another Closure called walkFirst. The Closure, walkFirst, is created here:

...
def walkFirst = myClosure.curry(walk)
...

This now gives us a simpler Closure we can send run and fly into without worrying about having to pass in walk first. This is a very useful utility of Groovy and Closures and we get exactly what we were expecting:

...
I am walking...
I am running...
I am walking...
I am flying...
...

Very cool stuff. Do yourself a favor, read more about Groovy.

Written by R.J. Salicco in: Development | Tags: , ,
Feb
08
2009
4

Adobe Air: Getting Started

I wanted to create this post because I needed a reference to where I am at with Adobe Air/Flex. Plus Vladimir Vivien said I needed to blog about what I have been doing. So here is what I have been doing:

I have mostly been creating Flex form based applications with datagrids that rely on RESTful Web services mostly running on Groovy/Grails but I have also created an Air application that communicates with TIBCO EMS. I want to go over the TIBCO integrated Air app, I call systemStatus. Basically, systemStatus makes an HTTP request to a URL like http://host:port/systemStatus and a TIBCO HTTP Receiver listens and responds after executing some processes on the ESB. The TIBCO project includes processes that execute some simple tasks, like queries on databases, and the results are accumulated and mapped to a pre-defined schema. The response is an XML document that looks something like this:

...
<resources>
    <resource>
        <name>Production Oracle</name>
        <type>database</type>
        <vendor>Oracle</vendor>
        <status>offline</status>
        <instance>server 1</instance>
    </resource>
    .
    .
    .
</resources>
...

The XML is pretty simple, but it does what I need it to do. It basically gives us some META data and a status for each of the resources, like databases, which are dependencies of the deployed TIBCO projects. I am going to stay away from the details pertaining to the TIBCO application but if you need some help setting up something like this, just contact me.

Next we turn to the Air/Flex application. The Air application is made up of only a few major components: <mx:HTTPService>, <mx:Panel>, <mx:TextInput>, <mx:DataGrid> and <mx:Button>. At the simplest level, the <mx:HTTPService> makes the call to the TIBCO service and the <mx:DataGrid> handles and displays the XML results. I have added the <mx:TextInput> component so the app can be configured to point to different TIBCO environments running the deployed systemStatus TIBCO application that provides the XML results. Here is the meat of the Air application:

...
<mx:HTTPService id="systemStatusService" result="r_Handler(event)" resultFormat="e4x" fault="f_Handler(event)" url="http://{serverName}" />

    <mx:Panel title="systemStatus" height="100%" width="100%" paddingTop="10" paddingLeft="10" paddingRight="10">

        <mx:ControlBar horizontalAlign="left">
            <mx:Label text="Server:Port"/>
            <mx:TextInput id="serverNameInput" enter="setServerName()"/>
        </mx:ControlBar>

        <mx:Label text="Systems:"/>

        <mx:DataGrid id="systemDG" width="100%" height="80%"
            dataProvider="{systemStatusService.lastResult.resource}"
            editable="true">
            <mx:columns>
                <mx:DataGridColumn dataField="vendor" headerText="Vendor" editable="false"/>
                <mx:DataGridColumn dataField="name" headerText="Name" editable="false"/>
                <mx:DataGridColumn dataField="instance" headerText="Instance" editable="false"/>
                <mx:DataGridColumn dataField="type" headerText="Type" editable="false"/>
                <mx:DataGridColumn dataField="status" headerText="Status" editable="false"/>
            </mx:columns>
        </mx:DataGrid>

        <mx:ControlBar horizontalAlign="left">
            <mx:Button id="refresh"
                label="Refresh"
                rollOver="refresh_rollOver(event);"
                rollOut="refresh_rollOut(event);"
                click="refresh_clickHandler();"/>
        </mx:ControlBar>

</mx:Panel>
...

Here is a screen shot of the Air application:


systemStatus

The refresh button will initiate another request to the TIBCO service and if anything has changed, the XML results will reflect the changes and the <mx:DataGrid> will be updated.

This is a pretty simple idea, but it demonstrates how we can take one technology and combine it with other tools and technologies to create useful applications to make life easier.

Download the code:
systemStatus.zip

Written by R.J. Salicco in: Development | Tags: , ,

Axiomatic IT Incorporated | Aeros Theme | TheBuckmaker.com WordPress Themes