Search in sources :

Example 6 with DashPackage

use of net.sourceforge.processdash.templates.DashPackage in project processdash by dtuma.

the class OpenLocalizationToolAction method getPackages.

/**
     * Returns a String containing all packages we want to translate,
     *  starting with the dashboardJar
     */
private String getPackages(String appTemplateDirName) {
    // add the application JAR file to the list, in position zero.
    StringBuffer packageFilenames = new StringBuffer(dashboardJar);
    // scan other dashboard add-ons to see if they contain localizable
    // resources.
    List packages = TemplateLoader.getPackages();
    for (Object p : packages) {
        DashPackage pkg = (DashPackage) p;
        String filename = pkg.filename;
        if (filename != null && !filename.equals(dashboardJar) && pkg.localizable)
            packageFilenames.append(RESOURCE_SEPARATOR + filename);
    }
    // packages by the loop above.  Look for these files and include them.
    if (StringUtils.hasValue(appTemplateDirName)) {
        File destDir = new File(appTemplateDirName);
        File[] appTemplateFiles = destDir.listFiles();
        if (appTemplateFiles != null) {
            for (File f : appTemplateFiles) {
                String name = f.getName().toLowerCase();
                if (name.startsWith("pspdash_") && name.endsWith(".jar"))
                    packageFilenames.append(RESOURCE_SEPARATOR + f.getPath());
            }
        }
    }
    return packageFilenames.toString();
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) DashPackage(net.sourceforge.processdash.templates.DashPackage) File(java.io.File)

Example 7 with DashPackage

use of net.sourceforge.processdash.templates.DashPackage in project processdash by dtuma.

the class ArchiveMetricsFileExporter method writeManifestMetaData.

private void writeManifestMetaData(XmlSerializer xml) throws IOException {
    xml.ignorableWhitespace(INDENT);
    xml.startTag(null, EXPORTED_TAG);
    String owner = ProcessDashboard.getOwnerName(ctx.getData());
    if (owner != null)
        xml.attribute(null, OWNER_ATTR, owner);
    String username = System.getProperty("user.name");
    if (username != null && username.length() > 0)
        xml.attribute(null, USERNAME_ATTR, username);
    xml.attribute(null, WHEN_ATTR, XMLUtils.saveDate(new Date()));
    writeFromDatasetTag(xml);
    List packages = TemplateLoader.getPackages();
    for (Iterator i = packages.iterator(); i.hasNext(); ) {
        DashPackage pkg = (DashPackage) i.next();
        xml.ignorableWhitespace(NEWLINE + INDENT + INDENT);
        xml.startTag(null, PACKAGE_ELEM);
        if (pkg.id != null)
            xml.attribute(null, PACKAGE_ID_ATTR, pkg.id);
        if (pkg.version != null)
            xml.attribute(null, VERSION_ATTR, pkg.version);
        xml.endTag(null, PACKAGE_ELEM);
    }
    xml.ignorableWhitespace(NEWLINE + INDENT);
    xml.endTag(null, EXPORTED_TAG);
    xml.ignorableWhitespace(NEWLINE);
}
Also used : Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) List(java.util.List) DashPackage(net.sourceforge.processdash.templates.DashPackage) Date(java.util.Date)

Example 8 with DashPackage

use of net.sourceforge.processdash.templates.DashPackage in project processdash by dtuma.

the class WebServer method writePackagesToDefaultEnv.

private void writePackagesToDefaultEnv() {
    Iterator i = DEFAULT_ENV.keySet().iterator();
    while (i.hasNext()) if (((String) i.next()).startsWith(PACKAGE_ENV_PREFIX))
        i.remove();
    i = TemplateLoader.getPackages().iterator();
    while (i.hasNext()) {
        DashPackage pkg = (DashPackage) i.next();
        DEFAULT_ENV.put(PACKAGE_ENV_PREFIX + pkg.id, pkg.version);
    }
}
Also used : Iterator(java.util.Iterator) DashPackage(net.sourceforge.processdash.templates.DashPackage)

Example 9 with DashPackage

use of net.sourceforge.processdash.templates.DashPackage in project processdash by dtuma.

the class TeamStartBootstrap method getDashPackageForFile.

private DashPackage getDashPackageForFile(File templateFile) throws MalformedURLException, InvalidDashPackage {
    String jarURL = templateFile.toURI().toURL().toString();
    URL url = new URL("jar:" + jarURL + "!/Templates/");
    DashPackage dashPackage = new DashPackage(url);
    return dashPackage;
}
Also used : InvalidDashPackage(net.sourceforge.processdash.templates.DashPackage.InvalidDashPackage) DashPackage(net.sourceforge.processdash.templates.DashPackage) URL(java.net.URL)

Aggregations

DashPackage (net.sourceforge.processdash.templates.DashPackage)9 File (java.io.File)4 URL (java.net.URL)3 ArrayList (java.util.ArrayList)3 InvalidDashPackage (net.sourceforge.processdash.templates.DashPackage.InvalidDashPackage)3 IOException (java.io.IOException)2 MalformedURLException (java.net.MalformedURLException)2 Iterator (java.util.Iterator)2 List (java.util.List)2 FileNotFoundException (java.io.FileNotFoundException)1 URLClassLoader (java.net.URLClassLoader)1 Date (java.util.Date)1 ProcessDashboard (net.sourceforge.processdash.ProcessDashboard)1 EVTaskList (net.sourceforge.processdash.ev.EVTaskList)1 BridgedWorkingDirectory (net.sourceforge.processdash.tool.bridge.client.BridgedWorkingDirectory)1 LocalWorkingDirectory (net.sourceforge.processdash.tool.bridge.client.LocalWorkingDirectory)1 WorkingDirectory (net.sourceforge.processdash.tool.bridge.client.WorkingDirectory)1