private void editExecutionPlanConfiguration( ExecutionPlanConfiguration executionPlanConfiguration, String executionPlanName, int tenantId, AxisConfiguration axisConfiguration) throws ExecutionPlanConfigurationException { ExecutionPlanConfigurationFile configFile = getExecutionPlanConfigurationFileByPlanName(executionPlanName, tenantId); String fileName = configFile.getFileName(); EventProcessorConfigurationFilesystemInvoker.delete( configFile.getFileName(), axisConfiguration); OMElement omElement = EventProcessorConfigurationHelper.toOM(executionPlanConfiguration); EventProcessorConfigurationFilesystemInvoker.save( omElement, executionPlanName, fileName, axisConfiguration); }
@Override public void deployExecutionPlanConfiguration( ExecutionPlanConfiguration executionPlanConfiguration, AxisConfiguration axisConfiguration) throws ExecutionPlanDependencyValidationException, ExecutionPlanConfigurationException { String executionPlanName = executionPlanConfiguration.getName(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); OMElement omElement = EventProcessorConfigurationHelper.toOM(executionPlanConfiguration); EventProcessorConfigurationHelper.validateExecutionPlanConfiguration(omElement, tenantId); File directory = new File(axisConfiguration.getRepository().getPath()); if (!directory.exists()) { if (directory.mkdir()) { throw new ExecutionPlanConfigurationException( "Cannot create directory to add tenant specific execution plan : " + executionPlanName); } } directory = new File( directory.getAbsolutePath() + File.separator + EventProcessorConstants.EP_ELE_DIRECTORY); if (!directory.exists()) { if (!directory.mkdir()) { throw new ExecutionPlanConfigurationException( "Cannot create directory " + EventProcessorConstants.EP_ELE_DIRECTORY + " to add tenant specific execution plan :" + executionPlanName); } } validateToRemoveInactiveExecutionPlanConfiguration(executionPlanName, axisConfiguration); EventProcessorConfigurationFilesystemInvoker.save( omElement, executionPlanName, executionPlanName + EventProcessorConstants.XML_EXTENSION, axisConfiguration); }