Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Summary

This page details an application that is comprised of multiple maven projects.  It will detail the overall maven project structure, the way the code is structured and webservice ports I have exposed

A web services can transmit any type of text structure but JSON is the most common.  The jackson api can be used to marshal data to and from the wire.  Rather then manipulating strings to and from json format directly, I have created Java classes that have the attributes on them that I want to transmit across the wire.  For example all responses from the server should be in json form so I have created the following class

Sample
package com.celestial.util.objects;

/**
 *
 * @author Selvyn
 */
public class SimpleErrorMessage
{
    private String  message;
    
    public  SimpleErrorMessage( String msg )
    {
        message = msg;
    }
    
    public  String  getMessage()
    {
        return message;
    }
    
    public  void    setMessage( String msg )
    {
        message = msg;
    }
}

When transmitted the result will be marshalled as {"message":"some value"}.

Objects such as these that are marshalled between different service points (clients or servers) have been placed in a maven project called DBankBusinessObjects.  All other projects are dependent on this project.  This project must be compiled and installed into your local maven repo so that dependent projects can locate the build artifact (mvn install).

Maven project hierarchy

Top maven project is a maven module project bringing together the service layer and reusable java artifact - DBankAppllicationRoot

DBankBusinessObjects maven project contains objects that will be marshalled between service points

DBankDBTier_ws_exp maven project (_exp implies exposed) is the service layer that exposes services to the database.  The example code has a rest api to create, find, and update users in the users table

Exposing the services

The next section outlines the way I ahve exposed the services using the jersey api.

  • No labels