Search in sources :

Example 1 with ApplicationClientParsingDeploymentProcessor

use of org.jboss.as.appclient.deployment.ApplicationClientParsingDeploymentProcessor in project wildfly by wildfly.

the class AppClientSubsystemAdd method performBoottime.

protected void performBoottime(final OperationContext context, ModelNode operation, final ModelNode model) throws OperationFailedException {
    final String deployment = AppClientSubsystemResourceDefinition.DEPLOYMENT.resolveModelAttribute(context, model).asString();
    final File file = new File(AppClientSubsystemResourceDefinition.FILE.resolveModelAttribute(context, model).asString());
    final String hostUrl = model.hasDefined(HOST_URL) ? AppClientSubsystemResourceDefinition.HOST_URL.resolveModelAttribute(context, model).asString() : null;
    final String connectionPropertiesUrl = model.hasDefined(CONNECTION_PROPERTIES_URL) ? AppClientSubsystemResourceDefinition.CONNECTION_PROPERTIES_URL.resolveModelAttribute(context, model).asString() : null;
    final List<String> parameters = AppClientSubsystemResourceDefinition.PARAMETERS.unwrap(context, model);
    context.addStep(new AbstractDeploymentChainStep() {

        protected void execute(DeploymentProcessorTarget processorTarget) {
            if (deployment != null && !deployment.isEmpty()) {
                processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_APP_CLIENT, new ApplicationClientStructureProcessor(deployment));
            }
            processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_REGISTER_JBOSS_ALL_APPCLIENT, new JBossAllXmlParserRegisteringProcessor<>(AppClientJBossAllParser.ROOT_ELEMENT, AppClientJBossAllParser.ATTACHMENT_KEY, new AppClientJBossAllParser()));
            processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_APP_CLIENT_XML, new ApplicationClientParsingDeploymentProcessor());
            processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_APPLICATION_CLIENT_MANIFEST, new ApplicationClientManifestProcessor());
            processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_APPLICATION_CLIENT_ACTIVE, new ActiveApplicationClientProcessor(deployment));
            processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_APPLICATION_CLIENT, new ApplicationClientDependencyProcessor());
            processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_APPLICATION_CLIENT, new ApplicationClientStartProcessor(hostUrl, connectionPropertiesUrl, parameters.toArray(EMPTY_STRING)));
        }
    }, OperationContext.Stage.RUNTIME);
    final ApplicationClientDeploymentService service = new ApplicationClientDeploymentService(file);
    context.getServiceTarget().addService(ApplicationClientDeploymentService.SERVICE_NAME, service).addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.getControllerValue()).install();
    try {
        URI uri;
        if (hostUrl == null) {
            uri = new URI("remote+http://localhost:8080");
        } else {
            uri = new URI(hostUrl);
        }
        context.getServiceTarget().addService(APP_CLIENT_URI_SERVICE_NAME, new ValueService<>(new ImmediateValue<>(uri))).install();
    } catch (URISyntaxException e) {
        throw new OperationFailedException(e);
    }
}
Also used : JBossAllXmlParserRegisteringProcessor(org.jboss.as.server.deployment.jbossallxml.JBossAllXmlParserRegisteringProcessor) ApplicationClientDependencyProcessor(org.jboss.as.appclient.deployment.ApplicationClientDependencyProcessor) OperationFailedException(org.jboss.as.controller.OperationFailedException) ApplicationClientDeploymentService(org.jboss.as.appclient.service.ApplicationClientDeploymentService) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) ValueService(org.jboss.msc.service.ValueService) ApplicationClientStartProcessor(org.jboss.as.appclient.deployment.ApplicationClientStartProcessor) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) ActiveApplicationClientProcessor(org.jboss.as.appclient.deployment.ActiveApplicationClientProcessor) ApplicationClientStructureProcessor(org.jboss.as.appclient.deployment.ApplicationClientStructureProcessor) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) ApplicationClientManifestProcessor(org.jboss.as.appclient.deployment.ApplicationClientManifestProcessor) ModelController(org.jboss.as.controller.ModelController) File(java.io.File) AppClientJBossAllParser(org.jboss.as.appclient.deployment.AppClientJBossAllParser) ApplicationClientParsingDeploymentProcessor(org.jboss.as.appclient.deployment.ApplicationClientParsingDeploymentProcessor)

Aggregations

File (java.io.File)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 ActiveApplicationClientProcessor (org.jboss.as.appclient.deployment.ActiveApplicationClientProcessor)1 AppClientJBossAllParser (org.jboss.as.appclient.deployment.AppClientJBossAllParser)1 ApplicationClientDependencyProcessor (org.jboss.as.appclient.deployment.ApplicationClientDependencyProcessor)1 ApplicationClientManifestProcessor (org.jboss.as.appclient.deployment.ApplicationClientManifestProcessor)1 ApplicationClientParsingDeploymentProcessor (org.jboss.as.appclient.deployment.ApplicationClientParsingDeploymentProcessor)1 ApplicationClientStartProcessor (org.jboss.as.appclient.deployment.ApplicationClientStartProcessor)1 ApplicationClientStructureProcessor (org.jboss.as.appclient.deployment.ApplicationClientStructureProcessor)1 ApplicationClientDeploymentService (org.jboss.as.appclient.service.ApplicationClientDeploymentService)1 ModelController (org.jboss.as.controller.ModelController)1 OperationFailedException (org.jboss.as.controller.OperationFailedException)1 AbstractDeploymentChainStep (org.jboss.as.server.AbstractDeploymentChainStep)1 DeploymentProcessorTarget (org.jboss.as.server.DeploymentProcessorTarget)1 JBossAllXmlParserRegisteringProcessor (org.jboss.as.server.deployment.jbossallxml.JBossAllXmlParserRegisteringProcessor)1 ValueService (org.jboss.msc.service.ValueService)1