@Override protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String parameterName, ModelNode valueToRestore, ModelNode valueToRevert, List<DataSource> handback) throws OperationFailedException { Boolean value = Constants.ENLISTMENT_TRACE.resolveValue(context, valueToRestore).asBoolean(); if (handback != null) { for (DataSource ds : handback) { ds.setEnlistmentTrace(value); } } }
@Override protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String parameterName, final ModelNode newValue, final ModelNode currentValue, final HandbackHolder<List<DataSource>> handbackHolder) throws OperationFailedException { final String jndiName = context.readResource(PathAddress.EMPTY_ADDRESS).getModel().get(Constants.JNDI_NAME.getName()).asString(); final ServiceController<?> managementRepoService = context.getServiceRegistry(false).getService( ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE); Boolean boolValue = Constants.ENLISTMENT_TRACE.resolveValue(context, newValue).asBoolean(); try { final ManagementRepository repository = (ManagementRepository) managementRepoService.getValue(); if (repository.getDataSources() != null) { for (DataSource dataSource : repository.getDataSources()) { if (jndiName.equalsIgnoreCase(dataSource.getJndiName())) { dataSource.setEnlistmentTrace(boolValue); } } List<DataSource> list = new ArrayList<>(); for (DataSource ds : repository.getDataSources()) { if (jndiName.equalsIgnoreCase(ds.getJndiName())) { list.add(ds); } } handbackHolder.setHandback(list); } } catch (Exception e) { throw new OperationFailedException(ConnectorLogger.ROOT_LOGGER.failedToSetAttribute(e.getLocalizedMessage())); } return false; }
@Override protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String parameterName, ModelNode valueToRestore, ModelNode valueToRevert, List<DataSource> handback) throws OperationFailedException { Boolean value = Constants.ENLISTMENT_TRACE.resolveValue(context, valueToRestore).asBoolean(); if (handback != null) { for (DataSource ds : handback) { ds.setEnlistmentTrace(value); } } }
@Override protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String parameterName, final ModelNode newValue, final ModelNode currentValue, final HandbackHolder<List<DataSource>> handbackHolder) throws OperationFailedException { final String jndiName = context.readResource(PathAddress.EMPTY_ADDRESS).getModel().get(Constants.JNDI_NAME.getName()).asString(); final ServiceController<?> managementRepoService = context.getServiceRegistry(false).getService( ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE); Boolean boolValue = Constants.ENLISTMENT_TRACE.resolveValue(context, newValue).asBoolean(); try { final ManagementRepository repository = (ManagementRepository) managementRepoService.getValue(); if (repository.getDataSources() != null) { for (DataSource dataSource : repository.getDataSources()) { if (jndiName.equalsIgnoreCase(dataSource.getJndiName())) { dataSource.setEnlistmentTrace(boolValue); } } List<DataSource> list = new ArrayList<>(); for (DataSource ds : repository.getDataSources()) { if (jndiName.equalsIgnoreCase(ds.getJndiName())) { list.add(ds); } } handbackHolder.setHandback(list); } } catch (Exception e) { throw new OperationFailedException(ConnectorLogger.ROOT_LOGGER.failedToSetAttribute(e.getLocalizedMessage())); } return false; }