public ListNodesHelper(Logger _logger, Servers servers, Nodes nodes, String type, boolean long_opt, boolean terse) { this.listType = type; this.long_opt = long_opt; this.terse = terse; this.servers = servers; nodeList=nodes.getNode(); infos = new LinkedList<NodeInfo>(); }
public ListNodesHelper(Logger _logger, Servers servers, Nodes nodes, String type, boolean long_opt, boolean terse) { logger = _logger; this.listType = type; this.long_opt = long_opt; this.terse = terse; this.servers = servers; nodeList=nodes.getNode(); infos = new LinkedList<NodeInfo>(); }
public static Node getNode(Nodes nodes, String name) { if (name == null || nodes == null) { return null; } for (Node node : nodes.getNode()) { if (node.getName().equals(name)) { return node; } } return null; }
public static Node getNode(Nodes nodes, String name) { if (name == null || nodes == null) { return null; } for (Node node : nodes.getNode()) { if (node.getName().equals(name)) { return node; } } return null; }
public static Node getNodeNamed(Domain d, String name) { if (d.getNodes() == null || name == null) { return null; } List<Node> nodes = d.getNodes().getNode(); for (Node n : nodes) { if (name.equals(n.getName().trim())) { return n; } } return null; }
public static Node getNodeNamed(Domain d, String name) { if (d.getNodes() == null || name == null) { return null; } List<Node> nodes = d.getNodes().getNode(); for (Node n : nodes) { if (name.equals(n.getName().trim())) { return n; } } return null; }
private List<Server> getServersForNode() { if (whichTarget == null) // FindBugs can't figure out that our caller already checked. throw new NullPointerException("impossible!"); boolean foundNode = false; Nodes nodes = domain.getNodes(); if (nodes != null) { List<Node> nodeList = nodes.getNode(); if (nodeList != null) { for (Node node : nodeList) { if (whichTarget.equals(node.getName())) { foundNode = true; break; } } } } if (!foundNode) { return null; } else { return domain.getInstancesOnNode(whichTarget); } }
private List<Cluster> getClustersForNode() { boolean foundNode = false; Nodes nodes = domain.getNodes(); if (nodes != null) { List<Node> nodeList = nodes.getNode(); if (nodeList != null) { for (Node node : nodeList) { if (whichTarget.equals(node.getName())) { foundNode = true; break; } } } } if (!foundNode) return null; else return domain.getClustersOnNode(whichTarget); }
private List<Cluster> getClustersForNode() { boolean foundNode = false; Nodes nodes = domain.getNodes(); if (nodes != null) { List<Node> nodeList = nodes.getNode(); if (nodeList != null) { for (Node node : nodeList) { if (whichTarget.equals(node.getName())) { foundNode = true; break; } } } } if (!foundNode) return null; else return domain.getClustersOnNode(whichTarget); }
private List<Server> getServersForNode() { boolean foundNode = false; Nodes nodes = domain.getNodes(); if (nodes != null) { List<Node> nodeList = nodes.getNode(); if (nodeList != null) { for (Node node : nodeList) { if (whichTarget.equals(node.getName())) { foundNode = true; break; } } } } if (!foundNode) { return null; } else { return domain.getInstancesOnNode(whichTarget); } }
public static Node getDefaultLocalNode(Nodes nodes) { if (nodes == null) { return null; } Dom serverDom = Dom.unwrap(nodes); Domain domain = serverDom.getHabitat().getComponent(Domain.class); for (Node node : nodes.getNode()) { if (node.getName().equals("localhost-"+domain.getName())) { return node; } } return null; } }
public static Node getDefaultLocalNode(Nodes nodes) { if (nodes == null) { return null; } Dom serverDom = Dom.unwrap(nodes); Domain domain = serverDom.getHabitat().getService(Domain.class); for (Node node : nodes.getNode()) { if (node.getName().equals("localhost-"+domain.getName())) { return node; } } return null; }
private String killInstance(AdminCommandContext context) { String msg = initializeInstance(); if (msg != null) return msg; String nodeName = instance.getNodeRef(); Node node = nodes.getNode(nodeName); NodeUtils nodeUtils = new NodeUtils(habitat, logger); // asadmin command to run on instances node ArrayList<String> command = new ArrayList<String>(); command.add("stop-local-instance"); command.add("--kill"); command.add(instanceName); String humanCommand = makeCommandHuman(command); String firstErrorMessage = Strings.get("stop.local.instance.kill", instanceName, nodeName, humanCommand); if (logger.isLoggable(Level.FINE)) logger.fine("stop-instance: running " + humanCommand + " on " + nodeName); nodeUtils.runAdminCommandOnNode(node, command, context, firstErrorMessage, humanCommand, null); ActionReport killreport = context.getActionReport(); if (killreport.getActionExitCode() != ActionReport.ExitCode.SUCCESS) { return killreport.getMessage(); } return null; }
private String killInstance(AdminCommandContext context) { String msg = initializeInstance(); if (msg != null) return msg; String nodeName = instance.getNodeRef(); Node node = nodes.getNode(nodeName); NodeUtils nodeUtils = new NodeUtils(habitat, logger); // asadmin command to run on instances node ArrayList<String> command = new ArrayList<String>(); command.add("stop-local-instance"); command.add("--kill"); command.add(instanceName); String humanCommand = makeCommandHuman(command); String firstErrorMessage = Strings.get("stop.local.instance.kill", instanceName, nodeName, humanCommand); logger.fine("stop-instance: running " + humanCommand + " on " + nodeName); nodeUtils.runAdminCommandOnNode(node, command, context, firstErrorMessage, humanCommand, null); ActionReport killreport = context.getActionReport(); if (killreport.getActionExitCode() != ActionReport.ExitCode.SUCCESS) { return killreport.getMessage(); } return null; }
private void createDefaultNode(Domain d, Nodes nodes) throws TransactionFailure, PropertyVetoException { Property domainProp = d.getProperty("administrative.domain.name"); String domainName = domainProp.getValue(); Node node = nodes.createChild(Node.class); node.setName("localhost" + "-" + domainName); node.setType("CONFIG"); node.setNodeHost("localhost"); node.setInstallDir("${com.sun.aas.productRoot}"); nodes.getNode().add(node); } }
private void createDefaultNode(Domain d, Nodes nodes) throws TransactionFailure, PropertyVetoException { Property domainProp = d.getProperty("administrative.domain.name"); String domainName = domainProp.getValue(); Node node = nodes.createChild(Node.class); node.setName("localhost" + "-" + domainName); node.setType("CONFIG"); node.setNodeHost("localhost"); node.setInstallDir("${com.sun.aas.productRoot}"); nodes.getNode().add(node); } }
@Override public void execute(AdminCommandContext context) { ActionReport report = context.getActionReport(); Logger logger = context.logger; Node node = nodes.getNode(name); if (node == null) { //no node to delete nothing to do here String msg = Strings.get("noSuchNode", name); logger.warning(msg); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(msg); return; } if (!(node.getType().equals("CONFIG") )){ //no node to delete nothing to do here String msg = Strings.get("notConfigNodeType", name); logger.warning(msg); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(msg); return; } CommandInvocation ci = cr.getCommandInvocation("_delete-node", report); ParameterMap map = new ParameterMap(); map.add("DEFAULT", name); ci.parameters(map); ci.execute(); }
@Override public void execute(AdminCommandContext context) { ActionReport report = context.getActionReport(); if (name == null) name = nodehost.toString(); if (nodes.getNode(name) != null) { //already created nothing to do here return; } CommandInvocation ci = cr.getCommandInvocation("_create-node", report); ParameterMap map = new ParameterMap(); map.add("DEFAULT", name); map.add(NodeUtils.PARAM_NODEDIR, nodedir); map.add(NodeUtils.PARAM_INSTALLDIR, installdir); map.add(NodeUtils.PARAM_NODEHOST, nodehost); map.add(NodeUtils.PARAM_TYPE,"CONFIG"); ci.parameters(map); ci.execute(); }
@Override public void execute(AdminCommandContext context) { ActionReport report = context.getActionReport(); Logger logger = context.getLogger(); Node node = nodes.getNode(name); if (node == null) { //no node to delete nothing to do here String msg = Strings.get("noSuchNode", name); logger.warning(msg); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(msg); return; } if (!(node.getType().equals("CONFIG") )){ //no node to delete nothing to do here String msg = Strings.get("notConfigNodeType", name); logger.warning(msg); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(msg); return; } CommandInvocation ci = cr.getCommandInvocation("_delete-node", report, context.getSubject()); ParameterMap map = new ParameterMap(); map.add("DEFAULT", name); ci.parameters(map); ci.execute(); }
@Override public void execute(AdminCommandContext context) { ActionReport report = context.getActionReport(); if (name == null) name = nodehost; if (nodes.getNode(name) != null) { //already created nothing to do here return; } CommandInvocation ci = cr.getCommandInvocation("_create-node", report, context.getSubject()); ParameterMap map = new ParameterMap(); map.add("DEFAULT", name); map.add(NodeUtils.PARAM_NODEDIR, nodedir); map.add(NodeUtils.PARAM_INSTALLDIR, installdir); map.add(NodeUtils.PARAM_NODEHOST, nodehost); map.add(NodeUtils.PARAM_TYPE,"CONFIG"); ci.parameters(map); ci.execute(); }