V2_0.java [src/java/m/example/simpleservice] Revision: 01c5d1e0809f19123630d5643710581b9221e8dc  Date: Sat Aug 18 13:08:40 MDT 2018
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package m.example.simpleservice;

import csip.ServiceException;
import javax.ws.rs.Path;
import oms3.annotations.*;
import csip.annotations.Stage;

@Name("conv #2")
@Description("Example of an simple service")
@Path("m/simpleservice/2.0")
//@QA(RELEASED)
@Stage("Stay away.")
//@Deprecated
//@Resource(file = "/data/us_cvalues_topo2ras_masked.zip", type = ARCHIVE)
//@Resource(file = "/data/us_cvalues_topo2ras_masked.tif", type = REFERENCE, id = "tiff")
public class V2_0 extends csip.ModelDataService {

    @Override
    protected void doProcess() throws Exception {
        long sleep = getLongParam("sleep", 0);
        Thread.sleep(sleep);
        double temp = getDoubleParam("temp_c");
        String un = getParamUnit("temp_c");
        if (un.equals("C")) {
            putResult("temp", temp * 9 / 5 + 32,"temperature", "F");
            return;
        }
        throw new ServiceException("missing unit.");
    }
}