use of org.onosproject.core.ApplicationRole in project onos by opennetworkinglab.
the class ApplicationArchive method loadAppDescription.
private ApplicationDescription loadAppDescription(XMLConfiguration cfg) {
String name = cfg.getString(NAME);
Version version = Version.version(cfg.getString(VERSION));
String origin = cfg.getString(ORIGIN);
String title = cfg.getString(TITLE);
// FIXME: title should be set as attribute to APP, but fallback for now...
title = title == null ? name : title;
String category = cfg.getString(CATEGORY, UTILITY);
String url = cfg.getString(URL);
byte[] icon = getApplicationIcon(name);
ApplicationRole role = getRole(cfg.getString(ROLE));
Set<Permission> perms = getPermissions(cfg);
String featRepo = cfg.getString(FEATURES_REPO);
URI featuresRepo = featRepo != null ? URI.create(featRepo) : null;
List<String> features = ImmutableList.copyOf(cfg.getString(FEATURES).split(","));
String apps = cfg.getString(APPS, "");
List<String> requiredApps = apps.isEmpty() ? ImmutableList.of() : ImmutableList.copyOf(apps.split(","));
// put full description to readme field
String readme = cfg.getString(DESCRIPTION);
// put short description to description field
String desc = compactDescription(readme);
return DefaultApplicationDescription.builder().withName(name).withVersion(version).withTitle(title).withDescription(desc).withOrigin(origin).withCategory(category).withUrl(url).withReadme(readme).withIcon(icon).withRole(role).withPermissions(perms).withFeaturesRepo(featuresRepo).withFeatures(features).withRequiredApps(requiredApps).build();
}
Aggregations