gpt4 book ai didi

com.cloud.utils.xmlobject.XmlObject.get()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 10:29:05 25 4
gpt4 key购买 nike

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

XmlObject.get介绍

暂无

代码示例

代码示例来源:origin: apache/cloudstack

public <T> List<T> getAsList(String elementStr) {
  Object e = get(elementStr);
  if (e instanceof List) {
    return (List<T>)e;
  }
  List lst = new ArrayList(1);
  if (e != null) {
    lst.add(e);
  }
  return lst;
}

代码示例来源:origin: apache/cloudstack

public static List<UcsProfile> fromXmlString(String xmlstr) {
  List<UcsProfile> ps = new ArrayList<UcsProfile>();
  XmlObject xo = XmlObjectParser.parseFromString(xmlstr);
  List<XmlObject> xos = xo.getAsList("outDns.dn");
  if (xos != null) {
    for (XmlObject x : xos) {
      //UcsProfile p = UcsProfile.fromXmlObject(x);
      UcsProfile p = new UcsProfile();
      p.setDn(x.get("value").toString());
      ps.add(p);
    }
  }
  return ps;
}

代码示例来源:origin: apache/cloudstack

boolean needRemove = false;
for (XmlObject pxml : ports) {
  XmlObject name = pxml.get("name");
  if (port.port.equals(name.getText())) {
    needRemove = true;
XmlObject tagged = xml.get("untagged");
tagged.removeAllChildren();
for (XmlObject p : newPorts) {

代码示例来源:origin: apache/cloudstack

ports.addAll(xml.<XmlObject>getAsList("untagged.fortyGigE"));
for (XmlObject pxml : ports) {
  XmlObject name = pxml.get("name");
  if (port.port.equals(name.getText())) {
    logger.debug(String.format("port[%s] has joined in vlan[%s], no need to program again", struct.getPort(), struct.getVlan()));
XmlObject tag = xml.get("untagged");
if (tag == null) {
  tag = new XmlObject("untagged");

代码示例来源:origin: apache/cloudstack

public <T> T evaluateObject(T obj) {
    Class<?> clazz = obj.getClass();
    try {
      do {
        Field[] fs = clazz.getDeclaredFields();
        for (Field f : fs) {
          f.setAccessible(true);
          Object value = get(f.getName());
          f.set(obj, value);
        }
        clazz = clazz.getSuperclass();
      } while (clazz != null && clazz != Object.class);
      return obj;
    } catch (Exception e) {
      throw new CloudRuntimeException(e);
    }
  }
}

代码示例来源:origin: apache/cloudstack

private boolean isProfileAssociated(Long ucsMgrId, String dn) {
  UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId);
  UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl());
  String cookie = getCookie(ucsMgrId);
  String cmd = UcsCommands.configResolveDn(cookie, dn);
  String res = client.call(cmd);
  XmlObject xo = XmlObjectParser.parseFromString(res);
  s_logger.debug(String.format("association response is %s", res));
  if (xo.get("outConfig.computeBlade.association").equals("none")) {
    throw new CloudRuntimeException(String.format("cannot associated a profile to blade[dn:%s]. please check your UCS manasger for detailed error information",
      dn));
  }
  return xo.get("outConfig.computeBlade.association").equals("associated");
}

代码示例来源:origin: apache/cloudstack

private String cloneProfile(Long ucsMgrId, String srcDn, String newProfileName) {
  UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId);
  UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl());
  String cookie = getCookie(ucsMgrId);
  String cmd = UcsCommands.cloneProfile(cookie, srcDn, newProfileName);
  String res = client.call(cmd);
  XmlObject xo = XmlObjectParser.parseFromString(res);
  return xo.get("outConfig.lsServer.dn");
}

代码示例来源:origin: apache/cloudstack

String ret = client.call(cmd);
XmlObject xo = XmlObjectParser.parseFromString(ret);
String cookie = xo.get("outCookie");
ucsCookie = new UcsCookie(cookie, currentTime);
cookies.put(ucsMgrId, ucsCookie);

代码示例来源:origin: MissionCriticalCloud/cosmic

public <T> List<T> getAsList(final String elementStr) {
  final Object e = get(elementStr);
  if (e instanceof List) {
    return (List<T>) e;
  }
  final List lst = new ArrayList(1);
  if (e != null) {
    lst.add(e);
  }
  return lst;
}

代码示例来源:origin: MissionCriticalCloud/cosmic

public <T> T evaluateObject(final T obj) {
    Class<?> clazz = obj.getClass();
    try {
      do {
        final Field[] fs = clazz.getDeclaredFields();
        for (final Field f : fs) {
          f.setAccessible(true);
          final Object value = get(f.getName());
          f.set(obj, value);
        }
        clazz = clazz.getSuperclass();
      } while (clazz != null && clazz != Object.class);
      return obj;
    } catch (final Exception e) {
      throw new CloudRuntimeException(e);
    }
  }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com