NIH | National Cancer Institute | NCI Wiki  

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Scrollbar
iconsfalse

...

Page info

...

title
title

Panel
titleContents of this Page
Table of Contents
minLevel2

Overview

The spring framework has emerged over the last few years as a versatile and efficient support structure for multiple types of Java applications. The MVC component facilitates the development of rich web-driven applications. The SpringSource tool suite(STS) is an Eclipse derivative software package bundling the necessary tools to develop efficiently with the Spring framework. The Spring 3 MVC project is a Maven compliant project and the guide will make use of it to include a LexEVS dependency.

This guide will illustrate how to use a local instance of LexEVS in a Spring 3.0.x MVC project and how to deploy it to a Tomcat 6 server from within STS. It was tested using LexEVS 6.0 and Windows 7. This should be applicable to other environments and future versions of LexEVS, but some parameters, especially paths, might need to be formatted differently.

This guide will NOT explore how to leverage LexEVS programatically or how to best develop with the Spring framework. The reader is invited to explore the multiple resources on the web that can help in this endeavor.

Prerequisites

You will need internet access to complete this guide.

LexEVS Local Runtime Install

Please follow carefully the steps mentioned in the Installing LexEVS 6.0 Local Runtime guide.

Once all the steps have been followed successfully you should have a functional LexEVS Local Runtime instance.

In order to facilitate subsequent testing, please load and activate the test terminology Automobiles.xml located in the folder {LEXEVS_HOME}\test\resources\testData\Automobiles.xml

...

.

...

Make

...

note

...

of

...

your

...

installation

...

folder.

...

Installing

...

Tomcat

...

6

...

  1. Navigate

...

  1. to

...

  1. the

...

  1. Tomcat

...

  1. 6

...

  1. download

...

  1. page

...

  1. and

...

  1. download

...

  1. the

...

  1. appropriate

...

  1. package

...

  1. for

...

  1. your

...

  1. system.

...

  1. The

...

  1. binary

...

  1. core

...

  1. distribution

...

  1. (zip)

...

  1. is

...

  1. the

...

  1. most

...

  1. usual

...

  1. one.

...

  1. Unzip

...

  1. the

...

  1. content

...

  1. of

...

  1. the

...

  1. file

...

  1. in

...

  1. the

...

  1. desired

...

  1. folder

...

  1. and

...

  1. make

...

  1. note

...

  1. of

...

  1. it.

...

Installing

...

SpringSource

...

Tool

...

Suite

...

(Tested

...

with

...

Version

...

2.7.1)

...

  1. Navigate

...

  1. to

...

  1. the

...

  1. STS

...

  1. download

...

  1. page

...

  1. to

...

  1. download

...

  1. the

...

  1. software.

...

  1. Please

...

  1. note

...

  1. that

...

  1. you

...

  1. don't

...

  1. have

...

  1. to

...

  1. fill

...

  1. out

...

  1. the

...

  1. form.

...

  1. If

...

  1. you

...

  1. do

...

  1. not

...

  1. wish

...

  1. to

...

  1. fill

...

  1. it

...

  1. all,

...

  1. just

...

  1. check

...

  1. the

...

  1. checkbox

...

  1. to

...

  1. accept

...

  1. the

...

  1. license

...

  1. terms

...

  1. and

...

  1. click

...

  1. on

...

  1. the

...

  1. link

...

  1. "Download

...

  1. Page"

...

  1. bellow

...

  1. the

...

  1. "Download

...

  1. Now"

...

  1. button.

...

  1. Choose

...

  1. the

...

  1. appropriate

...

  1. version

...

  1. for

...

  1. your

...

  1. environment

...

  1. and

...

  1. install

...

  1. it.

...

  1. Make

...

  1. sure

...

  1. that

...

  1. you

...

  1. have

...

  1. the

...

  1. Java

...

  1. JDK

...

  1. 1.6

...

  1. (or

...

  1. less

...

  1. ideally

...

  1. 1.5)

...

  1. installed.

...

  1. During

...

  1. setup,

...

  1. make

...

  1. sure

...

  1. to

...

  1. make

...

  1. a

...

  1. note

...

  1. of

...

  1. where

...

  1. you

...

  1. installed

...

  1. the

...

  1. program.

...

  1. During

...

  1. step

...

  1. 4,

...

  1. make

...

  1. sure

...

  1. "Apache

...

  1. Maven

...

  1. 2..."

...

  1. in

...

  1. selected.

...

  1. You

...

  1. can

...

  1. launch

...

  1. STS

...

  1. and

...

  1. select

...

  1. the

...

  1. location

...

  1. of

...

  1. your

...

  1. workspace.

...

  1. You

...

  1. will

...

  1. then

...

  1. be

...

  1. presented

...

  1. with

...

  1. the

...

  1. Welcome

...

  1. page.

...

  1. You

...

  1. can

...

  1. close

...

  1. it

...

  1. with

...

  1. the

...

  1. "x"

...

  1. next

...

  1. to

...

  1. the

...

  1. tab

...

  1. on

...

  1. top

...

  1. left.

...

  1. This

...

  1. will

...

  1. bring

...

  1. a

...

  1. Spring

...

  1. perspective.

...

Setting

...

up

...

Tomcat

...

6

...

in

...

STS

...

  1. Open

...

  1. STS.

...

  1. It

...

  1. should

...

  1. be

...

  1. enabled

...

  1. by

...

  1. default

...

  1. but

...

  1. make

...

  1. sure

...

  1. you're

...

  1. in

...

  1. the

...

  1. Spring

...

  1. perspective.

...

  1. In

...

  1. the

...

  1. left

...

  1. lower

...

  1. corner

...

  1. should

...

  1. be

...

  1. the

...

  1. server

...

  1. view.

...

  1. Right-click

...

  1. in

...

  1. the

...

  1. view

...

  1. and

...

  1. choose

...

  1. "New

...

  1. ->

...

  1. Server"

...

  1. in

...

  1. the

...

  1. context

...

  1. menu.

...

  1. Type

...

  1. "Tomcat"

...

  1. in

...

  1. the

...

  1. "Select

...

  1. the

...

  1. server

...

  1. type:"

...

  1. textbox.

...

  1. Then

...

  1. scroll

...

  1. down

...

  1. in

...

  1. the

...

  1. selectbox

...

  1. bellow

...

  1. and

...

  1. choose

...

  1. Tomcat

...

  1. v6.0

...

  1. Server.

...

  1. Click

...

  1. "Next".

...

  1. On

...

  1. the

...

  1. next

...

  1. screen,

...

  1. browse

...

  1. to

...

  1. your

...

  1. tomcat

...

  1. install

...

  1. folder

...

  1. and

...

  1. select

...

  1. it.

...

  1. Click

...

  1. on

...

  1. "Finish"

...


  1. You

...

  1. should

...

  1. now

...

  1. see

...

  1. an

...

  1. entry

...

  1. named

...

  1. "Tomcat

...

  1. v6.0

...

  1. Server

...

  1. at

...

  1. localhost"

...

  1. in

...

  1. the

...

  1. server view.

Creating a New Spring MVC 3 Project

  1. Click on the menu File -> New - > Spring Template Project.
  2. Select Spring MVC Project from the list and click Next.
    1. It will ask you if you want to download file: click Proceed.
  3. Enter a project name. For this guide we will name it "testlex".
  4. Enter the top level package (x.x.x).

...

  1. We

...

  1. will

...

  1. name

...

  1. it

...

  1. "org.test.test".

...

  1. Wiki Markup
    Click on Finish.
    It might take some time before your back to a responsive Spring perspective. STS will need to download some dependencies for the project.
    You should then see your project \[

...

  1. testlex\] in the package explorer view on top left part of the windows.

...

Small

...

STS

...

Warning

...

That

...

Can

...

be

...

Fixed

...

There

...

is

...

a

...

little

...

bug

...

that

...

is

...

annoying

...

in

...

STS

...

regarding

...

missing

...

XML

...

definition.

...

You

...

should

...

see

...

a

...

tiny

...

warning

...

icon

...

on

...

your

...

project

...

and

...

if

...

you

...

drill

...

down,

...

it

...

relates

...

to

...

the

...

file

...

"log4j.xml".

...

The

...

issue

...

has

...

been

...

described

...

in

...

a

...

Spring

...

forum

...

post

...

but

...

the

...

"Key"

...

that

...

needs

...

to

...

be

...

entered

...

is:

{
No Format
}-//APACHE//DTD LOG4J 1.2//EN{noformat}
*

and

...

NOT

...

-//LOGGER

...

-

...

this

...

changed

...

from

...

the

...

previous

...

STS

...

version.

...

The

...

solution

...

is:

...

  1. Menu

...

  1. Windows

...

  1. ->

...

  1. Preferences

...

  1. ->

...

  1. XML

...

  1. ->

...

  1. XML

...

  1. Catalog

...

  1. Click

...

  1. on

...

  1. add

...

  1. Click

...

  1. on

...

  1. File

...

  1. System

...

  1. and

...

  1. select

...

  1. the

...

  1. jar.

...

  1. It

...

  1. should

...

  1. be

...

  1. something

...

  1. similar

...

  1. to:

...

  1. {SpringSource

...

  1. install

...

  1. folder

...

  1. }\sts-2.7.1.RELEASE\plugins\org.apache.log4j_1.2.15.v201012070815.jar

...

  1. Add

...

  1. "jar:file:"

...

  1. in

...

  1. front

...

  1. of

...

  1. the

...

  1. path

...

  1. and

...

  1. !/org/apache/log4j/xml/log4j.dtd

...

  1. at

...

  1. the

...

  1. end

...

  1. of

...

  1. the

...

  1. path

...

  1. (without

...

  1. the

...

  1. ")

...

  1. In

...

  1. the

...

  1. key

...

  1. textbox,

...

  1. enter

...

  1. -//APACHE//DTD

...

  1. LOG4J

...

  1. 1.2//EN

...

  1. (without

...

  1. the

...

  1. ")

...

  1. Click

...

  1. Ok

...

  1. to

...

  1. close

...

  1. this

...

  1. window,

...

  1. then

...

  1. ok

...

  1. again

...

  1. to

...

  1. close

...

  1. the

...

  1. preference

...

  1. window.

...

  1. Once

...

  1. you

...

  1. follow

...

  1. the

...

  1. instructions,

...

  1. you

...

  1. need

...

  1. to

...

  1. add

...

  1. and

...

  1. remove

...

  1. a

...

  1. space

...

  1. to

...

  1. trigger

...

  1. a

...

  1. modification

...

  1. then

...

  1. save

...

  1. the

...

  1. file.

...

  1. The

...

  1. warning

...

  1. should

...

  1. be

...

  1. gone.

...

  1. Do

...

  1. this

...

  1. for

...

  1. both

...

  1. log4j.xml

...

  1. files:

...

    • one

...

    • in

...

    • src/main/resources

...

    • one in src/test/resources

...

Verification

  1. Wiki Markup
    Select the \[

...

  1. textlex\] folder project in the package explorer window then click on play button or click on the menu "Run" \-> Run
    The next window will ask you how you want to run the project. Select "Run on server".

...

  1. In

...

  1. the

...

  1. list

...

  1. on

...

  1. the

...

  1. next

...

  1. window,

...

  1. you

...

  1. should

...

  1. see

...

  1. the

...

  1. "Tomcat

...

  1. v6.0

...

  1. Server

...

  1. at

...

  1. localhost"

...

  1. entry

...

  1. that

...

  1. you

...

  1. created

...

  1. earlier.

...

  1. Select

...

  1. it

...

  1. and

...

  1. check

...

  1. the

...

  1. box

...

  1. "Always

...

  1. use

...

  1. this

...

  1. server..."

...

  1. Click

...

  1. Next

...

  1. ,

...

  1. then

...

  1. click

...

  1. Finish

...

  1. .

...


  1. You

...

  1. should

...

  1. then

...

  1. see

...

  1. the

...

  1. "Hello

...

  1. world

...

  1. !"

...

  1. page

...

  1. with

...

  1. the

...

  1. current

...

  1. time

...

  1. on

...

  1. it.

...


  1. You

...

  1. now

...

  1. have

...

  1. a

...

  1. functioning

...

  1. Spring

...

  1. 3 MVC project.

Adding LexEVS as a Maven Dependency

The Spring 3 MVC project being a Maven compliant project, we will add LexEVS as dependency. It is not available in a public repository so we will need to install in our local repository first.

Downloading the Required Files

You will need four files to successfully add LexEVS as a dependency.

  1. LexEVS jar: Can be found in your local LexEVS install: {LEXEVS_HOME}\runtime-components\lexbig.jar

...

    • For easier access,

...

    • copy

...

    • it

...

    • to

...

    • a

...

    • short

...

    • location.

...

    • We

...

    • will

...

    • use

...

    • E:\

...

  1. LexEVS

...

  1. POM

...

  1. file:

...

  1. This

...

  1. includes

...

  1. the

...

  1. information

...

  1. on

...

  1. the

...

  1. dependencies

...

  1. LexEVS

...

  1. will

...

  1. rely

...

  1. on.

...

  1. You

...

  1. can

...

  1. download

...

  1. it

...

  1. Lexevs-6.0.0.pom.zip

...

    • Wiki Markup
      Unzip it to the same location \[E:\]

...

  1. LexEVS

...

  1. uses

...

  1. a

...

  1. patched

...

  1. version

...

  1. of

...

  1. the

...

  1. dependency

...

  1. ddlutils.

...

  1. You

...

  1. need

...

  1. to

...

  1. download

...

  1. it

...

  1. here
    • Wiki Markup
      Place it in the same directory \[E:\]

...

  1. This

...

  1. dependency

...

  1. also

...

  1. has

...

  1. a

...

  1. POM

...

  1. file

...

  1. which

...

  1. you

...

  1. can

...

  1. download

...

  1. Ddlutils-1.0-PATCHED.pom.zip

...

    • Wiki Markup
      Unzip it to the same location \[E:\]

...

Installing

...

a

...

LexEVS

...

Dependency

...

As

...

these

...

Maven

...

dependencies

...

are

...

not

...

available

...

in

...

a

...

public

...

repository,

...

you

...

will

...

need

...

to

...

add

...

them

...

to

...

our

...

local

...

repository.

...

Open

...

a

...

command

...

window

...

and

...

navigate

...

to

...

the

...

{SpringSource

...

install

...

folder

...

}\maven-2.2.1.RELEASE\bin

...

folder.

...

On

...

Windows

...

7,

...

you

...

can

...

use

...

the

...

file

...

explorer

...

to

...

navigate

...

to

...

this

...

folder

...

and

...

then

...

"Shift+right

...

click"

...

in

...

the

...

folder

...

and

...

select

...

"Open

...

command

...

window

...

here".

...

JAVA_HOME

...

Environment

...

Variable

...

Missing

...

Should

...

you

...

have

...

an

...

error

...

message

...

stating

...

the

...

need

...

for

...

a

...

JAVA_HOME

...

system

...

variable

...

when

...

you

...

execute

...

the

...

MVN

...

commands,

...

please

...

follow

...

the

...

appropriate

...

steps

...

for

...

your

...

system

...

to

...

add

...

it

...

(steps

...

provided

...

bellow

...

for

...

Windows

...

7).

...

  1. On

...

  1. Windows

...

  1. 7,

...

  1. click

...

  1. on

...

  1. the

...

  1. start

...

  1. button,

...

  1. then

...

  1. right-click

...

  1. on

...

  1. computer

...

  1. and

...

  1. select

...

  1. properties.

...

  1. Select

...

  1. Advanced

...

  1. system

...

  1. settings

...

  1. in

...

  1. the

...

  1. left

...

  1. pane

...

  1. and

...

  1. select

...

  1. the

...

  1. advanced

...

  1. tab

...

  1. in

...

  1. the

...

  1. window

...

  1. that

...

  1. opens

...

  1. up.

...

  1. Click

...

  1. on

...

  1. Environment

...

  1. Variables

...

  1. button.

...

  1. Click

...

  1. on

...

  1. the

...

  1. button

...

  1. New

...

  1. in

...

  1. the

...

  1. lower

...

  1. half

...

  1. of

...

  1. the

...

  1. window

...

  1. and

...

  1. add

...

  1. JAVA_HOME

...

  1. as

...

  1. a

...

  1. name

...

  1. and

...

  1. the

...

  1. path

...

  1. to

...

  1. your

...

  1. JRE

...

  1. installation

...

  1. as

...

  1. a

...

  1. value.

...

  1. Click

...

  1. OK

...

  1. 3

...

  1. times

...

  1. to

...

  1. close

...

  1. the

...

  1. windows.

...

  1. Close

...

  1. and

...

  1. reopen

...

  1. your

...

  1. commmand

...

  1. window

...

  1. and

...

  1. it

...

  1. should

...

  1. now

...

  1. work.

...

MVN

...

Commands

...

For

...

all

...

the

...

following

...

commands,

...

please

...

change

...

*E:

...

*

...

to

...

the

...

path

...

of

...

the

...

folder

...

chosen

...

to

...

place

...

the

...

four

...

files

...

above.

...

  1. Then

...

  1. enter

...

  1. this

...

  1. command

...

  1. at

...

  1. the

...

  1. command

...

  1. prompt:

...

  1. Code Block

...

  1. mvn install:install-file -Dfile="E:\ddlUtils-1.0-PATCHED.jar" -DpomFile="E:\ddlutils-1.0-PATCHED.pom"

...

  1. You

...

  1. should

...

  1. then

...

  1. see

...

  1. a

...

  1. build

...

  1. successful

...

  1. message.

...

  1. The

...

  1. ddlUtils

...

  1. dependency

...

  1. is

...

  1. now

...

  1. available

...

  1. in

...

  1. your

...

  1. local

...

  1. repository.

...

  1. Now

...

  1. enter

...

  1. this

...

  1. command

...

  1. at

...

  1. the

...

  1. command

...

  1. prompt:

...

  1. Code Block

...

  1. mvn install:install-file -Dfile="E:\lexbig.jar" -DpomFile="E:\lexevs-6.0.0.pom"

...

  1. You

...

  1. should

...

  1. also

...

  1. see

...

  1. a

...

  1. build

...

  1. successful

...

  1. message.

...

  1. The

...

  1. LexEVS

...

  1. dependency

...

  1. is

...

  1. now

...

  1. available

...

  1. in

...

  1. your

...

  1. local

...

  1. repository.

...

  1. Open

...

  1. STS

...

  1. and

...

  1. select

...

  1. the

...

  1. menu

...

  1. Window

...

  1. ->

...

  1. Show

...

  1. View

...

  1. ->

...

  1. Other

...

  1. Scroll

...

  1. down

...

  1. to

...

  1. the

...

  1. folder

...

  1. Maven

...

  1. and

...

  1. select

...

  1. Maven

...

  1. Repositories.

...

  1. Click

...

  1. OK.

...


  1. You

...

  1. should

...

  1. now

...

  1. have

...

  1. a

...

  1. Maven

...

  1. Repositories

...

  1. view

...

  1. in

...

  1. the

...

  1. lower

...

  1. part

...

  1. of

...

  1. the

...

  1. window.

...

  1. Select

...

  1. and

...

  1. unfold

...

  1. Local

...

  1. Repositories.

...

  1. Right-click

...

  1. Local

...

  1. Repository

...

  1. and

...

  1. select

...

  1. Rebuild

...

  1. Index

...

  1. from

...

  1. the

...

  1. context

...

  1. menu.

...

  1. Click

...

  1. Ok

...

  1. when

...

  1. asked

...

  1. if

...

  1. you're

...

  1. sure

...

  1. you

...

  1. want

...

  1. to

...

  1. rebuild

...

  1. it.

...

Adjusting

...

Scope

...

of

...

JUnit

...

LexEVS

...

currently

...

uses

...

JUnit

...

during

...

runtime.

...

This

...

is

...

a

...

bit

...

unusual

...

and

...

might

...

change

...

in

...

a

...

future

...

release

...

but

...

for

...

now,

...

it

...

needs

...

to

...

be

...

adjusted.

...

  1. Wiki Markup
    Select the project folder \[

...

  1. testlex\] in the Package Explorer view and unfold it.

...

  1. Double

...

  1. click

...

  1. on

...

  1. the

...

  1. pom.xml

...

  1. file

...

  1. to

...

  1. open

...

  1. it.

...

  1. Select

...

  1. the

...

  1. Dependencies

...

  1. tab

...

  1. at

...

  1. the

...

  1. bottom

...

  1. of

...

  1. the

...

  1. window.

...

  1. In

...

  1. the

...

  1. Dependencies

...

  1. pane,

...

  1. scroll

...

  1. down

...

  1. in

...

  1. the

...

  1. dependencies

...

  1. selectbox

...

  1. and

...

  1. click

...

  1. once

...

  1. on

...

  1. junit.

...

  1. On

...

  1. the

...

  1. right

...

  1. side,

...

  1. the

...

  1. Dependency

...

  1. Details

...

  1. area

...

  1. should

...

  1. present

...

  1. a

...

  1. scope

...

  1. which

...

  1. is

...

  1. "test"

...

  1. in

...

  1. the

...

  1. combobox.

...

  1. Change

...

  1. it

...

  1. to

...

  1. compile.

...

  1. Click

...

  1. on

...

  1. menu

...

  1. File

...

  1. ->

...

  1. Save

...

  1. or

...

  1. press

...

  1. Ctrl-s.

...

Including LexEVS in the MVC Project

  1. Wiki Markup
    Select the \[

...

  1. textlex\] project. Right-click on it and select Maven \-> Add Dependency from the context menu.

...

  1. Enter

...

  1. lexevs

...

  1. in

...

  1. the

...

  1. first

...

  1. textbox.

...


  1. The

...

  1. search

...

  1. results

...

  1. should

...

  1. show:

...

  1. lexevs

...

  1. lexevs

...

  1. Select

...

  1. it

...

  1. and

...

  1. click

...

  1. ok.

...

  1. STS

...

  1. will

...

  1. now

...

  1. download

...

  1. all

...

  1. the

...

  1. dependencies

...

  1. needed

...

  1. to

...

  1. work

...

  1. with

...

  1. LexEVS.

...

  1. You

...

  1. can

...

  1. follow

...

  1. the

...

  1. progress

...

  1. in

...

  1. the

...

  1. progress

...

  1. view

...

  1. (tab).

...

Creating

...

a

...

Test

...

File

  1. Wiki Markup
    Select and unfold the project folder \[

...

  1. textlex\] in the package explorer.

...

  1. Wiki Markup
    Navigate to src/test/java. You should see an empty package \[

...

  1. org.test.test\]

...

  1. Right-click

...

  1. on

...

  1. it

...

  1. and

...

  1. select

...

  1. New

...

  1. ->

...

  1. JUnit

...

  1. Test

...

  1. Case

...

  1. Put

...

  1. the

...

  1. name

...

  1. of

...

  1. your

...

  1. test

...

  1. in

...

  1. the

...

  1. name

...

  1. textbox.

...

  1. We

...

  1. will

...

  1. name

...

  1. it

...

  1. LexBigConnect.

...

  1. Click

...

  1. on

...

  1. Finish.

...

  1. Copy

...

  1. this

...

  1. in

...

  1. the

...

  1. file

...

  1. (including

...

  1. the

...

  1. last

...

  1. bracket):

...

  1. Code Block

...

  1. package org.test.test;
    
    import static org.junit.Assert.*;
    
    import org.LexGrid.LexBIG.Exceptions.LBInvocationException;
    import org.LexGrid.LexBIG.Impl.LexBIGServiceImpl;
    import org.LexGrid.LexBIG.LexBIGService.LexBIGService;
    import org.LexGrid.LexBIG.DataModel.InterfaceElements.CodingSchemeRendering;
    
    import org.junit.Test;
    
    public class LexBigConnect {
    
        @Test
        public void test() throws LBInvocationException {
    
            LexBIGService lbSvc = LexBIGServiceImpl.defaultInstance();
            System.out.println("The currently active terminologies are:");
            for(CodingSchemeRendering csr : lbSvc.getSupportedCodingSchemes().getCodingSchemeRendering())
                System.out.println(csr.getCodingSchemeSummary().getFormalName());
    
            assertTrue(true);
        }
    }

...

  1. Make sure to change the package name if you didn't

...

  1. use

...

  1. org.test.test

...

  1. initially.

...

  1. Save

...

  1. the

...

  1. file.

...

Adding

...

a

...

JVM

...

Parameter

...

to

...

Locate

...

the

...

lbconfig.props

...

  1. In

...

  1. STS,

...

  1. select

...

  1. the

...

  1. menu

...

  1. Run

...

  1. ->

...

  1. Run

...

  1. Configurations...

...

  1. Select

...

  1. JUnit

...

  1. in

...

  1. the

...

  1. left

...

  1. list.

...

  1. Wiki Markup
    Select the new button (white rectangle with a little yellow \+)
    The name of the profile will be defaulted to the name of your class \[

...

  1. LexBigConnect\]

...

  1. Click

...

  1. on

...

  1. the

...

  1. tab

...

  1. Arguments

...

  1. and

...

  1. add

...

  1. this

...

  1. parameter

...

  1. to

...

  1. the

...

  1. VM

...

  1. textbox:

...

  1. Code Block

...

  1. -DLG_CONFIG_FILE="\{LEXEVS_HOME\}\resources\config\lbconfig.props"

...

  1. Replace {LEXEVS_HOME

...

  1. }

...

  1. by

...

  1. the

...

  1. absolute

...

  1. path

...

  1. to

...

  1. the

...

  1. LexEVS

...

  1. local

...

  1. install

...

  1. done

...

  1. earlier

...

  1. in

...

  1. the

...

  1. process.

...

  1. Wiki Markup
    Then click Apply followed by Run.
    You should then see a successful completion of a JUnit test. The console log will also show "The currently active terminologies are:" followed by the name of the terminologies \[

...

  1. Automobiles\] if you loaded it

...

  1. .

Integrating LexEVS in a Web Page

Adding a JVM Parameter to Locate the lbconfig.props

I# n STS, double-click on the "Tomcat v6.0..."

...

entry

...

in

...

the

...

server

...

view

...

(left

...

lower

...

corner).

...

  1. This

...

  1. will

...

  1. open

...

  1. the

...

  1. server

...

  1. Overview.

...

  1. Click

...

  1. on

...

  1. the

...

  1. "Open

...

  1. launch

...

  1. configuration"

...

  1. link

...

  1. in

...

  1. the

...

  1. General

...

  1. Information

...

  1. section.

...

  1. Select

...

  1. the

...

  1. Arguments

...

  1. tab

...

  1. and

...

  1. in

...

  1. the

...

  1. VM

...

  1. arguments

...

  1. textbox,

...

  1. at

...

  1. the

...

  1. bottom,

...

  1. after

...

  1. the

...

  1. existing

...

  1. arguments

...

  1. add

...

  1. this:

...

  1. Code Block

...

  1. -DLG_CONFIG_FILE="\{LEXEVS_HOME\}\resources\config\lbconfig.props"

...

  1. Replace {LEXEVS_HOME

...

  1. }

...

  1. by

...

  1. the

...

  1. absolute

...

  1. path

...

  1. to

...

  1. the

...

  1. LexEVS

...

  1. local

...

  1. install

...

  1. done

...

  1. earlier

...

  1. in

...

  1. the

...

  1. process.

...

  1. Make

...

  1. sure

...

  1. there's

...

  1. a

...

  1. space

...

  1. between

...

  1. the

...

  1. end

...

  1. of

...

  1. the

...

  1. last

...

  1. existing

...

  1. argument

...

  1. and

...

  1. the

...

  1. dash

...

  1. of

...

  1. this

...

  1. one.

...

  1. Click

...

  1. Apply

...

  1. then

...

  1. click

...

  1. OK.

...

Adjusting

...

the

...

Controller

...

Although

...

this

...

is

...

unlikely

...

the

...

way

...

in

...

which

...

you

...

will

...

integrate

...

LexEVS

...

in

...

a

...

MVC

...

project,

...

it

...

will

...

confirm

...

that

...

using

...

the

...

project

...

with

...

Tomcat

...

works.

...

This

...

assumes

...

that

...

you

...

have

...

at

...

least

...

one

...

loaded

...

and

...

active

...

terminology

...

in

...

your

...

local

...

LexEVS

...

Server.

...

  1. Navigate

...

  1. the

...

  1. project

...

  1. tree

...

  1. to

...

  1. src/main/java

...

  1. and

...

  1. double-click

...

  1. on

...

  1. HomeController.java

...

  1. to

...

  1. open

...

  1. it.

...

  1. Copy

...

  1. this

...

  1. in

...

  1. the

...

  1. file

...

  1. (including

...

  1. the

...

  1. last

...

  1. bracket):

...

  1. Code Block

...

  1. package org.test.test;
    
    import java.text.DateFormat;
    import java.util.Date;
    import java.util.Locale;
    
    import org.LexGrid.LexBIG.DataModel.InterfaceElements.CodingSchemeRendering;
    import org.LexGrid.LexBIG.Exceptions.LBInvocationException;
    import org.LexGrid.LexBIG.Impl.LexBIGServiceImpl;
    import org.LexGrid.LexBIG.LexBIGService.LexBIGService;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.stereotype.Controller;
    import org.springframework.ui.Model;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RequestMethod;
    
    
    /**
     * Handles requests for the application home page.
     */
    @Controller
    public class HomeController {
    
        private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
    
        /**
         * Simply selects the home view to render by returning its name.
         * @throws LBInvocationException
         */
        @RequestMapping(value = "/", method = RequestMethod.GET)
        public String home(Locale locale, Model model) throws LBInvocationException {
            logger.info("Welcome home! the client locale is "+ locale.toString());
    
            Date date = new Date();
            DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
    
            String formattedDate = dateFormat.format(date);
    
            model.addAttribute("serverTime", formattedDate );
    
            Integer n = 1;
    
            LexBIGService lbSvc = LexBIGServiceImpl.defaultInstance();
            for(CodingSchemeRendering csr : lbSvc.getSupportedCodingSchemes().getCodingSchemeRendering()){
                System.out.println(csr.getCodingSchemeSummary().getFormalName());
                model.addAttribute("term"+n.toString(), csr.getCodingSchemeSummary().getFormalName());
                n++;
            }
    
            return "home";
        }
    
    }

...

  1. Make sure to change the package name if you didn't

...

  1. use

...

  1. org.test.test

...

  1. initially.

...

  1. Save

...

  1. the

...

  1. file.

...

Adjusting

...

the

...

JSP

...

Page

...

  1. In

...

  1. the

...

  1. Package

...

  1. Explorer,

...

  1. nagivate

...

  1. to

...

  1. src/main/webapp/WEB-INF/views

...

  1. and

...

  1. open

...

  1. home.jsp

...

  1. by

...

  1. double-clicking.

...

  1. Replace

...

  1. the

...

  1. text

...

  1. in

...

  1. the

...

  1. file

...

  1. with

...

  1. this

...

  1. one:

...

  1. Code Block

...

  1. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ page session="false" %>
    <html>
    <head>
        <title>Home</title>
    </head>
    <body>
    <h1>
        Hello world!
    </h1>
    
    <p>The time on the server is ${serverTime}.</p>
    <p>One of the active terminologies on the LexEVS server is: ${term1}</p>
    </body>
    </html>

...

  1. Save the file and close it.

Running the Project

  1. Wiki Markup
    Select the project \[

...

  1. textlex\] in the Package Explorer.

...

  1. Select

...

  1. the

...

  1. menu

...

  1. Run

...

  1. ->

...

  1. Run.

...

  1. Select

...

  1. "Run

...

  1. on

...

  1. Server"

...

  1. then

...

  1. click

...

  1. OK.

...

  1. You

...

  1. should

...

  1. see

...

  1. the

...

  1. home

...

  1. page

...

  1. displayed

...

  1. with

...

  1. the

...

  1. date/time

...

  1. and,

...

  1. on

...

  1. the

...

  1. last

...

  1. line,

...

  1. the

...

  1. name

...

  1. of

...

  1. one

...

  1. of

...

  1. your

...

  1. active

...

  1. terminology

...

  1. in

...

  1. LexEVS.

...

  1. You

...

  1. now

...

  1. have

...

  1. a

...

  1. functional

...

  1. Spring

...

  1. 3

...

  1. MVC

...

  1. project

...

  1. interacting

...

  1. successfully

...

  1. with

...

  1. a

...

  1. local

...

  1. instance

...

  1. of

...

  1. LexEVS.

...

Acknowledgement

This guide was contributed by the TRANSFoRM group / INSERM U936.

Scrollbar
iconsfalse