The Utility Web Applications for MetBroker

infestationwatchSoftware and s/w Development

Oct 28, 2013 (3 years and 10 months ago)

92 views

AFITA2006

5TH C
ONFERENCE OF ASIAN F
EDERATION
FOR

INFORMATION TECHNOLO
GY IN
AGRICULTURE

The Utility Web Applications for MetBroker


K
.
Tanaka
1


Abstract

MetBroker is a broker system

that

serves as

middleware between weather databases and users. It
enables

access
to
various weather databases through the
i
nternet by unified access method.

Seve
ral
plant growth models, disease and pest forecasting models
utilizing

MetBroker were developed

and
used
as a framework for
agricultural
model development.

There are also s
everal

utility Web applications for MetBroker

developed.

And s
ince there are
numerou
s

implementation
s such as Java
A
pplet, Java
Se
rvlet, JSP tag library, and Ajax,
a user
can
choose depending on
their

execut
ion

environment
.

All applications

can
be
carried out

on a
W
eb
browser.


Keywords
:
MetBroker, Web Application,
Java
, Ajax



Introducti
on

MetBroker

(
URL 1
)

is a broker system

that serves as

middleware between weather databases and
users.
By using
MetBroker as
the
weather data acquisition source
,

plant growth models, disease and
pest forecasting models

(
URL 2
)

will have

following advantage
s
:

1)

It can connect to as
many weather databases
as

MetBroker can connect

to
.

2)

Even if the databases which MetBroker can connect
to
increase or a connection method is
changed, it is not necessary to revise the program to use MetBroker.

Moreover, the framework

for
agricultural
model development

(
Tanaka 2004, 2006,

URL 3


which
can use MetBroker is provided

and released
.

The
application area
us
ing

the weather data acquired via MetBroker is not only for agricultural model
developed by the framework.

Then, functions, such as MetBroker connection, request generation, and
res
ult processing, were provided as various utility Web applications.

A

new application using weather
data can be developed by extending or calling such
Web
applications.

Since these are Web

1

K. Tanaka, Field Monitoring Research Team, National Agricultural Research Center, Tsukuba
Ibaraki 305
-
8666 Japan, tanaka.kei@affrc.go.jp


AFITA2006

5TH C
ONFERENCE OF ASIAN F
EDERATION
FOR

INFORMATION TECHNOLO
GY IN
AGRICULTURE

applications, they can be executed on a
W
eb browser.

Moreover, the s
tring
output by Web application

can be displayed in the language depending on the user's execution environment.

The resource of
English and Japanese is prepared by default.


Java Applet

/ Application

Java applet

(
F
igure 1)

exists from the time of a Java ap
pearance and

is one of the influential ways which
provides

a rich client
environment
on a
W
eb browser.

The
availability of several

Java APIs
(Application Program Interface) which include classes for GUI and network
allow the
easy

develop
ment of

an applicat
ion.

Since it is client side application, communication is unnecessary and the
response time is short after acquiring weather data.

However
,

i
t
requires

Java plug
-
in and
entail some
loading time.

The application can acquire weather data by operating the cl
ass for data holding of this
Web
application.


Java Servlet

Java Servlet (Fig
ure

2) is a server side application.

Servlet does not
spend

loading time

unlike Applet
.

In Servlet, when the user response is returned, it will be processed in a server and a resu
lt will be
returned as HTML or binary data such as an image.

Page changes need a screen update and the
response time may become long depending on the performance of a server and the communication
environment. Since the screen of
S
ervlet application
is
cons
truct
ed

using

HTML, it is difficult to give the
same operability as an applet.

But
equivalent GUI component
s

are

developed by us
ing

DHTML
(JavaScript

+

CSS)
.

In the case of
S
ervlet, the class for data holding is held
in

HttpSession.


Display
Customized

For

Cellular

P
hone


T
he
Web

application
for cellular

phone
is

the Servlet application whose output
is
adjusted

to the

cellular
phone
screen size
(Figure 3).

It can be
operated by arrow keys and
ten

key.

If an application can be
executed with a cellular phone,

a use scene will be expanded.


JSP Tag Library


In JSP
(JavaServer Pages)
, the code of Java can be embedded into HTML. When JSP is accessed
from a client, it will be processed
in

a server and be sent as HTML. JSP is mainly used to generate
HTML for displa
ying result data processed by Servlet.
JSP tag library provides the logic part of JSP as
a library of custom tag
s
. Since only a JSP tag is described in HTML and there is no logic part,
t
he role
of logic development and a desktop can be divided. The tag lib
rary for MetBroker can acquire
weather
data from MetBroker and display
it

as a chart by specifying ID and an element name with the attribute
of the tag (Figure 4).





XML

AFITA2006

5TH C
ONFERENCE OF ASIAN F
EDERATION
FOR

INFORMATION TECHNOLO
GY IN
AGRICULTURE

Utility value of XML as a general
-
purpose data format is high.
By outputting the dat
a acquired from
MetBroker by Servlet in XML form, the following XML data can be dynamically generated.



The list of weather databases which MetBroker can access.

http://g6450.narc.affrc.go.jp:8080/metbroker/sourcelist.xml?detail



The
list of weather stations

which
belong to

weather database NOAA and
exists in South India
.

http://g6450.narc.affrc.go.jp:8080/metbroker/stationlist.xml?source=noaa:430000&detail



Weather data acquired from MetBroker by specifying
the weather station
,
the interval
,
the

meteorologica
l element
s
, and
the
observation
resolution.

http://g6450.narc.affrc.go.jp:8080/metbroker/dataset.xml?source=noaa&station=432950&in
terval=2006/1/1
-
2006/1/10&element=airtemperature,rain,wind,humidity&duration=daily


Ajax


After Google Maps is released last y
ear, Ajax (Asynchronous JavaScript+XML) attracts attention.
Ajax is
a

technique
that
us
es

the asynchronous communication by XMLHttpRequest of JavaScript.

S
ince required data is acquired asynchronously
, a

screen display is not kept waiting until processing
of
data is completed
.

That
difference
in

behavior of JavaScript depending

on

web browsers increases the
trouble of development.

Google Maps (
URL
4
,
Figure 5) is used

i
n order to display and choose the
weather station which MetBroker treats
.


In the Servlet

version, t
he data acquired from MetBroker is embedded
in

HTML which builds a screen,
and is sent from a server.

In the Ajax version, the data
acquired
from MetBroker is
presented

as XML
data, and a screen is built by JavaScript on a client side.

Although
S
ervlet generates XML data,
it
doe
s

not
process

to build
a screen.

In

the Ajax version, the Web application which does not need page
changes for a screen update by asynchronous communication
and dynamical screen development by
JavaScript
can be developed.


The program which outputs the weather station data of MetBroker as XML data for Google Earth
(URL
5
) was devel
o
ped.

When

XML data is displayed by Google Earth (Figure 6) and the link in a
balloon is clicked, it can move to
an
existing

Web application.


Di
scussion

The utility Web
application
s that use Metbroker to access

weather data were developed.
T
he
application using Ajax
technology

shows the greatest potential for increase utilization in the future
because of
its

operability.
It seems that the response

time can be reduced i
f the data of MetSOAP
(Laurenson 2004) can be used as the data
for

Ajax application.





References

Laurenson, M. R., A. Yamakawa, H. Meng, T.Kiura, J.Wang and S. Ninomiya 2004. Integration of
Data Broker Web Services for Agricultural

Grid. Proc. AFITA/WCCA 2004. pp.433
-
438.


AFITA2006

5TH C
ONFERENCE OF ASIAN F
EDERATION
FOR

INFORMATION TECHNOLO
GY IN
AGRICULTURE

Tanaka, K. 2004. The Java Package for Developing Plant Growth Models, Disease and Pest
Forecasting Models.

Proc. AFITA/WCCA 2004. pp.765
-
768.


Tanaka, K
.

2006.
A Java Framework for Developing a Plant Growth and Di
sease Prediction Model
.
JSAI. 15(2):183
-
194.


URL 1: MetBroker.
http://www.agmodel.org/projects/metbroker.html


URL 2: Agricultural Models.
http://cse.naro.affrc.go.jp/ketanaka/model/


URL 3: Framework f
or
Agricultural M
odel
D
evelopment
.
http://cse.naro.af
frc.go.jp/ketanaka/model/help/development/


URL
4
: Google Maps API.
http://www.google.com/apis/maps/


URL
5
: Google Earth KML.
http://earth.google.com/
kml/


AFITA2006

5TH C
ONFERENCE OF ASIAN F
EDERATION
FOR

INFORMATION TECHNOLO
GY IN
AGRICULTURE

Figures



Fig
ure

1. The Java Applet version of MetBroker data viewer

h
ttp://cse.naro.affrc.go.jp/ketanaka/model/applet/MetBrokerDemo.html




Fig
ure

2. The Servlet version of MetBroker data viewe
r

http://g6450.narc.affrc.go.jp:8080/metbroker/


AFITA2006

5TH C
ONFERENCE OF ASIAN F
EDERATION
FOR

INFORMATION TECHNOLO
GY IN
AGRICULTURE


Fig
ure

3. The Cellular pho
ne version of MetBroker data viewer.

http://g6450.narc.affrc.go.jp:8080/metbroker
-
i/






Fig
ure 4. JSP Tag
Library

for MetBroker

and its example.

http://cse.naro.affrc.go.jp/ketanaka/model/servlet/metbroker
-
tag.zip



<% String interval = String.valueOf(Calendar.getInstance().get(Calendar.YEAR)
-

1) +
"/1/1
-
year"; %>

<mb:request source="
noaa
" station="
432950
" int erval="<%=int erval%>" element ="air t emperat ure" durat ion="daily" id="ID" />


<mb:chart align="left" imageOpt ion="hspace=
\
"20
\
"" id="ID" />


<mb:st at ion element ="source" id="ID" />

<mb:st at ion id
="ID" />

<mb:element id="ID" /><br />


<mb:int erval format ="<%=Dat eFormat.get Dat eInst ance()%>" id="ID" /><br />

<br />


AirTemp.(ave): <mb:value element ="air t emperat ure" format ="0.0" id="ID" /><br />

AirTemp.(max)
: <mb:value element ="air t emperat ure" summ
arize="maximum" id="ID" /><br />

AirTemp.(min)
: <mb:value element ="air t emperat ure" summarize="minimum" id="ID" /><br />

<br clear="all" />

Acquire weat her dat a from Met Broker

Show result as a chart

Show st at ion name and dat a int erval

Show av
e.,max. and min. air
t emp
erat ure

mb: t ag is for JSP t ag
library

AFITA2006

5TH C
ONFERENCE OF ASIAN F
EDERATION
FOR

INFORMATION TECHNOLO
GY IN
AGRICULTURE



Fig
ure

5
.
Map interface using Google
Maps

to select a weather station of MetBroker

and

the
example of XML for the weather stations in a map area.

http://g6450.narc.affrc.go.jp:8080/metbroker/mbmap.html




Fig
ure

6.

The Ajax version of MetBroker data viewer.

http://g6450.narc.affrc.go.jp:8080/metbroker/ajax.html



http://g6450.narc.affrc.go.j p:8080/metbroker/areastation.xml?area
=15,76,11,80


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

<stations>


<source id="noaa">



<name lang="en">noaa</name>



<region id="IN">




<name lang="en">India (S of 20 Deg N)</name>




<station id="432370">





<name lang="en">ANANTAPUR</name>





<place alt="350.00" lat="14.68" lon="77.61"/>




</station>




<station id="432450">





<name lang="en">NELLORE</name>





<place alt="20.00" lat="14.45" lon="79.98"/>




</station>




<station id="432330">





<name lang="en">CHITRADURGA</name>





<place alt="733.00" lat="14.23" lon="76.43"/>




</sta
tion>




<station id="432950">





<name lang="en">BANGALORE</name>





<place alt="921.00" lat="12.96" lon="77.58"/>




</station>




...



</region>


</source>

</stations>

AFITA2006

5TH C
ONFERENCE OF ASIAN F
EDERATION
FOR

INFORMATION TECHNOLO
GY IN
AGRICULTURE


Fig
ure 7. Map interface using Google Earth to select a weather station of MetBroker.

http://cse.naro.affrc.go.jp/ketanaka/model/google
-
earth/metbro
ker_en.kmz