final Integer ttl =
new Integer(advert.getDefaultRunningTimeSeconds());
final Duration ttlDur =
CommonUtil.minutesToDuration(ttl.intValue());
ResourceProperty prop =
new SimpleResourceProperty(
Constants_GT4_0.RP_FACTORY_DefTTL);
prop.add(ttlDur);
this.propSet.add(prop);
/* MaximumRunningTime: */
final Integer maxttl =
new Integer(advert.getMaximumRunningTimeSeconds());
final Duration maxTtlDur =
CommonUtil.minutesToDuration(maxttl.intValue());
prop = new SimpleResourceProperty(
Constants_GT4_0.RP_FACTORY_MaxTTL);
prop.add(maxTtlDur);
this.propSet.add(prop);
/* TODO: NOT an RP yet: MaximumAfterRunningTime */
//final Integer offset =
// new Integer(advert.getMaximumAfterRunningTime());
//final Duration offsetDur =
// CommonUtil.minutesToDuration(offset.intValue());
/* CPUArchitectureName */
final String[] validArches = advert.getCpuArchitectureNames();
if (validArches != null && validArches.length > 0) {
prop = new SimpleResourceProperty(Constants_GT4_0.RP_FACTORY_CPUArch);
// Can only advertise one of them due to JSDL XSD restrictions.
prop.add(validArches[0]);
this.propSet.add(prop);
}
if (advert.getVmm() != null) {
final VMM_Type vmm = new VMM_Type();
vmm.setType(VMM_TypeType.Xen);
final String[] versions = advert.getVmmVersions();
if (versions != null) {
vmm.setVersion(versions);
}
prop = new SimpleResourceProperty(Constants_GT4_0.RP_FACTORY_VMM);
prop.add(vmm);
this.propSet.add(prop);
}
final String[] assocs;
try {
assocs = advert.getNetworkNames();
} catch (Exception e) {
throw new ResourceException(e);
}
if (assocs != null && assocs.length > 0) {
final Associations rpAssoc = new Associations(assocs);
prop = new SimpleResourceProperty(Constants_GT4_0.RP_FACTORY_ASSOCIATIONS);
prop.add(rpAssoc);
this.propSet.add(prop);
}
}