use of cbit.vcell.simdata.DataSetMetadata 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();
}
}
use of cbit.vcell.simdata.DataSetMetadata in project vcell by virtualcell.
the class SimDataServerResource method getSimDataRepresentation.
private SimDataRepresentation getSimDataRepresentation(User vcellUser) {
// if (!application.authenticate(getRequest(), getResponse())){
// // not authenticated
// return new SimulationTaskRepresentation[0];
// }else{
RestDatabaseService restDatabaseService = ((VCellApiApplication) getApplication()).getRestDatabaseService();
try {
DataSetMetadata dataSetMetadata = restDatabaseService.getDataSetMetadata(this, vcellUser);
SimulationRep simRep = restDatabaseService.getSimulationRep(dataSetMetadata.getSimKey());
SimDataRepresentation simDataRepresentation = new SimDataRepresentation(dataSetMetadata, simRep.getScanCount());
return simDataRepresentation;
} catch (PermissionException e) {
e.printStackTrace();
throw new ResourceException(Status.CLIENT_ERROR_UNAUTHORIZED, "not authorized");
} catch (ObjectNotFoundException e) {
e.printStackTrace();
throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, "simulation metadata not found");
} catch (Exception e) {
throw new ResourceException(Status.SERVER_ERROR_INTERNAL, e.getMessage());
}
// }
}
Aggregations