Example usage for org.apache.commons.lang SystemUtils IS_OS_WINDOWS

List of usage examples for org.apache.commons.lang SystemUtils IS_OS_WINDOWS

Introduction

In this page you can find the example usage for org.apache.commons.lang SystemUtils IS_OS_WINDOWS.

Prototype

boolean IS_OS_WINDOWS

To view the source code for org.apache.commons.lang SystemUtils IS_OS_WINDOWS.

Click Source Link

Document

Is true if this is Windows.

The field will return false if OS_NAME is null.

Usage

From source file:net.erdfelt.android.sdkfido.ui.SdkFidoFrame.java

private void enableExitKey() {
    InputMap rootInput = getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    ActionMap rootAction = getRootPane().getActionMap();

    if (SystemUtils.IS_OS_UNIX || SystemUtils.IS_OS_WINDOWS) {
        rootInput.put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.CTRL_DOWN_MASK), "exit");
        rootInput.put(KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.CTRL_DOWN_MASK), "exit");
    }/*from  ww w .  ja  v  a 2 s.c  o m*/

    if (SystemUtils.IS_OS_MAC) {
        rootInput.put(KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.META_DOWN_MASK), "exit");
    }

    rootAction.put("exit", new KeyAction(actionMapper, "exit"));
}

From source file:com.wavemaker.runtime.module.ModuleController.java

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {

    String requestURI = request.getRequestURI();
    final String moduleURI = "/" + MODULES_PREFIX;
    final String moduleURIAbs = moduleURI + "/";
    final String moduleJsURI = moduleURIAbs + MODULES_JS;
    final String epURI = moduleURIAbs + EXTENSION_PATH;
    final String epURIAbs = epURI + "/";
    final String idURI = moduleURIAbs + ID_PATH;
    final String idURIAbs = idURI + "/";

    // trim off the servlet name
    requestURI = requestURI.substring(requestURI.indexOf('/', 1));

    if (moduleURI.equals(requestURI) || moduleURIAbs.equals(requestURI)) {
    } else if (epURI.equals(requestURI) || epURIAbs.equals(requestURI)) {
        Set<String> names = this.moduleManager.listExtensionPoints();

        response.setContentType("text/html");
        Writer writer = response.getWriter();
        writer.write("<html><body>\n");
        for (String ext : names) {
            writer.write(ext + "<br />\n");
        }//from ww w .jav  a  2 s .co  m
        writer.write("</body></html>\n");
        writer.close();
    } else if (idURI.equals(requestURI) || idURIAbs.equals(requestURI)) {
        Set<String> names = this.moduleManager.listModules();

        response.setContentType("text/html");
        Writer writer = response.getWriter();
        writer.write("<html><body>\n");
        for (String ext : names) {
            writer.write(ext + "<br />\n");
        }
        writer.write("</body></html>\n");
        writer.close();
    } else if (moduleJsURI.equals(requestURI)) {
        Set<String> extensions = this.moduleManager.listExtensionPoints();

        JSONObject jo = new JSONObject();

        JSONObject extJO = new JSONObject();
        for (String extension : extensions) {
            JSONArray ja = new JSONArray();

            List<ModuleWire> wires = this.moduleManager.getModules(extension);
            for (ModuleWire wire : wires) {
                ja.add(wire.getName());
            }

            extJO.put(extension, ja);
        }

        jo.put("extensionPoints", extJO);

        response.setContentType(ServerConstants.JSON_CONTENT_TYPE);
        Writer writer = response.getWriter();
        writer.write(jo.toString());
        writer.close();
    } else {
        Tuple.Two<ModuleWire, String> tuple = parseRequestPath(requestURI);
        if (tuple.v1 == null) {
            String message = MessageResource.NO_MODULE_RESOURCE.getMessage(requestURI, tuple.v2);
            this.logger.error(message);

            response.setStatus(HttpServletResponse.SC_NOT_FOUND);
            Writer outputWriter = response.getWriter();
            outputWriter.write(message);

            return null;
        }

        URL url = this.moduleManager.getModuleResource(tuple.v1, tuple.v2);
        URLConnection conn = url.openConnection();
        if (SystemUtils.IS_OS_WINDOWS) {
            conn.setDefaultUseCaches(false);
        }

        response.setContentType(conn.getContentType());
        OutputStream os = null;
        InputStream is = null;

        try {
            os = response.getOutputStream();
            is = conn.getInputStream();

            IOUtils.copy(conn.getInputStream(), os);
        } finally {
            if (os != null) {
                os.close();
            }
            if (is != null) {
                is.close();
            }
        }
    }

    return null;
}

From source file:de.sub.goobi.helper.VariableReplacerWithoutHibernate.java

/**
 * Variablen innerhalb eines Strings ersetzen. Dabei vergleichbar zu Ant die
 * Variablen durchlaufen und aus dem Digital Document holen.
 *//*from  w w  w  .  ja va 2s .c  o m*/
public String replace(String inString) {
    if (inString == null) {
        return "";
    }

    /*
     * replace metadata, usage: $(meta.firstchild.METADATANAME)
     */
    for (MatchResult r : findRegexMatches(this.namespaceMeta, inString)) {
        if (r.group(1).toLowerCase().startsWith("firstchild.")) {
            inString = inString.replace(r.group(),
                    getMetadataFromDigitalDocument(MetadataLevel.FIRSTCHILD, r.group(1).substring(11)));
        } else if (r.group(1).toLowerCase().startsWith("topstruct.")) {
            inString = inString.replace(r.group(),
                    getMetadataFromDigitalDocument(MetadataLevel.TOPSTRUCT, r.group(1).substring(10)));
        } else {
            inString = inString.replace(r.group(),
                    getMetadataFromDigitalDocument(MetadataLevel.ALL, r.group(1)));
        }
    }

    FolderInformation fi = new FolderInformation(this.process.getId(), this.process.getTitle());

    String processpath = fi.getProcessDataDirectory().replace("\\", "/");
    String tifpath = fi.getImagesTifDirectory(false).replace("\\", "/");
    String imagepath = fi.getImagesDirectory().replace("\\", "/");
    String origpath = fi.getImagesOrigDirectory(false).replace("\\", "/");
    String metaFile = fi.getMetadataFilePath().replace("\\", "/");
    String ocrBasisPath = fi.getOcrDirectory().replace("\\", "/");
    String ocrPlaintextPath = fi.getTxtDirectory().replace("\\", "/");
    String sourcePath = fi.getSourceDirectory().replace("\\", "/");
    String importPath = fi.getImportDirectory().replace("\\", "/");
    Ruleset ruleset = ProcessManager.getRuleset(this.process.getRulesetId());
    String myprefs = ConfigCore.getParameter("RegelsaetzeVerzeichnis") + ruleset.getFile();

    /*
     * da die Tiffwriter-Scripte einen Pfad ohne endenen Slash haben wollen,
     * wird diese rausgenommen
     */
    if (tifpath.endsWith(File.separator)) {
        tifpath = tifpath.substring(0, tifpath.length() - File.separator.length()).replace("\\", "/");
    }
    if (imagepath.endsWith(File.separator)) {
        imagepath = imagepath.substring(0, imagepath.length() - File.separator.length()).replace("\\", "/");
    }
    if (origpath.endsWith(File.separator)) {
        origpath = origpath.substring(0, origpath.length() - File.separator.length()).replace("\\", "/");
    }
    if (processpath.endsWith(File.separator)) {
        processpath = processpath.substring(0, processpath.length() - File.separator.length()).replace("\\",
                "/");
    }
    if (importPath.endsWith(File.separator)) {
        importPath = importPath.substring(0, importPath.length() - File.separator.length()).replace("\\", "/");
    }
    if (sourcePath.endsWith(File.separator)) {
        sourcePath = sourcePath.substring(0, sourcePath.length() - File.separator.length()).replace("\\", "/");
    }
    if (ocrBasisPath.endsWith(File.separator)) {
        ocrBasisPath = ocrBasisPath.substring(0, ocrBasisPath.length() - File.separator.length()).replace("\\",
                "/");
    }
    if (ocrPlaintextPath.endsWith(File.separator)) {
        ocrPlaintextPath = ocrPlaintextPath.substring(0, ocrPlaintextPath.length() - File.separator.length())
                .replace("\\", "/");
    }
    if (inString.contains("(tifurl)")) {
        if (SystemUtils.IS_OS_WINDOWS) {
            inString = inString.replace("(tifurl)", "file:/" + tifpath);
        } else {
            inString = inString.replace("(tifurl)", "file://" + tifpath);
        }
    }
    if (inString.contains("(origurl)")) {
        if (SystemUtils.IS_OS_WINDOWS) {
            inString = inString.replace("(origurl)", "file:/" + origpath);
        } else {
            inString = inString.replace("(origurl)", "file://" + origpath);
        }
    }
    if (inString.contains("(imageurl)")) {
        if (SystemUtils.IS_OS_WINDOWS) {
            inString = inString.replace("(imageurl)", "file:/" + imagepath);
        } else {
            inString = inString.replace("(imageurl)", "file://" + imagepath);
        }
    }

    if (inString.contains("(tifpath)")) {
        inString = inString.replace("(tifpath)", tifpath);
    }
    if (inString.contains("(origpath)")) {
        inString = inString.replace("(origpath)", origpath);
    }
    if (inString.contains("(imagepath)")) {
        inString = inString.replace("(imagepath)", imagepath);
    }
    if (inString.contains("(processpath)")) {
        inString = inString.replace("(processpath)", processpath);
    }
    if (inString.contains("(importpath)")) {
        inString = inString.replace("(importpath)", importPath);
    }
    if (inString.contains("(sourcepath)")) {
        inString = inString.replace("(sourcepath)", sourcePath);
    }
    if (inString.contains("(ocrbasispath)")) {
        inString = inString.replace("(ocrbasispath)", ocrBasisPath);
    }
    if (inString.contains("(ocrplaintextpath)")) {
        inString = inString.replace("(ocrplaintextpath)", ocrPlaintextPath);
    }
    if (inString.contains("(processtitle)")) {
        inString = inString.replace("(processtitle)", this.process.getTitle());
    }
    if (inString.contains("(processid)")) {
        inString = inString.replace("(processid)", String.valueOf(this.process.getId()));
    }
    if (inString.contains("(metaFile)")) {
        inString = inString.replace("(metaFile)", metaFile);
    }
    if (inString.contains("(prefs)")) {
        inString = inString.replace("(prefs)", myprefs);
    }

    if (this.step != null) {
        String stepId = String.valueOf(this.step.getId());
        String stepname = this.step.getTitle();

        inString = inString.replace("(stepid)", stepId);
        inString = inString.replace("(stepname)", stepname);
    }

    // replace WerkstueckEigenschaft, usage: (product.PROPERTYTITLE)

    for (MatchResult r : findRegexMatches("\\(product\\.([\\w.-]*)\\)", inString)) {
        String propertyTitle = r.group(1);
        List<Property> ppList = ProcessManager.getProductProperties(this.process.getId());
        for (Property pe : ppList) {
            if (pe.getTitle().equalsIgnoreCase(propertyTitle)) {
                inString = inString.replace(r.group(), pe.getValue());
                break;
            }
        }
    }

    // replace Vorlageeigenschaft, usage: (template.PROPERTYTITLE)

    for (MatchResult r : findRegexMatches("\\(template\\.([\\w.-]*)\\)", inString)) {
        String propertyTitle = r.group(1);
        List<Property> ppList = ProcessManager.getTemplateProperties(this.process.getId());
        for (Property pe : ppList) {
            if (pe.getTitle().equalsIgnoreCase(propertyTitle)) {
                inString = inString.replace(r.group(), pe.getValue());
                break;
            }
        }
    }

    // replace Prozesseigenschaft, usage: (process.PROPERTYTITLE)

    for (MatchResult r : findRegexMatches("\\(process\\.([\\w.-]*)\\)", inString)) {
        String propertyTitle = r.group(1);
        List<Property> ppList = ProcessManager.getProcessProperties(this.process.getId());
        for (Property pe : ppList) {
            if (pe.getTitle().equalsIgnoreCase(propertyTitle)) {
                inString = inString.replace(r.group(), pe.getValue());
                break;
            }
        }
    }
    return inString;
}

From source file:hudson.tasks.AntTest.java

@Test
public void testParameterExpansion() throws Exception {
    if (!SystemUtils.IS_OS_WINDOWS) {
        String antName = configureDefaultAnt().getName();
        // Use a matrix project so we have env stuff via builtins, parameters and matrix axis.
        MatrixProject project = r.createProject(MatrixProject.class, "test project");// Space in name
        project.setAxes(new AxisList(new Axis("AX", "is")));
        project.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("FOO", "bar", "")));
        project.setScm(new ExtractResourceSCM(getClass().getResource("ant-job.zip")));
        project.getBuildersList().add(new Ant("", antName, null, null,
                "vNUM=$BUILD_NUMBER\nvID=$BUILD_ID\nvJOB=$JOB_NAME\nvTAG=$BUILD_TAG\nvEXEC=$EXECUTOR_NUMBER\n"
                        + "vNODE=$NODE_NAME\nvLAB=$NODE_LABELS\nvJAV=$JAVA_HOME\nvWS=$WORKSPACE\nvHURL=$HUDSON_URL\n"
                        + "vBURL=$BUILD_URL\nvJURL=$JOB_URL\nvHH=$HUDSON_HOME\nvJH=$JENKINS_HOME\nvFOO=$FOO\nvAX=$AX"));
        r.assertBuildStatusSuccess(project.scheduleBuild2(0));
        MatrixRun build = project.getItem("AX=is").getLastBuild();
        String log = JenkinsRule.getLog(build);
        assertTrue("Missing $BUILD_NUMBER: " + log, log.contains("vNUM=1"));
        // TODO 1.597+: assertTrue("Missing $BUILD_ID: " + log, log.contains("vID=1"));
        assertTrue("Missing $JOB_NAME: " + log, log.contains(project.getName()));
        // Odd build tag, but it's constructed with getParent().getName() and the parent is the
        // matrix configuration, not the project.. if matrix build tag ever changes, update
        // expected value here:
        assertTrue("Missing $BUILD_TAG: " + log, log.contains("vTAG=jenkins-test project-AX\\=is-1"));
        assertTrue("Missing $EXECUTOR_NUMBER: " + log, log.matches("(?s).*vEXEC=\\d.*"));
        // $NODE_NAME is expected to be empty when running on master.. not checking.
        assertTrue("Missing $NODE_LABELS: " + log, log.contains("vLAB=master"));
        assertTrue("Missing $JAVA_HOME: " + log, log.matches("(?s).*vJH=[^\\r\\n].*"));
        assertTrue("Missing $WORKSPACE: " + log, log.matches("(?s).*vWS=[^\\r\\n].*"));
        assertTrue("Missing $HUDSON_URL: " + log, log.contains("vHURL=http"));
        assertTrue("Missing $BUILD_URL: " + log, log.contains("vBURL=http"));
        assertTrue("Missing $JOB_URL: " + log, log.contains("vJURL=http"));
        assertTrue("Missing $HUDSON_HOME: " + log, log.matches("(?s).*vHH=[^\\r\\n].*"));
        assertTrue("Missing $JENKINS_HOME: " + log, log.matches("(?s).*vJH=[^\\r\\n].*"));
        assertTrue("Missing build parameter $FOO: " + log, log.contains("vFOO=bar"));
        assertTrue("Missing matrix axis $AX: " + log, log.contains("vAX=is"));
    }//from   w  ww .  j a  v  a2s .c  o  m
}

From source file:com.jayway.maven.plugins.android.AndroidNdk.java

/**
 * Returns the complete path for the ndk-build tool, based on this NDK.
 *
 * @return the complete path as a <code>String</code>, including the tool's filename.
 *///from w w  w.ja  va 2s  .  com
public String getNdkBuildPath() {
    if (SystemUtils.IS_OS_WINDOWS) {
        return new File(ndkPath, "/ndk-build.cmd").getAbsolutePath();
    } else {
        return new File(ndkPath, "/ndk-build").getAbsolutePath();
    }
}

From source file:me.philnate.textmanager.updates.Updater.java

/**
 * checks which operation system is in use and based on that the appropriate
 * application name is returned. So for windows it will add the .exe suffix
 * //  w  w w  .  jav a2s .  c  o  m
 * @param appName
 * @return
 */
public static String getProgram(String appName) {
    if (SystemUtils.IS_OS_WINDOWS) {
        return appName + ".exe";
    }
    return appName;
}

From source file:com.tesora.dve.sql.IgnoreForeignKeyTest.java

@Test
public void testForwardColocated() throws Throwable {
    try {/*from ww  w  .j av a2 s . co m*/
        checkDDL.create(conn);
        conn.execute("set foreign_key_checks=0");
        conn.execute("create range openrange (int) persistent group checkg");
        conn.execute(
                "create table C (`id` int, `fid` int, primary key (`id`), foreign key (`fid`) references P (`id`)) range distribute on (fid) using openrange");
        conn.execute(
                "create table P (`id` int, `fid` int, `sid` int, primary key (`id`)) range distribute on (id) using openrange");
        assertFalse("should not have warnings", conn.hasWarnings());
        Object[] results = br(nr, "C", "fid", "P", "id");
        Object[] windowsNativeResults = br(nr, "c", "fid", "p", "id");
        conn.assertResults(peinfoSql, results);
        dbh.assertResults(nativeInfoSql, (SystemUtils.IS_OS_WINDOWS ? windowsNativeResults : results));
    } finally {
        checkDDL.destroy(conn);
    }
}

From source file:com.ibm.ecm.extension.aspera.AsperaPlugin.java

private void copyResources() throws AsperaPluginException {
    resourcePaths.add(copyResource("", "asperaweb_id_dsa.openssh", ""));
    resourcePaths.add(copyResource(ETC, "aspera-license", ETC));
    resourcePaths.add(copyResource(ETC, "aspera.conf", ETC));
    if (SystemUtils.IS_OS_WINDOWS) {
        copyWindowsResources();/*from w  w  w  . j  a  v a2 s  . c  om*/
    } else if (SystemUtils.IS_OS_MAC_OSX) {
        resourcePaths.add(makeFileExecutable(copyResource(BIN_OSX, "ascp4", BIN)));
    } else if (SystemUtils.IS_OS_LINUX) {
        resourcePaths.add(makeFileExecutable(copyResource(BIN_LINUX, "ascp4", BIN)));
    } else {
        throw new AsperaPluginException("The operating system is not supported.");
    }
}

From source file:com.cloud.utils.net.NetUtils.java

public static String getDefaultHostIp() {
    if (SystemUtils.IS_OS_WINDOWS) {
        final Pattern pattern = Pattern.compile("\\s*0.0.0.0\\s*0.0.0.0\\s*(\\S*)\\s*(\\S*)\\s*");
        try {//  w  w w . ja  v a  2  s  .c o m
            final Process result = Runtime.getRuntime().exec("route print -4");
            final BufferedReader output = new BufferedReader(new InputStreamReader(result.getInputStream()));

            String line = output.readLine();
            while (line != null) {
                final Matcher matcher = pattern.matcher(line);
                if (matcher.find()) {
                    return matcher.group(2);
                }
                line = output.readLine();
            }
        } catch (final IOException e) {
            s_logger.debug("Caught IOException", e);
        }
        return null;
    } else {
        NetworkInterface nic = null;
        final String pubNic = getDefaultEthDevice();

        if (pubNic == null) {
            return null;
        }

        try {
            nic = NetworkInterface.getByName(pubNic);
        } catch (final SocketException e) {
            return null;
        }

        String[] info = null;
        try {
            info = NetUtils.getNetworkParams(nic);
        } catch (final NullPointerException ignored) {
            s_logger.debug("Caught NullPointerException when trying to getDefaultHostIp");
        }
        if (info != null) {
            return info[0];
        }
        return null;
    }
}

From source file:de.sub.goobi.helper.VariableReplacer.java

/**
 * Variablen innerhalb eines Strings ersetzen. Dabei vergleichbar zu Ant die
 * Variablen durchlaufen und aus dem Digital Document holen
 *///w w w.j  a v  a 2s  . c  o m
public String replace(String inString) {
    if (inString == null) {
        return "";
    }

    /*
     * replace metadata, usage: $(meta.firstchild.METADATANAME)
     */
    for (MatchResult r : findRegexMatches(this.namespaceMeta, inString)) {
        if (r.group(1).toLowerCase().startsWith("firstchild.")) {
            inString = inString.replace(r.group(),
                    getMetadataFromDigitalDocument(MetadataLevel.FIRSTCHILD, r.group(1).substring(11)));
        } else if (r.group(1).toLowerCase().startsWith("topstruct.")) {
            inString = inString.replace(r.group(),
                    getMetadataFromDigitalDocument(MetadataLevel.TOPSTRUCT, r.group(1).substring(10)));
        } else {
            inString = inString.replace(r.group(),
                    getMetadataFromDigitalDocument(MetadataLevel.ALL, r.group(1)));
        }
    }

    // replace paths and files
    try {
        String processpath = fileService
                .getFileName(serviceManager.getProcessService().getProcessDataDirectory(this.process))
                .replace("\\", "/");
        String tifpath = fileService
                .getFileName(serviceManager.getProcessService().getImagesTifDirectory(false, this.process))
                .replace("\\", "/");
        String imagepath = fileService.getFileName(fileService.getImagesDirectory(this.process)).replace("\\",
                "/");
        String origpath = fileService
                .getFileName(serviceManager.getProcessService().getImagesOrigDirectory(false, this.process))
                .replace("\\", "/");
        String metaFile = fileService.getFileName(fileService.getMetadataFilePath(this.process)).replace("\\",
                "/");
        String ocrBasisPath = fileService.getFileName(fileService.getOcrDirectory(this.process)).replace("\\",
                "/");
        String ocrPlaintextPath = fileService.getFileName(fileService.getTxtDirectory(this.process))
                .replace("\\", "/");
        // TODO name ndern?
        String sourcePath = fileService.getFileName(fileService.getSourceDirectory(this.process)).replace("\\",
                "/");
        String importPath = fileService.getFileName(fileService.getImportDirectory(this.process)).replace("\\",
                "/");
        String myprefs = ConfigCore.getParameter("RegelsaetzeVerzeichnis")
                + this.process.getRuleset().getFile();

        /*
         * da die Tiffwriter-Scripte einen Pfad ohne endenen Slash haben
         * wollen, wird diese rausgenommen
         */
        if (tifpath.endsWith(File.separator)) {
            tifpath = tifpath.substring(0, tifpath.length() - File.separator.length()).replace("\\", "/");
        }
        if (imagepath.endsWith(File.separator)) {
            imagepath = imagepath.substring(0, imagepath.length() - File.separator.length()).replace("\\", "/");
        }
        if (origpath.endsWith(File.separator)) {
            origpath = origpath.substring(0, origpath.length() - File.separator.length()).replace("\\", "/");
        }
        if (processpath.endsWith(File.separator)) {
            processpath = processpath.substring(0, processpath.length() - File.separator.length()).replace("\\",
                    "/");
        }
        if (importPath.endsWith(File.separator)) {
            importPath = importPath.substring(0, importPath.length() - File.separator.length()).replace("\\",
                    "/");
        }
        if (sourcePath.endsWith(File.separator)) {
            sourcePath = sourcePath.substring(0, sourcePath.length() - File.separator.length()).replace("\\",
                    "/");
        }
        if (ocrBasisPath.endsWith(File.separator)) {
            ocrBasisPath = ocrBasisPath.substring(0, ocrBasisPath.length() - File.separator.length())
                    .replace("\\", "/");
        }
        if (ocrPlaintextPath.endsWith(File.separator)) {
            ocrPlaintextPath = ocrPlaintextPath
                    .substring(0, ocrPlaintextPath.length() - File.separator.length()).replace("\\", "/");
        }
        if (inString.contains("(tifurl)")) {
            if (SystemUtils.IS_OS_WINDOWS) {
                inString = inString.replace("(tifurl)", "file:/" + tifpath);
            } else {
                inString = inString.replace("(tifurl)", "file://" + tifpath);
            }
        }
        if (inString.contains("(origurl)")) {
            if (SystemUtils.IS_OS_WINDOWS) {
                inString = inString.replace("(origurl)", "file:/" + origpath);
            } else {
                inString = inString.replace("(origurl)", "file://" + origpath);
            }
        }
        if (inString.contains("(imageurl)")) {
            if (SystemUtils.IS_OS_WINDOWS) {
                inString = inString.replace("(imageurl)", "file:/" + imagepath);
            } else {
                inString = inString.replace("(imageurl)", "file://" + imagepath);
            }
        }

        if (inString.contains("(tifpath)")) {
            inString = inString.replace("(tifpath)", tifpath);
        }
        if (inString.contains("(origpath)")) {
            inString = inString.replace("(origpath)", origpath);
        }
        if (inString.contains("(imagepath)")) {
            inString = inString.replace("(imagepath)", imagepath);
        }
        if (inString.contains("(processpath)")) {
            inString = inString.replace("(processpath)", processpath);
        }
        if (inString.contains("(importpath)")) {
            inString = inString.replace("(importpath)", importPath);
        }
        if (inString.contains("(sourcepath)")) {
            inString = inString.replace("(sourcepath)", sourcePath);
        }

        if (inString.contains("(ocrbasispath)")) {
            inString = inString.replace("(ocrbasispath)", ocrBasisPath);
        }
        if (inString.contains("(ocrplaintextpath)")) {
            inString = inString.replace("(ocrplaintextpath)", ocrPlaintextPath);
        }
        if (inString.contains("(processtitle)")) {
            inString = inString.replace("(processtitle)", this.process.getTitle());
        }
        if (inString.contains("(processid)")) {
            inString = inString.replace("(processid)", String.valueOf(this.process.getId().intValue()));
        }
        if (inString.contains("(metaFile)")) {
            inString = inString.replace("(metaFile)", metaFile);
        }
        if (inString.contains("(prefs)")) {
            inString = inString.replace("(prefs)", myprefs);
        }

        if (this.task != null) {
            String stepId = String.valueOf(this.task.getId());
            String stepname = this.task.getTitle();

            inString = inString.replace("(stepid)", stepId);
            inString = inString.replace("(stepname)", stepname);
        }

        // replace WerkstueckEigenschaft, usage: (product.PROPERTYTITLE)

        for (MatchResult r : findRegexMatches("\\(product\\.([\\w.-]*)\\)", inString)) {
            String propertyTitle = r.group(1);
            for (Workpiece ws : this.process.getWorkpieces()) {
                for (Property workpieceProperty : ws.getProperties()) {
                    if (workpieceProperty.getTitle().equalsIgnoreCase(propertyTitle)) {
                        inString = inString.replace(r.group(), workpieceProperty.getValue());
                        break;
                    }
                }
            }
        }

        // replace Vorlageeigenschaft, usage: (template.PROPERTYTITLE)

        for (MatchResult r : findRegexMatches("\\(template\\.([\\w.-]*)\\)", inString)) {
            String propertyTitle = r.group(1);
            for (Template v : this.process.getTemplates()) {
                for (Property templateProperty : v.getProperties()) {
                    if (templateProperty.getTitle().equalsIgnoreCase(propertyTitle)) {
                        inString = inString.replace(r.group(), templateProperty.getValue());
                        break;
                    }
                }
            }
        }

        // replace Prozesseigenschaft, usage: (process.PROPERTYTITLE)

        for (MatchResult r : findRegexMatches("\\(process\\.([\\w.-]*)\\)", inString)) {
            String propertyTitle = r.group(1);
            List<ProcessProperty> ppList = PropertyParser.getPropertiesForProcess(this.process);
            for (ProcessProperty pe : ppList) {
                if (pe.getName().equalsIgnoreCase(propertyTitle)) {
                    inString = inString.replace(r.group(), pe.getValue());
                    break;
                }
            }

        }

    } catch (IOException e) {
        logger.error(e);
    }

    return inString;
}