import org.LexGrid.LexBIG.LexBIGService.LexBIGService;
import org.LexGrid.LexBIG.Utility.Constructors;
import org.LexGrid.LexBIG.caCore.interfaces.LexEVSApplicationService;
import org.LexGrid.codingSchemes.CodingScheme;

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

public class Test {

    LexBIGService lbSvc;

    public void run(String codingScheme, String version) {
        // Set the LexEVS URL (for remote access)
        String evsUrl = "https://lexevsapi65.nci.nih.gov/lexevsapi65";

        // Get the LexBIG service reference from LexEVS Application Service
        try {
            lbSvc = (LexEVSApplicationService) ApplicationServiceProvider.getApplicationServiceFromUrl(evsUrl,
                    "EvsServiceInfo");
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        // Resolve Scheme
        try {
            CodingScheme scheme = lbSvc.resolveCodingScheme(codingScheme,
                    Constructors.createCodingSchemeVersionOrTagFromVersion(version));
            if(scheme != null) {
                System.out.println("Found scheme: " + scheme.getCodingSchemeName());
            }else {
                System.out.println("Scheme not found: " + codingScheme);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    /**
     * Main
     */
    public static void main(String[] args) {
        String name = "NCI Thesaurus";
        String version = "18.03d";

        new Test().run(name, version);
    }
}