venerdì 29 aprile 2011

Installing m2eclipse in Eclipse 3.6 (Helios) with the Eclipse Marketplace

The Eclipse Marketplace makes it easy to install m2eclipse and m2eclipse (Extras) in Eclipse 3.6 (Helios). To open the Eclipse Marketplace, go to the Eclipse Help menu and select Eclipse Marketplace... as shown in Figure 2.1, “Opening the Eclipse Marketplace”.
Opening the Eclipse Marketplace
Figure 2.1. Opening the Eclipse Marketplace

The first time you open the Eclipse Marketplace, you will be asked to select a Marketplace. Select the Eclipse Marketplace as shown in Figure 2.2, “Selecting the Eclipse Marketplace”.
Selecting the Eclipse Marketplace
Figure 2.2. Selecting the Eclipse Marketplace

2.2.1. Installing Maven Integration for Eclipse (Core)

Maven Integration for Eclipse is separated into two components: the Core of Maven Integration for Eclipse and an optional package of extra, unsupported components. To install the core component of Maven Integration for Eclipse, open the Eclipse Marketplace, select the Search tab, and search for "Maven Integration" as shown in Figure 2.3, “Selecting Maven Integration for Eclipse from Eclipse Marketplace”. Click on the Install button to the right of the second item listed in Figure 2.3, “Selecting Maven Integration for Eclipse from Eclipse Marketplace”.
Selecting Maven Integration for Eclipse from Eclipse Marketplace
Figure 2.3. Selecting Maven Integration for Eclipse from Eclipse Marketplace

Once you click on Install, Eclipse will download a list of available components from the remote update site and present you with a list of available features in the Maven Integration for Eclipse plugin as shown in Figure 2.4, “Selecting the Core m2eclipse Feature for Installation”. Select the single, required component named "Maven Integration for Eclipse (Required)", and click on the Finish button.
Selecting the Core m2eclipse Feature for Installation
Figure 2.4. Selecting the Core m2eclipse Feature for Installation

Eclipse will then ask you to agree to the licenses for Maven Integration for Eclipse in the Review Licenses step shown in Figure 2.5, “Agreeing to Software License During m2eclipse Installation”. Maven Integration for Eclipse is distributed under the Eclipse Public License version 1.0. If you agree with the conditions of this license, select "I accept the terms of the license agreement" and click on the Finish button.
Agreeing to Software License During m2eclipse Installation
Figure 2.5. Agreeing to Software License During m2eclipse Installation

During the installation process, Eclipse may warn you that the software you are installing contains "unsigned content". If you see the dialog shown in Figure 2.6, “Ignoring Warning During m2eclipse Installation”, click on OK to continue the installation process.
Ignoring Warning During m2eclipse Installation
Figure 2.6. Ignoring Warning During m2eclipse Installation

Once m2eclipse has been installed, Eclipse will prompt you to either restart or apply changes to a running Eclipse. At this stage of the installation, you should click on Restart Now to restart your Eclipse instance. After a successful restart, Maven Integration for Eclipse will be installed.
Restarting Eclipse after m2eclipse Installation
Figure 2.7. Restarting Eclipse after m2eclipse Installation

2.2.2. Installing Maven Integration for Eclipse (Extras) Prerequisites

The Maven Integration for Eclipse extra components provide support for additional tools like the Web Tools Project (WTP), Subversion integration via Subclipse, and integration with Mylyn. The following sections provide guidance for users installing some of the prerequisites for m2eclipse extra components.

2.2.2.1. Installing Subclipse in the Eclipse Marketplace

To install Subclipse in the Eclipse Marketplace, open the Marketplace, select the Search tab, and search for "Subclipse" to see the dialog shown in Figure 2.8, “Selecting Subclipse from the Eclipse Marketplace”. Click on Install next to the Subclipse search result item.
Selecting Subclipse from the Eclipse Marketplace
Figure 2.8. Selecting Subclipse from the Eclipse Marketplace

Select the appropriate Subclipse components, agree to the software license for Subclipse, and restart your Eclipse installation after the installation process is completed.

2.2.2.2. Installing Mylyn in the Eclipse Marketplace

To install Mylyn in the Eclipse Marketplace, open the Marketplace, select the Search tab, and search for "Mylyn" to see the dialog shown in Figure 2.9, “Selecting Mylyn from the Eclipse Marketplace”. Click on Install next to the Mylyn search result item.
Selecting Mylyn from the Eclipse Marketplace
Figure 2.9. Selecting Mylyn from the Eclipse Marketplace

Select the appropriate SMylyn components, agree to the software license for Mylyn, and restart you Eclipse installation after the installation process is completed.

2.2.3. Installing Maven Integration for Eclipse (Extras)

To install the extra components for Maven Integration for Eclipse, open the Eclipse Marketplace, select the Search tab, and search for Maven Integration to see the search results shown in Figure 2.10, “Selecting Maven Integration for Eclipse (Extras) from the Eclipse Marketplace”. CLick on Install next to the "Maven Integration for Eclipse (Extras)" search result item.
Selecting Maven Integration for Eclipse (Extras) from the Eclipse Marketplace
Figure 2.10. Selecting Maven Integration for Eclipse (Extras) from the Eclipse Marketplace

Once you have clicked on Install, Eclipse will download the list of available plugin components from the remote update site. The list of available components will then be displayed in the Confirm Select Features step as shown in Figure 2.11, “Selecting m2eclipse (Extras) Components to Install”. The components available in the Maven Integration for Eclipse (Extras) site are:

M2Eclipse Extensions Development Suppport (Optional)
Install this component if you want to develop custom pages in the POM Editor, create custom actions in the Maven popup menu, provide custom templates in the POM XML editor, or make other customizations to m2eclipse.
Maven Integration for WTP (Optional)
If you are developing applications using the Eclipse Web Tools Project, this component will adapt the Maven classpath container and other Maven resources to the WTP standards.
Maven issue tracking configurator for Mylyn 3.x (Optional)
Maven can be configured to work with Mylyn a comprehensive issue and time tracking plugin which currently ships with the Eclipse IDE.
Maven SCM handler for Subclipse (Optional)
Subclipse is a popular Subversion plugin for Eclipse hosted by the Tigris community. If you want to use Maven with Subclipse, this component will provide the necessary integration between the two plugins.
Maven SCM handler for Team/CVS (Optional)
This component provides integration between the m2eclipse plugin and the CVS support built into Eclipse.
Maven SCM Integration (Optional)
This component is required if you installed one of the previous plugins (Subclipse or Team/CVS)
Project configurators for commonly used maven plugins (temporary)
This is a temporary project which contains project configurators for commonly used Maven Plugins.
Selecting m2eclipse (Extras) Components to Install
Figure 2.11. Selecting m2eclipse (Extras) Components to Install

Once you have selected the features you wish to install, click Next. Clicking Next will bring you to the Review Licenses step as shown in Figure 2.12, “Agreeing to Software License During m2eclipse (Extras) Installation”. The m2eclipse Extras is distributed under the Eclipse Public License version 1.0. If you agree to this open source license, select "I accept the terms of the license agreement" and click on "Finish".
Agreeing to Software License During m2eclipse (Extras) Installation
Figure 2.12. Agreeing to Software License During m2eclipse (Extras) Installation

During the installation process for the m2eclipse Extras, you may receive some warning that "you are installing software that contains unsigned content". If you see the dialog shown in Figure 2.13, “Ignoring Warning During m2eclipse (Extras) Installation”, click OK to continue the installation process.
Ignoring Warning During m2eclipse (Extras) Installation
Figure 2.13. Ignoring Warning During m2eclipse (Extras) Installation

Once the installation process is finished, Eclipse will prompt you to apply the changes or restart your Eclipse instance with a dialog shown in Figure 2.14, “Restarting Eclipse after m2eclipse (Extras) Installation”. To complete the installation of m2eclipse (Extras), restart your Eclipse instance.
Restarting Eclipse after m2eclipse (Extras) Installation
Figure 2.14. Restarting Eclipse after m2eclipse (Extras) Installation

giovedì 21 aprile 2011

Use Jetty to run Maven web applications in NetBeans

Jetty is a great web server. It is fast to start up and that makes it very useful during development. Jetty has a Maven plugin we can use in our Maven web application project. This way we can use Jetty to test our JSP files. We can change the JSP file and hit the Refresh button of our browser to see the result immediately. We can even compile a Java class file and Jetty will restart so we can test the result in our browser.
Let's see how we can do this in NetBeans. We go to File | New Project, select Maven Project and click the Next button.
In the next dialog window we select Maven Webapp Archetype and click the Next button.
Now we can fill in the values for our project and press the Finish button.
NetBeans creates a new project for us. To add Jetty Maven plugin we must open the pom.xml file for our project. In the build section we must add the following code:

 
  org.mortbay.jetty
  maven-jetty-plugin
  6.1.14
  
   5
  
 
At line 6 we define how often Jetty will scan the source directories to look for changes. Because we add this definition we can change JSP files and see the result in our web browser without restarting the server.
Okay, we have defined Jetty for our project, but how can we run Jetty in NetBeans? We go to File | Project Properties and select the Actions category. We must look for the action Run project and select it. In the Execute goals field we add jetty:run. This will start Jetty if we run our project. We can close the dialog window.
Now we go to Run | Run Project to start Jetty. In the Output window of NetBeans we see the following text:
Starting jetty 6.1.14 ...
2009-02-11 10:20:20.610::INFO:  jetty-6.1.14
2009-02-11 10:20:20.982::INFO:  No Transaction manager found - if your webapp requires one, please configure one.
2009-02-11 10:20:21.335::INFO:  Started SelectChannelConnector@0.0.0.0:8080
Started Jetty Server
Starting scanner at interval of 5 seconds.
At line 3 we see Started SelectChannelConnector@0.0.0.0:8080 this means Jetty is available at port 8080. We open a web browser and open http://localhost:8080/webappjetty/ and we see the following:
We go back to NetBeans and open the file index.jsp. We add the following to the file:

It works!

We switch back to our web browser and reload the page and we get:

mercoledì 20 aprile 2011

DataNucleus AccessPlatform 3.0





The DataNucleus AccessPlatform provides persistence and retrieval of data to a range of datastores using a range of APIs, with a range of query languages. Software for persistence typically only caters for one type of datastore, or one API. DataNucleus is unique in that it supports all standardised persistence APIs for a very wide range of datastores . DataNucleus is the only persistence software certified JDO compliant. DataNucleus is continually innovating and pushing capabilities forward, as well as continually pushing forward the JDO spec. DataNucleus gives you the power to swap persistence API, and datastore when you want to. In fact it allows JPA mapping data to be used with JDO persistence, and vice versa - another unique feature of DataNucleus. Time to take advantage of this power ...


DataNucleus - Tutorial for JDO
An application can be JDO-enabled via many routes depending on the development process of the project in question. For example the project could use Eclipse as the IDE for developing classes. In that case the project would typically use the DataNucleus Eclipse plugin. Alternatively the project could use Ant, Maven or some other build tool. In this case this tutorial should be used as a guiding way for using DataNucleus in the application. The JDO process is quite straightforward.
  1. Step 0 : Download DataNucleus AccessPlatform
  2. Step 1 : Design your domain/model classes as you would do normally
  3. Step 2 : Define their persistence definition using Meta-Data.
  4. Step 3 : Compile your classes, and instrument them (using the DataNucleus enhancer).
  5. Step 4 : Generate the database tables where your classes are to be persisted.
  6. Step 5 : Write your code to persist your objects within the DAO layer.
  7. Step 6 : Run your application.
  8. Step 7 : Things to add.
The tutorial guides you through this. You can obtain the code referenced in this tutorial from SourceForge (one of the files entitled "datanucleus-samples-tutorial-*").

Parancoe 3 web framework

Parancoe is a project aiming to simplify the release of web applications promoting the convention over configuration philosophy and the DRY principle. This project is promoted by the JUG Padova, and everybody can partecipate.
Parancoe is a Java meta-framework aggregating in an useful way Hibernate/JPA, Spring 2, Spring MVC and, for the AJAX support, DWR.
Parancoe purpose is to give to developers a set of libraries ready to build standard web applications (which in most cases are just crud applications) without worrying of long and harmful configurations files. Parancoe will be composed of a full MVC stack.
Parancoe is open source and is released under the Apache License, Version 2.0.
Are you interested in the parancoe word meaning? A “parancoa” is a scaffolding in the dialect of the Venice (Italy) area.

Lot of time I don’t post something…
But the development of Parancoe is not death. I’m working at the next major release: Parancoe 3.0!
Some of the changes:
  • The persistence (generic DAOs) has its own independent project now: Lambico. It’s more evolved and robust.
  • Parancoe now uses Spring 3.0, with it latest evolution and improvements.
  • The suggested style for developing the controllers is the REST one.
  • The validation is JSR 303 – Bean Validation (according to Spring MVC 3.0).
  • We have a new subproject called Parancoe – Validation, for introducing some useful validator, ready for use. (what about a “new password” validator?)
You can start trying Parancoe 3 using the snapshots: Parancoe artifacts are already in our Maven snapshot repository.
For starting a new project based on Parancoe 3, use the “Parancoe Advanced Archetype”, typing the following command:

mvn -DarchetypeGroupId=org.parancoe \
    -DarchetypeArtifactId=parancoe-advancedarchetype \
    -DarchetypeVersion=3.0-SNAPSHOT \
    -DarchetypeRepository=https://oss.sonatype.org/content/repositories/snapshots \
    -Darchetype.repository=https://oss.sonatype.org/content/repositories/snapshots \
    -Darchetype.interactive=false \
    -DgroupId=org.myorg \
    -DartifactId=myapp \
    -Dpackage=org.myorg.padt \
    -Dversion=1.0-SNAPSHOT \
    --batch-mode \
    --update-snapshots \
    org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate


project page: http://www.parancoe.org/