Search in sources :

Example 1 with ShellException

use of ambit2.base.external.ShellException in project ambit-mirror by ideaconsult.

the class ShellBalloonWeb method getBalloonHome.

@Override
protected String getBalloonHome() throws ShellException {
    try {
        AMBITConfigProperties properties = new AMBITConfigProperties();
        String wheredragonlives = properties.getPropertyWithDefault(ShellBalloon.BALLOON_HOME, AMBITConfigProperties.ambitProperties, null);
        if (wheredragonlives == null)
            throw new ShellException(null, String.format("Can't find where Balloon is located. No property %s in %s", ShellBalloon.BALLOON_HOME, AMBITConfigProperties.ambitProperties));
        return wheredragonlives;
    } catch (ShellException x) {
        throw x;
    } catch (Exception x) {
        throw new ShellException(null, x);
    }
}
Also used : ShellException(ambit2.base.external.ShellException) AMBITConfigProperties(ambit2.base.config.AMBITConfigProperties) ShellException(ambit2.base.external.ShellException)

Example 2 with ShellException

use of ambit2.base.external.ShellException in project ambit-mirror by ideaconsult.

the class ShellBalloon method initialize.

@Override
protected void initialize() throws ShellException {
    super.initialize();
    String balloon_home = getBalloonHome();
    File exe = new File(String.format("%s%s%s", balloon_home, File.separator, BALLOON_EXE));
    File winexe = new File(String.format("%s%s%s.exe", balloon_home, File.separator, BALLOON_EXE));
    if (!exe.exists() && !winexe.exists()) {
        throw new ShellException(this, String.format("%s does not exist! Have you set %s environment variable?", exe.getAbsolutePath(), BALLOON_HOME));
    }
    addExecutable(CommandShell.os_WINDOWS, winexe.getAbsolutePath(), null);
    addExecutable(CommandShell.os_WINDOWSVISTA, winexe.getAbsolutePath(), null);
    addExecutable(CommandShell.os_WINDOWS7, winexe.getAbsolutePath(), null);
    addExecutable(CommandShell.os_FreeBSD, exe.getAbsolutePath(), null);
    addExecutable(CommandShell.os_LINUX, exe.getAbsolutePath(), null);
    setOutputFile(getOutputFileName());
    setInputFile(outputFile.replace("o_bln", "i_bln"));
    setReadOutput(true);
}
Also used : File(java.io.File) ShellException(ambit2.base.external.ShellException)

Example 3 with ShellException

use of ambit2.base.external.ShellException in project ambit-mirror by ideaconsult.

the class CommandShell method getHomeFromConfig.

public synchronized String getHomeFromConfig(String propertiesResource, String propertyHome) throws ShellException {
    try {
        AMBITConfigProperties properties = new AMBITConfigProperties();
        String wheredragonlives = properties.getPropertyWithDefault(propertyHome, propertiesResource, null);
        if (wheredragonlives == null) {
            logger.log(Level.SEVERE, String.format("Can't find where %s is located. No property %s in %s", toString(), propertyHome, propertiesResource));
            throw new ShellException(null, String.format("Can't find where %s is located.", toString()));
        }
        return wheredragonlives;
    } catch (ShellException x) {
        throw x;
    } catch (Exception x) {
        throw new ShellException(null, x);
    }
}
Also used : AMBITConfigProperties(ambit2.base.config.AMBITConfigProperties) AmbitException(net.idea.modbcum.i.exceptions.AmbitException) IOException(java.io.IOException)

Example 4 with ShellException

use of ambit2.base.external.ShellException in project ambit-mirror by ideaconsult.

the class OpenBabelAbstractShell method initialize.

@Override
protected void initialize() throws ShellException {
    super.initialize();
    String obabel_home = getOBabelHome();
    File exe = new File(String.format("%s/%s", obabel_home, OBABEL_EXE));
    File winexe = new File(String.format("%s/%s.exe", obabel_home, OBABEL_EXE));
    if (!exe.exists() && !winexe.exists()) {
        throw new ShellException(this, String.format("%s does not exist! Have you set %s environment variable?", exe.getAbsolutePath(), OBABEL_HOME));
    }
    addExecutable(CommandShell.os_WINDOWS, winexe.getAbsolutePath(), null);
    addExecutable(CommandShell.os_WINDOWSVISTA, winexe.getAbsolutePath(), null);
    addExecutable(CommandShell.os_WINDOWS7, winexe.getAbsolutePath(), null);
    addExecutable(CommandShell.os_FreeBSD, exe.getAbsolutePath(), null);
    addExecutable(CommandShell.os_LINUX, exe.getAbsolutePath(), null);
    setInputFile(null);
    setOutputFile(getOutputFileName());
    setReadOutput(true);
}
Also used : File(java.io.File) ShellException(ambit2.base.external.ShellException)

Example 5 with ShellException

use of ambit2.base.external.ShellException in project ambit-mirror by ideaconsult.

the class OpenBabelGen3D method getOBabelHome.

@Override
protected String getOBabelHome() throws ShellException {
    try {
        AMBITConfigProperties properties = new AMBITConfigProperties();
        String wheredragonlives = properties.getPropertyWithDefault(OpenBabelGen3D.OBABEL_HOME, AMBITConfigProperties.ambitProperties, null);
        if (wheredragonlives == null)
            throw new ShellException(null, String.format("Can't find where OpenBabel is located. No property %s in %s", OpenBabelGen3D.OBABEL_HOME, AMBITConfigProperties.ambitProperties));
        return wheredragonlives;
    } catch (ShellException x) {
        throw x;
    } catch (Exception x) {
        throw new ShellException(null, x);
    }
}
Also used : ShellException(ambit2.base.external.ShellException) AMBITConfigProperties(ambit2.base.config.AMBITConfigProperties) ShellException(ambit2.base.external.ShellException)

Aggregations

ShellException (ambit2.base.external.ShellException)27 File (java.io.File)19 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)13 CDKException (org.openscience.cdk.exception.CDKException)10 AmbitException (net.idea.modbcum.i.exceptions.AmbitException)8 FileInputStream (java.io.FileInputStream)7 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)5 FileOutputStream (java.io.FileOutputStream)4 AMBITConfigProperties (ambit2.base.config.AMBITConfigProperties)3 FileWriter (java.io.FileWriter)3 InputStreamReader (java.io.InputStreamReader)3 DelimitedFileFormat (ambit2.core.io.DelimitedFileFormat)2 IteratingDelimitedFileReader (ambit2.core.io.IteratingDelimitedFileReader)2 OpenBabelGen3D (ambit2.core.smiles.OpenBabelGen3D)2 SDFWriter (org.openscience.cdk.io.SDFWriter)2 Property (ambit2.base.data.Property)1 MopacShellOB (ambit2.mopac.MopacShellOB)1 BufferedInputStream (java.io.BufferedInputStream)1 InputStream (java.io.InputStream)1