org.jboss.as.server.deployment.Phase Java Examples

The following examples show how to use org.jboss.as.server.deployment.Phase. 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: 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 #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: 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 #5
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();
}
 
Example #6
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 #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: 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 #9
Source File: DeployerChainAddHandler.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private DeployerChainAddHandler() {
    final EnumMap<Phase, Set<RegisteredDeploymentUnitProcessor>> map = new EnumMap<Phase, Set<RegisteredDeploymentUnitProcessor>>(Phase.class);
    for (Phase phase : Phase.values()) {
        map.put(phase, new ConcurrentSkipListSet<RegisteredDeploymentUnitProcessor>());
    }
    this.deployerMap = map;
}
 
Example #10
Source File: DeployerChainAddHandler.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static void addDeploymentProcessor(final String subsystemName, Phase phase, int priority, DeploymentUnitProcessor processor) {
    final EnumMap<Phase, Set<RegisteredDeploymentUnitProcessor>> deployerMap = INSTANCE.deployerMap;
    Set<RegisteredDeploymentUnitProcessor> registeredDeploymentUnitProcessors = deployerMap.get(phase);
    RegisteredDeploymentUnitProcessor registeredDeploymentUnitProcessor = new RegisteredDeploymentUnitProcessor(priority, processor, subsystemName);
    if(registeredDeploymentUnitProcessors.contains(registeredDeploymentUnitProcessor)) {
        throw ServerLogger.ROOT_LOGGER.duplicateDeploymentUnitProcessor(priority, processor.getClass());
    }
    registeredDeploymentUnitProcessors.add(registeredDeploymentUnitProcessor);
}
 
Example #11
Source File: AbstractDeploymentChainStep.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void addDeploymentProcessor(final String subsystemName, final Phase phase, final int priority, final DeploymentUnitProcessor processor) {
    DeployerChainAddHandler.addDeploymentProcessor(subsystemName, phase, priority, processor);
}
 
Example #12
Source File: AbstractDeploymentChainStep.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void addDeploymentProcessor(final Phase phase, final int priority, final DeploymentUnitProcessor processor) {
    addDeploymentProcessor("", phase, priority, processor);
}
 
Example #13
Source File: CDISubsystemExtension.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
@Override
public void addDeploymentProcessor(DeploymentProcessorTarget processorTarget, SubsystemState subsystemState) {
    processorTarget.addDeploymentProcessor(CamelExtension.SUBSYSTEM_NAME, Phase.INSTALL, CamelSubsystemAdd.INSTALL_CDI_BEAN_ARCHIVE_PROCESSOR, new CDIBeanArchiveProcessor());
}
 
Example #14
Source File: CamelCoreSubsystemExtension.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
@Override
public void addDeploymentProcessor(DeploymentProcessorTarget processorTarget, SubsystemState subsystemState) {
    DeploymentUnitProcessor parser = new JBossAllXmlParserRegisteringProcessor<CamelDeploymentSettings.Builder>(CamelIntegrationParser.ROOT_ELEMENT, CamelDeploymentSettings.BUILDER_ATTACHMENT_KEY, new CamelIntegrationParser());
    processorTarget.addDeploymentProcessor(CamelExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, CamelSubsystemAdd.STRUCTURE_REGISTER_CAMEL_INTEGRATION, parser);
}
 
Example #15
Source File: ServerLogger.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Message(id = 153, value = "Failed to process phase %s of %s")
StartException deploymentPhaseFailed(Phase phase, DeploymentUnit deploymentUnit, @Cause Throwable cause);
 
Example #16
Source File: ServerLogger.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@LogMessage(level = ERROR)
@Message(id = 43, value = "Deployment unit processor %s unexpectedly threw an exception during undeploy phase %s of %s")
void caughtExceptionUndeploying(@Cause Throwable cause, DeploymentUnitProcessor dup, Phase phase, DeploymentUnit unit);
 
Example #17
Source File: DeploymentDependenciesProcessor.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void registerJBossXMLParsers() {
    DeployerChainAddHandler.addDeploymentProcessor(ServerService.SERVER_NAME, Phase.STRUCTURE, Phase.STRUCTURE_REGISTER_JBOSS_ALL_DEPLOYMENT_DEPS, new JBossAllXmlParserRegisteringProcessor<DeploymentDependencies>(ROOT_1_0, DeploymentDependencies.ATTACHMENT_KEY, DeploymentDependenciesParserV_1_0.INSTANCE));
}
 
Example #18
Source File: DeploymentStructureDescriptorParser.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void registerJBossXMLParsers() {
    DeployerChainAddHandler.addDeploymentProcessor(ServerService.SERVER_NAME, Phase.STRUCTURE, Phase.STRUCTURE_REGISTER_JBOSS_ALL_STRUCTURE_1_0, new JBossAllXmlParserRegisteringProcessor<ParseResult>(ROOT_1_0, RESULT_ATTACHMENT_KEY, JBossDeploymentStructureParser10.JBOSS_ALL_XML_PARSER));
    DeployerChainAddHandler.addDeploymentProcessor(ServerService.SERVER_NAME, Phase.STRUCTURE, Phase.STRUCTURE_REGISTER_JBOSS_ALL_STRUCTURE_1_1, new JBossAllXmlParserRegisteringProcessor<ParseResult>(ROOT_1_1, RESULT_ATTACHMENT_KEY, JBossDeploymentStructureParser11.JBOSS_ALL_XML_PARSER));
    DeployerChainAddHandler.addDeploymentProcessor(ServerService.SERVER_NAME, Phase.STRUCTURE, Phase.STRUCTURE_REGISTER_JBOSS_ALL_STRUCTURE_1_2, new JBossAllXmlParserRegisteringProcessor<ParseResult>(ROOT_1_2, RESULT_ATTACHMENT_KEY, JBossDeploymentStructureParser12.JBOSS_ALL_XML_PARSER));
    DeployerChainAddHandler.addDeploymentProcessor(ServerService.SERVER_NAME, Phase.STRUCTURE, Phase.STRUCTURE_REGISTER_JBOSS_ALL_STRUCTURE_1_3, new JBossAllXmlParserRegisteringProcessor<ParseResult>(ROOT_1_3, RESULT_ATTACHMENT_KEY, JBossDeploymentStructureParser13.JBOSS_ALL_XML_PARSER));
}
 
Example #19
Source File: DeploymentProcessorTarget.java    From wildfly-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Add a deployment processor.
 *
 * This is a legacy method that does not take a subsystem name. A subsystem name
 * of the empty string is assumed.
 *
 * @param phase the processor phase install into (must not be {@code null})
 * @param priority the priority within the selected phase
 * @param processor the processor to install
 */
@Deprecated
void addDeploymentProcessor(Phase phase, int priority, DeploymentUnitProcessor processor);
 
Example #20
Source File: DeploymentProcessorTarget.java    From wildfly-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Add a deployment processor.
 *
 * @param subsystemName The name of the subsystem registering this processor
 * @param phase the processor phase install into (must not be {@code null})
 * @param priority the priority within the selected phase
 * @param processor the processor to install
 */
void addDeploymentProcessor(String subsystemName, Phase phase, int priority, DeploymentUnitProcessor processor);