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();
}
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);
}
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);
}
}
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;
}
Aggregations