/** * Notify RM to create a new node. * * @param parentID The ID of the machine the node belongs to * @param name the name of the node * @param number the number of the node (rank) * @return the id of the new node */ public String createNode(String parentID, String name, int number) { String id = generateID(); ElementAttributeManager mgr = new ElementAttributeManager(); AttributeManager attrMgr = new AttributeManager(); attrMgr.addAttribute( NodeAttributes.getStateAttributeDefinition().create(NodeAttributes.State.UP)); try { attrMgr.addAttribute( NodeAttributes.getNumberAttributeDefinition().create(new Integer(number))); } catch (IllegalValueException e) { /* * This exception is not possible, since number is always valid. */ RMCorePlugin.log(e); assert false; } attrMgr.addAttribute(ElementAttributes.getNameAttributeDefinition().create(name)); mgr.setAttributeManager(new RangeSet(id), attrMgr); fireRuntimeNewNodeEvent(eventFactory.newRuntimeNewNodeEvent(parentID, mgr)); DebugUtil.trace( DebugUtil.RTS_TRACING, "RTS {0}: new node #{1}", getResourceManager().getConfiguration().getName(), id); //$NON-NLS-1$ return id; }
/** Initialize the attribute manager. This is called each time the runtime is started. */ private void initialize() { attrMgr.clear(); attrMgr.setAttributeDefinitions(ElementAttributes.getDefaultAttributeDefinitions()); attrMgr.setAttributeDefinitions(ErrorAttributes.getDefaultAttributeDefinitions()); attrMgr.setAttributeDefinitions(FilterAttributes.getDefaultAttributeDefinitions()); attrMgr.setAttributeDefinitions(JobAttributes.getDefaultAttributeDefinitions()); attrMgr.setAttributeDefinitions(MachineAttributes.getDefaultAttributeDefinitions()); attrMgr.setAttributeDefinitions(MessageAttributes.getDefaultAttributeDefinitions()); attrMgr.setAttributeDefinitions(NodeAttributes.getDefaultAttributeDefinitions()); attrMgr.setAttributeDefinitions(ProcessAttributes.getDefaultAttributeDefinitions()); attrMgr.setAttributeDefinitions(QueueAttributes.getDefaultAttributeDefinitions()); attrMgr.setAttributeDefinitions(ResourceManagerAttributes.getDefaultAttributeDefinitions()); }