public static FlexyClassLoader createInstanceClassLoader(Instance c, String nodeName, BootstrapService bs) { if (c instanceof ContainerNode && ((ContainerNode) c).getHost() != null && ((ContainerNode) c).getHost().getName().equals(nodeName)) { return createTypeClassLoader(((ContainerNode) c).getHost().getTypeDefinition(), nodeName, bs); } else { return createTypeClassLoader(c.getTypeDefinition(), nodeName, bs); } }
private static void apply(Instance leftH, ContainerNode targetNode) throws KevScriptException { if (leftH instanceof ComponentInstance) { targetNode.addComponents((ComponentInstance) leftH); } else { if (leftH instanceof ContainerNode) { targetNode.addHosts((ContainerNode) leftH); } else { throw new KevScriptException("\""+leftH.getName()+"\" is not a node instance nor a component. Move failed"); } } } }
private static void apply(ContainerNode node, Group group) { group.removeSubNodes(node); node.removeGroups(group); FragmentDictionary fDic = group.findFragmentDictionaryByID(node.getName()); if (fDic != null) { group.removeFragmentDictionary(fDic); } } }
public void bootstrap(ContainerRoot model, UpdateCallback callback) throws Exception { ContainerNode currentNode = model.findNodesByID(core.getNodeName()); if (currentNode != null) { if (currentNode.findNetworkInformationByID("ip") == null) { currentNode.addNetworkInformation(info); Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces(); int i = 0;
if (td instanceof NodeType) { final ContainerNode instance = factory.createContainerNode(); instance.setTypeDefinition(td); if (name.getType().equals(Type.InstancePath) && name.getChildren().size() == 1) { final String newNodeName = InterpretExpr.interpret(name.getChildren().get(0), ctxVars); instance.setName(newNodeName); if (model.findNodesByID(newNodeName) != null) { throw new KevScriptError("Node already exist for name : " + newNodeName); final String parentNodeName = InterpretExpr.interpret(name.getChildren().get(0), ctxVars); final String newNodeName = InterpretExpr.interpret(name.getChildren().get(1), ctxVars); instance.setName(newNodeName); final ContainerNode parentNode = model.findNodesByID(parentNodeName); if (parentNode == null) { parentNode.addHosts(instance); i = instance; "Unable to find a node named: " + nodeName); } else { parentNode.addComponents(instance); i = instance;
public void fillAdditional(TraceSequence traces, ContainerNode targetNode, ContainerRoot currentModel, String nodeName) { for (ContainerNode n : targetNode.getHosts()) { ContainerNode previousNode = (ContainerNode) currentModel.findByPath(n.path()); if (previousNode != null) { traces.populate(previousNode.createTraces(n, false, false, false, true)); } else { traces.populate(n.toTraces(true, true)); for (Group g : targetNode.getGroups()) { Group previousGroup = (Group) currentModel.findByPath(g.path()); if (previousGroup != null) { for (ComponentInstance comp : targetNode.getComponents()) { for (Port port : comp.getProvided()) { for (MBinding b : port.getBindings()) {
private static void apply(ContainerNode node, Group group) { group.addSubNodes(node); node.addGroups(group); DictionaryType dictionaryType = group.getTypeDefinition().getDictionaryType(); if (dictionaryType != null) { DefaultKevoreeFactory factory = new DefaultKevoreeFactory(); FragmentDictionary fDic = factory.createFragmentDictionary(); fDic.setName(node.getName()); for (DictionaryAttribute attr : dictionaryType.getAttributes()) { if (attr.getFragmentDependant()) { Value value = factory.createValue(); value.setName(attr.getName()); value.setValue(attr.getDefaultValue()); fDic.addValues(value); } } group.addFragmentDictionary(fDic); } } }
components.addAll(host.getComponents()); ComponentInstance comp = host.findComponentsByID(instancePath.get(1)); if (comp != null) { components.add(comp);
ClassLoader classLoader = runtime.installTypeDefinition(node); NodeType nodeObject = (NodeType) runtime.createInstance(node, classLoader); if (node.getTypeDefinition().getDictionaryType() != null) { for (DictionaryAttribute attr : node.getTypeDefinition().getDictionaryType().getAttributes()) { if (!attr.getFragmentDependant()) { ContainerNode currentNode = currentModel.findNodesByID(nodeName); if (currentNode != null) { Value proposedVal = node.getDictionary().findValuesByID(attr.getName()); if (proposedVal == null) { Value param = factory.createValue(); param.setName(attr.getName()); param.setValue(attr.getDefaultValue()); node.getDictionary().addValues(param); Log.debug("Set default node param: {} = '{}'", param.getName(), param.getValue()); 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);
ContainerRoot stopModel = modelCloner.clone(currentModel); ContainerNode nodeToStop = stopModel.findNodesByID(getNodeName()); nodeToStop.setStarted(false); for (ContainerNode childNode : nodeToStop.getHosts()) { childNode.setStarted(false); hub.setStarted(false); for (ComponentInstance childComponent : nodeToStop.getComponents()) { childComponent.setStarted(false);
public void visit(KMFContainer child, String refNameInParent, KMFContainer parent) { if (child instanceof ContainerNode && !((ContainerNode) child).getName().equals(currentNodeName)) { noChildrenVisit(); noReferencesVisit(); //protection but should not be std case } else { result.addAll(child.toTraces(true, true)); } } }, true, true, false);
if (currentNode.findNetworkInformationByID("ip") == null) { NetworkInfo info = core.getFactory().createNetworkInfo(); info.setName("ip"); currentNode.addNetworkInformation(info); Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces(); int i = 0;
if (td instanceof NodeType) { final ContainerNode instance = factory.createContainerNode(); instance.setTypeDefinition(td); if (name.getType().equals(Type.InstancePath) && name.getChildren().size() == 1) { final String newNodeName = InterpretExpr.interpret(name.getChildren().get(0), ctxVars); instance.setName(newNodeName); if (model.findNodesByID(newNodeName) != null) { throw new KevScriptException("Node already exist for name : " + newNodeName); final String parentNodeName = InterpretExpr.interpret(name.getChildren().get(0), ctxVars); final String newNodeName = InterpretExpr.interpret(name.getChildren().get(1), ctxVars); instance.setName(newNodeName); final ContainerNode parentNode = model.findNodesByID(parentNodeName); if (parentNode == null) { parentNode.addHosts(instance); i = instance; "Unable to find a node named: " + nodeName); } else { parentNode.addComponents(instance); i = instance;
private static void apply(ContainerNode node, Group group) { group.removeSubNodes(node); node.removeGroups(group); FragmentDictionary fDic = group.findFragmentDictionaryByID(node.getName()); if (fDic != null) { group.removeFragmentDictionary(fDic); } } }
private static void apply(ContainerNode node, Group group) { group.addSubNodes(node); node.addGroups(group); DictionaryType dictionaryType = group.getTypeDefinition().getDictionaryType(); if (dictionaryType != null) { DefaultKevoreeFactory factory = new DefaultKevoreeFactory(); FragmentDictionary fDic = factory.createFragmentDictionary(); fDic.setName(node.getName()); for (DictionaryAttribute attr : dictionaryType.getAttributes()) { if (attr.getFragmentDependant()) { Value value = factory.createValue(); value.setName(attr.getName()); value.setValue(attr.getDefaultValue()); fDic.addValues(value); } } group.addFragmentDictionary(fDic); } } }
components.addAll(host.getComponents()); ComponentInstance comp = host.findComponentsByID(instancePath.get(1)); if (comp != null) { components.add(comp);
@Override public List<String> getRemotePortPaths() { ArrayList<String> result = new ArrayList<String>(); Channel channel = (Channel) modelService.getCurrentModel().getModel().findByPath(channelPath); if (channel != null) { for (MBinding binding : channel.getBindings()) { ContainerNode parentNode = (ContainerNode) binding.getPort().eContainer().eContainer(); if (parentNode != null) { if (!parentNode.getName().equals(localNodePath)) { org.kevoree.Port finalPort = binding.getPort(); if (finalPort != null) { result.add(finalPort.path()); } } } } } return result; } }
throw new KevScriptException("Node not found for name " + nodeName); NetworkInfo info = networkTargetNode.findNetworkInformationByID(propType); DefaultKevoreeFactory factory = new DefaultKevoreeFactory(); if (info == null) { info = factory.createNetworkInfo(); info.setName(propType); networkTargetNode.addNetworkInformation(info);