Package net.sourceforge.processdash.util

Examples of net.sourceforge.processdash.util.ProfTimer


    public synchronized void releaseLock() {
        if (userName == null)
            return;

        ProfTimer pt = new ProfTimer(logger,
                "ResourceBridgeClient.releaseLock[" + remoteUrl + "]");
        try {
            doLockPostRequest(RELEASE_LOCK_ACTION);
            setOfflineLockStatus(OfflineLockStatus.NotLocked);
            pt.click("Released bridged lock");
        } catch (Exception e) {
            // We don't throw any error here, because if we fail to release
            // the bridged lock, the worst case scenario is that it will time
            // out on the server after 5 minutes or so.  Log a message for
            // posterity.
View Full Code Here


   
    public static DashHierarchy loadTemplates(DataRepository data) {
        LOAD_TEMPLATES_PERMISSION.checkPermission();

        DashHierarchy templates = new DashHierarchy(null);
        ProfTimer pt = new ProfTimer(TemplateLoader.class,
            "TemplateLoader.loadTemplates");

        URL[] roots = getTemplateURLs();
        pt.click("Got template roots");

        String templateDirURL;
        for (int i=roots.length;   i-- > 0) {
            templateDirURL = roots[i].toString();

            if (templateDirURL.startsWith("file:/")) {
                /* If the /Templates directory exists as a local file
                 * somewhere, search through that directory for process
                 * templates.
                 */

                // strip "file:" from the beginning of the url.
                String dirname = templateDirURL.substring(5);
                dirname = HTMLUtils.urlDecode(dirname);
                searchDirForTemplates(templates, dirname, data);
                pt.click("searched dir '" + dirname + "' for templates");

            } else {
                /* If the /Templates directory found is in a jar somewhere,
                 * search through the jar for process templates.
                 */

                // Strip "jar:" from the beginning and the "!/Templates/"
                // from the end of the URL.
                String jarFileURL = templateDirURL.substring
                    (4, templateDirURL.indexOf('!'));
                searchJarForTemplates(templates, jarFileURL, data);
                pt.click("searched jar '" + jarFileURL + "' for templates");
            }
        }

        generateRollupTemplates(templates, data);

        createProcessRoot(templates);

        pt.click("done loading templates");
        return templates;
    }
View Full Code Here

        GET_TEMPLATE_URLS_PERMISSION.checkPermission();

        if (template_url_list != null) return template_url_list;

        Vector result = new Vector();
        ProfTimer pt = new ProfTimer(TemplateLoader.class,
                "TemplateLoader.getTemplateURLs");

        String userSetting = getSearchPath();
        if (userSetting != null && userSetting.length() != 0) {
            StringTokenizer tok = new StringTokenizer(userSetting, ";");
            while (tok.hasMoreTokens())
                addTemplateURLs(tok.nextToken(), result);
        }

        File appTemplateDir = getApplicationTemplateDir();
        if (appTemplateDir.isDirectory()) {
            try {
                result.add(appTemplateDir.toURI().toURL());
                scanDirForJarFiles(appTemplateDir, result);
            } catch (MalformedURLException e) {}
        }

        String baseDir = getBaseDir();
        if (unpackagedBinaryBaseDir != null)
            addTemplateURLs(unpackagedBinaryBaseDir + Settings.sep + "dist",
                    result);
        addTemplateURLs(baseDir, result);

        try {
            Enumeration e = TemplateLoader.class.getClassLoader()
                .getResources(TEMPLATE_DIR);
            while (e.hasMoreElements())
                result.addElement(e.nextElement());
        } catch (IOException ioe) {
            logger.severe("An exception was encountered when searching "
                    + "for process templates in the classpath:\n\t" + ioe);
        }

        filterURLList(result);

        template_url_list = urlListToArray(result);
        pt.click("Calculated template URL list");
        return template_url_list;
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.processdash.util.ProfTimer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.