=Paper= {{Paper |id=None |storemode=property |title=Applying MDA in Developing Intermediary Service for Data Retrieval |pdfUrl=https://ceur-ws.org/Vol-920/p25-boberic-krsticev.pdf |volume=Vol-920 |dblpUrl=https://dblp.org/rec/conf/bci/Krsticev12 }} ==Applying MDA in Developing Intermediary Service for Data Retrieval== https://ceur-ws.org/Vol-920/p25-boberic-krsticev.pdf
            Applying MDA in Developing Intermediary Service
                           for Data Retrieval
                                                             Danijela Boberić Krstićev
                                                              University of Novi Sad
                                                                Faculty of Sciences
                                                        Trg Dositeja Obradovića 4, Novi Sad
                                                                      Serbia
                                                                  +381214852873
                                                                 dboberic@uns.ac.rs

ABSTRACT                                                                               through a well-defined notation.
                                                                                       MDA separates the business logic from the complexity of the
In this paper, service for data retrieval from existing library
                                                                                       execution platforms. This separation is done through the efficient
management system is described. This service intermediates
                                                                                       use of models in the software development process where
between library management system which provides data and
                                                                                       enterprise architectures are supported by automated model
system which requires that data. The main idea is that this service
                                                                                       transformations. In order to represent abstract view of the system
should support various protocols for data retrieval. Also, this
                                                                                       various modelling standards (Unified Modelling Language (UML)
service should be flexible for future update and simple enough for
                                                                                       [17], the Meta-Object Facility (MOF)[14] and the XML Metadata
integration into any library management system. Service
                                                                                       Interchange (XMI)[19]) are used.
presented in this paper is developed by using Model Driven
Architecture (MDA) approach. Different models (proposed by                             The Model-Driven Architecture has been proved as a very
MDA) of this service are presented in this paper. Models are                           promising approach to accelerate the software development and
presented by using UML 2.0 specification. Transformations from                         there are many papers describing usage of MDA in software
models to Java programming code are done by using AndroMDA                             development. MDA approach can be applied in any phase of
framework.                                                                             software development. For instance, in the paper [7] MDA is
                                                                                       applied to create graphical user interface (GUI) of the Amazon
Categories and Subject Descriptors                                                     Integration and Cooperation Project for modernization of
D.2.11 [Software Engineering]: Software Architectures – Data                           hydrological monitoring. In that paper, GUI source code is
abstraction                                                                            generated from UML models by using the AndroMDA framework
                                                                                       [1]. Also, MDA approach is used in the process of building a
General Terms                                                                          healthcare enterprise information system on Java 2 enterprise
Design, Standardization                                                                edition (J2EE) platform. The process of developing such system is
                                                                                       described in the paper [15]. In the paper [8], a method that uses
Keywords                                                                               the model transformation technology of MDA to generate unit test
Model-driven architecture, web services, AndroMDA, inform-                             cases from a platform-independent model of the system is
ation retrieval                                                                        presented. The main idea of that method is to first create UML
                                                                                       sequence diagrams which will be transformed into a general unit
1. INTRODUCTION                                                                        test case model and then transformations are applied on that
Model-driven architecture (MDA) is a software design approach                          general model to generate platform specific (JUnit, SUnit etc.) test
for the development of software systems. The aim of MDA is to                          cases that are concrete and executable. Moreover, using MDA
enhance interoperability, portability and productivity of                              approach provides benefit to the development of system which
computing systems by means of abstract models [9]. Using MDA                           solves its problems with cooperative organization consisting of
MDA it is possible to create design of system which is                                 several heterogeneous computing components and in the paper
independent of its implementation. As result of using MDA                              [11] is proposed the development process of the multi-agent
approach we get models that become highly reusable assets.                             community computing system using MDA approach.
Models play a major role in MDA and main idea of MDA is to                             In this paper, different models and the standards behind the MDA
create different models at different levels of abstraction. Some of                    are introduced. These concepts are applied in the developing
models may be independent of software platforms, while others                          service for bibliographic record retrieval, following the
will be specific to particular platforms [13]. Precisely, the                          AndroMDA methodology to demonstrate how logic
Computational Independent Model (CIM), the Platform                                    implementation can be reduced to the minimum when core
Independent Model (PIM) and the Platform Specific Model (PSM)                          business functionality is addressed during the modelling phase.
are the three model types that have been largely adopted by the                        The presentation of this paper proceeds in five sections. At the
software community. For every development life cycle phase of                          beginning of the paper, we described main functionalities of
an application, MDA suggests to elaborate a corresponding model                        service for bibliographic record retrieval. Those functionalities are
                                                                                       presented through computation independent model. After that, we
                                                                                       continued by presenting platform independent model of service
BCI’12, September 16–20, 2012, Novi Sad, Serbia.
Copyright © 2012 by the paper’s authors. Copying permitted only for private and        for record retrieval. In the fourth Section we discussed
academic purposes. This volume is published and copyrighted by its editors.            programming code which is generated by AndroMDA framework.
Local Proceedings also appeared in ISBN 978-86-7031-200-5, Faculty of Sciences,
University of Novi Sad.



                                                                                  25
At the end of the          paper,     we   gave   brief summary of          actors on the use case diagram. Integration of client side of
the paper's main points.                                                    protocol should not be a difficult, but implementation of server
                                                                            side of protocol requires much more effort. In order to integrate
2. COMPUTATION INDEPENDENT                                                  server side of a protocol it is necessary to process massage which
MODEL                                                                       is sent through that protocol. A massage contains query defined
                                                                            by query language supported by the protocol and that query
In order to build a large-scale software it is necessary that all           language is independent of underlying system, so it is necessary to
requirements are clearly defined, so the OMG recommends                     transform that query into query which could be understood by
defining a computation independent model (CIM) in order to                  underlying system. Also, in order to provide interoperability it is
represent the application in its global environment. The CIM                necessary that data are exchanged in some standard form, so
model describes what the system is expected to do, but hides all            system which implements server side of some protocol must
details of the system’s structure to remain independent of how that         supply mechanism for transformation data in appropriate form. If
system will be implemented. In the field of software engineering,           system would like to support communication through different
CIM is well known as a domain model created by domain experts.              protocols, then those tasks must be done for each protocol.
CIM model may describe system functionalities through
application of use case and activity diagrams and the actors that           The main aim of service presented in this paper is to enable
interact with the system. The CIM model should act as a                     simpler implementation of various protocols for data retrieval.
connector between those that are experts about the domain and               Namely, service should support search and retrieve of data no
those that are experts of the design and construction.                      matter which protocol is used. This functionality is presented by
                                                                            the use case Find records in the figure 1. Furthermore, this service
CIM model of service for bibliographic record retrieval is                  will accept massages from different protocols and transform
presented in the figure 1.This service should act as an                     queries into CQL query language [3] (use case Transform to CQL
intermediary between search protocols and existing library                  query). After query transformation, query will be sent to
system. The main aim of this service is to enable search and                appropriate components (wrappers) which are responsible for
retrieval of data from various libraries using different standard           transformation of CQL query into a query language supported by
protocols for search and retrieval. Currently, the most known               underlying system. For instance, wrapper may be responsible for
protocols for searching bibliographic data are Z39.50 [5] and SRU           transformation of CQL language into SQL language in accordance
[16] protocols. Those protocols should provide interoperable                with architecture of database of underlying system.
communication between different library management systems.
Namely, one system may search and retrieve data from other                  This task is represented with use case Delegate CQL to wrapper.
system without knowing software architecture of that other                  Every underlying system should have its own wrapper, and
system. It is only necessary that both systems have                         wrapper is not part of service presented in this paper. After
implementation of client and server side of appropriate protocol.           executing query and retrieving data from library management
There are ready-to-use open source solutions for client and server          system, the final task of this service will be to transform retrieved
side of Z39.50 and SRU protocols and they just need to be                   records into form supported by protocol through which query is
integrated in an existing library management system. In the figure          sent (use case Transform record).
1, a server side of Z39.50 and SRU protocols are presented as

                                                                                     Transform query
                                                                                          to CQL
                        SRU Server
                                                                  <>


                                                        Find records
                                                       extension points
                                                      record is found             <>
                                                                             (record is found          Transform record
                                                                                     )
                      Z39.50 Server
                                                                       <>




                                                                  Delegate CQL query
                                                                      to wrapper



       Figure 1: Computation independent model of service for bibliographic records retrieval.




                                                                       26
3. PLATFORM INDEPENDENT MODEL                                              implement interface QueryConverter shown in the Figure 2, but
                                                                           architecture of service remains the same.
After we got the CIM model of software, the next step in software
development using MDA approach is to create platform                       One of the reasons for choosing CQL query language as a query
independent model (PIM). The platform independent model                    that will be forwarded to library system is that concepts defined in
should be considered as independent from the underlying                    the Z39.50 standard query language could be easily mapped to the
technology and should give only a view of the system regardless            corresponding concepts defined by CQL query language. CQL
on execution platform. In other word, PIM is model of system               query language has very rich semantic, so it could be used for
designed in such way that it can execute on technologically                creating various types of queries. Also, because it is based on the
independent virtual machine [6]. However, the PIM model must               concept of Context set, it is extendable and it allows usage of
contains enough information in order to enable code generation             various types of Context sets for different purposes. So, we don’t
using appropriate CASE tool.                                               need to use CQL just for the purpose of searching bibliographic
                                                                           material it could be, for example, used for searching geographical
PIM model for service for bibliographic records retrieval is given         data. According to those facts, we assumed that CQL is general
in the figure 2. The Mediator class provides a unique interface to         query language and that probably any query language could be
communicate with different server components that implement the            transformed in it. In the case that there is a new query language, it
appropriate protocols. This class accepts query from server side of        is necessary to perform mapping of this new query language into
protocols and returns bibliographic records in the format which is         CQL query language or if it is not feasible to extend the object
defined by server. In this way it is enabled that regardless of            model of CQL query language with new concepts.
protocol which is used, we always use the same method to submit
query and retrieve search results. That means that our system              The next tasks of this service is to return records in the format
becomes more scalable and it is possible to add some new search            which was defined by the client which sent request, and this task
and retrieval protocols without refactoring this service.                  is delegated to the RecordSerializer interface. Bibliographic
                                                                           records which are retrieved after executing query should be in the
The Mediator class can accept queries defined by different query           form of an XML document.
languages and all those queries should be transformed in an
internal query language which will be further forward to wrapper           Current implementation of service should support transformation
components. The QueryConverter interface is responsible for                of bibliographic records into XML document which can be
transformation of query. This interface has two implementation             instance of UNIMARCslim XML schema [18], MARC21slim
classes: CQLConverter and RPNConverter. In this implement-                 XML schema [12] or Dublin Core XML schema [4] and because
ation, it was chosen that accepted queries will be transformed into        of that currently there are three classes which implement interface
object representation of CQL query language which is defined by            RecordSerializer (UnimarcSerializer, Marc21Serializer and
SRU standard. If we are going to add support for new query                 DublinCoreSerializer). Adding support for new format would
language it is necessary just to add new class which will                  require creating a new class which would implement interface
                                                                           RecordSerializer.




          Figure 2: Platform independent model of service for bibliographic records retrieval.

                                                                      27
4. ANDROMDA AND CODE GENERATION                                           package which is mapped to a schema namespace, so that an .xsd
                                                                          file is created for this package and imported by the wsdl files that
Once the platform independent model has been accurately                   reference the schema. The default values for style and use of web
defined, platform specific details can be handled in the platform         service are wrapped and literal, respectively, but using tagged
specific model (PSM). The role of PSM model type is to ease               values                andromeda_webservice_style                and
code generation that fit the underlying execution platform. MDA           andromeda_web_service_use those values can be changed.
suggests using UML profiles to create language-specific code
models. For example, an UML profile for a Java EE platform                AndroMDA does not require using any specific UML tool but it is
allows code models creation that ensures Java EE development              necessary that PIM model can be exported as XMI document. For
after code generation.                                                    creating PIM model for this service we used MagicDraw case tool
                                                                          [10] version 16.6, which support exporting UML model into XMI
However, this step can be skipped by using AndroMDA [1]. This             format. When PIM model is completed, we can start code
is an open source, Java-based tool supporting model driven                generator and following documents are created:
development. It has an open and pluggable design, such that many
of its components can be extended easily. The core concept of                  •    Mediator.wsdl and intermediary.xsd document – WSDL
AndroMDA is the use of so called cartridges. A cartridge                            document which describes web service and XML
describes the transformation rules from PIM over PSM to                             schema document describing data types.
implementation code. AndroMDA is mostly used by developers                     •    MediatorSEI.java -the service endpoint interface (SEI)
working with J2EE technologies. Out-of-the-box AndroMDA can                    •    MediatorSEIImpl.java -the class which implements the
setup a new J2EE project from scratch, in which code is generated                   SEI
from a UML model.                                                              •    MediatorSEIImplTest.java -         UnitTest for the
In order to transform model into programming code, AndroMDA                         MediatorSEIImpl (does not require deployment to web
requires usage of stereotypes and tagged values which will be                       service container/runtime)
considered during the process of code generation. Choosing                     •    MediatorWSDelegate.java - the class that the
appropriate stereotypes and tagged value AndroMDA can                               MediatorSEIImpl delegates to, for each method
generate code for Hibernate, EJB, Spring, WebServices, and                          implementation
Struts. Also, it is necessary to have installed Java 2 Virtual                 •    GetRecordsImpl.java –           the class that the
Machine (Java 2 SDK), at least version 1.5, and Maven or Ant. It                    MediatorWSDelegate delegates to. For each operation
is recommended to use Maven because most of the AndroMDA                            of web service one class is generated. This class should
tools come with a Maven plugin.                                                     contain actual implementation of web service.
After environment is set up, the next step is to use AndroMDA to               •    Mediator_WSClient.java - Java service client which
create empty project for chosen technology. That project can be                     calls each web service.
later imported into integrated development environment, such as           After implementing business logic of web service, this service
Eclipse. The most significant sub-directories in the project              could be deployed on any runtime environment, like a JBoss.
structure are as follows:                                                 AndroMDA creates build files which will be used in process of
                                                                          deployment and developer does not need to think about that.
    •    /mda/src -where the UML model file is
         located.                                                         5. CONCLUSION
    •    /mda/conf -where the AndroMDA engine
         configuration file is located.                                   In this paper, we presented the development of an illustrative
    •    /core/target -where the code generator               example of service for information retrieval using different
         places most of the resulting files. Those files will be          protocols based on applications of a Model-Driven Architecture
         overwritten on subsequent runs of the code generator so          (MDA) approach. Our main idea was to present usage of
         we should not make any modifications to them.                    AndroMDA framework in generating programming code based on
    •    /core/src -source files that require manual          UML models.
         implementation go here. Files in this directory will not
                                                                          In this paper, we described functionality of service through
         be overwritten on subsequent runs of the code
                                                                          computation independent model and then we presented
         generator.
                                                                          architecture of service through platform independent model. Our
This service for data retrieval is implemented in Java                    idea was to implement that service in Java programming language
programming language and it is implemented as XML Web                     as XML web service and AndroMDA provide mechanism for
Service using CXF JAX-WS framework [2], so those options                  generating such code. It is just necessary to use appropriate
must be specified when AndroMDA creates initial project.                  stereotypes and tagged values in the process of modelling.
Furthermore, elements of the PIM model described in the previous          AndroMDA has specific UML profile containing all stereotypes
section should have stereotypes describing which class will be            and tagged values needed for web services modelling.
transformed into web service. AndroMDA has its own UML
profile which should be used when it comes to modelling of web            It is general impression that AndroMDA framework can generate
service. Namely, class which is going to be web service must have         application which could be deployed on some runtime
stereotype <> and its operations which will be                environment, but still it is expected that developers must
exposed as web service operations must have stereotype                    implement business logic by themselves. AndroMDA could be
<>. In the figure 2, class Mediator and              very useful to less seasoned developers because they do not need
its operation getRecords(String query, String format):String[] has        to think about software architecture. That task can be delegate to
those stereotypes. Also package containing Mediator class must            AndroMDA.
have stereotype <>. This stereotype defines a



                                                                     28
6. ACKNOWLEDGMENTS                                                      [9] Kleppe, A., Warmer J. and Bast, W., 2003, MDA Explained:
The work is partially supported by Ministry of Education and                The Model Driven Architecture—Practice and Promise,
Science of the Republic of Serbia, through project no. OI174023:            Addison-Wesley Professional.
"Intelligent techniques and their integration into wide-spectrum        [10] MagicDraw case tool, https://www.magicdraw.com/
decision support".
                                                                        [11] Maalal, S., Addou, M., 2011, A new approach of designing
                                                                             Multi-Agent Systems, International Journal of Advanced
7. REFERENCES                                                                Computer Science and Applications, Vol. 2, No. 11.
[1] AndroMDA, http://www.andromda.org
                                                                        [12] Marc21Slim XML Schema,
[2] Apache CXF: An open-source services framework,
                                                                             http://www.loc.gov/standards/marcxml/schema/MARC21sli
    http://cxf.apache.org/
                                                                             m.xsd
[3] CQL – Contextual Query Language,
                                                                        [13] Mellor, Stephen J., Scott, K., Uhl A., Weise, D., 2004, MDA
    http://www.loc.gov/standards/sru/specs/cql.html
                                                                             Distilled: Principles of Model Driven Architecture, Addison-
[4] DublinCore XML Schema,                                                   Wesley
    http://www.loc.gov/standards/sru/resources/dc-schema.xsd
                                                                        [14] Meta-Object Facility, http://www.omg.org/spec/MOF/2.4.1/
[5]    Information Retrieval (Z39.50): Application Service
                                                                        [15] Ramljak, D. Pukšec, J., Huljenić, D., Končar, M., Šimić, D.,
      Definition and Protocol Specification,
                                                                             2003, Building enterprise information system using model
      http://www.loc.gov/z3950/agency/Z39-50-2003.pdf
                                                                             driven architecture on J2EE platform, in Proceedings of the
[6] Gašević, D., Đurić, D., Devedžić, V., 2006, Model driven                 7th International Conference on Telecommunications, IEEE,
    architecture and ontology development, Springer                          pp. 521–526.
[7] J. de Almeida Monte-Mor, Ferreira, E.O., Campos, H. F.,             [16] SRU – Search/Retrieval using URL,
    Marques da Cunha, A., Vieira Dias, L. A. ,2011, Applying                 http://www.loc.gov/standards/sru/
    MDA Approach to Create Graphical User Interfaces, Eighth
                                                                        [17] Unified Modelling Language, http://www.uml.org/
    International Conference on Information Technology: New
    Generations, Las Vegas, Nevada, USA                                 [18] UNIMARCSlim XML Schema,
                                                                             http://www.bncf.firenze.sbn.it/progetti/unimarc/slim/docume
[8] Javed, A. Z., Strooper, P. A. and Watson, G. N., 2007,
                                                                             ntation/unimarcslim.xsd.
    Automated generation of test cases using model-driven
    architecture, In AST’07, page 3, Washington, DC, USA,               [19] XML Metadata Interchange,
    IEEE Computer Society.                                                   http://www.omg.org/spec/XMI/2.4.1/




                                                                   29