Search in sources :

Example 26 with XmlParseException

use of cbit.vcell.xml.XmlParseException in project vcell by virtualcell.

the class ClientDocumentManager method save.

/**
 * Insert the method's description here.
 * Creation date: (2/5/01 4:58:40 PM)
 */
public VCImage save(VCImage vcImage) throws DataAccessException {
    try {
        String vcImageXML = null;
        try {
            vcImageXML = XmlHelper.imageToXML(vcImage);
        } catch (XmlParseException e) {
            e.printStackTrace(System.out);
            throw new DataAccessException(e.getMessage());
        }
        String savedVCImageXML = sessionManager.getUserMetaDbServer().saveVCImage(new BigString(vcImageXML)).toString();
        VCImage savedVCImage = null;
        try {
            savedVCImage = XmlHelper.XMLToImage(savedVCImageXML);
        } catch (XmlParseException e) {
            e.printStackTrace(System.out);
            throw new DataAccessException(e.getMessage());
        }
        savedVCImage.refreshDependencies();
        KeyValue savedKey = savedVCImage.getVersion().getVersionKey();
        if (xmlHash.get(savedKey) == null) {
            xmlHash.put(savedKey, savedVCImageXML);
        }
        try {
            ISize size = new ISize(savedVCImage.getNumX(), savedVCImage.getNumY(), savedVCImage.getNumZ());
            GIFImage browseData = BrowseImage.makeBrowseGIFImage(savedVCImage);
            VCImageInfo savedVCImageInfo = new VCImageInfo(savedVCImage.getVersion(), size, savedVCImage.getExtent(), browseData, VCellSoftwareVersion.fromSystemProperty());
            imgInfoHash.put(savedKey, savedVCImageInfo);
            fireDatabaseInsert(new DatabaseEvent(this, DatabaseEvent.INSERT, null, savedVCImageInfo));
        } catch (Exception e) {
            e.printStackTrace(System.out);
        }
        return savedVCImage;
    } catch (RemoteProxyException e) {
        e.printStackTrace(System.out);
        throw new DataAccessException(VCellErrorMessages.FAIL_SAVE_MESSAGE + "\n\n" + e.getMessage());
    }
}
Also used : GIFImage(cbit.image.GIFImage) KeyValue(org.vcell.util.document.KeyValue) ISize(org.vcell.util.ISize) VCImage(cbit.image.VCImage) BigString(org.vcell.util.BigString) XmlParseException(cbit.vcell.xml.XmlParseException) BigString(org.vcell.util.BigString) DataAccessException(org.vcell.util.DataAccessException) VCImageInfo(cbit.image.VCImageInfo) PermissionException(org.vcell.util.PermissionException) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) XmlParseException(cbit.vcell.xml.XmlParseException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException) DataAccessException(org.vcell.util.DataAccessException) ExpressionException(cbit.vcell.parser.ExpressionException) MathException(cbit.vcell.math.MathException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)

Example 27 with XmlParseException

use of cbit.vcell.xml.XmlParseException in project vcell by virtualcell.

the class ClientDocumentManager method saveAsNew.

/**
 * Insert the method's description here.
 * Creation date: (1/19/01 11:27:52 AM)
 */
public Geometry saveAsNew(Geometry geometry, java.lang.String newName) throws DataAccessException {
    try {
        String geometryXML = null;
        try {
            geometryXML = XmlHelper.geometryToXML(geometry);
        } catch (XmlParseException e) {
            e.printStackTrace(System.out);
            throw new DataAccessException(e.getMessage());
        }
        if (isChanged(geometry, geometryXML) == false) {
            System.out.println("<<<<<WARNING>>>>>>>ClientDocumentManger.save(Geometry), called on unchanged geometry");
            return geometry;
        }
        String savedGeometryXML = sessionManager.getUserMetaDbServer().saveGeometryAs(new BigString(geometryXML), newName).toString();
        Geometry savedGeometry = getGeometryFromDatabaseXML(savedGeometryXML);
        KeyValue savedKey = savedGeometry.getVersion().getVersionKey();
        if (xmlHash.get(savedKey) == null) {
            xmlHash.put(savedKey, savedGeometryXML);
        }
        updateGeometryRelatedHashes(savedGeometry);
        return savedGeometry;
    } catch (RemoteProxyException e) {
        e.printStackTrace(System.out);
        throw new DataAccessException(VCellErrorMessages.FAIL_SAVE_MESSAGE + "\n\n" + e.getMessage());
    }
}
Also used : Geometry(cbit.vcell.geometry.Geometry) KeyValue(org.vcell.util.document.KeyValue) BigString(org.vcell.util.BigString) XmlParseException(cbit.vcell.xml.XmlParseException) BigString(org.vcell.util.BigString) DataAccessException(org.vcell.util.DataAccessException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)

Example 28 with XmlParseException

use of cbit.vcell.xml.XmlParseException in project vcell by virtualcell.

the class ClientDocumentManager method getGeometry.

/**
 * Insert the method's description here.
 * Creation date: (11/14/00 4:02:44 PM)
 * @return cbit.vcell.biomodel.BioModel
 * @param bioModelInfo cbit.vcell.biomodel.BioModelInfo
 */
public Geometry getGeometry(GeometryInfo geometryInfo) throws DataAccessException {
    Geometry geometry = null;
    try {
        XMLSource geomSource = new XMLSource(getGeometryXML(geometryInfo.getVersion().getVersionKey()));
        geometry = XmlHelper.XMLToGeometry(geomSource);
    } catch (XmlParseException e) {
        e.printStackTrace(System.out);
        throw new DataAccessException(e.getMessage());
    }
    try {
        if (geometry.getDimension() > 0 && geometry.getGeometrySurfaceDescription().getGeometricRegions() == null) {
            geometry.getGeometrySurfaceDescription().updateAll();
        }
    } catch (Exception e) {
        e.printStackTrace(System.out);
    // throw new DataAccessException("Geometric surface generation error:\n"+e.getMessage());
    }
    return geometry;
}
Also used : Geometry(cbit.vcell.geometry.Geometry) XmlParseException(cbit.vcell.xml.XmlParseException) XMLSource(cbit.vcell.xml.XMLSource) DataAccessException(org.vcell.util.DataAccessException) PermissionException(org.vcell.util.PermissionException) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) XmlParseException(cbit.vcell.xml.XmlParseException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException) DataAccessException(org.vcell.util.DataAccessException) ExpressionException(cbit.vcell.parser.ExpressionException) MathException(cbit.vcell.math.MathException)

Example 29 with XmlParseException

use of cbit.vcell.xml.XmlParseException in project vcell by virtualcell.

the class ClientDocumentManager method isChanged.

/**
 * Insert the method's description here.
 * Creation date: (2/5/01 4:58:40 PM)
 */
public boolean isChanged(Simulation sim) throws DataAccessException {
    if (isChangedVersion(sim.getVersion())) {
        return true;
    }
    KeyValue simKey = sim.getVersion().getVersionKey();
    if (simKey == null) {
        throw new RuntimeException(this.getClass().getName() + ".isChanged(Simulation): Sim Version not null, Simulation key is null");
    }
    String loadedSimXML = (String) xmlHash.get(simKey);
    if (loadedSimXML == null) {
        throw new RuntimeException("Expecting simulation key=" + simKey + " to be in ClientDocumentManager cache");
    }
    try {
        return !VCMLComparator.compareEquals(XmlHelper.simToXML(sim), loadedSimXML, false);
    } catch (XmlParseException e) {
        e.printStackTrace(System.out);
        throw new DataAccessException(e.getMessage());
    }
}
Also used : KeyValue(org.vcell.util.document.KeyValue) BigString(org.vcell.util.BigString) XmlParseException(cbit.vcell.xml.XmlParseException) DataAccessException(org.vcell.util.DataAccessException)

Example 30 with XmlParseException

use of cbit.vcell.xml.XmlParseException in project vcell by virtualcell.

the class ClientDocumentManager method getGeometryFromDatabaseXML.

/**
 * Insert the method's description here.
 * Creation date: (9/22/2004 5:22:40 PM)
 * @return cbit.vcell.mathmodel.MathModel
 * @param mathModelXML java.lang.String
 */
private Geometry getGeometryFromDatabaseXML(String geometryXML) throws DataAccessException {
    try {
        Geometry geometry = XmlHelper.XMLToGeometry(new XMLSource(geometryXML));
        geometry.refreshDependencies();
        try {
            if (geometry.getDimension() > 0) {
                geometry.getGeometrySurfaceDescription().updateAll();
            }
        } catch (Exception e) {
            e.printStackTrace(System.out);
            throw new DataAccessException("Geometric surface generation error:\n" + e.getMessage());
        }
        return geometry;
    } catch (XmlParseException e) {
        e.printStackTrace();
        throw new DataAccessException(e.getClass().getName() + ": " + e.getMessage());
    }
}
Also used : Geometry(cbit.vcell.geometry.Geometry) XmlParseException(cbit.vcell.xml.XmlParseException) XMLSource(cbit.vcell.xml.XMLSource) PermissionException(org.vcell.util.PermissionException) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) XmlParseException(cbit.vcell.xml.XmlParseException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException) DataAccessException(org.vcell.util.DataAccessException) ExpressionException(cbit.vcell.parser.ExpressionException) MathException(cbit.vcell.math.MathException) DataAccessException(org.vcell.util.DataAccessException)

Aggregations

XmlParseException (cbit.vcell.xml.XmlParseException)49 DataAccessException (org.vcell.util.DataAccessException)35 XMLSource (cbit.vcell.xml.XMLSource)19 BigString (org.vcell.util.BigString)18 BioModel (cbit.vcell.biomodel.BioModel)16 KeyValue (org.vcell.util.document.KeyValue)16 SQLException (java.sql.SQLException)14 ExpressionException (cbit.vcell.parser.ExpressionException)12 IOException (java.io.IOException)12 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)11 SimulationContext (cbit.vcell.mapping.SimulationContext)10 PrintWriter (java.io.PrintWriter)9 User (org.vcell.util.document.User)9 MathException (cbit.vcell.math.MathException)8 MathModel (cbit.vcell.mathmodel.MathModel)8 Element (org.jdom.Element)8 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)8 BioModelInfo (org.vcell.util.document.BioModelInfo)7 PropertyVetoException (java.beans.PropertyVetoException)5 File (java.io.File)5