@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 void revertUpdateToRuntime(OperationContext context, ModelNode operation, String parameterName, ModelNode valueToRestore, ModelNode valueToRevert, List<ConnectionManager> handback) throws OperationFailedException { Boolean value = Constants.ENLISTMENT_TRACE.resolveValue(context, valueToRestore).asBoolean(); if (handback != null) { for (ConnectionManager ds : handback) { ds.setEnlistmentTrace(value); } } }
protected void executeWriteAttribute(String attributeName, OperationContext context, ModelNode operation, T component, PathAddress address) throws OperationFailedException { if (componentType.hasPool() && POOL_MAX_SIZE.getName().equals(attributeName)) { int newSize = POOL_MAX_SIZE.resolveValue(context, operation.get(VALUE)).asInt(); final Pool<?> pool = componentType.getPool(component); final int oldSize = pool.getMaxSize(); componentType.getPool(component).setMaxSize(newSize); context.completeStep(new OperationContext.RollbackHandler() { @Override public void handleRollback(OperationContext context, ModelNode operation) { pool.setMaxSize(oldSize); } }); } else { // Bug; we were registered for an attribute but there is no code for handling it throw EjbLogger.ROOT_LOGGER.unknownAttribute(attributeName); } }
@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 boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String parameterName, final ModelNode newValue, final ModelNode currentValue, final HandbackHolder<List<ConnectionManager>> handbackHolder) throws OperationFailedException { final String jndiName = context.readResource(PathAddress.EMPTY_ADDRESS).getModel().get(Constants.JNDINAME.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.getConnectors() != null) { List<ConnectionManager> handback = new LinkedList<>(); for (Connector connector : repository.getConnectors()) { for (ConnectionManager cm : connector.getConnectionManagers()) { if (jndiName.equalsIgnoreCase(cm.getUniqueId())) { cm.setEnlistmentTrace(boolValue); handback.add(cm); } } } handbackHolder.setHandback(handback); } } catch (Exception e) { throw new OperationFailedException(ConnectorLogger.ROOT_LOGGER.failedToSetAttribute(e.getLocalizedMessage())); } return false; }
static String getName(final OperationContext context, final ModelNode model) throws OperationFailedException { return NAME.resolveValue(context, model.get(NAME.getName())).asString(); }
static String getName(final OperationContext context, final ModelNode model) throws OperationFailedException { return NAME.resolveValue(context, model.get(NAME.getName())).asString(); }
static String getRealm(final OperationContext context, final ModelNode model) throws OperationFailedException { ModelNode value; if ((value = model.get(REALM.getName())).isDefined()) { return REALM.resolveValue(context, value).asString(); } else { return null; } }
static String getRealm(final OperationContext context, final ModelNode model) throws OperationFailedException { ModelNode value; if ((value = model.get(REALM.getName())).isDefined()) { return REALM.resolveValue(context, value).asString(); } else { return null; } }
static AuthorizerConfiguration.PrincipalType getPrincipalType(final OperationContext context, final ModelNode model) throws OperationFailedException { return AuthorizerConfiguration.PrincipalType.valueOf(TYPE.resolveValue(context, model.get(TYPE.getName())).asString()); }
static AuthorizerConfiguration.PrincipalType getPrincipalType(final OperationContext context, final ModelNode model) throws OperationFailedException { return AuthorizerConfiguration.PrincipalType.valueOf(TYPE.resolveValue(context, model.get(TYPE.getName())).asString()); }
@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 void revertUpdateToRuntime(OperationContext context, ModelNode operation, String parameterName, ModelNode valueToRestore, ModelNode valueToRevert, List<ConnectionManager> handback) throws OperationFailedException { Boolean value = Constants.ENLISTMENT_TRACE.resolveValue(context, valueToRestore).asBoolean(); if (handback != null) { for (ConnectionManager ds : handback) { ds.setEnlistmentTrace(value); } } }
ModelNode superResult = value.getType() == ModelType.OBJECT ? value : super.resolveValue(resolver, value);
@Override protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String parameterName, final ModelNode newValue, final ModelNode currentValue, final HandbackHolder<List<ConnectionManager>> handbackHolder) throws OperationFailedException { final String jndiName = context.readResource(PathAddress.EMPTY_ADDRESS).getModel().get(Constants.JNDINAME.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.getConnectors() != null) { List<ConnectionManager> handback = new LinkedList<>(); for (Connector connector : repository.getConnectors()) { for (ConnectionManager cm : connector.getConnectionManagers()) { if (jndiName.equalsIgnoreCase(cm.getUniqueId())) { cm.setEnlistmentTrace(boolValue); handback.add(cm); } } } handbackHolder.setHandback(handback); } } catch (Exception e) { throw new OperationFailedException(ConnectorLogger.ROOT_LOGGER.failedToSetAttribute(e.getLocalizedMessage())); } return false; }
@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; }
handbackHolder); boolean currBool = PlatformAttributes.ENABLED.resolveValue(context, currentValue).asBoolean(); boolean newBool = PlatformAttributes.ENABLED.resolveValue(context, newValue).asBoolean(); if (currBool == newBool) { return false; // don't know if this would ever happen, but if it does, nothing changed
handbackHolder); boolean currBool = LocalJMXAttributes.ENABLED.resolveValue(context, currentValue).asBoolean(); boolean newBool = LocalJMXAttributes.ENABLED.resolveValue(context, newValue).asBoolean(); if (currBool == newBool) { return false; // don't know if this would ever happen, but if it does, nothing changed
handbackHolder); boolean currBool = LocalDMRAttributes.ENABLED.resolveValue(context, currentValue).asBoolean(); boolean newBool = LocalDMRAttributes.ENABLED.resolveValue(context, newValue).asBoolean(); if (currBool == newBool) { return false; // don't know if this would ever happen, but if it does, nothing changed
handbackHolder); boolean currBool = RemoteDMRAttributes.ENABLED.resolveValue(context, currentValue).asBoolean(); boolean newBool = RemoteDMRAttributes.ENABLED.resolveValue(context, newValue).asBoolean(); if (currBool == newBool) { return false; // don't know if this would ever happen, but if it does, nothing changed