Enterprise Information Architecture for the dissemination of Geothermal Data
Abstract
English: This thesis enables an information system for the dissemination of Geothermal Data by using Enterprise Integration Patterns in an Event Driven Service Oriented Architecture and gives details about the architecture, design and implementation of the system, the technologies and concepts used.
Full text
Enterprise Information Architecture for the dissemination of Geothermal Data Anshuman Mehta Barcelona School of Informatics Universitat Polit´ecnica de Catalunya A thesis submitted for the degree of Master in Information Technology 2011 September
Abstract Information systems in an organization are usually developed in silos and remain usable only within a certain part of the organization. One of the challenges of Service Oriented Architecture is to develop information systems with reusable components and services which are then composed to enable new services. This thesis enables an information system for the dissemination of Geothermal Data by using Enterprise Integration Patterns in an Event Driven Service Oriented Architecture. The system developed with this architecture is loosely coupled and is highly scalable and flexible. This thesis gives details about the architecture, design and implementation of the system and the underlying technologies and concepts used to develop the system.
To my wife for her consistent help and guidance, my parents and sister for their continuous support and encouragement.
Acknowledgements I am grateful to Fabian Moerchen for providing me an opportunity to research in Siemens Corporate Research and the freedom provided to work and develop on the thesis. I am indebted to Phillip Hussels for his constant guidance and technical discussions which strengthened the thesis. I would also like to thank the software development team in the GTDA project project at SCR for their valuable contributions to the project. I would like to thank Toni Urpi for his guidance, Gemma Sese for her continuous support at UPC and Xavier Franch and other professors at UPC. I would also like to thank the Unitech International Organization for the opportunity to undertake this internship under their banner and for the delightful academic experience at ETH. My special thanks go to my wife Indu for her understanding and love during the past few years. Her support and encouragement was in the end what made this dissertation possible. My parents, Om Prakash and Sunita, receive my deepest gratitude and love for their dedication and the many years of support during my studies. I would also like to thank my sister, Shaifali, for her knocks of guidance, support and love over all these years.
Contents Glossary vii 1 Introduction 1 1.1 Motivation .................................. 1 1.2 TheThesis .................................. 2 1.3 Contributions................................. 2 1.4 Layout of the Document . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 Background 5 2.1 Service Oriented Architecture . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1.1 Enterprise Service Bus . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1.2 REST ................................. 6 2.2 Enterprise Integration Patterns . . . . . . . . . . . . . . . . . . . . . . . 6 2.2.1 Message................................ 6 2.2.2 MessageChannel........................... 6 2.2.3 MessageEndpoints.......................... 8 2.2.4 Message Translator . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2.5 Filter ................................. 8 2.2.6 ContentEnricher........................... 9 2.2.7 Router................................. 9 2.2.8 Splitter ................................ 10 2.2.9 Aggregator .............................. 10 2.2.10ServiceActivator........................... 10 2.2.11ChannelAdapter........................... 11 iii
CONTENTS 3 Requirements 13 3.1 Project Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.2 Overview ................................... 13 3.3 UseCases................................... 15 3.4 Automatization................................ 18 4 Architecture and Technology 19 4.1 Architecture.................................. 19 4.2 Services .................................... 20 4.3 TechnologySurvey .............................. 21 4.3.1 DataIntegration ........................... 21 4.3.2 UserInterface............................. 22 4.3.3 Search................................. 24 4.3.4 FileRepository............................ 24 4.3.5 Geospatial WebServices . . . . . . . . . . . . . . . . . . . . . . . 25 4.3.6 Security................................ 25 4.4 Decisions ................................... 26 4.4.1 Spring Integration . . . . . . . . . . . . . . . . . . . . . . . . . . 26 4.4.2 ExtJS ................................. 26 4.4.3 Solr .................................. 27 4.4.4 Custom VitualFileSystem Implementation . . . . . . . . . . . . . 27 4.4.5 Geoportal and GeoServer . . . . . . . . . . . . . . . . . . . . . . 27 4.4.6 Shiro.................................. 27 4.4.7 Spring Batch and Spring Batch Admin . . . . . . . . . . . . . . . 27 4.4.8 PostgreSQL and PostGIS . . . . . . . . . . . . . . . . . . . . . . 28 5 Design 29 5.1 Design..................................... 29 5.1.1 Application............................... 29 5.1.2 Publication Pipeline. . . . . . . . . . . . . . . . . . . . . . . . . . 30 5.1.3 ETL................................... 31 5.2 Modules.................................... 33 5.2.1 Persistence .............................. 34 5.2.2 FileSystem.............................. 35 iv
CONTENTS 5.2.3 FileDetection............................. 35 5.2.4 Integration .............................. 37 5.2.5 Server................................. 37 5.2.6 ETLServices............................. 38 5.2.7 ETLBatchAdmin.......................... 38 5.2.8 Security................................ 38 5.2.9 Workflow ............................... 39 5.2.10Geoportal............................... 39 5.2.11Solr .................................. 39 5.3 PackagingofModules ............................ 40 5.4 Database ................................... 40 5.4.1 FileSystem............................... 40 5.4.2 Integration............................... 41 5.4.3 Core. ................................. 42 5.4.4 Staging................................. 44 5.4.5 GtdaBatch............................... 44 5.4.6 Geoportal................................ 45 5.4.7 Security................................. 46 5.4.8 workflow................................ 46 5.5 Decisions ................................... 47 5.5.1 UUID.................................. 47 5.5.2 Integration Wrapper Services. . . . . . . . . . . . . . . . . . . . . 47 5.5.3 Channels................................ 47 5.5.4 Transaction Boundary. . . . . . . . . . . . . . . . . . . . . . . . . 48 5.5.5 Persistence Units. . . . . . . . . . . . . . . . . . . . . . . . . . . 48 6 Implementation 49 6.1 TheChainPattern.............................. 49 6.2 Integration of Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 6.2.1 UploadaFile............................. 50 6.2.2 Fetch Uploaded files . . . . . . . . . . . . . . . . . . . . . . . . . 51 6.2.3 Split the List of Messages and Filter Detected and Undetected Files.................................. 52 v
CONTENTS 6.2.4 Transform the message . . . . . . . . . . . . . . . . . . . . . . . . 54 6.2.5 Route the Messages to the approprite Services . . . . . . . . . . 54 6.2.6 ServiceActivators . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 6.2.6.1 File Detection . . . . . . . . . . . . . . . . . . . . . . . 56 6.2.6.2 Validate Publications . . . . . . . . . . . . . . . . . . . 58 6.2.6.3 Load Bibliography . . . . . . . . . . . . . . . . . . . . . 59 6.2.6.4 SOLR Publisher . . . . . . . . . . . . . . . . . . . . . . 61 6.2.6.5 GEOPORTAL Publisher . . . . . . . . . . . . . . . . . 62 6.3 Security .................................... 64 6.4 ETLBatchAdmin .............................. 67 7 Evaluation 69 7.1 Environment ................................. 69 7.2 Degree of Loose Coupling . . . . . . . . . . . . . . . . . . . . . . . . . . 70 7.3 Throughput.................................. 73 7.4 DegreeofReusability............................. 75 7.5 DevelopmentEffort.............................. 75 7.6 Discussion................................... 77 8 Conclusions 79 8.1 Conclusions.................................. 79 8.2 FutureWork ................................. 80 9 Appendix 81 9.1 Plan ...................................... 81 9.1.1 Initialplan .............................. 81 9.1.2 Development plan . . . . . . . . . . . . . . . . . . . . . . . . . . 81 9.1.3 Variance................................ 84 9.2 UserScreens ................................. 84 List of Figures 93 List of Tables 95 References 97 vi
Glossary API Application Programming Interface CSW Catalog Service for the Web DAO Data Access Object DOE Department of Energy DSL Domain Specific Language EAI Enterprise Application Integration EDA Event Driven Architecture EIP Enterprise Integration Patterns ESB Enterprise Service Bus FTP File Transfer Protocol GTDA Geothermal Data Aggregation HTTP HyperText Transfer Protocol IDE Integrated Development Environment J2EE Java Platform Enterprise Edition JCR Java Content Repository JDBC Java Database Connectivity JMS Java Messaging Service JNDI Java Naming and Directory Interface JPA Java Persistence API JS Java Script JSON JavaScript Object Notation LDAP Lighweight Directory Access Protocol MAVEN Software Project Management and Comprehension Tool NGDS National Geothermal Data System RAD Rapid Application Development REST Representational State Transfer RIA Rich Internet Applications SAML Security Assertion Markup Language SDS Software Design Specification SOA Service Oriented Architecture SpEL Spring Expression Language SRS Software Requirement Specification SSO Single Sign On UI User Interface URI Universal Resource Identifier WFS Web Feature Service XML Extensible Markup Language vii
2. BACKGROUND 2.1.2 REST REST. or Representational State Transfer is an architectural style for building loosely coupled systems. A RESTful web service is implemented using HTTP and the principles of REST. It is a collection of resources with three defined aspects: 1. The base URI for the Web Service. 2. the Internet Media Type of the data supported by the Web Service (eg. XML, JSON etc.) 3. the set of operations supported by the web service using HTTP methods (e.g. POST, GET, PUT or DELETE) REST and JSON are gaining popularity in today’s web-based platforms and applications[1]. 2.2 Enterprise Integration Patterns Enterprise Integration Patterns.1are a collection of 65 integration patterns described in Enterprise Integration Patterns[2]. These patterns help solve system and data integration problems to develop robust integration solutions and are relevant in both the SOA and ESB space. We look below at a few patterns that we have incorporated into our application design, which will be useful for understanding the design and implementation of the system. 2.2.1 Message A message consists of headers and a payload. The headers contain data that is relevant to the messaging system, like the return address or correlation ID (which uniquely identifies the message). The payload contains the actual data that is to be accessed or processed by the receiver as shown in figure 2.1. 2.2.2 Message Channel Producers send Messages to a channel and consumers receive messages from a channel as shown in figure 2.2. A message channel can either follow point-to-point or publishsubscribe semantics. 1http://www.enterpriseintegrationpatterns.com/ 6
2.2 Enterprise Integration Patterns Figure 2.1: Message - An eip pattern described at http://www.eaipatterns.com/Message.html Figure 2.2: Message Channel - A pattern described at http://www.eaipatterns.com/MessageChannel.html. 7
2. BACKGROUND 2.2.3 Message Endpoints Figure 2.3: Message Endpoint - A pattern described at http://www.eaipatterns.com/MessageEndpoint.html. Messaging Endpoints are the connections between functional services and the messaging framework. The message endpoints handle messages and are mapped to message channels. 2.2.4 Message Translator Figure 2.4: Transformer - A pattern described at http://www.eaipatterns.com/MessageTranslator.html. A Message Translator or transformer is used to transform the payload of a message from one format to another. It can also be used to add, modify or remove message headers 2.2.5 Filter A Message Filter determines whether a message can be sent to an output channel. It may check for a payload content type, a property value , the presence of a header etc. to determine whether to drop a message or send it to the output channel. 8
2.2 Enterprise Integration Patterns Figure 2.5: Filter - A pattern described at http://www.eaipatterns.com/Filter.html. 2.2.6 Content Enricher Figure 2.6: Header Enricher - A pattern described at http://www.eaipatterns.com/DataEnricher.html. A Content Enricher enhances a message with more information than was provided by the target system. eg. Adding headers to a message. 2.2.7 Router Figure 2.7: Router - A pattern described at http://www.eaipatterns.com/MessageRouter.html. A Message Router determines which channel should receive a channel based on 9
2. BACKGROUND metadata or data in payload or header of the message. 2.2.8 Splitter Figure 2.8: Splitter - A pattern described at http://www.eaipatterns.com/Sequencer.html. A Message Splitter splits a message on its input channel into multiple messages and then sends each of these messages onto its output channel. 2.2.9 Aggregator Figure 2.9: Aggregator - A pattern described at http://www.eaipatterns.com/Aggregator.html. A Message Aggregator receives multiple messages and combines them into a single message. 2.2.10 Service Activator A Service Activator connects a service instance to the messaging system. A message received on the input channel invokes an operation on the service which sends the results to an outbound channel. 10
2.2 Enterprise Integration Patterns Figure 2.10: Service Activator - A pattern described at http://www.eaipatterns.com/MessagingAdapter.html. 2.2.11 Channel Adapter Figure 2.11: Channel Adapter - A pattern described at http://www.eaipatterns.com/ChannelAdapter.html. A Channel Adapter may be inbound or outbound and connects a messaging system to another system or transport (eg. File, http, jms, ftp, jdbc etc.) 11
2. BACKGROUND 12
3 Requirements This chapter gives a brief introduction into the project requirements and elaborates on a few details relevant to the thesis.1 3.1 Project Requirements 3.2 Overview A high level view of the GTDA system is presented in figure 3.1. An overview of the actors and the use cases is provided in the following sections. As mentioned in the introduction 1.2 the scope of this thesis is to help implement the underlying framework for this system in agreement with SOA principles. The use cases and actors then interact with the services exposed by the underlying architectural framework. It is in this context that an automated publication pipeline, introduced in the design chapter in section 5.1.2, incorporates the consumption of services (or automatization of use cases) without the need for external actors when possible. The architecture then provides extension points for hooking in manual interactions with the system as described in later chapters. There were certain external requirements as well such as to make the whole system modular and reusable and we expect changes to the original requirements because the users may better express their needs when they have a working system. 1with inputs from the GTDA Software Requirements Specification.pdf 13
3. REQUIREMENTS Figure 3.1: Context Diagram - The Context of the GTDA application. 14
3.3 Use Cases The GTDA system supports and facilitates the uploading, integration and submission of geothermal data. The system checks the integrity of data and performs quality assurance wherever and whenever possible. For those scenarios where the data cannot be automatically validated then the system will allow the owners of the data to process and analyze the data and perform manual quality assurance. The system also handles the submission of meta-data records into the NGDS system and transmission of geothermal data. In brief the system supports the following feature groups: •Data Input •Data Browsing •Quality Assurance •Data Submission •System Administration 3.3 Use Cases This section provides a very high level view of the actors and use cases of the system. •Actors 1. NGDS performs query and retrieval operation on the GTDA system. 2. System Administrator performs maintenance tasks of the system including administering users, user roles and data. 3. Data Submitter uses the system to input the geothermal data and can view and browse data in the system. 4. Geothermal Analyst uses the system to browse, view and export geothermal data. 5. Data Owner owns the geothermal data input by the Data Submitter and uses the system to analyze and determine the quality of the input data. •Use Cases 15
4. ARCHITECTURE AND TECHNOLOGY Mule[8] is a lightweight Java based ESB and integration platform that can connect to various protocols. Since it is lightweight it is highly scalable. Mule provides orchestration facilities with the Mule Studio[9] which can create flows very quickly. For each flow data is received or send from configured endpoints to components or services as chosen and mediated upon by Mule (eg. routing, transformation etc.). Spring Integration[10] extends the core Spring programming model to support the well-known EIP’s. It enables lightweight messaging within Spring-based applications and supports integration with external systems via declarative adapters. These adapters provide a higher-level of abstraction over Spring’s support for remoting, messaging, and scheduling. Flows are configured using spring configuration files or developed using the integration-graph in SpringSource Tool Suite 1. 4.3.2 User Interface A UI is an important part of an application. In order to support a variety of complex user interactivity and provide a seamless user experience we decided to make the application a Rich Internet Application or RIA. A RIA platform would need to have support for data grids, a rich support of customizable widgets, charts and most importantly an extensible API. Adobe Flex[11] is a very popular UI development platform for RIA’s. It provides a rich API for developing user screens, animations, data grids, maps and charts. Mobile and web applications can be developed using a common code base. However due to performance issues such as slow dynamic rendering of complex UI’s and the unclarity of future support on mobile devices for flex (Android but not iOS) especially with alternatives like HTML5 on the horizaon made us explore other alternatives. Google Web Toolkit[12] or GWT is an emerging open source platform for RIA development. Most of the code is written in Java and then efficiently compiled into JS by the GWT compiler. GWT provides customizable pre-built widgets2. The development environment GWT Designer is plugged into Eclipse, a popular IDE for Java, 1SpringSource Tool Suite at http://www.springsource.com/developer/sts 2http://code.google.com/webtoolkit/doc/latest/RefWidgetGallery.html 22
4.3 Technology Survey and provides tools for Rapid Application Development(RAD). GWT also popularizes the concept of MVP1[13] and adds concepts of Activities and Places[14]. In our evaluation we successfully integrated GWT with Spring back-end services using libraries like gwt-sl2,overriding bean instantiation[15] and various other libraries. We tested the architecture with and without MVP architecture and also with GWT-RPC[16]. GWT integrates with Google Charts3however it requires a user to be online for use4. . The visualization libraries are loaded dynamically and then interact with the data to create the charts. This was against our requirements and there were also a few concerns related to the maturity of the platform especially the frequent updates and releases which made us look at other alternatives of GWT SmartGWT[17] is a GWT based framework and has an extensive, customizable and rich set of widgets5for RIA’s. We evaluated both the LGPL version and commercial version of SmartGWT. The LGPL version requires the developer to create their own Datasource[18] and utilizing their various client-data-integration[19] options, we used RestDataSource[20], adhere to the DSProtocol[21]. The Enterprise version provides a powerful mapping6to SmartGWT’s visual components and the backend and also contains charts. However at the time of our evaluation the charts feature was not yet released which was an important requirement. ExtGWT[22] is a GPLv3 and also commercially licensed GWT based framework and has an extensive set of data grid and visualization charts7components. However at the period of our evaluation the ExtGWT framework was being rehauled to support new GWT 2.x features. ExtJS[23] is available under the GPLv3 and commercial licence. It is a JavaScript based webframework with a MVC8architecture. It has an elaborate set of of data grid 1Model-View-Presenter 2http://code.google.com/p/gwt-sl/ 3http://code.google.com/apis/chart/ 4http://code.google.com/apis/chart/interactive/faq.html#offline 5http://www.smartclient.com/smartgwtee/showcase/ 6http://forums.smartclient.com/showthread.php?t=4839 7http://www.sencha.com/products/extgwt/examples/ 8Model-View-Controller 23
4. ARCHITECTURE AND TECHNOLOGY components, widgets and visually attractive charts 1. These components and widgets can be integrated with server-side code using REST. The ExtJS framework is mature, well maintained with good charting features. 4.3.3 Search The GTDA project requires end-users to have full-text search2capability for documents uploaded into the file repository, within the catalog and also within maps to provide an aggregated result. Apache Lucene [24] is an open-source, high-performance, full-featured text search engine library written entirely in Java. It has a simple API which provides access to its powerful features. Apache Solr [25] is an open-source standalone full-text search server which embeds the Apache Lucene search library for full-text indexing and search. It also has REST- like HTTP/XML and JSON API’s. Its major features of interest to us included rich document handling, geospatial search, full-text search, highlighting amongst others. During our evaluation we installed Solr within a Apache Tomcat3instance and developed a simple API to upload rich text documents and index them to make them available for full-text search. 4.3.4 File Repository The storage system for the GTDA project has management requirements such as creation of folders to manage files, renaming, deletion etc. This should be flexible to include permission settings. A content repository provides access to such features. Apache JackRabbit [26] is a content repository fully conforming to JCR API. It supports structured and unstructured content, versioning, transactions amongst others. Since the content stored into JackRabbit can any form of data we decided to evaluate it. We installed the JackRabbit repository and created Workspaces and nodes (representing files and folders). Stress tests on JackRabbit revealed a performance degrade 1http://www.sencha.com/products/extjs/examples/ 2http://en.wikipedia.org/wiki/Full text search 3http://tomcat.apache.org/ 24
4.3 Technology Survey when a single node contains references to more than 10k nodes. The documentation for JackRabbit required extensive search and samples were scant. Custom Implementation of a virtual file system would be our implementation of a lightweight api that creates a wrapper for management services over a filesystem. We develop CRUD operations over a filesystem and provide unique references to files using UUIDs storing the relevant metadata associated with that file in a relational database. This virtual filesystem also supports directories (or folders managed by users) with CRUD operations which can contain other directories or files. 4.3.5 Geospatial WebServices Geoportal [27] is an open-source product that enables discovery and use of geospatial resources. It helps organizations to manage and publish their geospatial resources to let users discover and connect to those resources. In our evaluation we installed Geoportal and also downloaded the source code and took an overview of the architecture to determine extensibility of the platform. We evaluated the workflow, permissions, metadata standards, database schema amongst other things. GeoServer [28] is an open-source product that implements the WMS standard and conforms to the WFS standard. It allows to display, publish, share and edit spatial information. 4.3.6 Security Spring Security [29] is a powerful and highly customizable access control framework. It provides authorization, web request security and service layer and domain object security which can be configured to run with any type of back-end (JDBC, CAS, LDAP etc. ). Apache Shiro [30] is an open-source Java Security framework that provides an api for authentication, authorization and permissions. It has a concept of a realm which could be anything from an Active Directory or JDBC back-end which acts as the repository for credentials and provides a fairly thin API layer over these to manage security concepts. 25
4. ARCHITECTURE AND TECHNOLOGY Shibboleth [31] is a standards based open-source software package for web-single sign on. It uses a federated identity based authentication and authorization infrastructure based on SAML. Its components include an Identity Provider (IdP) and Service Provider (SP). The IdP authenticates the user and provides an authentication token to the SP. SP’s rely on IdP’s to assert the identity of a user. 4.4 Decisions 4.4.1 Spring Integration To cover the aspects of system and data integration we chose the Spring Integration framework since it provides a very lightweight messaging framework built on top of the familiar Spring Framework. It incorporates the same programming paradigms from the Spring framework and hence the learning curve was believed to be short and infact was. The adapters provided by the Spring Integration covered the requirements from the project specification and the inherent messaging model can be linked to Spring framework’s application events. Rather than looking for a full blown ESB, we decided to use the lightweight spring integration context for messaging, routing and connecting our services. 4.4.2 ExtJS We really wanted to try out the GWT platform but the plain GWT from Google did not support many widgets. SmartGWT required us to adhere to their protocol. ExtGWT was being revamped to incorporate GWT2.x features. Another concern was how to connet GWT developed in Java to an existing JS api, which is possible using JSNI1. One of the major requirements was to have a robust and visually appealing chart framework. ExtJS provided just that. Since our services for the UI were being exposed via RESTful spring controllers the UI could be independently developed and connected to our services. ExtJS also has its own MVC application design pattern which is quite useful for managing JavaScript code which quickly becomes unmanageable. Owing to the above factors our choice for the UI was to develop our screens using ExtJS. 1http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html 26
4.4 Decisions 4.4.3 Solr Since Solr functions as a standalone web application and it has Java API available to connect to it using a RESTful API using JSON and XML we chose Solr over Lucene which is a library. Also Solr provides all the features which are required by our project and follows the standards proposed in our architecture. 4.4.4 Custom VitualFileSystem Implementation Our evaluation of JackRabbit was sluggish mostly because it involved reading a behemoth JCR specification. While we did delve with code and the features seemed promising, they took too much development effort. It was realized soon enough a customized yet extensible virtual file system approach targeted to our requirement could be built rather quickly and hence this approach was preferred. 4.4.5 Geoportal and GeoServer Since submission of data to the NGDS needed to be performed via OCG web-services1 as defined by USGIN 2, Geoportal which supports CSW and GeoServer which supports WFS were evaluated for features and extension points and chosen as the standard for catalog and geo-spatial web-services. 4.4.6 Shiro Spring Security was surprisingly a little bit more complex to understand and implement quickly. We evaluated Shiro and its concepts seemed simple enough to understand for implementation of authentication, authorization and permissions. However, SSO implementation in Shiro requires the use of Cached Sessions. Shibboleth is planned to be revisited in the future for SSO and will primarily deal with the authentication aspect of security and Shiro will deal with the authorization and permissions part. 4.4.7 Spring Batch and Spring Batch Admin Prior to the beginning of this project certain other ETL services were already being developed using Spring Batch and it provided a robust framework and API for such 1http://www.opengeospatial.org/standards/common 2http://usgin.org/ 27
4. ARCHITECTURE AND TECHNOLOGY services. We extended the Spring Batch Admin, an open-source web application from Spring, to connect to the back-end ETL services to provide a management layer over these services. The management layer provides tasks such as launching, restarting, terminating and monitoring various ETL services. The interesting aspect of using Spring Batch Admin is that it registers the ETL services and exposes them using REST endpoints with JSON, which is the standard of communication in our proposed architecture. 4.4.8 PostgreSQL and PostGIS The PostgreSQL1is an open-source object relational database with a strong reputation and was the choice for our database. PostGIS2was chosen to add support for geographic objects to PostgreSQL. 1http://www.postgresql.org 2http://postgis.refractions.net/ 28
5 Design In continuance with the architectural design proposed in 4.1 this chapter expands further on the design of modules based on the services described in 4.2. The chapter first elaborates on the architecture, then on the design of the modules, the database schemas and finally concludes with certain important design decisions made. 5.1 Design 5.1.1 Application. Figure 5.1: SOA Application Design - Modularized components of the architecture As displayed in figure 5.1 the architecture consits of two web modules, the Server 29
5. DESIGN Web Module and the ETL Batch Admin Module. All other modules such as geoportal, search, geoserver exist as independent services. All internal and external services are exposed on and can be consumed via the Message Bus. External services have REST- ful endpoints that enable them to be consumed independently of the message bus if required. The Message Bus also incorporates certain Business Wrapper Services which implement the business logic of the GTDA application by consuming the services as required. The Message Bus also tracks the flow of information as it arrives and moves out of the system. 5.1.2 Publication Pipeline. One of the objectives of the thesis was to develop automated publication pipeline which simulates the business process flow of the life-cycle of a document which is input into the GTDA system. The current publication pipeline has been designed and implemented to be automated and various quality checkpoints will be pushed into place in order to make this integrate with a manual workflow. The automated publication pipeline is described as below: 1. Upload a File. A file is uploaded into the system either via a web form or as part of an ETL service. This file is then stored into the file system. 2. Detect Files. A file uploaded in the system is then detected according to the various data profiles and corresponding formats as explained in the Import Data Profile Use case in the requirements chapter 3.3. A data profile can be one of as listed below. (a) Bibliography is an index of publications maintained by the various partners. If a file is detected as a bibliography then the corresponding ETL Service is triggered to load data (the publications) into the corresponding table in the database. (b) Publication is the actual file referred to in the bibliography 2a. Currently these files are paper only and universities scan and OCR them and in this system they need to be indexed and linked to the bibliographic record. Thus if a file is detected as a publication from a particular source (partner) then a verification check is done to determine if the publication exists in the 30
5.1 Design bibliography associated from that source. If such a verification succeeds then it proceeds to index the publication for searching.3 (c) Data File is a file which is not a publication or a bibliography and can be an image file, document, database dump file or any other acceptable data file format. When such a file is detected then Quality Checks are enforced and then it proceeds to be published to geoportal 4 if such a file is to be published to the catalog. 3. Publish to SOLR. Publish the file to SOLR for indexing and full text search. 4. Publish to Geoportal. Create an ISO compliant meta-data for the file and publish it to Geoportal. 5.1.3 ETL. We identified over twenty ETL services and designed them as Spring Batch jobs configuring and designing the interfaces as described in the reference1For example consider an ETL Service to upload an Excel file into a database. To implement this using Spring Batch we need to implement the ItemReader interface 2to read items from the excel file and an ItemWriter interface3to write the read items into the database. We then use the spring xml configurations to wire up these components together. Listing 5.1: Reading Publications from an Excel file 1public cl as s PublicationFileReader implements ItemReader<Publication>{ 3private String path=”” ; private String source=”” ;// s e t the partner p r o f i l e i nf o 5 private BufferedReader br=null ; 7private String cu rren tLine=null ; 9public void initialize (){ // i n i t i a l i z e buffe r e d r eader 11 br=new BufferedReader(new FileReader ( path ) ) ; c ur r en t Li ne=br . r ea dL in e ( ) ; 13 // handle exceptio n s } 15 1http://static.springsource.org/spring-batch/reference/html-single/index.html 2http://static.springsource.org/spring-batch/apidocs/org/springframework/batch/item/ItemReader.html 3http://static.springsource.org/spring-batch/apidocs/org/springframework/batch/item/ItemWriter.html 31
5. DESIGN 2. @RequestMapping. Maps web requests made to moduleservice to be handled by this Controller. This can be applied at a class or method level. When used together the associate request for the listing 5.9 would be of the form /moduleservice/doAService 3. @RequestParam. Binds a method parameter to a webrequest parameter. 5.2.6 ETL Services This module encapsulates all the configurations related to Spring Batch Jobs or ETL services. An ETL Service in most scenarios reads a file in a certain format, does some processing on it and stores it into the relational database. These ETL Services are configured as Spring batch jobs which provides the necessary interfaces and classes to implement such a system very efficiently. We currently have over twenty configured jobs each within their own configuration files. These configurations are then wrapped up or referenced from a single configuration file which provides the extension point for other modules. The database configurations are described in the sub-section GtdaBatch in the Database section 5.4.5 and overview of the design for an elt service was provided in the section 5.1.3. 5.2.7 ETL Batch Admin This module is a custom configured Spring Batch Admin web based module 4.4.7. It overrides the default configurations1of Spring Batch Admin to plug into our database back-end. ETL Services can be launched, stopped, inspected and their executions can be monitored using a simple REST enabled web-service using JSON as the data format. It uses the same database configurations as the ETL Service as mentioned in the sub-section GtdaBatch of the Database section 5.4.5. 5.2.8 Security There are two parts to security, authentication and authorization. Using Apache Shiro’s security concepts we designed a schema 5.4.7 and a thin JDBC realm to connect to it. Using shiro filters we are able to intercept every request to check for authentication and using shiro annotations over methods and urls we are able to protect instances 1http://static.springsource.org/spring-batch-admin/reference/customization.html 38
5.2 Modules and application paths to users with certain roles and permissions. Shiro provides a framework to handle customizable permissions as well. To achieve single-sign-on it is necessary to cache user sessions, however we will be investigating an alternative approach using Shibboleth for authentication and using shiro for authorization. This solution has been deferred to a later project phase. 5.2.9 Workflow The Workflow module is being developed as a concept to be reusable in the future. The workflow module will be coupled with the Security module described in subsection 5.2.8 to support concepts of permissible viewing and assignment of tasks. The main concept of a workflow is that it is a set of items which progresses through certain states as they are assigned to different users who perform manual operations on an item. Items are uniquely identified by a type which in our case is mostly a File. The manual operations performed by the user will mostly invoke services already defined within the system. These manual operations are required for quality checks which cannot be performed by the automatic publication pipeline system. 5.2.10 Geoportal The Geoportal server requires Apache Directory Services[34] for authentication and authorization according to roles [user, publisher and administrator]. It also utilizes Lucene for full-text search of content published in its catalog hence requires a folder configuration for indexing. The database configurations are described in the subsection Geoportal in the section Databases 5.4.6. 5.2.11 Solr The Solr server is deployed within a Apache Tomcat[35] instance and its installation requires folder configuration for indexing and the appropriate jars to be placed in the tomcat endorsed lib folder. 39
5. DESIGN 5.3 Packaging of Modules We follow the J2EE specification on the deployment of J2EE web modules1. The deployment environment for these modules is Apache Tomcat[35]. The GTDA application consists of the following J2EE Web Applications described below: Server. The Server Web Module binds the following modules filedetection, filesystem, persistence, integration and security. The integration module provides the binding for gluing all the exposed services from other modules. Also the integration module defines the persistence.xml for JPA to create a persistence unit comprising of entities from all the modules. This persistence unit is then utilized by all other modules deployed within the Server module. ETL Batch Admin. The ETL Batch Admin binds the persistence and the ETL services module. The ETL services module defines the persistence.xml for JPA to create a persistence unit comprising the entities from the persistence module. Geoportal. The Geoportal module is a J2EE WAR deployed within the same Tomcat instance with the requisite configurations for authentication and authorization with the configured LDAP server and folders for indexing. Solr. The Solr module is deployed as a J2EE WAR as well with the requisite configurations for indexing. 5.4 Database Schemas. The Database design incorporates various schemas in accordance with achieving a loosely coupled design. Each schema corresponds to a particular module and different schemas may reference each other using constraints as applicable. We describe below the schemas currently available within our system: 5.4.1 FileSystem. The filesystem schema is the main schema for storing files and managing directories for the application. The schema is designed to incorporate both directories and files, 1http://java.sun.com/j2ee/tutorial/1 3-fcs/doc/WebComponents3.html 40
5.4 Database Figure 5.3: File System Schema - The implementation for the File System Service as such there are two table Directories and Files. A Directory consists of directories or files , hence the directory table is self referential and the files table has a foreign key to map to its parent directory. The primary identifier for files and directories in the systems is a java.util.UUID1object. 5.4.2 Integration. Figure 5.4: Integration Schema - The backbone for tracking transitions in the system The integration schema provides the tracking and most relevant information for any file which passes through the system. It provide the capability to track down a file to a particular service and the state in which it currently exists. This is useful for tracking failures and exception scenarios in the system. 1http://download.oracle.com/javase/1,5.0/docs/api/java/util/UUID.html 41
5. DESIGN 5.4.3 Core. Figure 5.5: Core Schema - For various different types of datatypes The core schema currently consists of only one table for the publications. This schema will be expanded to incorporate different types of data with addition of new tables. The publication table is fairly simple it consists of all the relevant identification or relational attributes for a publication. Since publications are files and are stored in the filesystem an extra column was added to publications to indicate its location in the filesystem. The publication uuid column is a foreign key referencing uuid column of the file table in schema filesystem. 42
5.4 Database Figure 5.6: Staging Schema - For datatypes related to geospatial services 43
5. DESIGN 5.4.4 Staging. The staging schema currently is designed to hold data to be presented in the geospatial domain for eg. maps. It consists of tables which represent data mapped to states, counties for representation on a map. 5.4.5 GtdaBatch. Figure 5.7: ETL Schema - Spring Batch tables 44
5.4 Database The spring batch tables are required by the spring batch framework for execution. Formally a job instance is individually recognized by the job parameters by which it is executed. A job instance can have multiple executions consisting of one or many steps. A job execution context stores the job-level data which is required for a job execution, this is useful to restart jobs from the state they left off. Similarly, the step execution context stores the step-level data which is required for a step execution. 5.4.6 Geoportal. Figure 5.8: Geoportal Schema - Geoportal tables The Geoportal schema is as designed by the ESRI organization. The gpt user table contains the full LDAP credentials for users permitted to use the system. The gpt resource table contains the relevant meta-data for a particular document and the gpt resource data contains the full meta-data xml for the document. The gpt search table helps users to save their searches. The gpt harvesting * tables are for when Geoportal is configured to harvest(import) documents from a certain folder. 45
5. DESIGN Figure 5.9: Security Schema - Security tables based on Apache Shiro concepts 5.4.7 Security. Using the concepts of Apache Shiro the security schema was designed. We define groups to have many users. There exists many roles in the system and a user can have multiple roles. Hence users and roles have a many-to-many relationship. Each role is associated with certain permissions, conversely users having certain roles have permissions for activities or accessing resources within the system. 5.4.8 workflow Figure 5.10: Workflow Schema - Workflow concept tables mapped to Users table 46
5.5 Decisions The workflow schema 5.10 is a concept schema and is currently under development. The schema models the concept of a workflow consisting of items uniquely identified by a UUID and of a certain type. These items exist in a certain state and are assigned to a user described in the security schema 5.4.7. The current states of an item are NEW, ASSIGNED, FAILED and COMPLETED. 5.5 Decisions 5.5.1 UUID. To maintain unique references through out the system, the UUID1was chosen to uniquely identify resources, files etc. as they flowed through the system and also to publish resources to the outside world. 5.5.2 Integration Wrapper Services. All integration wrapper services business services wrapped around actual services used in the integration module implement the interface in the listing below. This implies that as messages route through the system any integration service which requires a reference to a particular file or resource will be able to acquire it using the UUID 5.5.1. Listing 5.10: File System Service public interface IntegrationService { 2@Transactional public Object s e r v i c e {UUID uuid }; 4} 5.5.3 Channels. In our investigation of Spring Integration, various types of Message Channels[36] options were tested. For the purpose of the project the Queue Channel implementation was used, as it does not let transaction support span across the channel as different threads perform the operations on both sides of the channel. 1http://download.oracle.com/javase/1,5.0/docs/api/java/util/UUID.html 47
6. IMPLEMENTATION 10 </ int:header −enricher> </ i n t : c h a i n> 6.2.4 Transform the message Figure 6.4: Transform To UUID - Filter Detected and Undetected Files We reuse this component frequently within the publication pipeline. All message payloads are transformed to UUID’s so that the next services in the pipeline can identify the resources associated with that messages as described in the section 5.5.2. The custom TransformToUUID class transforms a message payload (a Collection or a integration.routingInfo entity) to a UUID. The headers for the message are retained and the message is sent to the routeToNextService channel. Listing 6.5: Transform To UUID <!−− tra nsformer to get the t r a c k i n g u u i d 2( pass r o u ti ng In fo o b je c t s / rows from i n t e g r a t i o n . r o u t i n g t a b l e )−−> <i n t : c h a n n e l i d=”transformToUUID”> 4<int: q u e u e c apaci ty=”200”/> </ i n t : c h a n n e l> 6<int:transformer input−channel=”transformToUUID” output−channel=”routeToNextService” method=” transform ”> 8<bean c l a s s=”com . siemens . s c r . gtda . i n t e g r a t i o n . t ra nsfo rm er . TransformToUUID”/> </int:transformer> 6.2.5 Route the Messages to the approprite Services We utilize the header-router from Spring Integration to implement routing based on the header values in a message. This is also a reusable component and all messages are sent to the routeToNextService channel for routing to the appropriate services , by sending the message to the channel for that service. This is done by doing a simple 54
6.2 Integration of Modules Figure 6.5: Header Router - Route Messages 55
6. IMPLEMENTATION check against the value of the header nextService as in line 4 in the listing below and the corresponding mapping for that value. Listing 6.6: Router 1<i n t : c h a n n e l i d=”routeToNextService”> <int: q u e u e c apaci ty=”200”/> 3</ i n t : c h a n n e l> <int:header −value−router header−name=” nextServ i c e ” 5input−channel=”routeToNextService”> <int:mapping value=”FILEDETECTION” channel=” f i l e D e t e c t i o n ”/> 7<int:mapping value=”VALIDATION” channel=”validatePublications”/> <int:mapping value=”ETLJOB” channel=”loadBibliography”/> 9<int:mapping value=”SOLR” channel=”publishPublicationsToSolr”/> <int:mapping value=”GEOPORTAL” 11 channel=”publishPublicationsToGeoportal”/> </ int:header −value−rou t e r> 6.2.6 ServiceActivators Service Activators as the name suggests is a pattern which activates services. In our implementation we have created wrappers around services, mostly for customized business logic, and then using Spring inject the already declared services into the wrapper service. In this sense most of the service activators 5.5.2 utilize actual services and are configured as flows using the EIP’s 2.2 implemented in Spring Integration. The implementation details are listed below: 6.2.6.1 File Detection Figure 6.6: File Detection - File Detection Files whose data profile is not yet known are attempted to be detected by the system, failing which they are pushed to a manual workflow. The messages containing the UUID’s of the files arrive at the fileDetection channel and are fed to the File Detection Chain and then onwards to the transformToUUID channel. 56
6.2 Integration of Modules Figure 6.7: File Detection Chain - File Detection Chain We assume that all messages entering the chain are detected and hence the next service is to be an ETL service. This is the first component of the chain, a header enricher which changes the header nextService to ETLJOB. The second component of the chain is then the service activator for the File Detection Wrapper service which receives the messages with payloads consisting of UUID’s of the files. The wrapper service fetches the file URL’s associated with those UUID’s from the file system service and passes them to the file detection service for detection. The detected result is then fed to the next component. If a file is undetected then the result returned from the File Detection Service is null, and this information is tracked in the integration schema in the routing table. A null message is not sent to the output channel in Spring Integration. The result of the detection from the File Detection Service is of the form ’Group DataProfile’ where Group refers to abbreviations of the data providers and DataProfile is one of Bibliography, Publication or DataFile. We use the filter component after the service with a SpEL expression (line 5) to route the Bibliographies to the transformToUUID channel and the Publications to the the Header Enricher component to change the value of the nextService header to VALIDATION. For DataFiles the current business logic is undefined, but as is evident from this configuration it is easily pluggable into the router configuration and can be branched out to its appropriate channel when its business logic is defined. The enriched messages are then routed to the the channel transform- ToUUID. As can be observed we are reusing existing channels and plugging back into the workflow to route these messages to the next requested service. Listing 6.7: File Detection <!−− r e c e i v e s the t racking uuid ; f e tc h e s the c orresponding path and then proceeds with det e c tio n −−> 57
6. IMPLEMENTATION 2<bean id=”fileDetectionIS” class=”com . siemens . s c r . gtda . i n t e g r a t i o n . s e r v i c e s . file . FileDetectionISImpl”> <property name=”fileDetectionService” r e f=”fileDetectionService”></ property> 4<property name=”fileSystemService” r e f=”fileSystemService”></property> <property name=”routingDao” r e f=” routingDao ”></property> 6</bean> 8<i n t : c h a n n e l i d=” f i l e D e t e c t i o n ”> <int: q u e u e c apaci ty=”200”/> 10 </ i n t : c h a n n e l> 12 <i n t : c h a i n input−channel=” f i l e D e t e c t i o n ” output−channel=”transformToUUID”> <!−− assume that f i l e i s d etected and hence next job i s ETL −−> 14 <int:header −enricher> <i n t : h e a d e r name=” nextService ” value=”ETLJOB” overwrite=” true ”></ i n t : h e a d e r> 16 </ int:header −enricher> <int:service−a c t i v a t o r r e f=”fileDetectionIS” method=” s e r v i c e ”/> 18 <i n t : f i l t e r e x p r e s sion=” payload . d a t a P r o f i l e . c o nt ains ( ’ Pub lica tion ’ ) ” discard−channel=”transformToUUID”/> <int:header −enricher> 20 <i n t : h e a d e r name=” nextService ” value=”VALIDATION” overwrite=” true”></ i n t : h e a d e r> </ int:header −enricher> 22 </ i n t : c h a i n> 6.2.6.2 Validate Publications Figure 6.8: Validate Publications - Validation Messages which contain UUID’s of files which have been detected as publications arrive at the validatePublications channel which is the input for the Publication Validation Chain. This Chain determines whether a publication belongs to a bibliography and then sends the message to the transformToUUID channel. The Validator Wrapper Service determines whether a publication belongs to a bibliography. It uses pattern matching on the name of the retrieved file, hence uses the file 58
6.2 Integration of Modules Figure 6.9: Validate PublicationsChain - Validation system service and uses the publicationDao for looking up the bibliographic reference. If the publication is validated then the referenced UUID is persisted to that publication and the message is sent to the next component, a header enricher, to change the value of the nextService header to SOLR. Listing 6.8: Validate Publications 1<bean id=”publicationValidator” c l a s s=”com . siemens . s c r . gtda . i n t e g r a t i o n . services . validator . PublicationValidatorISImpl”> <property name=”fileSystemService” r e f=”fileSystemService”></property> 3<property name=”publicationDao” r e f=”publicationDao”></property> <property name=”routingDao” r e f=” routingDao ”></property> 5</bean> 7<i n t : c h a n n e l i d=”validatePublications”> <int: q u e u e c apaci t y=”200”/> 9</ i n t : c h a n n e l> 11 <i n t : c h a i n input−channel=”validatePublications” output−channel=” routeToNextService”> <int:service−a c t i v a t o r r e f=” p u b l i c a t i o n V a l i d a t o r ” method=” s e r v i c e ”/> 13 <int:header −enricher> <i n t : h e a d e r name=” nextService ” value=”SOLR” overwrite=” tr ue ”></ i n t : h e a d e r> 15 </ int:header −enricher> </ i n t : c h a i n> 6.2.6.3 Load Bibliography Messages which contain UUID’s of files which have been detected as a bibliography arrive at the loadBibliography channel which is the input for ETL Launching Service. 59
6. IMPLEMENTATION Figure 6.10: Load Bibliography - Load Bibliography The ETL services are deployed within the ETL Batch Admin Web context 5.3 and exposed with REST endpoints. We utilize the Spring framework’s RestTemplate (lines 12-19, 6.9 configured with a StringHttpMessageConverter1to handle the JSON request and response strings. The string $gtdaJobLaunchURL is replaced with the string http ://serverURL :port/spring−batch−admin/jobs/jobName.json?jobParameters and the ETL Wrapper Service utilizes the data profile to figure out the corresponding jobName and the file system service to retrieve the fileURL passed on as one of the jobParameters for that ETL job. Listing 6.9: Load Bibliography <!−− Spring BATCH jobs Launching S erv i c e −−> 2<i n t : c h a n n e l i d=”loadBibliography”> <int: q u e u e c apaci ty=”200”/> 4</ i n t : c h a n n e l> <bean id=”gtdaJobLaunchService” 6c l a s s=”com . siemens . s c r . gtda . i n t e g r a t i o n . s e r v i c e s . batch . BatchJobsLaunchingServiceISImpl”> <property name=”restTemplate” r e f=”gtdaJobLaunchRestTemplate”/> 8<property name=”routingDao” r e f=” routingDao ”/> <property name=”fileSystemService” r e f=”fileSystemService”/> 10 <property name=”gtdaJobLaunchURL” value=”${gtdaJobLaunchURL}”/> </bean> 12 <bean id=”gtdaJobLaunchRestTemplate” c l a s s=” org . springframework . web . c l i e n t . RestTemplate”> <property name=”messageConverters”> 14 <l i s t> <bean id=” stringMessageConverter ” 16 class=” org . springframework . http . c o nverter . StringHttpMessageConverter”/> </ l i s t> 18 </property> </bean> 20 <int:service−a c t i v a t o r input−channel=”loadBibliography” 1http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/http/converter/StringHttpMessageConverter.html 60
6.2 Integration of Modules r e f=”gtdaJobLaunchService” method=” s e r v i c e ” output−channel=”logChannel ”/> 6.2.6.4 SOLR Publisher Figure 6.11: SOLR Publisher - Solr Publisher Messages which contain UUID’s of publications which are validated arrive at the publishPublicationsToSolr channel which is the input for the Solr Wrapper Service. This service utilizes the file system service to fetch the URL for the publication. SOLR deployed within a tomcat container exposes REST endpoints and we developed a servicelines 4-8, 6.10 to publish pdf’s, text using this RESTful service to SOLR. Listing 6.10: SOLR Publisher 1<!−− SOLR SERVICE −−> <i n t : c h a n n e l i d=”publishPublicationsToSolr”> 3<int: q u e u e c apaci t y=”200”/> </ i n t : c h a n n e l> 5<bean id=”solrService” c l a s s=”com . siemens . s c r . gtda . i n t e g r a t i o n . s e r v i c e s . s o l r . S o lrR estS ervi ce ”> 7<property name=”solrRestURL” value=”${s o l r . r e s t u r l }”/> <property name=”solrURL” value=”${s o l r . u rl }”/> 9</bean> <bean id=”solrPublisher” 11 class=”com . siemens . s c r . gtda . i n t e g r a t i o n . s e r v i c e s . s o l r . S olr Se r vi c eISImpl ” > <property name=”routingDao” r e f=”routingDao”/> 13 <property name=”fileSystemService” r e f=”fileSystemService”/> 61
6. IMPLEMENTATION <property name=”solrService” r e f=”solrService”/> 15 <property name=”publicationDao” r e f=”publicationDao”/> </bean> Figure 6.12: SOLR Publisher Chain - Solr Publisher Filtering Publications to be sent to the Catalog Service. The SOLR publisher chain consists of the service activator of the Solr Wrapper Service. Some publications are not required to be sent to the Catalog Service. We therefore use a Filter with a SpEL expression lines 4-6, 6.11which filters out messages which belong to a particular list lines 8-11, 6.11 and send the rest of the messages to the next component, the header enricher, to change the value of the nextService header to GEOPORTAL. Listing 6.11: SOLR Publisher Filter <!−− l i s t of sources that are not to be sent to g eoportal −−> 2<u t i l : l i s t id=” f i l t e r C a t a l o g L i s t ”> <value>OSTI</value> 4<value>STANFORD</value> </ u t i l : l i s t> 6 <i n t : c h a i n input−channel=”publishPublicationsToSolr” output−channel=” transformToUUID”> 8<int:service−a c t i v a t o r r e f=”solrPublisher” method=” s e r v i c e ”/> 10 <i n t : f i l t e r e x p r e s sion=” ! @ f i l t e r C a t a l o g L i s t . c on tain s ( payload . groupSource ) ” discard−channel=” logChannel ”/> <int:header −enricher> 12 <i n t : h e a d e r name=” nextService ” value=”GEOPORTAL” o verwrit e=” t rue ”/> </ int:header −enricher> 14 </ i n t : c h a i n> 6.2.6.5 GEOPORTAL Publisher Messages which are to be published to the catalog service provided by Geoportal are 62
6.2 Integration of Modules Figure 6.13: Geoportal Publisher - Geoportal Publisher received on the publishPublicationsToGeoportal which is the input for the Geoportal Wrapper Service. Geoportal exposes itself via a REST endpoint and we therefore again make use of the Spring REST template (line 26-42, 6.12 which also provides a mechanism to automatically login using basic authentication. Since we post XML data to the REST url, the message converted which is used for this REST template is the ByteArrayHttpMessageConverter1. The XML data is posted using a template designed from the ISO 19139/19115 Dataset standard. We use this template to push in required data elements using our custom developed ISOPublicationGeneratorlines 16-20,6.12 and then post the XML stream to Geoportal. The xml marshalling and unmarshalling is handled using Apache XmlBeans. Listing 6.12: Geoportal Publisher Filter <!−− GEOPORTAL SERVICE −−> 2<i n t : c h a n n e l i d=”publishPublicationsToGeoportal”> <int: q u e u e c apaci t y=”200”/> 4</ i n t : c h a n n e l> <bean id=”geoportalPublisher” 6class=”com . siemens . s c r . gtda . i n t e g r a t i o n . s e r v i c e s . g eoportal . GeoportalServiceISImpl”> <property name=”geoportalService” r e f=”geoportalService”/> 8<property name=”publicationDao” r e f=”publicationDao”/> <property name=”routingDao” r e f=”routingDao”/> 10 <property name=” isoTemplateGenerator ” r e f=”ISOTemplateGenerator”/> </bean> 12 <bean id=”geoportalService” class=”com . siemens . s c r . gtda . i n t e g r a t i o n . s e r v i c e s . g eoportal . GeoportalRestService”> 14 <property name=”geoportalRestURL” value=”${g eo p o r t a l . r e s t u r l }”/> <property name=” restTemplate ” r e f=”geoportalRestTemplate”/> 16 </bean> <bean id=”ISOTemplateGenerator” 18 class=”com . siemens . s c r . gtda . i n t e g r a t i o n . s e r v i c e s . g eoportal . ISOPublicationGenerator”> 1http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/http/converter/ByteArrayHttpMessageConverter.html 63
7. EVALUATION 7.2 Degree of Loose Coupling Loose coupling is a highly desirable property of a SOA system or any software system. It enables component reuse, parallel development, simplifies unit testing, enables scalable and flexible architectures and also has benefits related to project management. Since our design is focused on implementing a loosely coupled and flexible architecture, we consider the degree of loose coupling an important measurement in the analysis of our architecture. The system is composed of different modules and based on the interactions between modules we show a basic visualization of the coupling which exists between the modules in our system as in figure 7.1. Figure 7.1: Module Coupling - A visualization of coupling of modules in the system In this section we use one of the methodology available to evaluate loose coupling and publish the results. Fenton and Melton[42] proposed the coupling types as shown in table 7.1 where the order of worst type of coupling to best runs from top to bottom. They then proposed a measure of coupling between modules xand yas M(x, y) = i+n n+ 1 (7.1) 70
7.2 Degree of Loose Coupling where i= the measure of the highest level of coupling between module xand yand n= the number of interactions between modules xand y The global coupling of a system may be defined as the average of the pairwise coupling of the modules. However, Fenton and Melton propose that the global coupling of a system Sconsisting of modules D1, ..., Dnis given by the median value of the set M(Di, Dj):1≤i < j ≤nwhere Mis the measure of pairwise coupling given above. We use the formula 7.1 and derive the results for the value of coupling as show in table 7.2. Coupling Type Coupling Level Modified definition between modules x and yfrom [43] Content 5 Component xrefers to the internals of component y, i.e., it changes data or alters a statement in y. Common 4 Components xand yrefer to the same global data. Control 3 Component xpasses a control parameter to y. Stamp 2 Component xpasses a record type variable as a parameter to y Data 1 Components xand ycommunicate by parameters, each of which is either a single data item or a homogenous structure that does not incorporate a control element. No Coupling 0 Components xand yhave no communication, i.e., are totally independent. Table 7.1: Coupling Levels - Fenton and Melton Modified Definition for Myers Coupling Level. In table 7.2, the top table shows the values of the pairwise coupling values where iis the highest value of the coupling level between a pair of module xand yand n is the number of interactions between those modules. The middle table, displays the evaluated results for the pairwise coupling using the formula 7.1. As can be seen from the results in the bottom table in 7.2 the coupling of the system is extremely low. The 71
7. EVALUATION Table 7.2: Pair Wise Coupling levels from Fenton and Melton Definition table 7.1 c=coupling level , n=no. of file system persistence uuid patch file detection integration server etl services etl batch admin solr geoportal interactions i n i n i n i n i n i n i n i n i n i n file system 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 persistence 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 uuid patch 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 file detection 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 integration 2 4 2 3 1 1 1 1 0 0 0 0 0 0 1 11 1 1 1 1 server 1 3 1 1 0 0 0 0 1 1 0 0 0 0 0 0 1 1 0 0 etl services 0 0 2 9 1 2 0 0 0 0 1 1 0 0 1 31 0 0 0 0 etl batch admin 0 0 0 0 0 0 0 0 0 0 0 0 1 7 0 0 0 0 0 0 solr 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 geoportal 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 file system persistence uuid patch file detection integration server etl services etl batch admin solr geoportal file system 0 0 1.667 0 0 0 0 0 0 0 persistence 0 0 1.667 0 0 0 0 0 0 0 uuid patch 0 0 0 0 0 0 0 0 0 0 file detection 0 0 0 0 0 0 0 0 0 0 integration 2.800 2.75 1.5 1.5 0 0 0 1.917 1.5 1.5 server 1.750 1.5 0 0 1.5 0 0 0 1.5 0 etl services 0 2.9 1.667 0 0 1.5 0 1.969 0 0 etl batch admin 0 0 0 0 0 0 1.875 0 0 0 solr 0 0 0 0 0 0 0 0 0 0 geoportal 0 0 0 0 0 0 0 0 0 0 Coupling b/w modules Mean 0.366 Median 0 Table 7.3: Top : Pair Wise Coupling levels from Fenton and Melton Definition table 7.1 Middle : Pairwise coupling values using formula 7.1 Bottom : Calculation results for coupling of the sytem. 72
7.3 Throughput median value of the pairwise coupling as proposed by Fenton and Melton[42] is 0 or the lowest possible. The average for the same results in a value of 0.366 for the system which is towards the lowest level of coupling value as shown in the table 7.1. 7.3 Throughput The architecture and the implementation design were tested for throughput. We carried out experiments and noted the throughput under different scenarios. Our implementation of Spring Integration using the poller with queue channels causes the processes on each message to be run on separate threads. Hence we created a mock service composed of other services in the system to form one coupled monolithic service and configured it to run with a thread pool to compare its performance with the messaging framework of Spring Integration. We refer back to the implementation of the publication pipeline (section 5.1.2) as the test bed.The scenarios and results from the same are listed below: •Using the Mock Coupled Service –A single publication through the publication pipeline using the Mock Coupled Service : On an average over a few runs the the processing time for one publication was 3.09 seconds. Figure 7.2: Throughput of the system using the Mock Service Figure 7.3: Box Plot for the time executions through the Mock Service 73
7. EVALUATION –Five hundred publications were passed through the publication pipeline. The graph for the throughput is as shown in the figure 7.2 and the box-plot are as shown in figure 7.3 The number of publications processed per second are 2.43. •Using Spring Integration –A single publication through the publication pipeline using the services on the spring integration framework: On an average over a few runs the processing time for one publication was 7.26. seconds. Figure 7.4: Throughput of the system using Spring Integration Figure 7.5: Box Plot for the time executions using Spring Integration –Five hundred publications were passed through the publication pipeline. The graph for the throughput is as show in the figure 7.4 and the box-plot is as shown in figure 7.5. The number of publications processed per second are 14.53. The results for this experiment were surprising. For a single publication through the pipeline the framework was expectedly slow because of the overheads related to messaging. However for a run consisting of several publications through the publication pipeline (which can handle them in parallel) the throughput or the number of publications processed per second is larger than that of the mock coupled service. This shows that the Spring Integration framework is quite robust for multi-threaded processing and our publication pipeline does not suffer from a messaging overhead over a parallel workload. Over a large run of parallel executions the performance of the framework is better than of the multi-threaded mock coupled service. 74
7.4 Degree of Reusability 7.4 Degree of Reusability Figure 7.6: Service Reusability - Service Re-use within the system Reusability is defined as the number of components that offer reuse in terms of either reusing existing services themselves (internal reuse) or in the number of different ways that they themselves can actually be reused (external reuse)[44]. Taking a look at 7.6, we see that every module other than the uuid patch and file detection, which are very independent and specific modules, is being used by another module within the system. Apart from this internal reusability, five of the total ten modules are exposed via RESTful endpoints, making them available for reuse for any other service external to the sytem. Hence it can be observed that our architecture has a good balance of internal and external reuse. 7.5 Development Effort Professional software project management mandates completion of tasks and activities within established time targets. In the software world this is established by the development of reusable components as described in 7.4 or reusing existing libraries for abstract tasks. We used a variety of libraries within our software development for 75
7. EVALUATION abstract tasks such as transaction management, connection pooling, object relational mapping amongst many others. An analysis of code coverage of the classes under the following core scenarios was undertaken •ETL. This scenario is that of a simple ETL job of which we have over 20 configured jobs. So this is a repeatable scenario within our code base and hence an analysis of a chosen ETL was taken. Since the ETL services make heavy use of the Spring Batch framework, it makes an interesting scenario. •ETL job with REST. This scenario is that of an ETL service connecting with services exposed by our Integration service. This is also a repeatable scenario within our code base and checks the code coverage of both the ETL Batch admin module and the Server Web Module. •The Pipeline. This covers the automated publication pipeline as described in 5.1.2 The idea is to show the amount of code written vs reusing existing open source libraries for the same task, and hence the corresponding decrease and savings in the development effort. The results of this analysis as shown in tables. 7.4 Total Interfaces 25 Total Classes Written 159 classes written used Library classes used %age ETL JOB 20 1339 1.493652 ETL JOB with REST 11 1430 0.769231 Automated Pipeline 60 1416 4.237288 Table 7.4: Top : Total Classes Written Bottom : Code Written vs Reusing Libraries As can be seen from the table7.4, the effort, estimated as a percentage of the classes actually written vs the number of classes reused from different libraries, is minimal ranging from 0.7% to 4.2%. There is some effort involved in learning the API of the different libraries but considering that the library classes can provide reusable code of upto 90% shows a significant savings in development effort. 76
7.6 Discussion 7.6 Discussion The above evaluations lead to the following conclusions related to our assessment of our architecture. The architecture is highly loosely coupled as is evident with the lowest coupling levels achieved as described in the table 7.2. The system has a fair degree of reusability as described in the section 7.4 with a high degree of internal module reuse and several modules supporting external RESTful interfaces. The system performs well under a heavy and parallel load execution and the throughput of the system is acceptable. The system uses a considerable amount of frameworks and external libraries and as such the development effort to develop the system was fairly reduced. 77
7. EVALUATION 78
8 Conclusions The conclusion of the thesis and current state of the implementation are provided in section 8.1 followed by future work. 8.1 Conclusions Event driven SOA is a paradigm in software development which helps develop architectures that are loosely coupled, protocol-independent, location agnostic, coarse grained amongst other characteristics. This thesis presents the architecture, design and implementation and working of an event driven SOA for services pertaining to the dissemination of geothermal data. This thesis uses Spring Integration to develop the integration bus and relies on the Spring framework for dependency injection and ETL Services. Multiple Services are exposed on the integration bus and can be consumed by other services . The current implementation supports the uploading of various document formats which are pushed into an automated pipeline on the integration bus which routes and filters the messages to services which process or consume these messages and then push them back on the integration bus. Experiments carried out on the deployed architecture showed that the system was loosely coupled, had a high level of reusable components and the throughput of the system developed was unaffected by the messaging overhead of the underlying integration bus. 79
9. APPENDIX Figure 9.5: Services Adminstration - User interface for monitoring documents and services. 86
9.2 User Screens Figure 9.6: Spring Batch Administration - The user interface for the File Upload Service. 87
9. APPENDIX Figure 9.7: Spring Batch Administration for Jobs - The user interface for the File Upload Service. 88
9.2 User Screens 4. ETL Administration The figure 9.6 shows the name of the jobs registered in the system. On clicking any of the jobs, the the detailed executions of the jobs are show as in figure 9.7. 5. CWS The figure 9.8 shows the user interface exposed by Geoportal. The right Figure 9.8: Catalog Service - The user interface for the Catalog Service exposed by Geoportal. of the central panel shows the Catalog and the left panel allows a user to search within the Catalog. 6. WFS The figure 9.9 shows the user interface exposed by GeoServer and developed using Open Layers. The locations on the map fetch the data associated with their respective points. This data when clicked upon shows the relevant data available for that location. 89
9. APPENDIX Figure 9.9: WFS Service - The user interface for the WFS service exposed by GeoServer. 7. Search The fig 9.10 shows the user interface for Search. This search interface Figure 9.10: Search Service - The user interface for the Search service exposed by Solr. does a full text search on the documents indexed in Solr and then collaborates those results to index into the database to fetch the relevant documents. 8. Work List The fig 9.11 shows the conceptual worklist screen. An item would appear on a user’s worklist tracked to the document it is associated with using the UUID. The user can then change the state of the item or if has sufficient permission assign to another person. 90
9.2 User Screens Figure 9.11: Worklist Concept Screen - The user interface for the Worklist concept Service. 91
9. APPENDIX 92
List of Figures 2.1 Message.................................... 7 2.2 MessageChannel............................... 7 2.3 MessageEndpoint .............................. 8 2.4 Transformer.................................. 8 2.5 Filter ..................................... 9 2.6 HeaderEnricher ............................... 9 2.7 Router..................................... 9 2.8 Splitter .................................... 10 2.9 Aggregator .................................. 10 2.10ServiceActivator............................... 11 2.11ChannelAdapter............................... 11 3.1 ContextDiagram............................... 14 3.2 UseCase ................................... 16 4.1 SOA...................................... 19 5.1 SOA Application Design . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 5.2 AgenericModule............................... 33 5.3 FileSystemSchema ............................. 41 5.4 IntegrationSchema.............................. 41 5.5 CoreSchema ................................. 42 5.6 StagingSchema................................ 43 5.7 ETLSchema ................................. 44 5.8 GeoportalSchema .............................. 45 5.9 SecuritySchema ............................... 46 93
LIST OF FIGURES 5.10WorkflowSchema............................... 46 6.1 Message Handler Chain . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 6.2 JDBC Inbound Apapter . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 6.3 Chain ..................................... 53 6.4 TransformToUUID ............................. 54 6.5 HeaderRouter ................................ 55 6.6 FileDetection................................. 56 6.7 FileDetectionChain............................. 57 6.8 Validate Publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 6.9 Validate PublicationsChain . . . . . . . . . . . . . . . . . . . . . . . . . 59 6.10LoadBibliography .............................. 60 6.11SOLRPublisher ............................... 61 6.12 SOLR Publisher Chain . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 6.13GeoportalPublisher ............................. 63 7.1 ModuleCoupling............................... 70 7.2 Throughput of the system using the Mock Service . . . . . . . . . . . . 73 7.3 Box Plot for the time executions through the Mock Service . . . . . . . 73 7.4 Throughput of the system using Spring Integration . . . . . . . . . . . . 74 7.5 Box Plot for the time executions using Spring Integration . . . . . . . . 74 7.6 ServiceReusability.............................. 75 9.1 InitialInvestigation.............................. 82 9.2 Implementation................................ 83 9.3 FileSystemBrowser ............................. 85 9.4 FileUploadPopUp ............................. 85 9.5 Services Adminstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 9.6 Spring Batch Administration . . . . . . . . . . . . . . . . . . . . . . . . 87 9.7 Spring Batch Administration for Jobs . . . . . . . . . . . . . . . . . . . 88 9.8 CatalogService................................ 89 9.9 WFSService ................................. 90 9.10SearchService................................. 90 9.11 Worklist Concept Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 94
List of Tables 7.1 CouplingLevels................................ 71 7.2 Pair Wise Coupling levels from Fenton and Melton Definition table 7.1 . 72 7.3 Top : Pair Wise Coupling levels from Fenton and Melton Definition table 7.1 Middle : Pairwise coupling values using formula 7.1 Bottom : Calculation results for coupling of the sytem. . . . . . . . . . . 72 7.4 Top : Total Classes Written Bottom : Code Written vs Reusing Libraries . . . . . . . . . . . . . . . 76 95