You are on page 1of 6

www.seipub.

org/ijc

International Journal on Communications (IJC) Volume 2 Issue 4, December 2013

Design and Implementation of a Graph


Configuration Software Based on SCA
Shi Xiaotian, Yahui Zhang, Cheng Bo, Chen Junliang
State Key Laboratory of Networking and Switching Technology
Beijing University of Posts & Telecommunications
Beijing 100876, China
cheerholics@gmail.com; zhangyahuitony@gmail.com
Abstract
Traditional graph Configuration software is usually designed
with a closely combination of industrial protocols, which
makes it lack of portability and the loosely-coupled attribute.
In order to solve the problem above, a new solution was
proposed in this paper. With SCA to provide implementations of service and MVC-mode to composite data-serviceview, this solution was designed to decouple business from
user interface and to promote the reusability of services and
views. Three core sections (data layers, service layers, view
layers) were designed to implement it. A demo has been in
use in the field of a heating system.
Keywords
Graph Configuration; SOA; SCA

Introduction
Graph Configuration software designed to monitor
and control sensor devices is basically used in all fields
of industry information, such as electricity and coal.
On the one hand, with the diversity of industrial
control protocol diversity, graph configuration
software is divided into two different kinds. One is
closely integrated with industrial control protocol,
which is mainly developed by the hardware vendors;
while the other is completely detached from industrial
control protocol, which can be used in different sorts of
data source. On the other hand, apart from industrial
control protocols, traditional graph configuration
software can only be applied to specific areas without
business and cant cope with various changing
demands flexibly. In the same time, with the
development of Internet-of-Things, the demand of
graph configuration software with great versatility and
portability is increasing. So it is an urgency to find a
solution to suit the case above.
Service-Oriented Architecture (SOA) is an architectural
approach that improves business agility by building
systems with reusable, and loosely coupled services.
Service-Component Architecture (SCA) is considered
122

as the most important implementation way of


enterprise SOA (Service Oriented Architecture) solution,
which occupies an important position in the field of
computing service. SCA, which is based on the
following theory: a single business provided as a
service, and combination of a series of different
services as a solution to meet concrete business needs,
provides a programming model for building SOA
applications and solutions. With this programming
model, a new service can be created to meet new needs,
and also services which have been created can be used
both in original fields and new fields as a component
so as to promote the reusability.
This paper proposed a solution to accomplish a design
and implementation of graph configuration software
with the following two attributes, one of which is to
promote the convenience of creating new services and
the reusability of original services in graph configuration
software, which is solved with SCA; while the other is
to decouple the concrete business layer with the
presentation layer, which makes the service be used in
different views, with the support of MVC (modelview-controller) design pattern.
In this paper, section 2 introduced the advantages of
this design and implementation. And section 3
described how to design and implement graph
configuration software with SCA and MVC in different
parts. Section 4 described the overall implementation
briefly. Section 5 gave the conclusion and future work.
Design Based on SCA and MVC
Traditional graph configuration software is usually
implemented with a mode that couples business logic
and UI tightly, in which users spend a lot of time and
energy focusing on the UI design repeatedly. Even
some software combines the data source with the
business logic, which causes a serious decline of the
reusability of business logic and UI presentation. With

International Journal on Communications (IJC) Volume 2 Issue 4, December 2013

the reasons above, a solution to decoupling business


logic and large-grained integration of UI is proposed.
With SOA applied to wider areas, stability and
availability of SOA have been proven. As an important
branch of SOA, SCA can be used to decouple business
logic and promote the versatility and convenience of
the software. In the process of design, the graph
configuration based on SCA, the MVC mode is selected
to decouple data layers, business logic layers and UI
presentation layers, as shown in Figure 1.
View
Library of graphics

www.seipub.org/ijc

business logic can be used in the graph configuration


software. At the same time, a common interface of a
service is provided for extensions and different
implementations. Also, local invocation interfaces and
remote invocation interfaces are provided for different
network environments. An interface for the integration
of business logic and UI presentation is provided in
order to bind different UI for the same business logic,
which makes different business logic decoupled from
different UI presentation for better reusability. The
frame of the business layers is designed as the
following figure.

Library of pictures

Service

s
e
c
i
v
r
e
s

d
n
a
r
e
w
e
i
v

f
o
g
n
i
d
n
i
B

Composites of
graphics and/or
pictures

Data

Data from
database

O
A
D

e
c
i
v
r
e
S
a
t
a
D

Conponent of Services

FIGURE 2 DESIGN OF BUSINESS LAYERS WITH SCA

Data from
publish-subscribe
system

FIGURE 1 DESIGN OF THE ARCHITECTURE OF THE GRAPH


CONFIGURATION SOFTWARE

In data layers, data is designed from the following two


ways: traditional relational database and middleware.
1.

2.

With a traditional relational database, SQL and


transaction management can make the query
easier and the update action with the guarantee
of ACID. At the same time. Providing an
interface of relational database is to provide a
shortcut of the migration and integration of
data from the original system to the new system.
With middleware (such as publish-subscribe
system), data can be accessed from different
systems, even the distributed systems. Also, clusters
can be used in publish-subscribe systems in order
to fix the problem of excessive concurrent data.

In business logic layers, services based on SCA


components are applied to the design of the system.
The services based on components should be
registered and published in the server so that the

In UI presentation layers, vector graphics are used to


avoid distortion in the process of scaling. The assessment of dynamic images GIF is provided to achieve
richer effects. A combination of a variety of graphics
and pictures is offered to achieve greater granularity of
presentation; and then encoded separately in order to
ensure a binding with business logic in such a
granularity of views for a better reusability and
pressing loser to the concrete business scenario.
Design and Implementation of Data Layers
As mentioned above, data source are composed of two
parts. One is from traditional relational database. The
other is from middleware system. On the one hand,
with the help of JDBC, the access of traditional
relational database can be easily accomplished. In
addition, taking the publish-subscribe system as an
example of middleware, receiving data from publishsubscribe system needs a publish-subscribe system. In
this software, servicemix is chosen to be the publishsubscribe server. To use servicemix as the publishsubscribe server, the following steps are taken:
1.

The interface INotificationProcess should be


implemented by the message subscriber class.
The method notificationProcess is used to receive
asynchronous data from the servicemix server,
123

www.seipub.org/ijc

International Journal on Communications (IJC) Volume 2 Issue 4, December 2013

when messages are sent by publisher.


2.

The class in which the interface above is


implemented should be published to the
servicemix server and registered as a subscriber
in order that the server can send data to it when
some publishers give the data messages related.
A java annotation can be applied here to
provide a way to publish the class.

Design and Implementation of Service Layers


As the core part of MVC, controller is used to deal
business logic and bind data layers and view layers.
According to the standard of SCA and the need of
business logic, controllers are implemented following
the steps below.
1.

Design the interface and implementation of


services. POJOs are used as the interfaces, with
SCA service component architectureJava common
annotation and APIs. Implementation is
involved with the concrete business logic.

public interface Service {


public void invoke(mxGraphComponent graphComponent,
mxICell cell,Object[]objects);
public void mousePressed(MouseEvent e);
public void mouseClicked(MouseEvent e);
public void mouseReleased(MouseEvent e);
public void mouseEntered(MouseEvent e);
public void mouseExited(MouseEvent e);
}

2.

Register of services. Services are registered in


the service.composite file. All the components,
services and implementations should be given in
the file, in order to publish in the server correctly.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>


<composite
xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:s="http://store"
xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
name="http://kingforeDrawBUPT"
targetNamespace="http://kingforeBUPT">
<component name="displaySystemTime">
<implementation.java
class="generate.DisplaySystemTimeService"/>
</component>
<component name="multiValueCells">
<implementation.java class="generate.MultiValueService"/>
</component>
<component name="senseService">
<implementation.java class="generate.SenseService"/>
</component>
</composite>

3.

124

Provide the composite of service. With the help


of Dependency Injection, services can be added to
other service, which can combine a new service
as a composite of services. Some complex
business logic can be implemented in this way.

4.

Publish services. As registered in the service.composite


file, services are published in this step so that
all the invokers can find and invoke the services.

SensorRouter.getSensorInstance().publish();
SensorRouter.getSensorInstance().
createSendCommand
(SensorRouter.getSensorInstance().getMonitorLocalAddress(),
ConfService.getMonitorReceiveAddr());
SensorRouter.getSensorInstance().
subSubscribeSensor("Monitor",
SensorRouter.getSensorInstance().getMonitorLocalAddress());

5.

Invoke services. After published, all the


services can be assigned to the views that need
the business logic. Services invokers can find all
the services through the composite file, and
bind and invoke it.

Design and Implementation of View Layers


As different business conditions need different UI and
simple UI cannot meet the need of real conditions, it is
necessary to combine different UI part as a whole to fit
different business conditions. In the design and
implementation of UI layers, the way to be coded and
saved as a independent XML file is chosen to
accomplish the target above, in which the UI
component can be designed and displayed as a whole
part to support a large-scale control. Typical XML file
mentioned above is described as the following code.
<root>
<mxCell id="0">
<Array as="status"/>
</mxCell>
<mxCell id="1" parent="1" value="" vertex="1">
<Array as="status"/>
<mxGeometry as="geometry" height="90.0" width="105.0"
x="120.0" y="195.0"/>
</mxCell>
<mxCell id="4" parent="1" style="triangle" value="" vertex="1">
<Array as="status"/>
<mxGeometry as="geometry" height="120.0" width="120.0"
x="226.0" y="180.0"/>
</mxCell>

It is also important to bind the business logic and UI,


i.e. to combine service layers and view layers. After
that, a large-scale component can be made. With a lot
of components made, a service-view component
library can be formed. Different service-view libraries
can be used in varieties of industries. Whether a view
needs a data depends on the service the view binds to,
in which way the views can totally be separated from
the data layers. If the views needs a data to display, a
service which has a data-resource property should be
bound to, otherwise a service without a data-resource
property.

International Journal on Communications (IJC) Volume 2 Issue 4, December 2013

Design and Implementation of the Graph


Configuration Sotfware
In this paper, the graph configuration software was
used in a warming system, which has a quantity of
sensors to get the data of the boiler and other warming
device. In this system, a number of similar views and
business should be applied, in which case, the graph
configuration software in SCA and MVC mode
mentioned above in this paper was suitable. Among all
the services, data related was demanded most, such as
simple display of data directly, display of words
transformed from data, display of pictures and
composite of pictures based on data, display of
dynamic views based on data which contains two
types: always dynamic in different ways and only
dynamic in one condition and static in others, and so
on. Different design and implementation will be
introduced as follows.
The data layer is implemented based on two data sources.
One is traditional database, which can be connected
with the help of JDBC, a data service is designed and
implemented here in the software as follows:
h2connPool = new ConnectionPool
("org.h2.Driver","jdbc:h2:tcp://"+h2IP+h2DB,h2UserName,
h2Password, true);
h2connPool.createPool();

The other is a publish-subscribe system, which can be


applied to distributed heterogeneous systems. Another
data service is designed and implemented here in the
software as follows:
@WebService(
endpointInterface="org.apache.servicemix.wsn.push.INotificationProcess",
serviceName="INotificationProcess")
public class SensorRouter implements INotificationProcess {
SendWSNCommand sendCommand;
public void publish(){
Endpoint.publish(getMonitorLocalAddress(), sensorRouter);
}
public void createSendCommand(String localAddr,String wsnAddr){
sendCommand = new SendWSNCommand(localAddr, wsnAddr);
}
public void subSubscribeSensor(String topic,String localAddr){
try {
String response10 = sendCommand.createPullPoint();
String response11 = sendCommand.subscribe(topic);
}catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void notificationProcess(String notification) {
String sensor = getSensor(notification);
String value = getValue(notification);
SensorValue sensorValue = (SensorValue) sensorMap.get(sensor);
if(sensorValue != null){
setCellValue(sensorValue, sensor, value);
}

www.seipub.org/ijc

In the service layer, regular services are provided and


the service interface is open to the users, based on
which the users can extend personalized services. The
design fits the OPC (open-closed principle). Regular
services can meet the requirement of general business
logic. The class diagram is as follows:
Task
-belongToCengID
-currentCeng
-Identifier
-ParentTask

<<uses>>

<<interface>>
Service
+setValue()
+moveCell()
+mousePressed()
+getValue()
+invoke()

<<uses>>

CellEngine

ServiceAdapter

#graphComponent
#task
+mouseClicked()
+mouseEntered()
+mouseExited()
+mousePressed()
+mouseReleased()

+setValue()
+moveCell()
+mousePressed()
+getValue()
+invoke()

<<uses>>

Adaptor

MultiValueService

SensorService

SenseService

+setValue()
+moveCell()
+mousePressed()
+getValue()
+invoke()

+setValue()
+moveCell()
+mousePressed()
+getValue()
+invoke()

-graphComponent
+mouseClicked()
+mouseEntered()
+mouseExited()
+mousePressed()
+mouseReleased()

+setValue()
+moveCell()
+mousePressed()
+getValue()
+invoke()

FIGURE 3 CLASS DIAGRAM OF SERVICE LAYER

In the view layer, the way to design views is


completely open to the user. Users can combine simple
graph and pictures together to get a composite of
views in varieties of display styles, which can be used
in more appropriate application scenarios. Same
services can be bound to different views which provide
personalized views. In the same time, same views can
be used in different places repeatedly, which can
reduce the loss of repeating painting and improve the
work efficiency. In addition, unified primitive interface
mode for users to reduce the degree of coupling of the
scenes, users can make better use of existing entities for
secondary development and migration scenarios. The
following UI is designed for the user painting and
compositing views:

FIGURE 4 USER PAINTING UI

After compositing views, views should be bound to the

125

www.seipub.org/ijc

International Journal on Communications (IJC) Volume 2 Issue 4, December 2013

service to meet the business requirement. The


following sequence diagram describes what users
should do to bind the service layer and view layer
together to give a large scale design, in order to
improve development efficiency.

services selection, data binding, and binding services


to components of visualization. In the run-time module,
Java-based timing-task section is provided to support
run-time service invocations. A typical run-time effect
is as follows. It shows the basic graph in heating
system.
Conclusion and Futrue work

FIGURE 5 SEQUENCE DIAGRAM OF DRAWING AND BINDING


VIEWS TO SERVICES

Apart from the MVC design, the graph configuration


can be separated into four modules functionally. Each
part gives a series of ability to get the software running.
The following figure describes how the four modules
combine together.

This paper focused on the graph configuration, with


Internet of Things developing at a rapid pace. With
graph
configuration
putting
forward
higher
distributed and networked requirement, a wide range
of data sources and convenient visualization service
components will occupy an increasingly important
position. SOA-based service delivery and based on the
MVC design method will play an increasingly
important role in the future of graph configuration
development.
In the future, we will continue to research on the
presentation layer of Internet of Things, in order to
make it more extendable and reusable. Also, SOAbased applications using an SCA design model
integrated with runtime and infrastructure concerns
can be deployed in a cloud environment. We will
research on the cloud deployment of the graph
configuration with a distributed system.
ACKNOWLEDGMENT

FIGURE 6 MODULES OF THE GRAPH CONFIGURATION

This research was supported by the National Grand


Fundamental Research 973 Program of China under
Grant No. 2011CB302506, 2011CB302704; National Key
Technology Research and Development Program of
China Research on the mobile community cultural
service aggregation supporting technology" (Grant No.
2012BAH94F02); National High-tech R&D Program of
China (863 Program) under Grant No. 2013AA102301;
National Natural Science Foundation of China under
Grant No. 61001118, 61132001); Program for New
Century Excellent Talents in University (Grant No.
NCET-11-0592); Project of New Generation Broad band
Wireless Network under Grant No. 2011ZX03002-00201

FIGURE 7 RUN-TIME VIEWS OF THE GRAPH CONFIGURATION

In the system-function module, XML-based core


coding section and Swing-based display section are
provided to support file coding and basic display. In
the painting module, Java-Graphic-based graphic
section and external images importing section are
provided to support Visual effects for pages. In the
service module, service section is provided to support

126

REFERENCES

Chong-wei Xu and Jose Hughes, Realizing the Open-Closed


Principle, Computer and Information Science, 2005.
Fourth Annual ACIS International Conference, 2005
Cristian Ruz, Francoise Baude, Bastien Sauvan, Adrian Mos,
Alain Boulze, Flexible SOA Lifecycle on the Cloud using

International Journal on Communications (IJC) Volume 2 Issue 4, December 2013

SCA, 15th IEEE International Enterprise Distributed

Qingxiang Chu, Yongjun Shen, Zhang Jiang A Transaction


Middleware

Object Computing Conference Workshops, 2011


Fazilat Hojaji and Mohammad Reza Ayatollazadeh shirazi,

www.seipub.org/ijc

Model

for

Computer Science 2009.

Governance Framework Information Management and

SCA Service Component

on 2010.

Programming

International Workshop on Education Technology

Developing a More Comprehensive and Expressive SOA


Engineering (ICIME), The 2nd IEEE International Conference

SCA

First
and

Architecture, Java Common

Annotations and APIs, SCA Version 1.00. March 21 2007


Tuscany, http://tuscany.apache.org/

Florian Daniel and Maristella Matera, Jin Yu, Boualem

Youyu Chen, Yang Zhang, JunLiang Chen, A Graph

Casati,

Configuration Method Based on UI Service Composition,

Understanding UI Integration, Internet Computing,

Seventh International Conference on Mobile Ad-hoc and

IEEE (Volume:11, Issue: 3 ), May-June 2007

Sensor Networks 2011.

Benatallah,

and

Regis

Saint-Paul,

Fabio

127

You might also like