Java 类com.vmware.vim25.AlarmExpression 实例源码

项目:vijava    文件:PrintAlarmManager.java   
public static void main(String[] args) throws Exception
{
  if(args.length != 3)
  {
    System.out.println("Usage: java PrintAlarmManager " 
      + "<url> <username> <password>");
    return;
  }

  ServiceInstance si = new ServiceInstance(
    new URL(args[0]), args[1], args[2], true);

  AlarmManager alarmMgr = si.getAlarmManager();

  System.out.println("Alarm expressions:");
  AlarmExpression[] defaultExps = alarmMgr.getDefaultExpression();
  printAlarmExpressions(defaultExps);

  System.out.println("\n\nAlarm descriptions:");
  AlarmDescription ad = alarmMgr.getDescription();
  printAlarmDescription(ad);

  si.getServerConnection().logout();
}
项目:vijava    文件:PrintAlarmManager.java   
static void printAlarmExpressions(AlarmExpression[] exps)
{
  for(int i=0; exps!=null && i<exps.length; i++)
  {
    System.out.println("\nAlarm expression #" + i);
    if(exps[i] instanceof MetricAlarmExpression)
    {
      MetricAlarmExpression mae = 
        (MetricAlarmExpression) exps[i];
      System.out.println("metric:" 
          + mae.getMetric().getCounterId());
      System.out.println("red:" + mae.getRed());
      System.out.println("type:" + mae.getType());
      System.out.println("yellow:" + mae.getYellow());
    }
    else if(exps[i] instanceof StateAlarmExpression)
    {
      StateAlarmExpression sae = 
        (StateAlarmExpression) exps[i];
      System.out.println("operator:" + sae.getOperator());
      System.out.println("red:" + sae.getRed());
      System.out.println("statePath:" + sae.getStatePath());
      System.out.println("type:" + sae.getType());
      System.out.println("yellow:" + sae.getYellow());
    }
  }
}
项目:jcloud-vsphere    文件:AlarmManagerApi.java   
List<AlarmExpression> getDefaultExpression();