Maven plugins for Glassfish ecosystem

GlassfishThis post is only a snapshot of what is available at the time of writing to use Glassfish from maven., seen from the perspective of a simple maven plugin developer (simple plugin or simple developer ?).

Before beginning asadmin-maven-plugin, I searched and tried several ways to use Glassfish from maven. Main use case is simply deployment and undeployment of applications.

There are two ways to do this “programmatically” :

  • using the asadmin command, Glassfish specific,
  • and using the JSR-88 api, app-server agnostic

Continue reading “Maven plugins for Glassfish ecosystem”

A repository for asadmin-maven-plugin

GlassfishTo ease the use of asadmin-maven-plugin I have set up a public repository that you can add to your maven settings / poms / proxies for maven to be able to download the plugin automagically.

The repositories are :

Here is the xml snippet you could add to your pom.xml file :

    <pluginRepositories>
        <pluginRepository>
            <id>asadmin-maven-plugin-releases-repository</id>
            <name>asadmin-maven-plugin-releases-repository</name>
            <url>http://asadmin-maven-plugin.googlecode.com/svn/trunk/repository/releases</url>
            <releases><enabled>true</enabled></releases>
            <snapshots><enabled>false</enabled></snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>asadmin-maven-plugin-snapshots-repository</id>
            <name>asadmin-maven-plugin-snapshots-repository</name>
            <url>http://asadmin-maven-plugin.googlecode.com/svn/trunk/repository/snapshots</url>
            <releases><enabled>false</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
    </pluginRepositories>

Plus, if you browse the source tree you’ll find two exemple projects, a WAR and an EAR, that use this plugin.

A simple maven plugin for Glassfish: asadmin-maven-plugin

GlassfishTo seamlessly use Glassfish from maven projects, JSR-88 seems to be answer. The cargo maven plugin has JSR-88 support planned but this will take time.

I published some days ago a maven plugin that simply wraps the asadmin command and aims to provide maven integration for starting, stopping glassfish and deploying and undeploying applications and modules.

Go to the Google Code page of asadmin-maven-plugin to download a preview version named asadmin-maven-plugin-0.1-SNAPSHOT : http://code.google.com/p/asadmin-maven-plugin/

The api is designed for easy extensibility so feel free to submit contributions !
Continue reading “A simple maven plugin for Glassfish: asadmin-maven-plugin”

A simple^W dumb Map wrapper to use with JAXB

Java XML

I sometimes need to use java.util.Map objects in WebServices. As I’m building all my WebServices with the JAX-WS RI (using the Metro bundle). The block responsible for XML (un)marshalling of POJO, named JAXB, does not allows to directly use Maps as a soap operation parameter. For this purpose I’ve written the following simple class that allows me to wrap Maps in a POJO that JAXB is able to (un)marshall :

public class JAXBMapWrapper<KT, VT> {

    private Map<KT, VT> wrappedMap;

    public JAXBMapWrapper() {
        wrappedMap = new HashMap<KT, VT>();
    }

    public Map<KT, VT> getWrappedMap() {
        return wrappedMap;
    }

    public void setWrappedMap(final Map<KT, VT> givenMap) {
        wrappedMap = givenMap;
    }

}

ATTENTION: I posted this some days ago and removed the post after understanding that this is simpler on the service side but that the client side gets cumbersome generated classes.. but google cache indexed the post in less than half a day.

Just don’t use this ! :) If you need to transmit Maps over JAX-WS webservices, do it the XmlAdapter way as advertised in the official Unofficial JAXB Guide instead.

Could it be dared to say that java is overdesigned ?

JavaJava 7 is coming. And it’s an awesome project ! Now that java is distributed under the GPL, developers can believe that the JSR way of doing things will be more and more pragmatic.

The title of this post is a little bit coarse but this is the feeling java gives to developpers who “learn and use java to create and run programs that make devices and internet useful for people“.

I just read some articles about jdk7 changes that I want to share :

About the new framework for fork-join style parallel decomposition and the ParallelArray class in java.util.concurrent :

About the first attempt to give packages and visibility modifiers a lift :

The first ones are really exciting ! The one about the superpackages scares me a little. I know it’s the first “public” communication about it but I sincerely hope that the final solution will be presented with successfull examples of complex implementations, ie. will be pragmatic.