NIH | National Cancer Institute | NCI Wiki  

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
{scrollbar:icons=false}

h1. {

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 guide for installing LexEVS 6.0 Local Runtime.

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

...

  1. 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. Click

...

  1. on

...

  1. Finish.

...


  1. It

...

  1. might

...

  1. take

...

  1. some

...

  1. time

...

  1. before

...

  1. your

...

  1. back

...

  1. to

...

  1. a

...

  1. responsive

...

  1. Spring

...

  1. perspective.

...

  1. STS

...

  1. will

...

  1. need

...

  1. to

...

  1. download

...

  1. some

...

  1. dependencies

...

  1. for

...

  1. the

...

  1. project.

...


  1. You

...

  1. should

...

  1. then

...

  1. see

...

  1. your

...

  1. project

...

  1. [testlex

...

  1. ]

...

  1. in

...

  1. the

...

  1. package

...

  1. explorer

...

  1. view

...

  1. on

...

  1. top

...

  1. left

...

  1. part

...

  1. of

...

  1. the

...

  1. 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. {

...

  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 !/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. Select the [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".
  2. In the list on the next window, you should see the "Tomcat v6.0 Server at localhost" entry that you created earlier. Select it and check the box "Always use this server..."
  3. Click Next, then click Finish.
    You should then see the "Hello world!" page with the current time on it.
    You now have a functioning Spring 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 Lexevs-6.0.0.pom.zip

...

    • 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 here
    • Place it in the same directory [E:]
  2. This dependency also has a POM file which you can download Ddlutils-1.0-PATCHED.pom.zip

...

    • 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 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. Select the project folder [testlex] in the Package Explorer view and unfold it.
  2. Double click on the pom.xml file to open it.
  3. Select the Dependencies tab at the bottom of the window.
  4. In the Dependencies pane, scroll down in the dependencies selectbox and click once on junit. On the right side, the Dependency Details area should present a scope which is "test" in the combobox.
  5. Change it to compile.
  6. Click on menu File -> Save or press Ctrl-s.

Including LexEVS in the MVC Project

  1. Select the [textlex] project. Right-click on it and select Maven -> Add Dependency from the context menu.
  2. Enter lexevs in the first textbox.
    The search results should show: lexevs lexevs
  3. Select it and click ok.
  4. STS will now download all the dependencies needed to work with LexEVS. You can follow the progress in the progress view (tab).

Creating a Test File

  1. Select and unfold the project folder [textlex] in the package explorer.
  2. Navigate to src/test/java. You should see an empty package [org.test.test]
  3. Right-click on it and select New -> JUnit Test Case
  4. Put the name of your test in the name textbox. We will name it LexBigConnect. Click on Finish.
  5. Copy this in the file (including the last bracket):
    Code Block
    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. Select

...

  1. the

...

  1. new

...

  1. button

...

  1. (white

...

  1. rectangle

...

  1. with

...

  1. a

...

  1. little

...

  1. yellow

...

  1. +)

...


  1. The

...

  1. name

...

  1. of

...

  1. the

...

  1. profile

...

  1. will

...

  1. be

...

  1. defaulted

...

  1. to

...

  1. the

...

  1. name

...

  1. of

...

  1. your

...

  1. class

...

  1. [LexBigConnect

...

  1. ]

...

  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. Then

...

  1. click

...

  1. Apply

...

  1. followed

...

  1. by

...

  1. Run.

...


  1. You

...

  1. should

...

  1. then

...

  1. see

...

  1. a

...

  1. successful

...

  1. completion

...

  1. of

...

  1. a

...

  1. JUnit

...

  1. test.

...

  1. The

...

  1. console

...

  1. log

...

  1. will

...

  1. also

...

  1. show

...

  1. "The

...

  1. currently

...

  1. active

...

  1. terminologies

...

  1. are:"

...

  1. followed

...

  1. by

...

  1. the

...

  1. name

...

  1. of

...

  1. the

...

  1. terminologies

...

  1. [Automobiles

...

  1. ]

...

  1. if

...

  1. you

...

  1. loaded

...

  1. it.

...

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. }
    
    

...

  1. }
  2. Make

...

  1. sure

...

  1. to

...

  1. change

...

  1. the

...

  1. package

...

  1. name

...

  1. if

...

  1. you

...

  1. 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>
  2. Save the file and close it.

Running the Project

  1. Select the project [textlex] in the Package Explorer.
  2. Select the menu Run -> Run. Select "Run on Server" then click OK.
  3. You should see the home page displayed with the date/time and, on the last line, the name of one of your active terminology in LexEVS.
  4. You now have a functional Spring 3 MVC project interacting successfully with a local instance of LexEVS.

Acknowledgement

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

Wiki Markup
{code}
# Save the file and close it.

h3. Running the Project

# Select the project \[textlex\] in the Package Explorer.
# Select the menu Run \-> Run. Select "Run on Server" then click OK.
# You should see the home page displayed with the date/time and, on the last line, the name of one of your active terminology in LexEVS.
# You now have a functional Spring 3 MVC project interacting successfully with a local instance of LexEVS.

h2. Acknowledgement

This guide was contributed by the [TRANSFoRM group|http://transformproject.eu/Home.html] / [INSERM U936|http://www.u936.univ-rennes1.fr].

{scrollbar:icons=false}