use of org.opennms.netmgt.provision.service.lifecycle.LifeCycleInstance in project opennms by OpenNMS.
the class CoreImportActivities method scanNodes.
@Activity(lifecycle = "import", phase = "scan", schedulingHint = "import")
public static void scanNodes(final Phase currentPhase, final ImportOperationsManager opsMgr, final RequisitionImport ri) {
if (ri.isAborted()) {
info("The import has been aborted, skipping scan phase import.");
return;
}
info("Scheduling nodes for phase {}", currentPhase);
final Collection<ImportOperation> operations = opsMgr.getOperations();
for (final ImportOperation op : operations) {
final LifeCycleInstance nodeScan = currentPhase.createNestedLifeCycle("nodeImport");
debug("Created lifecycle {} for operation {}", nodeScan, op);
nodeScan.setAttribute("operation", op);
nodeScan.setAttribute("requisitionImport", ri);
nodeScan.trigger();
}
}
use of org.opennms.netmgt.provision.service.lifecycle.LifeCycleInstance in project opennms by OpenNMS.
the class Provisioner method importModelFromResource.
/**
* <p>importModelFromResource</p>
*
* @param resource a {@link org.springframework.core.io.Resource} object.
* @param rescanExisting TODO
* @param monitor a {@link org.opennms.netmgt.provision.service.operations.ProvisionMonitor} object.
* @throws java.lang.Exception if any.
*/
protected void importModelFromResource(final Resource resource, final String rescanExisting, final ProvisionMonitor monitor) throws Exception {
final LifeCycleInstance doImport = m_lifeCycleRepository.createLifeCycleInstance("import", m_importActivities);
doImport.setAttribute("resource", resource);
doImport.setAttribute("rescanExisting", rescanExisting);
doImport.trigger();
doImport.waitFor();
final RequisitionImport ri = doImport.findAttributeByType(RequisitionImport.class);
if (ri.isAborted()) {
throw new ModelImportException("Import failed for resource " + resource.toString(), ri.getError());
}
}
Aggregations