Search in sources :

Example 1 with RpcDataServerProxy

use of org.vcell.rest.rpc.RpcDataServerProxy in project vcell by virtualcell.

the class RestDatabaseService method getDataSetMetadata.

public DataSetMetadata getDataSetMetadata(SimDataServerResource resource, User vcellUser) throws ObjectNotFoundException, DataAccessException, SQLException {
    if (vcellUser == null) {
        vcellUser = VCellApiApplication.DUMMY_USER;
    }
    UserLoginInfo userLoginInfo = new UserLoginInfo(vcellUser.getName(), null);
    // resource.getRequestAttributes().get(VCellApiApplication.SIMDATAID);
    String simId = resource.getAttribute(VCellApiApplication.SIMDATAID);
    KeyValue simKey = new KeyValue(simId);
    SimulationRep simRep = getSimulationRep(simKey);
    if (simRep == null) {
        throw new ObjectNotFoundException("Simulation with key " + simKey + " not found");
    }
    User owner = simRep.getOwner();
    int jobIndex = 0;
    VCMessageSession rpcSession = vcMessagingService.createProducerSession();
    try {
        RpcDataServerProxy rpcDataServerProxy = new RpcDataServerProxy(userLoginInfo, rpcSession);
        VCSimulationIdentifier vcSimID = new VCSimulationIdentifier(simKey, owner);
        VCDataIdentifier vcdID = new VCSimulationDataIdentifier(vcSimID, jobIndex);
        DataSetMetadata dataSetMetadata = rpcDataServerProxy.getDataSetMetadata(vcdID);
        return dataSetMetadata;
    } finally {
        rpcSession.close();
    }
}
Also used : VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) KeyValue(org.vcell.util.document.KeyValue) User(org.vcell.util.document.User) VCMessageSession(cbit.vcell.message.VCMessageSession) BigString(org.vcell.util.BigString) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) RpcDataServerProxy(org.vcell.rest.rpc.RpcDataServerProxy) DataSetMetadata(cbit.vcell.simdata.DataSetMetadata) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) UserLoginInfo(org.vcell.util.document.UserLoginInfo) VCDataIdentifier(org.vcell.util.document.VCDataIdentifier) SimulationRep(cbit.vcell.modeldb.SimulationRep)

Example 2 with RpcDataServerProxy

use of org.vcell.rest.rpc.RpcDataServerProxy in project vcell by virtualcell.

the class RestDatabaseService method getDataSetTimeSeries.

public DataSetTimeSeries getDataSetTimeSeries(SimDataValuesServerResource resource, User vcellUser) throws DataAccessException, ObjectNotFoundException, SQLException {
    if (vcellUser == null) {
        vcellUser = VCellApiApplication.DUMMY_USER;
    }
    UserLoginInfo userLoginInfo = new UserLoginInfo(vcellUser.getName(), null);
    // resource.getRequestAttributes().get(VCellApiApplication.SIMDATAID);
    String simId = resource.getAttribute(VCellApiApplication.SIMDATAID);
    // resource.getRequestAttributes().get(VCellApiApplication.SIMDATAID);
    String jobIndexString = resource.getAttribute(VCellApiApplication.JOBINDEX);
    KeyValue simKey = new KeyValue(simId);
    SimulationRep simRep = getSimulationRep(simKey);
    if (simRep == null) {
        throw new ObjectNotFoundException("Simulation with key " + simKey + " not found");
    }
    int jobIndex = Integer.parseInt(jobIndexString);
    // TODO: pass in variables names from the query parameters.
    String[] variableNames = null;
    User owner = simRep.getOwner();
    VCMessageSession rpcSession = vcMessagingService.createProducerSession();
    try {
        RpcDataServerProxy rpcDataServerProxy = new RpcDataServerProxy(userLoginInfo, rpcSession);
        VCSimulationIdentifier vcSimID = new VCSimulationIdentifier(simKey, owner);
        VCDataIdentifier vcdID = new VCSimulationDataIdentifier(vcSimID, jobIndex);
        DataSetTimeSeries dataSetTimeSeries = rpcDataServerProxy.getDataSetTimeSeries(vcdID, variableNames);
        return dataSetTimeSeries;
    } finally {
        rpcSession.close();
    }
}
Also used : VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) KeyValue(org.vcell.util.document.KeyValue) User(org.vcell.util.document.User) VCMessageSession(cbit.vcell.message.VCMessageSession) BigString(org.vcell.util.BigString) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) RpcDataServerProxy(org.vcell.rest.rpc.RpcDataServerProxy) DataSetTimeSeries(cbit.vcell.simdata.DataSetTimeSeries) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) UserLoginInfo(org.vcell.util.document.UserLoginInfo) VCDataIdentifier(org.vcell.util.document.VCDataIdentifier) SimulationRep(cbit.vcell.modeldb.SimulationRep)

Aggregations

VCMessageSession (cbit.vcell.message.VCMessageSession)2 SimulationRep (cbit.vcell.modeldb.SimulationRep)2 VCSimulationDataIdentifier (cbit.vcell.solver.VCSimulationDataIdentifier)2 VCSimulationIdentifier (cbit.vcell.solver.VCSimulationIdentifier)2 RpcDataServerProxy (org.vcell.rest.rpc.RpcDataServerProxy)2 BigString (org.vcell.util.BigString)2 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)2 KeyValue (org.vcell.util.document.KeyValue)2 User (org.vcell.util.document.User)2 UserLoginInfo (org.vcell.util.document.UserLoginInfo)2 VCDataIdentifier (org.vcell.util.document.VCDataIdentifier)2 DataSetMetadata (cbit.vcell.simdata.DataSetMetadata)1 DataSetTimeSeries (cbit.vcell.simdata.DataSetTimeSeries)1