@Override public void performRuntime(final OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { // Compensating is remove final ModelNode address = operation.require(OP_ADDR); final String name = PathAddress.pathAddress(address).getLastElement().getValue(); final String archiveOrModuleName; if (!model.hasDefined(ARCHIVE.getName()) && !model.hasDefined(MODULE.getName())) { throw ConnectorLogger.ROOT_LOGGER.archiveOrModuleRequired(); } if (model.get(ARCHIVE.getName()).isDefined()) { archiveOrModuleName = model.get(ARCHIVE.getName()).asString(); } else { archiveOrModuleName = model.get(MODULE.getName()).asString(); } ModifiableResourceAdapter resourceAdapter = RaOperationUtil.buildResourceAdaptersObject(name, context, operation, archiveOrModuleName); List<ServiceController<?>> newControllers = new ArrayList<ServiceController<?>>(); if (model.get(ARCHIVE.getName()).isDefined()) { RaOperationUtil.installRaServices(context, name, resourceAdapter, newControllers); } else { RaOperationUtil.installRaServicesAndDeployFromModule( context, name, resourceAdapter, archiveOrModuleName, newControllers); if (context.isBooting()) { context.addStep( new OperationStepHandler() { public void execute(final OperationContext context, ModelNode operation) throws OperationFailedException { // Next lines activate configuration on module deployed rar // in case there is 2 different resource-adapter config using same module deployed // rar // a Deployment sercivice could be already present and need a restart to consider // also this // newly added configuration ServiceName restartedServiceName = RaOperationUtil.restartIfPresent(context, archiveOrModuleName, name); if (restartedServiceName == null) { RaOperationUtil.activate(context, name, archiveOrModuleName); } context.completeStep( new OperationContext.RollbackHandler() { @Override public void handleRollback(OperationContext context, ModelNode operation) { try { RaOperationUtil.removeIfActive(context, archiveOrModuleName, name); } catch (OperationFailedException e) { } } }); } }, OperationContext.Stage.RUNTIME); } } }