Search in sources :

Example 21 with BioModelInfo

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

the class BioModelTestReader method visitBioModel.

public void visitBioModel(BioModel bioModel, PrintStream logFilePrintStream) {
    KeyValue currentKey = bioModel.getVersion().getVersionKey();
    BioModelInfo bmInfo = bioModelInfoHash.get(currentKey);
    logFilePrintStream.append(" == SUCEEDED IN READING BIOMODEL " + bmInfo.getVersion().getName() + "; key : " + currentKey.toString() + "\n");
    unparsedBioModels.remove(currentKey);
    for (Iterator<KeyValue> iterator = unparsedBioModels.iterator(); iterator.hasNext(); ) {
        KeyValue key = iterator.next();
        bmInfo = bioModelInfoHash.get(key);
        logFilePrintStream.append(" == FAILED TO READ BIOMODEL : " + bmInfo.getVersion().getName() + "; key : " + key.toString() + "\n");
        iterator.remove();
    }
    return;
}
Also used : KeyValue(org.vcell.util.document.KeyValue) BioModelInfo(org.vcell.util.document.BioModelInfo)

Example 22 with BioModelInfo

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

the class RuleBasedTest method main.

public static void main(String[] args) {
    try {
        PropertyLoader.loadProperties();
    } catch (Exception e) {
        e.printStackTrace();
    }
    final int numTrials = 40;
    VCDatabaseVisitor vcDatabaseVisitor = new VCDatabaseVisitor() {

        @Override
        public void visitMathModel(MathModel mathModel, PrintStream logFilePrintStream) {
            throw new IllegalArgumentException("Not Implemented");
        }

        @Override
        public void visitGeometry(Geometry geometry, PrintStream logFilePrintStream) {
            throw new IllegalArgumentException("Not Implemented");
        }

        @Override
        public void visitBioModel(BioModel bioModel, PrintStream logFilePrintStream) {
            SimulationContext[] simulationContexts = bioModel.getSimulationContexts();
            for (SimulationContext simContext : simulationContexts) {
                if ((simContext.getApplicationType() == Application.NETWORK_STOCHASTIC) && simContext.getGeometry().getDimension() == 0) {
                    File baseDirectory = createDirFile(simContext);
                    try {
                        checkNonspatialStochasticSimContext(simContext, baseDirectory, numTrials);
                    } catch (Exception e) {
                        e.printStackTrace();
                        if (!e.getMessage().contains("Only Mass Action Kinetics supported ")) {
                            writeMessageTofile(baseDirectory, e.getMessage());
                        }
                    }
                }
            }
        }

        @Override
        public boolean filterMathModel(MathModelInfo mathModelInfo) {
            return false;
        }

        @Override
        public boolean filterGeometry(GeometryInfo geometryInfo) {
            return false;
        }

        @Override
        public boolean filterBioModel(BioModelInfo bioModelInfo) {
            return // bioModelInfo.getVersion().getName().equals("model");
            bioModelInfo.getVersion().getName().equals("simpleModel_Network_orig");
        }
    };
    String currentUserID = "schaff";
    String[] allUsers = new String[] { /*-all*/
    currentUserID, "-" };
    VCDatabaseScanner.scanBioModels(allUsers, vcDatabaseVisitor, false);
}
Also used : PrintStream(java.io.PrintStream) MathModel(cbit.vcell.mathmodel.MathModel) BioModelInfo(org.vcell.util.document.BioModelInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) SimulationContext(cbit.vcell.mapping.SimulationContext) Geometry(cbit.vcell.geometry.Geometry) BioModel(cbit.vcell.biomodel.BioModel) GeometryInfo(cbit.vcell.geometry.GeometryInfo) VCDatabaseVisitor(cbit.vcell.modeldb.VCDatabaseVisitor) File(java.io.File)

Example 23 with BioModelInfo

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

the class LoginChecker method attemptLogin.

private static boolean attemptLogin(SiteInfo si, String user, String password) {
    long start = 0;
    try {
        if (VERBOSE) {
            start = System.currentTimeMillis();
        }
        String url = si.bootStrapUrl();
        VCellBootstrap vcellBootstrap = (VCellBootstrap) java.rmi.Naming.lookup(url);
        DigestedPassword dp = new UserLoginInfo.DigestedPassword(password);
        UserLoginInfo uli = new UserLoginInfo(user, dp);
        VCellConnection vcellConnection = vcellBootstrap.getVCellConnection(uli);
        if (vcellConnection == null) {
            if (VERBOSE) {
                System.out.println("no connection on " + si + " in " + elapsed(start) + " seconds");
            }
            return false;
        }
        UserMetaDbServer dataServer = vcellConnection.getUserMetaDbServer();
        @SuppressWarnings("unused") BioModelInfo[] bmi = dataServer.getBioModelInfos(true);
        if (VERBOSE) {
            System.out.println("success on " + si + " in " + elapsed(start) + " seconds");
        }
        return true;
    } catch (MalformedURLException e) {
        e.printStackTrace();
        throw new Error("bad code");
    } catch (Exception e) {
        if (VERBOSE) {
            System.out.println("failed in " + elapsed(start) + " seconds");
        }
        e.printStackTrace();
        return false;
    }
}
Also used : VCellConnection(cbit.vcell.server.VCellConnection) UserMetaDbServer(cbit.vcell.server.UserMetaDbServer) MalformedURLException(java.net.MalformedURLException) VCellBootstrap(cbit.vcell.server.VCellBootstrap) BioModelInfo(org.vcell.util.document.BioModelInfo) DigestedPassword(org.vcell.util.document.UserLoginInfo.DigestedPassword) MalformedURLException(java.net.MalformedURLException) UserLoginInfo(org.vcell.util.document.UserLoginInfo)

Example 24 with BioModelInfo

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

the class ClientRobot method run.

/**
 * Insert the method's description here.
 * Creation date: (3/8/01 3:04:15 PM)
 */
public void run() {
    try {
        String[] args = { host, userid, password };
        setManagerManager(cbit.vcell.client.test.ClientTester.mainInit(args, "ClientRobot", null));
        for (int i = 0; i < 10; i++) {
            log.print("Robot " + getName() + "starting loop : " + i);
            BioModel bioModel = XmlHelper.XMLToBioModel(new XMLSource(bioModelFile));
            String newName = "bioModel_" + getName() + "_" + Math.random();
            log.print("Saving bioModel \"" + newName + "\"");
            getManagerManager().getDocumentManager().saveAsNew(bioModel, newName, null);
            BioModelInfo[] bioModelInfos = getManagerManager().getDocumentManager().getBioModelInfos();
            if (bioModelInfos != null && bioModelInfos.length > 0) {
                for (int j = 0; j < bioModelInfos.length; j++) {
                    log.print("bioModelInfo[" + j + "] = " + bioModelInfos[j]);
                }
            }
        }
    } catch (Throwable e) {
        log.exception(e);
    } finally {
        log.alert("Robot " + getName() + " exiting");
    }
}
Also used : BioModel(cbit.vcell.biomodel.BioModel) BioModelInfo(org.vcell.util.document.BioModelInfo) XMLSource(cbit.vcell.xml.XMLSource)

Example 25 with BioModelInfo

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

the class SBMLExportTest method getBiomodelByName.

static BioModel getBiomodelByName(VCellConnection vcn, String name) throws RemoteProxyException, DataAccessException, XmlParseException {
    EscapedName eName = new EscapedName(name);
    UserMetaDbServer dataServer = vcn.getUserMetaDbServer();
    for (BioModelInfo bmi : dataServer.getBioModelInfos(false)) {
        String mName = bmi.getVersion().getName();
        if (eName.matches(mName)) {
            KeyValue bioModelKey = bmi.getVersion().getVersionKey();
            BigString bioModelXML = dataServer.getBioModelXML(bioModelKey);
            BioModel bioModel = XmlHelper.XMLToBioModel(new XMLSource(bioModelXML.toString()));
            return bioModel;
        }
    }
    // if not found, list what's available
    for (BioModelInfo bmi : dataServer.getBioModelInfos(false)) {
        String mName = bmi.getVersion().getName();
        System.out.println(mName);
    }
    return null;
}
Also used : UserMetaDbServer(cbit.vcell.server.UserMetaDbServer) KeyValue(org.vcell.util.document.KeyValue) BioModel(cbit.vcell.biomodel.BioModel) BioModelInfo(org.vcell.util.document.BioModelInfo) BigString(org.vcell.util.BigString) BigString(org.vcell.util.BigString) XMLSource(cbit.vcell.xml.XMLSource)

Aggregations

BioModelInfo (org.vcell.util.document.BioModelInfo)79 DataAccessException (org.vcell.util.DataAccessException)38 MathModelInfo (org.vcell.util.document.MathModelInfo)37 BioModel (cbit.vcell.biomodel.BioModel)25 GeometryInfo (cbit.vcell.geometry.GeometryInfo)22 KeyValue (org.vcell.util.document.KeyValue)18 SimulationContext (cbit.vcell.mapping.SimulationContext)17 VCDocumentInfo (org.vcell.util.document.VCDocumentInfo)15 BigString (org.vcell.util.BigString)14 User (org.vcell.util.document.User)14 Vector (java.util.Vector)13 Simulation (cbit.vcell.solver.Simulation)12 XmlParseException (cbit.vcell.xml.XmlParseException)12 SQLException (java.sql.SQLException)12 XMLSource (cbit.vcell.xml.XMLSource)10 MathModel (cbit.vcell.mathmodel.MathModel)9 Hashtable (java.util.Hashtable)9 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)9 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)8 Geometry (cbit.vcell.geometry.Geometry)7