use of org.opennms.netmgt.provision.service.operations.RequisitionImport 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 a {@link java.lang.String} object - Valid values are "true", "false" and "dbonly".
* @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());
}
}
use of org.opennms.netmgt.provision.service.operations.RequisitionImport in project opennms by OpenNMS.
the class CoreImportActivities method loadSpecFile.
@Activity(lifecycle = "import", phase = "validate", schedulingHint = "import")
public RequisitionImport loadSpecFile(final Resource resource) {
final RequisitionImport ri = new RequisitionImport();
info("Loading requisition from resource {}", resource);
try {
final Requisition specFile = m_provisionService.loadRequisition(resource);
ri.setRequisition(specFile);
debug("Finished loading requisition.");
} catch (final Throwable t) {
ri.abort(t);
}
return ri;
}
Aggregations