com.sun.enterprise.config.serverbeans.Server.getNodeRef()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(244)

本文整理了Java中com.sun.enterprise.config.serverbeans.Server.getNodeRef()方法的一些代码示例,展示了Server.getNodeRef()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getNodeRef()方法的具体详情如下:
包路径:com.sun.enterprise.config.serverbeans.Server
类名称:Server
方法名:getNodeRef

Server.getNodeRef介绍

[英]Gets the value of the node property. SE/EE only. Specifies name of node agent where server instance is hosted
[中]获取节点属性的值。仅限SE/EE。指定承载服务器实例的节点代理的名称

代码示例

代码示例来源:origin: org.glassfish.main.admin/admin-util

public final String getNode(final Server server) {
  if (server == null)
    return null;
  String node = server.getNodeRef();
  if (StringUtils.ok(node))
    return node;
  else
    return "no node";
}

代码示例来源:origin: org.glassfish.admin/admin-util

public final String getNode(final Server server) {
  if (server == null)
    return null;
  String node = server.getNodeRef();
  if (StringUtils.ok(node))
    return node;
  else
    return "no node";
}

代码示例来源:origin: org.glassfish.cluster/cluster-admin

private static String serverListToString(List<Server> servers) {
  StringBuilder sb = new StringBuilder();
  for (Server s : servers) {
    sb.append(s.getNodeRef() + ":" + s.getName() + " ");
  }
  return sb.toString().trim();
}

代码示例来源:origin: org.glassfish.main.cluster/cluster-admin

private static String serverListToString(List<Server> servers) {
  StringBuilder sb = new StringBuilder();
  for (Server s : servers) {
    sb.append(s.getNodeRef() + ":" + s.getName() + " ");
  }
  return sb.toString().trim();
}

代码示例来源:origin: org.glassfish.admin/config-api

public static List<Server> getServersOnNode(Servers servers, Node node) {
  List<Server> serverList = servers.getServer();
  List<Server> serverListOnNode = new ArrayList<Server>();
  Server instance = null;
  String nodeName = node.getName();
  if (serverList.size() > 0) {
    for (Server server: serverList){
      if (nodeName.equals(server.getNodeRef())){
        serverListOnNode.add(server);
      }
    }
  }
  return serverListOnNode;
}

代码示例来源:origin: org.glassfish.main.admin/config-api

public static List<Server> getServersOnNode(Servers servers, Node node) {
  List<Server> serverList = servers.getServer();
  List<Server> serverListOnNode = new ArrayList<Server>();
  Server instance = null;
  String nodeName = node.getName();
  if (serverList.size() > 0) {
    for (Server server: serverList){
      if (nodeName.equals(server.getNodeRef())){
        serverListOnNode.add(server);
      }
    }
  }
  return serverListOnNode;
}

代码示例来源:origin: org.glassfish.admin/config-api

public static List<Cluster> getClustersOnNode(Domain domain, String nodeName) {
    HashMap<String,Cluster> clMap = new HashMap<String,Cluster>();
  List<Server> serverList = getInstancesOnNode(domain, nodeName);
  try {
    for(Server server : serverList) {
      Cluster mycl = server.getCluster();
      if(nodeName.equals(server.getNodeRef()) )   {
        clMap.put(mycl.getName(),mycl);
      }
    }
  }
  catch(Exception e) {
    Logger.getAnonymousLogger().warning("Error when getting clusters on node " + e.getLocalizedMessage());
  }
  return new ArrayList(clMap.values());
}

代码示例来源:origin: org.glassfish.main.admin/config-api

public static List<Cluster> getClustersOnNode(Domain domain, String nodeName) {
  HashMap<String,Cluster> clMap = new HashMap<String,Cluster>();
  List<Server> serverList = getInstancesOnNode(domain, nodeName);
  try {
    for(Server server : serverList) {
      Cluster mycl = server.getCluster();
      if(nodeName.equals(server.getNodeRef()) )   {
        clMap.put(mycl.getName(),mycl);
      }
    }
  }
  catch(Exception e) {
    logger.log(Level.WARNING, ConfigApiLoggerInfo.errorGettingCluster, e.getLocalizedMessage());
  }
  return new ArrayList(clMap.values());
}

代码示例来源:origin: org.glassfish.main.admin/config-api

public static List<Server> getInstancesOnNode(Domain domain, String nodeName) {
  List<Server> ret = new LinkedList<Server>();
  try {
    if(!StringUtils.ok(nodeName))
      return ret;
    List<Server> servers = domain.getServers().getServer();
    for(Server server : servers) {
      if(nodeName.equals(server.getNodeRef()))
          ret.add(server);
    }
  }
  catch(Exception e) {
     logger.log(Level.WARNING,ConfigApiLoggerInfo.errorGettingServers , e.getLocalizedMessage());
  }
  return ret;
}

代码示例来源:origin: org.glassfish.admin/config-api

public static List<Server> getInstancesOnNode(Domain domain, String nodeName) {
  List<Server> ret = new LinkedList<Server>();
  try {
    if(!StringUtils.ok(nodeName))
      return ret;
    List<Server> servers = domain.getServers().getServer();
    for(Server server : servers) {
      if(nodeName.equals(server.getNodeRef()))
          ret.add(server);
    }
  }
  catch(Exception e) {
     Logger.getAnonymousLogger().warning("Error when getting servers " + e.getLocalizedMessage());
  }
  return ret;
}

代码示例来源:origin: org.glassfish.cluster/cluster-admin

String nodeName = server.getNodeRef();

代码示例来源:origin: org.glassfish.main.admin/config-api

public static boolean nodeInUse(Node node) {
  //check if node is referenced by an instance
  String nodeName = node.getName();
  Dom serverDom = Dom.unwrap(node);
  Servers servers = serverDom.getHabitat().getService(Servers.class);
  List<Server> serverList = servers.getServer();
  if (serverList != null) {
    for (Server server : serverList) {
      if (nodeName.equals(server.getNodeRef())) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: org.glassfish.admin/config-api

public static boolean nodeInUse(Node node) {
    //check if node is referenced by an instance
    String nodeName = node.getName();
    Dom serverDom = Dom.unwrap(node);
    Servers servers = serverDom.getHabitat().getComponent(Servers.class);
    List<Server> serverList=servers.getServer();
    if (serverList != null) {
      for (Server server : serverList){
        if (nodeName.equals(server.getNodeRef())){
          return true;
        }
      }
    }
    return false;
  }
}

代码示例来源:origin: org.glassfish.main.cluster/cluster-admin

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;
}

代码示例来源:origin: org.glassfish.cluster/cluster-admin

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;
}

代码示例来源:origin: org.glassfish.main.jms/jms-admin

if (targetServer != null && ! targetServer.isDas()) {
  port = JmsRaUtil.getJMSPropertyValue(targetServer);
  host = domain.getNodeNamed(targetServer.getNodeRef()).getNodeHost();
} else{
  Cluster cluster = domain.getClusterNamed(target);
    targetServer = cluster.getInstances().get(0);
    port = JmsRaUtil.getJMSPropertyValue(targetServer);
    host = domain.getNodeNamed(targetServer.getNodeRef()).getNodeHost();

代码示例来源:origin: org.glassfish.common/internal-api

List<Server> allInstances = getAllInstances();
for(Server s : allInstances) {
  if(targetName.equals(s.getNodeRef()))
    instances.add(s);

代码示例来源:origin: eclipse-ee4j/glassfish

List<Server> allInstances = getAllInstances();
for(Server s : allInstances) {
  if(targetName.equals(s.getNodeRef()))
    instances.add(s);

代码示例来源:origin: org.glassfish.admin/config-api

String nodeName = server.getNodeRef();
if (StringUtils.ok(nodeName)) {
  Node node = nodes.getNode(nodeName);

代码示例来源:origin: org.glassfish.main.admin/config-api

String nodeName = server.getNodeRef();
if (StringUtils.ok(nodeName)) {
  Node node = nodes.getNode(nodeName);

相关文章