Listing 1

<?xml version="1.0"?>
<project>
<modelVersion>4.0.0</modelVersion>
  <groupId>com.examples.droid</groupId>
  <artifactId>droid</artifactId>
  <packaging>pom</packaging>
  <version>1.0</version>
  <name>droid</name>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.codehaus.xfire</groupId>
        <artifactId>xfire-spring</artifactId>
        <version>1.2.4</version>
      </dependency>
      <dependency>
        <groupId>com.examples.droid</groupId>
        <artifactId>droid-core</artifactId>
        <version>${project.version}</version>
      </dependency>
      ...
    </dependencies>
  </dependencyManagement>
  <modules>
    <module>droid-core</module>
    <module>droid-dao-provisioning</module>
    <module>droid-ws-provisioning</module>
  </modules>
  <build>
    <plugins>
     ...
    </plugins>
  </build>
</project>

Listing 2

<?xml version="1.0"?>
<project>
  <parent>
    <groupId>com.examples.droid</groupId>
    <artifactId>droid</artifactId>
    <version>1.0</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.examples.droid</groupId>
  <artifactId>droid-core</artifactId>
  <packaging>jar</packaging>
  <name>droid core</name>
  <dependencies>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
    </dependency>
      ... ... ...
  </dependencies>
</project>

Listing 3

      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <executions>
            <execution>
              <id>generate-hibernate-source</id>
              <phase>generate-sources</phase>
              <configuration>
                <tasks>

                  <!-- Enable the HibernateToolTask -->
                  <taskdef name="hibernatetool"
				  classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="maven.compile.classpath"/>
     <!-- Generate XML metadata mapping files from database schema -->
                  <hibernatetool>
			...
                  </hibernatetool>

                </tasks>
              </configuration>
              <goals>
                <goal>run</goal>
              </goals>
            </execution>
          </executions>
      </plugin>

Listing 4

  <bean id="provisioningDaoImpl" class="com.examples.droid.dao.provisioning.ProvisioningDaoImpl">
    <property name="sessionFactory" ref="provisioningSessionFactory"/>
  </bean>

  <bean id="provisioningSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="provisioningDataSource"/>
    <property name="mappingResources">
      <list>
       <value>com/examples/droid/dao/provisioning/Android.hbm.xml</value>
      </list>
    </property>
    <property name="hibernateProperties">
      <props>
        <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
        <prop key="hibernate.hbm2ddl.auto">create</prop>
      </props>
    </property>
  </bean>

Listing 5

<execution>
  <id>generate-wsdl-types</id>
  <phase>generate-sources</phase>
  <configuration>
  <tasks>
    <!-- generate and compile types from our schema --> 
    <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean"
	 classpathref="maven.compile.classpath"/>
     <xmlbean
       classgendir="${project.build.directory}/classes"
	    srcgendir="${project.build.directory}/generated-source"
		classpathref="maven.compile.classpath"
		failonerror="true"
		javasource="1.5">
       <fileset dir="src/wsdl" includes="*.wsdl"/>
     </xmlbean>
    <!-- generate our service client, interface, and impl class -->
    <!-  using XFire's web service generation task              -->
    <wsgen outputDirectory="${project.build.directory}/generated-source"
	       wsdl="${basedir}/src/wsdl/${project.artifactId}.wsdl"
		   package="${project.groupId}"
		   generateServerStubs="true"
		   binding="xmlbeans"/>
              </tasks>
              <sourceRoot>${project.build.directory}/generated-source</sourceRoot>
  </configuration>
</execution>

Listing 6

Public class ProvisioningServiceImpl implements ProvisioningServicePort {

  private CoreService coreService;
  private ProvisioningDao provisioningDao;

  public FindDroidResponseDocument findDroid(FindDroidDocument findDroidRequest) {
    FindDroidResponseDocument document = FindDroidResponseDocument.Factory.newInstance();
    // Calling the core service to execute some functionality
    getCoreService().doSomething("do something");
    // Use the data access service and call the method findDroid()
    // to find our droid
    Android android = getProvisioningDao().findDroid(findDroidRequest.getFindDroid().getDroidId());
    FindDroidResponse response = document.addNewFindDroidResponse();
    response.setIsError(false);
    DroidInfo droidInfo = response.addNewDroidInfo();
    // in essence this is our mapping of domain objects (Android) to
    // our message objects (DroidInfo). Never expose your domain
    // objects to the outside world.
    droidInfo.setName(android.getName());
    response.setDroidInfo(droidInfo);
    return document;
  }

  getters() and setters() for the two injected services...
}