use of org.graalvm.component.installer.model.GraalEdition in project graal by oracle.
the class GraalEditionList method createComponentCatalog.
@Override
public ComponentCatalog createComponentCatalog(CommandInput in) {
ComponentRegistry targetGraalVM = in.getLocalRegistry();
if (targetGraalVM != this.targetGraal) {
GraalEditionList gl = listGraalEditions(in, targetGraalVM);
return gl.createComponentCatalog(in);
}
if (catalog != null) {
return catalog;
}
String edId = in.optValue(Commands.OPTION_USE_EDITION, "");
GraalEdition ge = getEdition(edId);
RemoteCatalogDownloader downloader = createEditionDownloader(ge);
CatalogContents col = new CatalogContents(feedback, downloader.getStorage(), targetGraalVM);
return catalog = col;
}
use of org.graalvm.component.installer.model.GraalEdition in project graal by oracle.
the class GraalEditionList method parseSimpleSpecification.
void parseSimpleSpecification(String defId, String spec) {
if (spec == null) {
return;
}
String[] eds = spec.split("\\{");
for (String part : eds) {
if ("".equals(part)) {
continue;
}
String edName;
String edId;
String src = part;
int endBracket = part.indexOf('}');
if (endBracket != -1) {
int eqSign = part.indexOf('=');
if (eqSign == -1 || eqSign >= endBracket) {
edId = edName = part.substring(0, endBracket);
} else {
edId = part.substring(0, eqSign);
edName = part.substring(eqSign + 1, endBracket);
}
src = part.substring(endBracket + 1).trim();
if (src.endsWith("|")) {
src = src.substring(0, src.length() - 1);
}
} else {
edId = defId != null ? defId : "ce";
edName = getEditionLabel(edId);
if (edName == null) {
edName = getEditionLabel(null);
}
}
GraalEdition ge = new GraalEdition(edId, edName);
boolean def = false;
ge.setSoftwareSources(parseChannelSources(edId, src));
if (defaultEdition == null && endBracket == -1) {
def = true;
} else if (edId.equals(defId)) {
def = true;
}
registerEdition(ge, def);
}
}
use of org.graalvm.component.installer.model.GraalEdition in project graal by oracle.
the class GraalEditionList method createEditionDownloader.
RemoteCatalogDownloader createEditionDownloader(GraalEdition edition) {
GraalEdition ed = edition;
if (ed == null) {
ed = defaultEdition;
}
RemoteCatalogDownloader dn = new RemoteCatalogDownloader(input, feedback, overrideCatalogSpec);
Stream.concat(ed.getSoftwareSources().stream(), localSources.stream()).forEach(dn::addLocalChannelSource);
// FIXME: temporary hack, remember to cleanup RemoteCatalogDownloader from debris, most of
// functionality
// has moved here.
dn.setRemoteSourcesAllowed(false);
return dn;
}
use of org.graalvm.component.installer.model.GraalEdition in project graal by oracle.
the class GraalEditionList method ensureDefaultDefined.
private void ensureDefaultDefined(String defEditionId) {
GraalEdition ge;
if (editions.isEmpty()) {
String label = getEditionLabel(defEditionId);
ge = new GraalEdition(defEditionId == null ? "" : defEditionId, label);
} else if (defaultEdition == null) {
ge = editions.get(0);
} else {
ge = defaultEdition;
}
registerEdition(ge, true);
}
use of org.graalvm.component.installer.model.GraalEdition in project graal by oracle.
the class GraalEditionListTest method testParseRelease20MultiCatalogDefs.
/**
* Checks multi-property definition parsing from the release file. The default property may be
* present, but will be ignored.
*
* @throws Exception
*/
@Test
public void testParseRelease20MultiCatalogDefs() throws Exception {
// this one contains multiple
loadReleaseFile("release20ceWithEE.properties");
storage.graalInfo.put(CommonConstants.CAP_EDITION, "ce");
GraalEditionList list = new GraalEditionList(this, this, getLocalRegistry());
list.setDefaultCatalogSpec(storage.graalInfo.get(CommonConstants.RELEASE_CATALOG_KEY));
List<GraalEdition> eds = list.editions();
assertFalse(eds.isEmpty());
assertEquals(2, eds.size());
GraalEdition ge = eds.get(0);
assertSame(list.getDefaultEdition(), ge);
assertEquals("Expected ce edition to be the default/installed", "ce", ge.getId());
assertEquals("Label from graal caps should be capitalized", "CE", ge.getDisplayName());
List<SoftwareChannelSource> sources = ge.getSoftwareSources();
assertEquals("CE edition has single source", 1, sources.size());
ge = eds.get(1);
assertEquals("Enterprise Edition must be present", "ee", ge.getId());
assertEquals("Enterprise label should be parsed out", "Enterprise Edition", ge.getDisplayName());
sources = ge.getSoftwareSources();
assertEquals("EE has more sources", 2, sources.size());
assertEquals("Expected decreasing priority", 2, sources.get(1).getPriority());
assertSame(ge, list.getEdition("ee"));
}
Aggregations