Spring Integration

Case Study Worksheet

Design Problem

Problem Statement:

Design feed processing framework which

  • Should be able to receive files from various external systems through different mechanisms like FTP, JMS, HTTP. There may be more external systems in future.
  • Process the files of different file structures (including any transformations if needed)
  • Send the file to external system for further processing or persist the file in some storage system, based on input file type.

Solutions features

  • Design should include high level architecture, data/object models, high level interfaces/classes.
  • System should be scalable, fault tolerant
  • System should support failure scenarios

Sample Input File-1

 

Coding Problem

Problem Statement:

  1. A Service in JAVA which returns the information about files in a specific directory. The service should provide 2 methods:
  • Method 1: Given a full path to a directory as a parameter, return an XML\JSON that contains description of all the files and directories (recursively) under the one given as the parameter. The description must include a full path, size and a flag if the entry is a directory or a file.
  • Method 2: Given a full path to a file as a parameter, return an XML\JSON that contains a full description of that file . The description must include a full path and all of the attributes available in the JDK 6 for a file object (e.g. read, write, execute, etc).

 

  1. A web based application which calls both methods and displays results. These methods should be exposed as REST api which can be called directly from a browser.

Additional requirements:

  • Project must have a minimal design specification document that explains main decisions made and abstractions used. Class diagram is required in the design.
  • Code must be written as if it is a production application with all necessary error checking, logging and corresponding code quality and OOD considerations;
  • JavaDocs must be used for documentation for all public APIs. The generated JavaDoc must be enough to understand APIs and how one would use them;
  • Unit tests must be written for all public APIs.
  • The project must be IDE agnostic, meaning that the person who gets the project would not need any particular IDE installed to compile and run. Because of this requirement the project must have either Maven or Ant build file;
  • There must be a document that describes deployment procedures, it is highly desirable that deployment execution would be available as the Maven targets or Ant tasks.
  • You should use Spring MVC framework to implement transport layer of your project (request/response layer, etc.) —

Technical View

Component View

Class Diagram : – Publisher/Subscriber

Class Diagram FTP/File System:

Class Diagram – File Processing:-

Class Diagram – Database System:-

Error Condition

Timeout Handling

How timeout settings apply to an HTTP Inbound Gateway

For outbound endpoints, the second thing to consider is timing while interacting with the remote server.

 

Sample Code for distribution :-

FileProcessor

For complete set of example please contact prshankar@outlook.com