private boolean isInstallable(TypeDefinition tdef) { List<DeployUnit> dus = tdef.getDeployUnits(); for (DeployUnit du : dus) { Value platform = du.findFiltersByID("platform"); if (platform != null && platform.getValue().equals("java")) { return true; } } return false; }
private boolean checkDUS(TypeDefinition tdef, Map<String, Object> duVersions) { boolean satisfied = true; for (Map.Entry<String, Object> entry : duVersions.entrySet()) { boolean found = false; for (int i=0; i < tdef.getDeployUnits().size(); i++) { DeployUnit du = tdef.getDeployUnits().get(i); String p = du.findFiltersByID("platform").getValue(); if (p.equals(entry.getKey()) && du.getVersion().equals(entry.getValue().toString())) { found = true; break; } } if (!found) { satisfied = false; break; } } return satisfied; } }
private DeployUnit getJavaDeployUnit(Instance instance) { TypeDefinition tdef = instance.getTypeDefinition(); if (tdef != null) { return tdef.getDeployUnits().stream().filter(du -> { Value filter = du.findFiltersByID("platform"); return filter != null && filter.getValue() != null && filter.getValue().equals("java"); }).findFirst().orElse(null); } return null; }
private void saveTdef(TypeFQN fqn, TypeDefinition tdef) { tdef.getDeployUnits().clear(); Path path = getTdefPath(fqn); String modelStr = serializer.serialize(tdef); writeFile(path.toFile(), modelStr); }
public static FlexyClassLoader createTypeClassLoader(TypeDefinition typeDefinition, String nodeName, BootstrapService bs) { FlexyClassLoader kcl = FlexyClassLoaderFactory.INSTANCE.create(); kcl.setKey(typeDefinition.path()); for (DeployUnit du : typeDefinition.getDeployUnits()) { FlexyClassLoader resolved = bs.get(du); if (resolved != null) { kcl.attachChild(resolved); } } return kcl; }
if (duIsTag) { if (duTag.equals(TypeFQN.Version.LATEST)) { latestDUS.put(key + '/' + tdef.getVersion(), getDUVersions(tdef.getDeployUnits())); Log.trace("TagResolver linked {} to {}/{}/{}", fqn, key, fqn.version.tdef, latestDUS.get(key + '/' + tdef.getVersion())); } else if (duTag.equals(TypeFQN.Version.RELEASE)) { releaseDUS.put(key + '/' + tdef.getVersion(), getDUVersions(tdef.getDeployUnits())); Log.trace("TagResolver linked {} to {}/{}/{}", fqn, key, fqn.version.tdef, releaseDUS.get(key + '/' + tdef.getVersion()));
private TypeDefinition askNext(TypeFQN fqn, ContainerRoot model) throws KevScriptException { ContainerRoot emptyModel = factory.createContainerRoot(); factory.root(emptyModel); TypeDefinition tdef = next().resolve(fqn, emptyModel); // tdef has been resolved from registry // save it in filesystem saveTdef(fqn, tdef); saveDeployUnits(fqn, tdef.getDeployUnits()); // TODO remove current tdefs DUs in order to use the resolved ones only? compare.merge(model, emptyModel).applyOn(model); return (TypeDefinition) model.findByPath(tdef.path()); }
throw new KevoreeDeployException("You are trying to start a NodeType that does not target this runtime version", e); } catch (KevoreeCoreException e) { throw new KevoreeDeployException("Unable to create instance " + node.getName() + ": " + node.getTypeDefinition().getName() + "/" + node.getTypeDefinition().getVersion() + "/" + node.getTypeDefinition().getDeployUnits().get(0).getVersion(), e);