public void editInactiveExecutionPlanConfiguration( String executionPlanConfiguration, String filename, AxisConfiguration axisConfiguration) throws ExecutionPlanConfigurationException, ExecutionPlanDependencyValidationException { try { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); OMElement omElement = AXIOMUtil.stringToOM(executionPlanConfiguration); EventProcessorConfigurationHelper.validateExecutionPlanConfiguration(omElement, tenantId); ExecutionPlanConfiguration config = EventProcessorConfigurationHelper.fromOM(omElement); EventProcessorConfigurationFilesystemInvoker.delete(filename, axisConfiguration); EventProcessorConfigurationFilesystemInvoker.save( executionPlanConfiguration, config.getName(), filename, axisConfiguration); } catch (XMLStreamException e) { log.error("Error while creating the xml object"); throw new ExecutionPlanConfigurationException("Not a valid xml object ", e); } }
public void editActiveExecutionPlanConfiguration( String executionPlanConfiguration, String executionPlanName, AxisConfiguration axisConfiguration) throws ExecutionPlanConfigurationException, ExecutionPlanDependencyValidationException { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); try { OMElement omElement = AXIOMUtil.stringToOM(executionPlanConfiguration); EventProcessorConfigurationHelper.validateExecutionPlanConfiguration(omElement, tenantId); ExecutionPlanConfiguration executionPlanConfigurationObject = EventProcessorConfigurationHelper.fromOM(omElement); if (!(executionPlanConfigurationObject.getName().equals(executionPlanName))) { if (!(checkExecutionPlanValidity(executionPlanConfigurationObject.getName(), tenantId))) { throw new ExecutionPlanConfigurationException( executionPlanConfigurationObject.getName() + " already registered as an execution in this tenant"); } } if (executionPlanName != null && executionPlanName.length() > 0) { String fileName; ExecutionPlanConfigurationFile file = getExecutionPlanConfigurationFileByPlanName(executionPlanName, tenantId); if (file == null) { fileName = executionPlanName + EventProcessorConstants.EP_CONFIG_FILE_EXTENSION_WITH_DOT; } else { fileName = file.getFileName(); } EventProcessorConfigurationFilesystemInvoker.delete(fileName, axisConfiguration); EventProcessorConfigurationFilesystemInvoker.save( executionPlanConfiguration, executionPlanName, fileName, axisConfiguration); } else { throw new ExecutionPlanConfigurationException( "Invalid configuration provided, No execution plan name."); } } catch (XMLStreamException e) { log.error("Error while creating the xml object"); throw new ExecutionPlanConfigurationException("Not a valid xml object, ", e); } }