Child pages
  • OpenEAI Generic RequestCommand and Provider

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

Implementation is in package org.openeai.jms.consumer.commands, part of openeai.jar

RequestCommandsProvidersOperationsRequired Objects

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

CrudProvider,AbstractCrudProvider,ExampleCrudProviderQuery, Create, Update, DeleteM,Q

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

GenerateProvider,AbstractGenerateProvider,ExampleGenerateProviderGenerate (only)M,R

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

CompleteProvider,AbstractCompleteProvider,ExampleCompleteProviderQuery, Create, Update, Delete, GenerateM,Q,R

M: message Object

Q: querySpecification Object

R: requisition Object (for Generate operation)


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> {}