Search in sources :

Example 1 with VCInfoContainer

use of org.vcell.util.document.VCInfoContainer in project vcell by virtualcell.

the class ClientDocumentManager method initAllDatabaseInfos.

/**
 * Insert the method's description here.
 * Creation date: (9/25/2003 7:45:19 AM)
 * @return cbit.vcell.modeldb.VCInfoContainer
 */
public synchronized void initAllDatabaseInfos() throws DataAccessException {
    clear();
    VCInfoContainer vcInfoContainer = null;
    try {
        System.out.println("ClientDocumentManager.initAllDatabaseInfos()");
        long time1 = System.currentTimeMillis();
        // 
        // gets BioModelMetaDatas, MathModelMetaDatas, all VersionInfos, and ResultSetInfos
        // 
        vcInfoContainer = sessionManager.getUserMetaDbServer().getVCInfoContainer();
        PerformanceMonitorEvent pme = new PerformanceMonitorEvent(this, getUser(), new PerformanceData("ClientDocumentManager.initAllDatabaseInfos()", MessageEvent.LOGON_STAT, new PerformanceDataEntry[] { new PerformanceDataEntry("remote call duration", Double.toString(((double) System.currentTimeMillis() - time1) / 1000.0)) }));
    } catch (RemoteProxyException e) {
        handleRemoteProxyException(e);
        throw new DataAccessException("RemoteProxyException: " + e.getMessage());
    }
    // 
    // BioModelInfos
    // 
    {
        bioModelInfoHash.clear();
        BioModelInfo[] bioModelInfos = vcInfoContainer.getBioModelInfos();
        if (bioModelInfos != null) {
            for (int i = 0; i < bioModelInfos.length; i++) {
                bioModelInfoHash.put(bioModelInfos[i].getVersion().getVersionKey(), bioModelInfos[i]);
            }
        }
    }
    // 
    // Geometries
    // 
    {
        geoInfoHash.clear();
        GeometryInfo[] geometryInfos = vcInfoContainer.getGeometryInfos();
        if (geometryInfos != null) {
            for (int i = 0; i < geometryInfos.length; i++) {
                geoInfoHash.put(geometryInfos[i].getVersion().getVersionKey(), geometryInfos[i]);
            }
        }
    }
    // 
    // MathModelInfos
    // 
    {
        mathModelInfoHash.clear();
        MathModelInfo[] mathModelInfos = vcInfoContainer.getMathModelInfos();
        if (mathModelInfos != null) {
            for (int i = 0; i < mathModelInfos.length; i++) {
                mathModelInfoHash.put(mathModelInfos[i].getVersion().getVersionKey(), mathModelInfos[i]);
            }
        }
    }
    // 
    // VCImageInfos
    // 
    {
        imgInfoHash.clear();
        VCImageInfo[] vcImageInfos = vcInfoContainer.getVCImageInfos();
        if (vcImageInfos != null) {
            for (int i = 0; i < vcImageInfos.length; i++) {
                imgInfoHash.put(vcImageInfos[i].getVersion().getVersionKey(), vcImageInfos[i]);
            }
        }
    }
    fireDatabaseRefresh(new DatabaseEvent(this, DatabaseEvent.REFRESH, null, null));
}
Also used : VCInfoContainer(org.vcell.util.document.VCInfoContainer) PerformanceData(cbit.rmi.event.PerformanceData) PerformanceMonitorEvent(cbit.rmi.event.PerformanceMonitorEvent) PerformanceDataEntry(cbit.rmi.event.PerformanceDataEntry) DataAccessException(org.vcell.util.DataAccessException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)

Example 2 with VCInfoContainer

use of org.vcell.util.document.VCInfoContainer in project vcell by virtualcell.

the class NagiosVCellMonitor method checkVCell.

private CheckResults checkVCell(VCELL_CHECK_LEVEL checkLevel, String rmiHostName, int rmiPort, String rmiBootstrapStubName, String vcellNagiosPassword, int criticalTimeout, int monitorPort) throws Exception {
    SimulationStatusPersistent lastSimStatus = null;
    String vcellVersion = null;
    TreeMap<VCELL_CHECK_LEVEL, Long> levelTimesMillisec = new TreeMap<NagiosVCellMonitor.VCELL_CHECK_LEVEL, Long>();
    long startTime = System.currentTimeMillis();
    VCellConnection vcellConnection = null;
    try {
        if (rmiHostName == null || rmiPort == -1) {
            throw new UnexpectedTestStateException("Host name/ip and rmiPort required for testing, rmihostname=" + rmiHostName + " rmiport=" + rmiPort);
        }
        String rmiUrl = "//" + rmiHostName + ":" + rmiPort + "/" + rmiBootstrapStubName;
        VCellBootstrap vcellBootstrap = null;
        try {
            vcellBootstrap = (VCellBootstrap) Naming.lookup(rmiUrl);
        } catch (Exception e) {
            throw new UnexpectedTestStateException("Error during bootstrap lookup, " + e.getClass().getSimpleName() + " " + e.getMessage());
        }
        vcellVersion = vcellBootstrap.getVCellSoftwareVersion();
        levelTimesMillisec.put(VCELL_CHECK_LEVEL.RMI_ONLY_0, System.currentTimeMillis() - startTime);
        if (checkLevel.ordinal() >= VCELL_CHECK_LEVEL.CONNECT_1.ordinal()) {
            if (vcellNagiosPassword == null) {
                throw new UnexpectedTestStateException("vcellNagios Password required for " + VCELL_CHECK_LEVEL.CONNECT_1.toString() + " and above");
            }
            UserLoginInfo userLoginInfo = new UserLoginInfo(VCELL_NAGIOS_USER, new DigestedPassword(vcellNagiosPassword));
            vcellConnection = vcellBootstrap.getVCellConnection(userLoginInfo);
            levelTimesMillisec.put(VCELL_CHECK_LEVEL.CONNECT_1, System.currentTimeMillis() - startTime - levelTimesMillisec.get(VCELL_CHECK_LEVEL.RMI_ONLY_0));
            if (checkLevel.ordinal() >= VCELL_CHECK_LEVEL.INFOS_2.ordinal()) {
                VCInfoContainer vcInfoContainer = vcellConnection.getUserMetaDbServer().getVCInfoContainer();
                levelTimesMillisec.put(VCELL_CHECK_LEVEL.INFOS_2, System.currentTimeMillis() - startTime - levelTimesMillisec.get(VCELL_CHECK_LEVEL.CONNECT_1));
                if (checkLevel.ordinal() >= VCELL_CHECK_LEVEL.LOAD_3.ordinal()) {
                    KeyValue bioModelKey = null;
                    final String testModelName = "Solver Suite 5.1 (BETA only ode)";
                    for (BioModelInfo bioModelInfo : vcInfoContainer.getBioModelInfos()) {
                        if (userLoginInfo.getUserName().equals(bioModelInfo.getVersion().getOwner().getName()) && bioModelInfo.getVersion().getName().equals(testModelName)) {
                            bioModelKey = bioModelInfo.getVersion().getVersionKey();
                            break;
                        }
                    }
                    BigString bioModelXML = vcellConnection.getUserMetaDbServer().getBioModelXML(bioModelKey);
                    BioModel bioModel = XmlHelper.XMLToBioModel(new XMLSource(bioModelXML.toString()));
                    bioModel.refreshDependencies();
                    levelTimesMillisec.put(VCELL_CHECK_LEVEL.LOAD_3, System.currentTimeMillis() - startTime - levelTimesMillisec.get(VCELL_CHECK_LEVEL.INFOS_2));
                    if (checkLevel.ordinal() >= VCELL_CHECK_LEVEL.DATA_4.ordinal()) {
                        final String testSimContextName = "non-spatial ODE";
                        SimulationContext simulationContext = bioModel.getSimulationContext(testSimContextName);
                        final String testSimName = "Copy of combined ida/cvode";
                        Simulation simulation = simulationContext.getSimulation(testSimName);
                        if (simulation == null) {
                            throw new UnexpectedTestStateException("Couldn't find sim '" + testSimName + "' for " + checkLevel.toString());
                        }
                        VCSimulationDataIdentifier vcSimulationDataIdentifier = new VCSimulationDataIdentifier(simulation.getSimulationInfo().getAuthoritativeVCSimulationIdentifier(), 0);
                        ArrayList<AnnotatedFunction> outputFunctionsList = simulationContext.getOutputFunctionContext().getOutputFunctionsList();
                        OutputContext outputContext = new OutputContext(outputFunctionsList.toArray(new AnnotatedFunction[outputFunctionsList.size()]));
                        double[] times = vcellConnection.getDataSetController().getDataSetTimes(vcSimulationDataIdentifier);
                        ODESimData odeSimData = vcellConnection.getDataSetController().getODEData(vcSimulationDataIdentifier);
                        levelTimesMillisec.put(VCELL_CHECK_LEVEL.DATA_4, System.currentTimeMillis() - startTime - levelTimesMillisec.get(VCELL_CHECK_LEVEL.LOAD_3));
                        if (checkLevel.ordinal() >= VCELL_CHECK_LEVEL.RUN_5.ordinal()) {
                            KeyValue copy1Key = null;
                            KeyValue copy2Key = null;
                            VCSimulationIdentifier testRunSimID = null;
                            try {
                                if (simulationContext.getSimulations().length != 1) {
                                    throw new UnexpectedTestStateException("Expecting only 1 sim to be copied for " + checkLevel.toString());
                                }
                                SimulationStatusPersistent simulationStatus = vcellConnection.getUserMetaDbServer().getSimulationStatus(simulation.getVersion().getVersionKey());
                                if (!simulationStatus.isCompleted()) {
                                    throw new UnexpectedTestStateException("Expecting completed sim to copy for " + checkLevel.toString());
                                }
                                String copyModelName = testModelName + "_" + rmiHostName + "_rmi" + rmiPort + "_siteprt" + monitorPort;
                                boolean bForceCleanup = true;
                                while (true) {
                                    boolean bMessy = false;
                                    for (BioModelInfo bioModelInfo : vcInfoContainer.getBioModelInfos()) {
                                        if (userLoginInfo.getUserName().equals(bioModelInfo.getVersion().getOwner().getName()) && bioModelInfo.getVersion().getName().equals(copyModelName)) {
                                            bMessy = true;
                                            if (bForceCleanup) {
                                                try {
                                                    vcellConnection.getUserMetaDbServer().deleteBioModel(bioModelInfo.getVersion().getVersionKey());
                                                } catch (Exception e) {
                                                    e.printStackTrace();
                                                }
                                            } else {
                                                throw new MessyTestEnvironmentException("Messy test environment, not expecting " + copyModelName + " and couldn't cleanup");
                                            }
                                        }
                                    }
                                    if (!bMessy) {
                                        break;
                                    }
                                    // get new vcInfoContainer without cleaned-up model
                                    vcInfoContainer = vcellConnection.getUserMetaDbServer().getVCInfoContainer();
                                    bForceCleanup = false;
                                }
                                BigString copyBioModelXMLStr = vcellConnection.getUserMetaDbServer().saveBioModelAs(bioModelXML, copyModelName, null);
                                BioModel copyBioModel = XmlHelper.XMLToBioModel(new XMLSource(copyBioModelXMLStr.toString()));
                                copy1Key = copyBioModel.getVersion().getVersionKey();
                                copyBioModel.refreshDependencies();
                                Simulation copySim = copyBioModel.getSimulationContext(testSimContextName).copySimulation(copyBioModel.getSimulationContext(testSimContextName).getSimulation(testSimName));
                                final String copyTestSimName = "test";
                                copySim.setName(copyTestSimName);
                                copyBioModel.refreshDependencies();
                                copyBioModelXMLStr = new BigString(XmlHelper.bioModelToXML(copyBioModel));
                                copyBioModelXMLStr = vcellConnection.getUserMetaDbServer().saveBioModel(copyBioModelXMLStr, null);
                                copyBioModel = XmlHelper.XMLToBioModel(new XMLSource(copyBioModelXMLStr.toString()));
                                copy2Key = copyBioModel.getVersion().getVersionKey();
                                copyBioModel.refreshDependencies();
                                Simulation newSimulation = copyBioModel.getSimulationContext(testSimContextName).getSimulation(copyTestSimName);
                                simulationStatus = vcellConnection.getUserMetaDbServer().getSimulationStatus(newSimulation.getVersion().getVersionKey());
                                if (simulationStatus != null && !simulationStatus.isNeverRan()) {
                                    throw new UnexpectedTestStateException("Expecting new sim to have 'never ran' status for " + checkLevel.toString());
                                }
                                testRunSimID = new VCSimulationIdentifier(newSimulation.getVersion().getVersionKey(), copyBioModel.getVersion().getOwner());
                                vcellConnection.getSimulationController().startSimulation(testRunSimID, 1);
                                lastSimStatus = simulationStatus;
                                MessageEvent[] messageEvents = null;
                                while (simulationStatus == null || (!simulationStatus.isStopped() && !simulationStatus.isCompleted() && !simulationStatus.isFailed())) {
                                    Thread.sleep(200);
                                    if (((System.currentTimeMillis() - startTime) / 1000) > criticalTimeout) {
                                        vcellConnection.getSimulationController().stopSimulation(testRunSimID);
                                        vcellConnection.getMessageEvents();
                                        break;
                                    }
                                    simulationStatus = vcellConnection.getUserMetaDbServer().getSimulationStatus(newSimulation.getVersion().getVersionKey());
                                    if (simulationStatus != null && !simulationStatus.toString().equals((lastSimStatus == null ? null : lastSimStatus.toString()))) {
                                        lastSimStatus = simulationStatus;
                                    }
                                    if (simulationStatus != null && simulationStatus.isFailed()) {
                                        throw new Exception("time " + ((System.currentTimeMillis() - startTime) / 1000) + ", Sim execution failed key:" + testRunSimID.getSimulationKey() + " sim " + newSimulation.getName() + " model " + copyBioModel.getVersion().getName() + " messg " + simulationStatus.getFailedMessage());
                                    }
                                    messageEvents = vcellConnection.getMessageEvents();
                                }
                            } finally {
                                try {
                                    if (copy1Key != null) {
                                        vcellConnection.getUserMetaDbServer().deleteBioModel(copy1Key);
                                    }
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }
                                try {
                                    if (copy2Key != null) {
                                        vcellConnection.getUserMetaDbServer().deleteBioModel(copy2Key);
                                    }
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }
                                if (testRunSimID != null) {
                                    deleteSimData(testRunSimID);
                                }
                            }
                            levelTimesMillisec.put(VCELL_CHECK_LEVEL.RUN_5, System.currentTimeMillis() - startTime - levelTimesMillisec.get(VCELL_CHECK_LEVEL.DATA_4));
                        }
                    }
                }
            }
        }
        return new CheckResults(vcellVersion, levelTimesMillisec, lastSimStatus, System.currentTimeMillis() - startTime, null);
    } catch (Exception e) {
        return new CheckResults(vcellVersion, levelTimesMillisec, lastSimStatus, System.currentTimeMillis() - startTime, e);
    } finally {
        vcellConnection = null;
    }
}
Also used : VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) KeyValue(org.vcell.util.document.KeyValue) MessageEvent(cbit.rmi.event.MessageEvent) VCellBootstrap(cbit.vcell.server.VCellBootstrap) BigString(org.vcell.util.BigString) ODESimData(cbit.vcell.solver.ode.ODESimData) DigestedPassword(org.vcell.util.document.UserLoginInfo.DigestedPassword) BigString(org.vcell.util.BigString) VCInfoContainer(org.vcell.util.document.VCInfoContainer) AnnotatedFunction(cbit.vcell.solver.AnnotatedFunction) VCellConnection(cbit.vcell.server.VCellConnection) BioModelInfo(org.vcell.util.document.BioModelInfo) SimulationStatusPersistent(cbit.vcell.server.SimulationStatusPersistent) TreeMap(java.util.TreeMap) SimulationContext(cbit.vcell.mapping.SimulationContext) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) IOException(java.io.IOException) OutputContext(cbit.vcell.simdata.OutputContext) Simulation(cbit.vcell.solver.Simulation) BioModel(cbit.vcell.biomodel.BioModel) UserLoginInfo(org.vcell.util.document.UserLoginInfo) XMLSource(cbit.vcell.xml.XMLSource)

Example 3 with VCInfoContainer

use of org.vcell.util.document.VCInfoContainer in project vcell by virtualcell.

the class HealthService method loginLoop.

private void loginLoop() {
    try {
        Thread.sleep(LOGIN_LOOP_START_DELAY);
    } catch (InterruptedException e1) {
    }
    while (true) {
        long id = loginStartEvent();
        try {
            UserLoginInfo userLoginInfo = new UserLoginInfo(testUserid, testPassword);
            RemoteProxyVCellConnectionFactory vcellConnectionFactory = new RemoteProxyVCellConnectionFactory(host, port, userLoginInfo);
            VCellConnection vcellConnection = vcellConnectionFactory.createVCellConnection();
            VCInfoContainer vcInfoContainer = vcellConnection.getUserMetaDbServer().getVCInfoContainer();
            loginSuccess(id);
        } catch (Throwable e) {
            loginFailed(id, e.getMessage());
        }
        try {
            Thread.sleep(LOGIN_LOOP_SLEEP);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
Also used : VCellConnection(cbit.vcell.server.VCellConnection) RemoteProxyVCellConnectionFactory(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory) VCInfoContainer(org.vcell.util.document.VCInfoContainer) UserLoginInfo(org.vcell.util.document.UserLoginInfo)

Example 4 with VCInfoContainer

use of org.vcell.util.document.VCInfoContainer in project vcell by virtualcell.

the class RemoteProxyVCellConnectionFactoryTest method test.

@Test
public void test() throws IOException {
    BiomodelRepresentation[] biomodelReps = apiClient.getBioModels(new BioModelsQuerySpec());
    assertNotNull(biomodelReps);
    VCInfoContainer vcInfoContainer = null;
    try {
        vcInfoContainer = vcConn.getUserMetaDbServer().getVCInfoContainer();
    } catch (DataAccessException | RemoteProxyException e) {
        e.printStackTrace();
        fail("exception");
    }
    assertNotNull(vcInfoContainer);
}
Also used : BiomodelRepresentation(org.vcell.api.common.BiomodelRepresentation) VCInfoContainer(org.vcell.util.document.VCInfoContainer) BioModelsQuerySpec(org.vcell.api.client.query.BioModelsQuerySpec) DataAccessException(org.vcell.util.DataAccessException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException) Test(org.junit.Test)

Example 5 with VCInfoContainer

use of org.vcell.util.document.VCInfoContainer in project vcell by virtualcell.

the class DbDriver method getVCInfoContainer.

/**
 * Insert the method's description here.
 * Creation date: (9/24/2003 12:54:32 PM)
 * @return cbit.vcell.modeldb.VCInfoContainer
 */
public static VCInfoContainer getVCInfoContainer(User user, Connection con, DatabaseSyntax dbSyntax) throws SQLException, DataAccessException {
    VCInfoContainer results = null;
    // 
    VCImageInfo[] vcImageInfos = null;
    GeometryInfo[] geometryInfos = null;
    MathModelInfo[] mathModelInfos = null;
    BioModelInfo[] bioModelInfos = null;
    // 
    StringBuffer sql = null;
    String special = null;
    ResultSet rset = null;
    boolean enableSpecial = true;
    boolean enableDistinct = true;
    Statement stmt = con.createStatement();
    try {
        // 
        // BioModelInfos
        // 
        {
            double beginTime = System.currentTimeMillis();
            special = " ORDER BY " + BioModelTable.table.name.getQualifiedColName() + "," + BioModelTable.table.versionBranchID.getQualifiedColName() + "," + BioModelTable.table.versionDate.getQualifiedColName();
            sql = new StringBuffer(BioModelTable.table.getInfoSQL(user, null, (enableSpecial ? special : null), dbSyntax));
            sql.insert(7, Table.SQL_GLOBAL_HINT);
            rset = stmt.executeQuery(sql.toString());
            ArrayList<BioModelInfo> tempInfos = new ArrayList<BioModelInfo>();
            Set<String> distinctV = new HashSet<String>();
            while (rset.next()) {
                BioModelInfo versionInfo = (BioModelInfo) BioModelTable.table.getInfo(rset, con, dbSyntax);
                if (!distinctV.contains(versionInfo.getVersion().getVersionKey().toString())) {
                    tempInfos.add(versionInfo);
                    distinctV.add(versionInfo.getVersion().getVersionKey().toString());
                }
            }
            rset.close();
            if (tempInfos.size() > 0) {
                bioModelInfos = new BioModelInfo[tempInfos.size()];
                tempInfos.toArray(bioModelInfos);
            }
            if (lg.isInfoEnabled()) {
                lg.info("BioModelInfo Time=" + (((double) System.currentTimeMillis() - beginTime) / (double) 1000));
            }
        }
        // 
        // MathModelInfos
        // 
        {
            double beginTime = System.currentTimeMillis();
            special = " ORDER BY " + MathModelTable.table.name.getQualifiedColName() + "," + MathModelTable.table.versionBranchID.getQualifiedColName() + "," + MathModelTable.table.versionDate.getQualifiedColName();
            sql = new StringBuffer(MathModelTable.table.getInfoSQL(user, null, (enableSpecial ? special : null), dbSyntax));
            sql.insert(7, Table.SQL_GLOBAL_HINT);
            rset = stmt.executeQuery(sql.toString());
            ArrayList<MathModelInfo> tempInfos = new ArrayList<MathModelInfo>();
            Set<String> distinctV = new HashSet<String>();
            while (rset.next()) {
                MathModelInfo versionInfo = (MathModelInfo) MathModelTable.table.getInfo(rset, con, dbSyntax);
                if (!distinctV.contains(versionInfo.getVersion().getVersionKey().toString())) {
                    tempInfos.add(versionInfo);
                    distinctV.add(versionInfo.getVersion().getVersionKey().toString());
                }
            }
            rset.close();
            if (tempInfos.size() > 0) {
                mathModelInfos = new MathModelInfo[tempInfos.size()];
                tempInfos.toArray(mathModelInfos);
            }
            if (lg.isInfoEnabled()) {
                lg.info("MathModelInfo Time=" + (((double) System.currentTimeMillis() - beginTime) / (double) 1000));
            }
        }
        // 
        // VCImageInfos
        // 
        {
            double beginTime = System.currentTimeMillis();
            special = " ORDER BY " + ImageTable.table.name.getQualifiedColName() + "," + ImageTable.table.versionBranchID.getQualifiedColName() + "," + ImageTable.table.versionDate.getQualifiedColName();
            sql = new StringBuffer(ImageTable.table.getInfoSQL(user, null, (enableSpecial ? special : null), true, dbSyntax));
            sql.insert(7, Table.SQL_GLOBAL_HINT);
            rset = stmt.executeQuery(sql.toString());
            ArrayList<VCImageInfo> tempInfos = new ArrayList<VCImageInfo>();
            Set<String> distinctV = new HashSet<String>();
            while (rset.next()) {
                VCImageInfo versionInfo = (VCImageInfo) ImageTable.table.getInfo(rset, con, dbSyntax);
                if (!distinctV.contains(versionInfo.getVersion().getVersionKey().toString())) {
                    tempInfos.add(versionInfo);
                    distinctV.add(versionInfo.getVersion().getVersionKey().toString());
                }
            }
            rset.close();
            if (tempInfos.size() > 0) {
                vcImageInfos = new VCImageInfo[tempInfos.size()];
                tempInfos.toArray(vcImageInfos);
            }
            if (lg.isInfoEnabled()) {
                lg.info("ImageInfo Time=" + (((double) System.currentTimeMillis() - beginTime) / (double) 1000));
            }
        }
        // 
        // GeometeryInfos
        // 
        {
            double beginTime = System.currentTimeMillis();
            special = " ORDER BY " + GeometryTable.table.name.getQualifiedColName() + "," + GeometryTable.table.versionBranchID.getQualifiedColName() + "," + GeometryTable.table.versionDate.getQualifiedColName();
            sql = new StringBuffer(GeometryTable.table.getInfoSQL(user, null, (enableSpecial ? special : null), true, dbSyntax));
            sql.insert(7, Table.SQL_GLOBAL_HINT + (enableDistinct ? "DISTINCT " : ""));
            rset = stmt.executeQuery(sql.toString());
            ArrayList<GeometryInfo> tempInfos = new ArrayList<GeometryInfo>();
            Set<String> distinctV = new HashSet<String>();
            while (rset.next()) {
                GeometryInfo versionInfo = (GeometryInfo) GeometryTable.table.getInfo(rset, con);
                if (!distinctV.contains(versionInfo.getVersion().getVersionKey().toString())) {
                    tempInfos.add(versionInfo);
                    distinctV.add(versionInfo.getVersion().getVersionKey().toString());
                }
            }
            rset.close();
            if (tempInfos.size() > 0) {
                geometryInfos = new GeometryInfo[tempInfos.size()];
                tempInfos.toArray(geometryInfos);
            }
            if (lg.isInfoEnabled()) {
                lg.info("GeometryInfo Time=" + (((double) System.currentTimeMillis() - beginTime) / (double) 1000));
            }
        }
    } finally {
        if (stmt != null) {
            stmt.close();
        }
    }
    results = new VCInfoContainer(user, vcImageInfos, geometryInfos, mathModelInfos, bioModelInfos);
    return results;
}
Also used : ResultSet(java.sql.ResultSet) Set(java.util.Set) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) BioModelInfo(org.vcell.util.document.BioModelInfo) ArrayList(java.util.ArrayList) MathModelInfo(org.vcell.util.document.MathModelInfo) VCInfoContainer(org.vcell.util.document.VCInfoContainer) GeometryInfo(cbit.vcell.geometry.GeometryInfo) ResultSet(java.sql.ResultSet) VCImageInfo(cbit.image.VCImageInfo)

Aggregations

VCInfoContainer (org.vcell.util.document.VCInfoContainer)6 VCellConnection (cbit.vcell.server.VCellConnection)3 BioModelInfo (org.vcell.util.document.BioModelInfo)3 UserLoginInfo (org.vcell.util.document.UserLoginInfo)3 MessageEvent (cbit.rmi.event.MessageEvent)2 BioModel (cbit.vcell.biomodel.BioModel)2 SimulationContext (cbit.vcell.mapping.SimulationContext)2 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)2 SimulationStatusPersistent (cbit.vcell.server.SimulationStatusPersistent)2 VCellBootstrap (cbit.vcell.server.VCellBootstrap)2 OutputContext (cbit.vcell.simdata.OutputContext)2 AnnotatedFunction (cbit.vcell.solver.AnnotatedFunction)2 Simulation (cbit.vcell.solver.Simulation)2 VCSimulationDataIdentifier (cbit.vcell.solver.VCSimulationDataIdentifier)2 VCSimulationIdentifier (cbit.vcell.solver.VCSimulationIdentifier)2 ODESimData (cbit.vcell.solver.ode.ODESimData)2 XMLSource (cbit.vcell.xml.XMLSource)2 BigString (org.vcell.util.BigString)2 DataAccessException (org.vcell.util.DataAccessException)2 KeyValue (org.vcell.util.document.KeyValue)2