Background

In implementation of ESB services, there is a recurring pattern of RequestCommand boilerplate and Provider.  This project uses java generic facility to help implement such a pattern so that code duplication is reduced.


Design Artifacts

RequestCommandsProvidersOperations

GenericCrudRequestCommand<M extends ActionableEnterpriseObject, Q extends XmlEnterpriseObject, P extends CrudProvider<M, Q>>

CrudProvider,AbstractCrudProvider,ExampleCrudProviderQuery, Create, Update, Delete

GenericGenerateRequestCommand<M extends ActionableEnterpriseObject, R extends XmlEnterpriseObject, P extends GenerateProvider<M, R>>

GenerateProvider,AbstractGenerateProvider,ExampleGenerateProviderGenerate (only)

GenericCompleteRequestCommand<M extends ActionableEnterpriseObject, Q extends XmlEnterpriseObject, R extends XmlEnterpriseObject, P extends CompleteProvider<M, Q, R>>

CompleteProvider,CompleteGenerateProvider,CompleteGenerateProviderQuery, Create, Update, Delete, Generate

M: message Object

Q: querySpecification Object

R: requisition Oject


Example: edu.emory.ProviderDemoService

//TestmoaGenericCompleteRequestCommand.java

package edu.emory.testmoa.service;


import org.openeai.config.CommandConfig;

import org.openeai.jms.consumer.commands.GenericCompleteRequestCommand;

import org.openeai.jms.consumer.commands.RequestCommand;


import edu.emory.moa.jmsobjects.examples.v1_0.TestSimpleMoa;

import edu.emory.moa.objects.resources.v1_0.TestSimpleMoaQuerySpecification;

import edu.emory.moa.objects.resources.v1_0.TestSimpleMoaRequisition;


public class TestmoaGenericCompleteRequestCommand extends

        GenericCompleteRequestCommand<TestSimpleMoa, TestSimpleMoaQuerySpecification, TestSimpleMoaRequisition, TestMoaCompleteProvider>

        implements RequestCommand {

    public TestmoaGenericCompleteRequestCommand(CommandConfig cConfig) throws InstantiationException {

        super(cConfig);

    }

}


//TestMoaCompleteProvider.java

package edu.emory.testmoa.service;


import org.openeai.jms.consumer.commands.provider.ExampleCompleteProvider;

import edu.emory.moa.jmsobjects.examples.v1_0.TestSimpleMoa;

import edu.emory.moa.objects.resources.v1_0.TestSimpleMoaQuerySpecification;

import edu.emory.moa.objects.resources.v1_0.TestSimpleMoaRequisition;

public class TestMoaCompleteProvider

        extends ExampleCompleteProvider<TestSimpleMoa, TestSimpleMoaQuerySpecification, TestSimpleMoaRequisition> {}