@Override protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException { super.performRuntime(context, operation, model); final String name = context.getCurrentAddressValue(); context.getServiceTarget().addService(context.getCapabilityServiceName(Capabilities.JOB_REPOSITORY_CAPABILITY.getName(), name, JobRepository.class), new InMemoryJobRepositoryService()).install(); } }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { super.performRuntime(context, operation, model); String name = context.getCurrentAddressValue(); ModelNode classModel = CLASS.resolveModelAttribute(context, model); if (classModel.isDefined()) { Class configSourceProviderClass = unwrapClass(classModel); try { ConfigSourceProvider configSourceProvider = ConfigSourceProvider.class.cast(configSourceProviderClass.newInstance()); ConfigSourceProviderService.install(context, name, configSourceProvider); } catch (Exception e) { throw new OperationFailedException(e); } } } }, new AbstractRemoveStepHandler() {
@Override protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException { super.performRuntime(context, operation, model); final String name = context.getCurrentAddressValue(); final String dsName = DATA_SOURCE.resolveModelAttribute(context, model).asString(); final ServiceTarget target = context.getServiceTarget(); final JdbcJobRepositoryService service = new JdbcJobRepositoryService(); Services.addServerExecutorDependency( target.addService(context.getCapabilityServiceName(Capabilities.JOB_REPOSITORY_CAPABILITY.getName(), name, JobRepository.class), service), service.getExecutorServiceInjector()) .addDependency(context.getCapabilityServiceName(Capabilities.DATA_SOURCE_CAPABILITY, dsName, DataSource.class), DataSource.class, service.getDataSourceInjector()) .install(); } }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { super.performRuntime(context, operation, model); String name = context.getCurrentAddressValue(); int ordinal = ORDINAL.resolveModelAttribute(context, model).asInt(); ModelNode props = PROPERTIES.resolveModelAttribute(context, model); ModelNode classModel = CLASS.resolveModelAttribute(context, model); ModelNode dirModel = DIR.resolveModelAttribute(context, model); final ConfigSource configSource; if (classModel.isDefined()) { Class configSourceClass = unwrapClass(classModel); try { configSource = ConfigSource.class.cast(configSourceClass.newInstance()); MicroProfileConfigLogger.ROOT_LOGGER.loadConfigSourceFromClass(configSourceClass); ConfigSourceService.install(context, name, configSource); } catch (Exception e) { throw new OperationFailedException(e); } } else if (dirModel.isDefined()) { String path = PATH.resolveModelAttribute(context, dirModel).asString(); String relativeTo = RELATIVE_TO.resolveModelAttribute(context, dirModel).asStringOrNull(); DirConfigSourceService.install(context, name, path, relativeTo, ordinal); } else { Map<String, String> properties = PropertiesAttributeDefinition.unwrapModel(context, props); configSource = new PropertiesConfigSource(properties, name, ordinal); ConfigSourceService.install(context, name, configSource); } } }, new AbstractRemoveStepHandler() {
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { performRuntime(context, operation, resource); context.completeStep(new OperationContext.RollbackHandler() { @Override public void handleRollback(OperationContext context, ModelNode operation) { rollbackRuntime(context, operation, resource); } }); } }, OperationContext.Stage.RUNTIME);
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { super.performRuntime(context, operation, model); this.installRuntimeServices(context, operation, model, null); }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException { super.performRuntime(context, operation, model, verificationHandler, newControllers); context.reloadRequired(); } }
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { performRuntime(context, operation, resource); context.completeStep(new OperationContext.RollbackHandler() { @Override public void handleRollback(OperationContext context, ModelNode operation) { rollbackRuntime(context, operation, resource); } }); } }, OperationContext.Stage.RUNTIME);
protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { if (context.isResourceServiceRestartAllowed()) { addOperation.performRuntime(context, operation, model, new ServiceVerificationHandler(), new ArrayList<ServiceController<?>>()); } else { context.revertReloadRequired(); } } }
/** * If the {@link OperationContext#isResourceServiceRestartAllowed() context allows resource removal}, * attempts to restore services by invoking the {@code performRuntime} method on the @{code addOperation} * handler passed to the constructor; otherwise puts the process in reload-required state. * * {@inheritDoc} */ @Override protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { if (context.isResourceServiceRestartAllowed()) { addOperation.performRuntime(context, operation, model); } else { context.revertReloadRequired(); } } }
/** * If the {@link OperationContext#isResourceServiceRestartAllowed() context allows resource removal}, * attempts to restore services by invoking the {@code performRuntime} method on the @{code addOperation} * handler passed to the constructor; otherwise puts the process in reload-required state. * * {@inheritDoc} */ @Override protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { if (context.isResourceServiceRestartAllowed()) { addOperation.performRuntime(context, operation, model); } else { context.revertReloadRequired(); } } }
@Override protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException { super.performRuntime(context, operation, model); final String name = context.getCurrentAddressValue(); context.getServiceTarget().addService(context.getCapabilityServiceName(Capabilities.JOB_REPOSITORY_CAPABILITY.getName(), name, JobRepository.class), new InMemoryJobRepositoryService()).install(); } }
@Override protected void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { super.performRuntime(context, operation, resource); ModelNode maxHistory = MAX_HISTORY.resolveModelAttribute(context, operation); context.getServiceTarget().addService(CONFIGURATION_CHANGES_CAPABILITY.getCapabilityServiceName(), new AbstractService<Void>() {}).install(); ConfigurationChangesCollector.INSTANCE.setMaxHistory(maxHistory.asInt()); }
@Override protected void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { super.performRuntime(context, operation, resource); ModelNode maxHistory = MAX_HISTORY.resolveModelAttribute(context, operation); context.getServiceTarget().addService(CONFIGURATION_CHANGES_CAPABILITY.getCapabilityServiceName(), new AbstractService<Void>() {}).install(); ConfigurationChangesCollector.INSTANCE.setMaxHistory(maxHistory.asInt()); }
@Override protected void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { super.performRuntime(context, operation, resource); context.getServiceTarget().addService(CONFIGURATION_CHANGES_CAPABILITY.getCapabilityServiceName(), new AbstractService<Void>() {}).install(); ModelNode maxHistory = MAX_HISTORY.resolveModelAttribute(context, operation); ConfigurationChangesCollector.INSTANCE.setMaxHistory(maxHistory.asInt()); }
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final List<ServiceController<?>> controllers = new ArrayList<ServiceController<?>>(); final ServiceVerificationHandler verificationHandler = new ServiceVerificationHandler(); performRuntime(context, operation, model, verificationHandler, controllers); if(requiresRuntimeVerification()) { context.addStep(verificationHandler, OperationContext.Stage.VERIFY); } context.completeStep(new OperationContext.RollbackHandler() { @Override public void handleRollback(OperationContext context, ModelNode operation) { rollbackRuntime(context, operation, model, controllers); } }); } }, OperationContext.Stage.RUNTIME);
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final List<ServiceController<?>> controllers = new ArrayList<ServiceController<?>>(); final ServiceVerificationHandler verificationHandler = new ServiceVerificationHandler(); performRuntime(context, operation, model, verificationHandler, controllers); if(requiresRuntimeVerification()) { context.addStep(verificationHandler, OperationContext.Stage.VERIFY); } context.completeStep(new OperationContext.RollbackHandler() { @Override public void handleRollback(OperationContext context, ModelNode operation) { rollbackRuntime(context, operation, model, controllers); } }); } }, OperationContext.Stage.RUNTIME);
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { super.performRuntime(context, operation, model); String name = context.getCurrentAddressValue(); ModelNode classModel = CLASS.resolveModelAttribute(context, model); if (classModel.isDefined()) { Class configSourceProviderClass = unwrapClass(classModel); try { ConfigSourceProvider configSourceProvider = ConfigSourceProvider.class.cast(configSourceProviderClass.newInstance()); ConfigSourceProviderService.install(context, name, configSourceProvider); } catch (Exception e) { throw new OperationFailedException(e); } } } }, new AbstractRemoveStepHandler() {
@Override protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException { super.performRuntime(context, operation, model); final String name = context.getCurrentAddressValue(); final String dsName = DATA_SOURCE.resolveModelAttribute(context, model).asString(); final ServiceTarget target = context.getServiceTarget(); final JdbcJobRepositoryService service = new JdbcJobRepositoryService(); Services.addServerExecutorDependency( target.addService(context.getCapabilityServiceName(Capabilities.JOB_REPOSITORY_CAPABILITY.getName(), name, JobRepository.class), service), service.getExecutorServiceInjector()) .addDependency(context.getCapabilityServiceName(Capabilities.DATA_SOURCE_CAPABILITY, dsName, DataSource.class), DataSource.class, service.getDataSourceInjector()) .install(); } }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { super.performRuntime(context, operation, model); String className = LISTENER_CLASS.resolveModelAttribute(context, model).asString(); String moduleIdentifier = LISTENER_MODULE.resolveModelAttribute(context, model).asString(); ProcessStateListener listener = newInstance(className, moduleIdentifier); Map<String, String> properties = PROPERTIES.unwrap(context, model); int timeout = TIMEOUT.resolveModelAttribute(context, model).asInt(); ProcessStateListenerService.install(context.getServiceTarget(), context.getProcessType(), context.getRunningMode(), context.getCurrentAddress().getLastElement().getValue(), listener, properties, timeout); }