跳至主要内容

博文

Deploy application into Cloudfoundry

VMware(the SpringSource's mother company) provides a PAAS cloud service(aka CloudFoundry.com), you can easily deploy your application into CloudFoundry.com via Roo CloudFoundry addon or CloudFoundry.com client tools. And VMware also provides a Eclipse IDE plugin, with which you can deploy the application into CloudFoundry in IDE, just like deploy into your local server instance. Configuration for CloudFoundry The following steps are based on the project we have created in before post. Add cloudfoundry dependency in your pom.xml . <dependency> <groupId>org.cloudfoundry</groupId> <artifactId>cloudfoundry-runtime</artifactId> <version>0.8.2</version> </dependency> Configure a cloud data source in spring configuration file applicationContext.xml . <beans profile="cloud"> <cloud:data-source id="dataSource"/> </beans> CloudFoundry also supports other service, such as MongoDb,...

Tao of Spring Roo

As you see, Spring Roo is not only a simple scollad tool for code generation, it also try to introduce a new programming model. AspectJ and AOP programming Roo is heavily dependent on AspectJ, the famous AOP framework, which is a subproject of Eclipse.org . With the benifit of AspectJ, Roo try to separate the concern of an entity class. The entity class itself focuses on the declaration of business fields, and only includes the basic definition of the properties and bean validation declaration, the JPA specific definitions are moved to _Roo_Jpa_Entity aspect, and the toString helper method is included in the _Roo_ToString aspect, the setter and getter methods of the properties are categorized in the _Roo_JavaBean aspect. As you have seen in the before section, the entity class becomes slim and clean. Roo will process the .aj files and compile them into classes at compile time. Thus all extra features in the .aj files will be accessible in the entity class at runtim...

More fun with Spring Roo

more fun with roo We have created a Spring web project using Spring Roo, now let us have a look at the generated codes. Import codes into Eclipse workspace If you created the project from Roo console, you can follow the following steps to import the project codes into your Eclipse workspace. If you created the project from Eclipse directly, skip this section. Start Eclipse IDE. Select Import... menu item from File menu in the Eclipse main menu. In the popup Import... dialog, expand the Maven node, and select Existing Maven Projects and click Next button. Choose the created project folder, it will scan the project files, and recognize the pom.xml file, select it by checking the checkbox, and click Finish button. Please keep patient, and wait for one or two minutes. After the project is imported Eclipse will resolve the dependencies automatically. Explore the project codes Switch to Spring perspective, and open Package view. In t...

Create a Spring project from Spring ToolSuite

The Spring company, SpringSource provides a full stack solution for Spring development, including excellent IDE support, SpringSource provides an Eclipse based IDE to speed up the development of Spring project. Install Spring ToolSuite You can download a copy of Spring ToolSuite from SpringSource , and install it into your local disk. Alternatively, you can get a copy of the JEE bundle from Eclipse website and install Spring ToolSuite plugin manually from Eclipse Marketplace. Download the newest Eclipse JEE Bundle from the Eclipse website . Extract the files from the zip archive into your local disk. Start up Eclipse IDE. Open Eclpse Marketplace from Help menu in the IDE menu bar. Search SpringSource to find the Spring ToolSuite plugin. Click Install button and wait the installation done. Restart IDE according to the prompt, and apply the change. Note: In the further content, I will use the words IDE or Eclipse , it refers to Spring ToolSuite or Eclipse...

Create a Spring Project with Roo

Spring Roo is a rapid scollad tool brought by SpringSource , which can help you to create a data centered project in several minutes. Assumption I assume you are familiar with Apache Maven and Eclipse IDE . I also assume you have installed the latest Oracle JDK 7 in your local system. Install Spring Roo Download Spring Roo from SpringSource , and extract the file into your local disk. Add /bin to your system PATH environment variable. For Linux user, export PATH=$PATH: /bin (Linux) For Windows user, set PATH=%PATH%; /bin (Windows) Create a project Create a new folder as the new project root folder. Open your system terminal, and enter the new created folder. Run roo command, it will launch the Roo console and display the Roo welcome message. ____ ____ ____ / __ \/ __ \/ __ \ / /_/ / / / / / / / / _, _/ /_/ / /_/ / /_/ |_|\____/\____/ 1.2.3.RELEASE [rev 7fd62b6] Welcome to Spring Roo. For assistance press TAB or type "hint" then hit EN...

Book Review: Arquillian Testing Guide

Today I have received my hard copy of the book, Arquillian Testing Guide. Comparing to the resource I had got at the end of last year, much content are improved. Arquillian is a modern Java EE testing framework, based the well-known JUnit or TestNG, brought by JBoss.org. In fact, currently Arquillian is beyond Java EE, and not only for Java EE application and Java EE container, such as it also supports Android application test and can run test in Android system(or Android simulator) . Most of my Arquillian experience is based on Java EE. If you have some experience of JUnit experience before, and eager to find a testing solution for your Java EE application and want to run the test case in container automatically, this book is for you. With Arquillian, you are free from preparing the test fixture before you write real tests. You can write tests in the nature way, such as using @Inject, @Resource etc in your test case directly as the way in yo...

Click4nb Update for NetBeans 7.3

I just updated the click4nb and rebuilt the source code against NetBeans IDE 7.3. No new features added. Follow the installation guide to install it into your IDE. Installation Read this wiki page to start your first Click application. Getting Started with Apache Click and NetBeans IDE Enjoy!

Getting Started with Apache Click and NetBeans IDE

Note: this post is from my project wiki pages, please read https://github.com/hantsy/click4nb/wiki/Getting-Started-with-Apache-Click-and-NetBeans-IDE for the newest version. If you have some suggestion or find some errors, please file an issue. Thanks. After moved from Google Code, I have cleaned the codes and just released a new version of click4nb , which was tested against the stable NetBeans IDE 7.2. Installation Following the steps in Installation wiki page to install click4nb into your NetBeans IDE. Create a web project with Apache Click Support Create a Web Application in NetBeans is very easy, follow the following steps to create one for yourself. Click the New Project button or click "File/New Project" menu from main menu in NetBeans IDE. In the popup New Project dialog, select Java Web in the Categories list, and Web Application in the "Projects", click Next button. In the Name and Location dialog, input the project related info, such...

Generate reports with Seam 3 Reports and Apache Velocity

Seam 3 provides a collection of standard CDI extensions. Seam3 report module bridges CDI and several report engines, such as JasperReports Pentaho XDocReport Basic Configuration Assume you have already created a Maven based Java EE 6 application. If not, you can create one using JBoss Forge. Add Seam 3 reports related dependencies into your pom.xml . <dependency> <groupId>org.jboss.seam.reports</groupId> <artifactId>seam-reports-api</artifactId> <version>${seam-reports-version}</version> </dependency> <!-- If you are using Jasper Reports, add the following dependency --> <dependency> <groupId>org.jboss.seam.reports</groupId> <artifactId>seam-reports-jasper</artifactId> <version>${seam-reports-version}</version> </dependency> Generally, in order to generate a JasperReports based report in a Seam 3/Java EE6 project, y...

Send email with Seam 3 Mail and JMS

Seam 3 Mail module provides simple API to use Java Mail API to send email message. Basic Configuration Assume you have already created a Maven based Java EE 6 application. Add seam mail dependency to your pom.xml file. <dependency> <groupId>org.jboss.seam.mail</groupId> <artifactId>seam-mail-api</artifactId> <scope>compile</scope> </dependency> <dependency> <groupId>org.jboss.seam.mail</groupId> <artifactId>seam-mail</artifactId> <scope>compile</scope> </dependency> Add basic mail configuration in your META-INF/seam-beans.xml . <mail:MailConfig serverHost="smtp.gmail.com" serverPort="587" auth="true" enableTls="true" username="<your gmail account>" password="<your password>"> <ee:modifies /> </mail:MailConfig> In your Java codes, inject ...

Click4nb 1.1.1 is available now

Click4 nb 1.1.1 is available for downloading now. I have uploaded the file to Google Code and NetBeans Plugin center. Get it and try. This release does not provide more new features but an improvement for Page class hyperlink support( Issue 1 ). Currently, click4 nb works well on NetBeans 6.8. I will move my development envoriment ot NetBeans 6.9 for the next version. In the next version, I will try my best to implement the following features. 1. Add click 2.2 support ( Cllick team has just release the first RC of Click 2.2), update the libary to Click 2.2 and improve the Content Assistance for 2.2. 2. Intergrate Cayenne Modeler into NetBeans IDE , add a action to open Cayenne file directly in NetBeans IDE . 3. Configuration for Cayenne ORM framework and Click intergration . Feel free to submit your feedback by email( hantsy@tom.com ) or leave message on this blog, you can also report your bug in the issue tracker.

Click Plugin for NetBeans 1.1 is avai...

Click Plugin for NetBeans 1.1 is available now Due to the shutdown of Kenai.com, I decided to move this project to Google Code. You can access from the new host page. http://code.google.com/p/click4nb/ Some features are provided in 1.1: 1. Click library update to 2.1 release. 2. You can customize a Click library, and create web project using your click library. see bug: NBX-1 3. CssImport and JsImport hyperlink support. see NBX-2 4. If more than one templates are mapped to one page class, it will popup a panel for you to select which file to open. You can download it from NetBeans Plugin portal or Google Code .

Click for NetBeans plugin 1.0 is avai...

Click for NetBeans plugin 1.0 is available now. I am very pleased to announce that the first version of Click for netBeans plugin is available now. You can get it from the Kenai.com or NetBeans plugin portal. Click i s a simple, but effective and component based web framework, it hosts on the Apache as a incubator project. This plugin bring basic Click support for NetBeans IDE. It includes the following features: 1、 Project creation wizard . 2、 Click Page creation wizard (the interface cloned clickide). 3、Provide basic error checks , hyperlink , code templates , code completion , refacotoring in click.xml file. 4、Also provide hyperlink , code templates , code completion in menu component configuration file. 5、Switch between Page Template, Page Class , Page properties quickly。 This project is open source under GPL, it hosts on kenai.com. Homepage: http://kenai.com/projects/nbx User Forum: http://kenai.com/projects/nbx/forums/user-forum Mail List: http://kenai.com/projects/nbx/lists Bu...

NetBeans Struts2 plugin updates

NetBeans Struts 2 plugin updates NetBeans Struts 2 plugin ( http://nbstruts2support.dev.java.net )is not updated for a long time. I checkout the source code and made some modification to the latest NetBeans IDE 6.7. 1.Update Struts library to the latest stable version 2.1.6 2.Update to the latest web framework API。 3.Redesigned configuration panel and provide more flexible configuration options 4.Other modification to Struts 2.1. Download here : https://dl.getdropbox.com/u/201666/nbstruts2.tar.bz2 Struts 2.1 provides next generation Filter to process request , and also provides a new optional Servlet . If you like choose Struts Servlet to process request , you can check "Servlet"  radio box in the "Reuqest processed by" section in the "Main" tab. This will generate some code like the following.    <servlet>         <servlet-name>struts2servlet</servlet-name>         <servlet-class...

Another NetBeans plugin updated - RichFaces

This a small personal update for  RichFaces plugin for NetBeans ( http://nbrichfacessupport.dev.java.net ) . Modification includes: 1. Update richfaces to 3.3.1.GA. 2. Add skin selector to the configuration panel. Then it will generate the following code in web.xml .     <context-param>         <param-name>javax.faces.STATE_SAVING_METHOD</param-name>         <param-value>server</param-value>     </context-param>     <context-param>         <param-name>org.richfaces.SKIN</param-name>         <param-value>japanCherry</param-value>     </context-param>     <context-param>         <param-name>org.richfaces.CONTROL_SKINNING</param-name>   ...

I updated two NetBeans plugins

The first one is the Wicket 1.4 support for NetBeans ( http://nbwicketsupport.dev.java.net ). I checked out nbwicketsupport ( http://nbwicketsupport.dev.java.net ) of branch nb_67. And made a slight modification on it for the Wicket 1.4 release version. 1. update wicket libaray to 1.4 release . 2. make wicket framework detect works. 3. update example (Login, Pizaa) application (Using filter instead of servlet, remove jasypt lib dependency ) Some problem I encountered. 1. In a maven web project , add Wicket support causes NetBeans dead. Kill and restart NetBeans, I found it configured correctly. 2. I tried to add some code to disable Wicket configuration and display the configured information on the Framework panel ( in the Project properties) after adding it to the Web project( Struts support use this style). But I do not how to get the "HomePage" from project ( code about it is commented). The second is the Stripes plugin (http://code.google.com/p/stripes4netbeans/). Small ...

Maven support in NetBeans 6.7 m2 ...en

NetBeans has released the second milestone product some days ago. There are many articles on PlanetNetBeans( http://www.planetnetbeans.org ) which were talking about the newest features NetBeans 6.7 will bring. Maven support is a highlight feature of them. Many peoples have praised the Maven support in NetBeans 6.7. I am a maven fan, but after I tried it, I was disappointed. Maven support is an incomplete work now. As described on NetBeans wiki, it supports JEE and Java Web project creation now. I found this functionality is only a short-circuit of the normal "Maven Project". In the second step of the wizard, it only provide a extra Java EE version option. In my idea, it must support: target server selection, project relation (parent Maven module and child Maven module) settings and web framework configuration. For "Web project", ideally, in the project definition panel , it must provide a "Add to existed Enterprise Application" option to add current ma...