org.jboss.as.server.AbstractDeploymentChainStep Java Examples

The following examples show how to use org.jboss.as.server.AbstractDeploymentChainStep. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RequestControllerSubsystemAdd.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void performBoottime(OperationContext context, ModelNode operation, final Resource resource)
        throws OperationFailedException {

    context.addStep(new AbstractDeploymentChainStep() {
        @Override
        protected void execute(DeploymentProcessorTarget processorTarget) {

            processorTarget.addDeploymentProcessor(RequestControllerExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_GLOBAL_REQUEST_CONTROLLER, new RequestControllerDeploymentUnitProcessor());
        }
    }, OperationContext.Stage.RUNTIME);

    int maxRequests = RequestControllerRootDefinition.MAX_REQUESTS.resolveModelAttribute(context, resource.getModel()).asInt();
    boolean trackIndividual = RequestControllerRootDefinition.TRACK_INDIVIDUAL_ENDPOINTS.resolveModelAttribute(context, resource.getModel()).asBoolean();

    RequestController requestController = new RequestController(trackIndividual);

    requestController.setMaxRequestCount(maxRequests);

    context.getServiceTarget().addService(RequestController.SERVICE_NAME, requestController)
            .addDependency(JBOSS_SUSPEND_CONTROLLER, SuspendController.class, requestController.getShutdownControllerInjectedValue())
            .install();

}
 
Example #2
Source File: SimpleSubsystemAdd.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void performBoottime(OperationContext context, ModelNode operation, Resource resource)
        throws OperationFailedException {

    //Add deployment processors here
    //Remove this if you don't need to hook into the deployers, or you can add as many as you like
    //see SubDeploymentProcessor for explanation of the phases
    context.addStep(new AbstractDeploymentChainStep() {
        public void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(SimpleSubsystemExtension.SUBSYSTEM_NAME, SimpleSubsystemDeploymentProcessor.PHASE, SimpleSubsystemDeploymentProcessor.PRIORITY, new SimpleSubsystemDeploymentProcessor());
        }
    }, OperationContext.Stage.RUNTIME);

    context.getServiceTarget().addService(SimpleService.NAME, new SimpleService()).install();
}
 
Example #3
Source File: KeycloakSubsystemAdd.java    From keycloak with Apache License 2.0 6 votes vote down vote up
@Override
protected void performBoottime(final OperationContext context, ModelNode operation, final ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) {
    context.addStep(new AbstractDeploymentChainStep() {
        @Override
        protected void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(KeycloakSamlExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, 0, chooseDependencyProcessor());
            processorTarget.addDeploymentProcessor(KeycloakSamlExtension.SUBSYSTEM_NAME,
                    Phase.POST_MODULE, // PHASE
                    Phase.POST_MODULE_VALIDATOR_FACTORY - 1, // PRIORITY
                    chooseConfigDeploymentProcessor());
            processorTarget.addDeploymentProcessor(KeycloakSamlExtension.SUBSYSTEM_NAME,
                    Phase.POST_MODULE, // PHASE
                    Phase.POST_MODULE_VALIDATOR_FACTORY - 1, // PRIORITY
                    chooseClusteredSsoDeploymentProcessor());
        }
    }, OperationContext.Stage.RUNTIME);
}
 
Example #4
Source File: KeycloakSubsystemAdd.java    From keycloak with Apache License 2.0 6 votes vote down vote up
@Override
protected void performBoottime(final OperationContext context, ModelNode operation, final ModelNode model) {
    context.addStep(new AbstractDeploymentChainStep() {
        @Override
        protected void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(KeycloakSamlExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, 0, chooseDependencyProcessor());
            processorTarget.addDeploymentProcessor(KeycloakSamlExtension.SUBSYSTEM_NAME,
                    Phase.POST_MODULE, // PHASE
                    Phase.POST_MODULE_VALIDATOR_FACTORY - 1, // PRIORITY
                    chooseConfigDeploymentProcessor());
            processorTarget.addDeploymentProcessor(KeycloakSamlExtension.SUBSYSTEM_NAME,
                    Phase.POST_MODULE, // PHASE
                    Phase.POST_MODULE_VALIDATOR_FACTORY - 1, // PRIORITY
                    chooseClusteredSsoDeploymentProcessor());
        }
    }, OperationContext.Stage.RUNTIME);
}
 
Example #5
Source File: SecurityManagerSubsystemAdd.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void performBoottime(final OperationContext context, final ModelNode operation, final ModelNode model)
        throws OperationFailedException {

    final Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS);
    final ModelNode node = Resource.Tools.readModel(resource);
    // get the minimum set of deployment permissions.
    final ModelNode deploymentPermissionsModel = node.get(DEPLOYMENT_PERMISSIONS_PATH.getKeyValuePair());
    final ModelNode minimumPermissionsNode = MINIMUM_PERMISSIONS.resolveModelAttribute(context, deploymentPermissionsModel);
    final List<PermissionFactory> minimumSet = this.retrievePermissionSet(context, minimumPermissionsNode);

    // get the maximum set of deployment permissions.
    ModelNode maximumPermissionsNode = MAXIMUM_PERMISSIONS.resolveModelAttribute(context, deploymentPermissionsModel);
    if (!maximumPermissionsNode.isDefined())
        maximumPermissionsNode = DEFAULT_MAXIMUM_SET;
    final List<PermissionFactory> maximumSet = this.retrievePermissionSet(context, maximumPermissionsNode);

    // validate the configured permissions - the minimum set must be implied by the maximum set.
    final FactoryPermissionCollection maxPermissionCollection = new FactoryPermissionCollection(maximumSet.toArray(new PermissionFactory[maximumSet.size()]));
    final StringBuilder failedPermissions = new StringBuilder();
    for (PermissionFactory factory : minimumSet) {
        Permission permission = factory.construct();
        if (!maxPermissionCollection.implies(permission)) {
            failedPermissions.append("\n\t\t").append(permission);
        }
    }
    if (failedPermissions.length() > 0) {
        throw SecurityManagerLogger.ROOT_LOGGER.invalidSubsystemConfiguration(failedPermissions);
    }

    // install the DUPs responsible for parsing and validating security permissions found in META-INF/permissions.xml.
    context.addStep(new AbstractDeploymentChainStep() {
        protected void execute(DeploymentProcessorTarget processorTarget) {
             processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_PERMISSIONS,
                     new PermissionsParserProcessor(minimumSet));
             processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_PERMISSIONS_VALIDATION,
                     new PermissionsValidationProcessor(maximumSet));
        }
    }, OperationContext.Stage.RUNTIME);
}
 
Example #6
Source File: KeycloakSubsystemAdd.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
protected void performBoottime(final OperationContext context, ModelNode operation, final ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) {
    context.addStep(new AbstractDeploymentChainStep() {
        @Override
        protected void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(Phase.DEPENDENCIES, 0, new KeycloakDependencyProcessorAS7());
            processorTarget.addDeploymentProcessor(
                    Phase.POST_MODULE, // PHASE
                    Phase.POST_MODULE_VALIDATOR_FACTORY - 1, // PRIORITY
                    new KeycloakAdapterConfigDeploymentProcessor());
        }
    }, OperationContext.Stage.RUNTIME);
}
 
Example #7
Source File: KeycloakSubsystemAdd.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
protected void performBoottime(final OperationContext context, ModelNode operation, final ModelNode model) {
    context.addStep(new AbstractDeploymentChainStep() {
        @Override
        protected void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(KeycloakExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, 0, chooseDependencyProcessor());
            processorTarget.addDeploymentProcessor(KeycloakExtension.SUBSYSTEM_NAME,
                    Phase.POST_MODULE, // PHASE
                    Phase.POST_MODULE_VALIDATOR_FACTORY - 1, // PRIORITY
                    chooseConfigDeploymentProcessor());
        }
    }, OperationContext.Stage.RUNTIME);
}
 
Example #8
Source File: BpmPlatformSubsystemAdd.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler,
        List<ServiceController< ? >> newControllers) throws OperationFailedException {

  // add deployment processors
  context.addStep(new AbstractDeploymentChainStep() {
    public void execute(DeploymentProcessorTarget processorTarget) {
      processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.PARSE, ProcessApplicationProcessor.PRIORITY, new ProcessApplicationProcessor());
      processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.DEPENDENCIES, ModuleDependencyProcessor.PRIORITY, new ModuleDependencyProcessor());
      processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.POST_MODULE, ProcessesXmlProcessor.PRIORITY, new ProcessesXmlProcessor());
      processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.INSTALL, ProcessEngineStartProcessor.PRIORITY, new ProcessEngineStartProcessor());
      processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.INSTALL, ProcessApplicationDeploymentProcessor.PRIORITY, new ProcessApplicationDeploymentProcessor());
    }
  }, OperationContext.Stage.RUNTIME);

  // create and register the MSC container delegate.
  final MscRuntimeContainerDelegate processEngineService = new MscRuntimeContainerDelegate();

  final ServiceController<MscRuntimeContainerDelegate> controller = context.getServiceTarget()
          .addService(ServiceNames.forMscRuntimeContainerDelegate(), processEngineService)
          .addListener(verificationHandler)
          .setInitialMode(Mode.ACTIVE)
          .install();

  newControllers.add(controller);

  // discover and register bpm platform plugins
  BpmPlatformPlugins plugins = BpmPlatformPlugins.load(getClass().getClassLoader());
  MscBpmPlatformPlugins managedPlugins = new MscBpmPlatformPlugins(plugins);

  ServiceController<BpmPlatformPlugins> serviceController = context.getServiceTarget()
    .addService(ServiceNames.forBpmPlatformPlugins(), managedPlugins)
    .addListener(verificationHandler)
    .setInitialMode(Mode.ACTIVE)
    .install();

  newControllers.add(serviceController);
}
 
Example #9
Source File: BpmPlatformSubsystemAdd.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {

  // add deployment processors
  context.addStep(new AbstractDeploymentChainStep() {
    public void execute(DeploymentProcessorTarget processorTarget) {
      processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.PARSE, ProcessApplicationProcessor.PRIORITY, new ProcessApplicationProcessor());
      processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.DEPENDENCIES, ModuleDependencyProcessor.PRIORITY, new ModuleDependencyProcessor());
      processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.POST_MODULE, ProcessesXmlProcessor.PRIORITY, new ProcessesXmlProcessor());
      processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.INSTALL, ProcessEngineStartProcessor.PRIORITY, new ProcessEngineStartProcessor());
      processorTarget.addDeploymentProcessor(ModelConstants.SUBSYSTEM_NAME, Phase.INSTALL, ProcessApplicationDeploymentProcessor.PRIORITY, new ProcessApplicationDeploymentProcessor());
    }
  }, OperationContext.Stage.RUNTIME);

  // create and register the MSC container delegate.
  final MscRuntimeContainerDelegate processEngineService = new MscRuntimeContainerDelegate();

  final ServiceController<MscRuntimeContainerDelegate> controller = context.getServiceTarget()
          .addService(ServiceNames.forMscRuntimeContainerDelegate(), processEngineService)
          .setInitialMode(Mode.ACTIVE)
          .install();

  // discover and register bpm platform plugins
  BpmPlatformPlugins plugins = BpmPlatformPlugins.load(getClass().getClassLoader());
  MscBpmPlatformPlugins managedPlugins = new MscBpmPlatformPlugins(plugins);

  ServiceController<BpmPlatformPlugins> serviceController = context.getServiceTarget()
    .addService(ServiceNames.forBpmPlatformPlugins(), managedPlugins)
    .setInitialMode(Mode.ACTIVE)
    .install();
}