Interacting with LexEVS 5.0 LexEVS in a Distributed Environment November 2009
Interacting with LexEVS 5.0 Course Outline Course Learning Objectives Discuss the components required for installing a distributed environment. Discuss the download and setup of LexEVS 5.0 for distributed environment. Provide hands-on code exercises.
Session Details: Interacting with LexEVS 5.0 Lesson Syllabus Lesson 1: Overview of Distributed Mode Lesson 2: Hands-On Installation Lesson 3: Hands-On Code Examples
Lesson 1: Overview of Distributed Mode When you complete this lesson, you will be able to: Identify the components required for installing a distributed environment.
Lesson 1: Overview of Distributed Mode Distributed Environment Components The reference software stack: Java 1.5 MySQL JBoss GA LexEVS 5.0 local runtime These should already be in place on your workstation. The LexEVS 5.0 local runtime was installed during the local installation lesson. JBoss GA is required for distributed configuration. Reference files: LexEVS_50_webRuntime_jboss.zip lexevs.properties
Lesson 1: Overview of Distributed Mode Reference Files LexEVS_50_webRuntime_jboss.zip Includes war file (lexevsapi50.war) to be deployed to the JBoss server. Available from VKC download. lexevs.properties Used to set LexEVS systems properties. Used to configure security restrictions. Specifies LG_CONFIG_FILE property used to determine the location of the local installation.
Lesson 2: Hands-On Installation When you complete this lesson, you will be able to: Download and setup of LexEVS 5.0 for a distributed environment.
Lesson 2: Hands-On Installation Install Distributed Components Reference document: installsetupdistributed.doc
Lesson 2: Hands-On Installation Review Installation Copy lexevsapi50.war into jboss GA\server\cacoreDataGrid\deploy directory. Update and copy lexevs.properties file into jboss GA/server/cacoreDataGrid/conf directory. Start the JBoss server (startServer1.bat)
Lesson 2: Hands-On Installation Verify Installation Use the following link to verify the application has been installed and configured correctly: gSchemes.CodingScheme&org.LexGrid.codingSchemes.CodingSch emehttp://localhost:8080/lexevsapi50/GetHTML?query=org.LexGrid.codin gSchemes.CodingScheme&org.LexGrid.codingSchemes.CodingSch eme
Lesson 2: Hands-On Installation Verify Installation If successful, all loaded coding schemes will be returned.
Lesson 3: Hands-On Code Examples When you complete this lesson, you will be able to: Execute code examples in a distributed environment.
Lesson 3: Hands-On Code Examples Exercises Hands-on code examples are broken down into three categories: Examples Exercises Solutions Code coverage for these examples includes: LexBigService ConnectToDistributedLexBIGService.java DemonstrateProxies.java LexEvsDataService ConnectToDistributedLexEVSDataService.java DetachedCriteriaQuery.java HQLQuery.java QueryByExample.java Extensions GetRegisteredGenericExtensions.java
Lesson 3: Hands-On Code Examples Example 1 - Overview ConnectToDistributedLexBIGService.java Demonstrates how to connect to the distributed service. public LexBIGService getDistributedLexBIGService() throws Exception { return (LexBIGService)ApplicationServiceProvider. getApplicationServiceFromUrl(SERVICE_URL, SERVICE_NAME); SERVICE_URL = " SERVICE_NAME = "EvsServiceInfo";
Lesson 3: Hands-On Code Examples Example 1 - Example Navigate to: lexevs.bootcamp.distributed.examples.lexbigservice.Conn ectToDistributedLexBIGService.java
Lesson 3: Hands-On Code Examples Example 1 - Exercise Navigate to: lexevs.bootcamp.distributed.exercises.lexbigservice.Get LexBIGServiceExercise.java HINT: Modify the method protected LexBIGService getDistributedLexBIGService() so that it instantiates LexBIGService using ApplicationServiceProvider.
Lesson 3: Hands-On Code Examples Example 1 - Solution Implemented method: public LexBIGService getDistributedLexBIGService() throws Exception { return (LexBIGService)ApplicationServiceProvider.getApplicatio nServiceFromUrl(SERVICE_URL, SERVICE_NAME); SERVICE_URL = " SERVICE_NAME = "EvsServiceInfo";
Lesson 3: Hands-On Code Examples Example 2 - Overview DemonstrateProxies.java Proxies help distributed API calls appear as if they are being called locally on the client. This makes coding from local to distributed very straightforward for the programmer (same API calls used).
Lesson 3: Hands-On Code Examples Example 2 - Example Navigate to: lexevs.bootcamp.distributed.examples.lexbigservice.Demo nstrateProxies.java
Lesson 3: Hands-On Code Examples Example 3 - Overview ConnectToDistributedLexEVSDataService.java Demonstrates how to connect to the distributed data service. public LexEVSDataService getDistributedLexEVSDataService() throws Exception { return (LexEVSDataService)ApplicationServiceProvider.getApplic ationServiceFromUrl(SERVICE_URL, SERVICE_NAME); SERVICE_URL = " SERVICE_NAME = "EvsServiceInfo";
Lesson 3: Hands-On Code Examples Example 3 - Example Navigate to: lexevs.bootcamp.distributed.examples.lexevsdataservice. ConnectToDistributedLexEVSDataService.java
Lesson 3: Hands-On Code Examples Example 3 - Exercise Navigate to: lexevs.bootcamp.distributed.exercises.lexevsdataservice.GetLexEVSDataServiceExercise.java Hint: Modify the method public LexEVSDataService getLexEVSDataService() so that it instantiates LexEVSDataService using ApplicationServiceProvider.
Lesson 3: Hands-On Code Examples Example 3 - Solution Implemented method: public LexEVSDataService getDistributedLexEVSDataService() throws Exception { return (LexEVSDataService)ApplicationServiceProvider. getApplicationServiceFromUrl(SERVICE_URL, SERVICE_NAME); SERVICE_URL = " SERVICE_NAME = "EvsServiceInfo";
Lesson 3: Hands-On Code Examples Example 4 - Overview DetachedCriteriaQuery.java Demonstrates how to query content using Hibernate Criteria Queries by creating a query outside the scope of a session and then executing it using an arbitrary session. The query is against a particular persistent class. protected DetachedCriteria buildDetachedCriteria() throws Exception { DetachedCriteria dc = DetachedCriteria.forClass(Concept.class); SimpleExpression restriction = Restrictions.like("_entityCode", "%Heart%"); dc.add(restriction); return dc; }
Lesson 3: Hands-On Code Examples Example 4 - Example Navigate to: lexevs.bootcamp.distributed.examples.lexevsdataservice. DetachedCriteriaQuery.java
Lesson 3: Hands-On Code Examples Example 4 - Exercise Navigate to: lexevs.bootcamp.distributed.exercises.lexevsdataservice.DetatchedCriteriaExercise.java Hint: Modify the method protected DetachedCriteria buildDetachedCriteria() so that it specifies the following detached criteria for the query. Class: Concept Term: ‘Bone’
Lesson 3: Hands-On Code Examples Example 4 - Solution Implemented method: protected DetachedCriteria buildDetachedCriteria() throws Exception { DetachedCriteria dc = DetachedCriteria.forClass(Concept.class); SimpleExpression restriction = Restrictions.eq("_entityCode", "Bone"); dc.add(restriction); return dc; }
Lesson 3: Hands-On Code Examples Example 5 - Overview HQLQuery.java Demonstrates how to query content using Hibernate Query Language (HQL). HQL is a powerful query language that is similar in appearance to SQL. public void runExample() throws Exception { LexEVSDataService lbds = getCaCoreService(); HQLCriteria hql = buildHqlQuery(); List concepts = lbds.query(hql); for(Concept concept : concepts){ PrintUtility.print(concept); } protected HQLCriteria buildHqlQuery() throws Exception { return new HQLCriteria("FROM org.LexGrid.concepts.Concept " + "as concept where concept._entityCode like '%ear%'"); }
Lesson 3: Hands-On Code Examples Example 5 - Example Navigate to: lexevs.bootcamp.distributed.examples.lexevsdataservice. HQLQuery.java
Lesson 3: Hands-On Code Examples Example 5 - Exercise Navigate to: lexevs.bootcamp.distributed.exercises.lexevsdataservice.HQLExercise.java Hint: Modify the method protected HQLCriteria buildHqlQuery() so that it specifies the following criteria for the query. Object: org.LexGrid.concepts.Concept Term: ‘Heart_Part’
Lesson 3: Hands-On Code Examples Example 5 - Solution Implemented method: protected HQLCriteria buildHqlQuery() throws Exception { return new HQLCriteria("FROM org.LexGrid.concepts.Concept " + "as concept where concept._entityCode = 'Heart_Part'"); }
Lesson 3: Hands-On Code Examples Example 6 - Overview QueryByExample.java Demonstrates how to utilize query-by-example. public void runExample() throws Exception { LexEVSDataService lbds = super.getCaCoreService(); Object qbeObect = buildQueryByExampleObject(); List concepts = lbds.search(qbeObect.getClass(), qbeObect); for(Concept concept : concepts){ PrintUtility.print(concept); } private Object buildQueryByExampleObject(){ Concept concept = new Concept(); concept.setEntityCode("Muscle"); return concept; }
Lesson 3: Hands-On Code Examples Example 6 - Example Navigate to: lexevs.bootcamp.distributed.examples.lexevsdataservice. QueryByExample.java
Lesson 3: Hands-On Code Examples Example 6 - Exercise Navigate to: lexevs.bootcamp.distributed.exercises.lexevsdataservice.QueryByExampleExercise.java Hint: Modify the method protected Object buildQueryByExampleObject() so that it specifies the following criteria for the query. Concept Entity Code ‘Heart_Part’
Lesson 3: Hands-On Code Examples Example 6 - Solution Implemented method: protected Object buildQueryByExampleObject() throws Exception { Concept concept = new Concept(); oncept.setEntityCode("Heart_Part"); return concept; }
Lesson 3: Hands-On Code Examples Example 7 - Overview GetRegisteredGenericExtensions.java Demonstrates that extensions that are available in the local environment are also available in distributed.
Lesson 3: Hands-On Code Examples Example 7 - Example Navigate to: lexevs.bootcamp.distributed.examples.extension.GetRegis teredGenericExtensions.java
Lesson 3: Hands-On Examples Resources Hibernate Query Language Detatched Criteria Queries querycriteria-detachedqueries
Lesson 3: Hands-On Examples Questions?