Search in sources :

Example 1 with VCellOptClient

use of org.vcell.api.client.VCellOptClient in project vcell by virtualcell.

the class OptimizationServerResource method get_json.

@Override
public JsonRepresentation get_json() {
    try {
        // VCellApiApplication application = ((VCellApiApplication)getApplication());
        // User vcellUser = application.getVCellUser(getChallengeResponse(),AuthenticationPolicy.prohibitInvalidCredentials);
        String optimizationId = (String) getRequestAttributes().get(VCellApiApplication.OPTIMIZATIONID);
        VCellOptClient optClient = new VCellOptClient("opt", 8080);
        String optRunString = optClient.getOptRunJson(optimizationId);
        JsonRepresentation optRunJsonRep = new JsonRepresentation(optRunString);
        return optRunJsonRep;
    // } catch (PermissionException e) {
    // e.printStackTrace();
    // throw new ResourceException(Status.CLIENT_ERROR_UNAUTHORIZED, "permission denied to requested resource");
    } catch (Exception e) {
        throw new ResourceException(Status.SERVER_ERROR_INTERNAL, e.getMessage());
    }
}
Also used : VCellOptClient(org.vcell.api.client.VCellOptClient) ResourceException(org.restlet.resource.ResourceException) JsonRepresentation(org.restlet.ext.json.JsonRepresentation) ResourceException(org.restlet.resource.ResourceException)

Aggregations

JsonRepresentation (org.restlet.ext.json.JsonRepresentation)1 ResourceException (org.restlet.resource.ResourceException)1 VCellOptClient (org.vcell.api.client.VCellOptClient)1