NIH | National Cancer Institute | NCI Wiki  

Versions Compared

Key

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

...

Users should be able to access a remote service with code similar to the following (Service URL should be adjusted to the current a valid LexEVS API service or one they have created for themselvessuch as the one hosted at NCI):

Code Block
themeEclipse
languagejava
package org.lexgrid.lexevs.remote.client;

import org.LexGrid.LexBIG.DataModel.Collections.CodingSchemeRenderingList;
import org.LexGrid.LexBIG.DataModel.InterfaceElements.CodingSchemeRendering;
import org.LexGrid.LexBIG.Exceptions.LBInvocationException;
import org.LexGrid.LexBIG.caCore.interfaces.LexEVSDistributed;

import gov.nih.nci.system.client.ApplicationServiceProvider;

public class MavenBasedPrototype {

	LexEVSDistributed lbs = null;
	private static String serviceUrl = "https://localhost.daplie.com:8443/lexevsapi64";
	public void run() throws LBInvocationException{
		try {
			lbs = (LexEVSDistributed)ApplicationServiceProvider.getApplicationServiceFromUrl(serviceUrl, "EvsServiceInfo");
	}
		catch(Exception e){
			System.out.println("Starting LexEVS Remote Client fails" + e);
	}

	CodingSchemeRenderingList list = lbs.getSupportedCodingSchemes();
		for(CodingSchemeRendering rendering: list.getCodingSchemeRendering()){
			System.out.println(rendering.getCodingSchemeSummary().getFormalName());
		}
	}

	public static void main(String[] args) {
		try {
			new MavenBasedPrototype().run();
		} catch (LBInvocationException e) {
			e.printStackTrace();
		}
	}
}

...

The LexEVS API is exposed by the LexEVS caCORE System for remote access as shown in the figure below. The through the caCORE System's LexEVSApplicationService class which implements the LexBIGService interface.

...

  • Java annotation marking methods that can be safely executed on the client side
  • classes that can be passed to the client without being wrapped by a proxy. The annotation is named @lgClientSideSafe. Every method in the LexEVS API that is accessible to the caCORE LexEVS user had to be considered and annotated if necessary.
  • Spring Aspect Oriented Programming (AOP) to proxy the LexEVS classes and intercept calls to their methods.
  • The LexEVS client wraps every object returned by the LexBIGService inside an AOP Proxy with advice from a LexBIGMethodInterceptor ("the interceptor").

The following graphic shows a sequence diagram showing method interception. The interceptor is responsible for intercepting all client calls on the methods in each object. If a method is marked with the @lgClientSideSafe annotation, it proceeds normally. Otherwise, the object, method name, and parameters are sent to the caCORE LexEVS server for remote execution.

...