@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); KeycloakAdapterConfigService config = KeycloakAdapterConfigService.INSTANCE; String deploymentName = deploymentUnit.getName(); if (!config.isKeycloakServerDeployment(deploymentName)) { return; } final EEModuleDescription description = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); String webContext = config.getWebContext(); if (webContext == null) { throw new DeploymentUnitProcessingException("Can't determine web context/module for Keycloak Server"); } description.setModuleName(webContext); }
@Override protected void performRemove(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { String deploymentName = ServerUtil.getDeploymentName(operation); KeycloakAdapterConfigService.INSTANCE.setWebContext(null); if (requiresRuntime(context)) { // don't do this on a domain controller addStepToRemoveServerWar(context, deploymentName); } super.performRemove(context, operation, model); }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); KeycloakAdapterConfigService config = KeycloakAdapterConfigService.INSTANCE; String deploymentName = deploymentUnit.getName(); if (!config.isKeycloakServerDeployment(deploymentName)) { return; } final EEModuleDescription description = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); String webContext = config.getWebContext(); if (webContext == null) { throw new DeploymentUnitProcessingException("Can't determine web context/module for Keycloak Server"); } description.setModuleName(webContext); }
@Override protected void performRemove(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { String deploymentName = ServerUtil.getDeploymentName(operation); KeycloakAdapterConfigService.INSTANCE.setWebContext(null); if (requiresRuntime(context)) { // don't do this on a domain controller addStepToRemoveServerWar(context, deploymentName); } super.performRemove(context, operation, model); }
@Override protected void finishModelStage(OperationContext context, ModelNode operation, String attributeName, ModelNode newValue, ModelNode oldValue, Resource model) throws OperationFailedException { if (!context.isNormalServer() || attribNotChanging(attributeName, newValue, oldValue)) { super.finishModelStage(context, operation, attributeName, newValue, oldValue, model); return; } String deploymentName = ServerUtil.getDeploymentName(operation); if (attributeName.equals(KeycloakSubsystemDefinition.WEB_CONTEXT.getName())) { KeycloakAdapterConfigService.INSTANCE.setWebContext(newValue.asString()); ServerUtil.addStepToRedeployServerWar(context, deploymentName); } super.finishModelStage(context, operation, attributeName, newValue, oldValue, model); }
@Override protected void finishModelStage(OperationContext context, ModelNode operation, String attributeName, ModelNode newValue, ModelNode oldValue, Resource model) throws OperationFailedException { if (!context.isNormalServer() || attribNotChanging(attributeName, newValue, oldValue)) { super.finishModelStage(context, operation, attributeName, newValue, oldValue, model); return; } String deploymentName = ServerUtil.getDeploymentName(operation); if (attributeName.equals(KeycloakSubsystemDefinition.WEB_CONTEXT.getName())) { KeycloakAdapterConfigService.INSTANCE.setWebContext(newValue.asString()); ServerUtil.addStepToRedeployServerWar(context, deploymentName); } super.finishModelStage(context, operation, attributeName, newValue, oldValue, model); }
protected void populateModel(final OperationContext context, final ModelNode operation, final Resource resource) throws OperationFailedException { ModelNode model = resource.getModel(); // set attribute values from parsed model for (AttributeDefinition attrDef : KeycloakSubsystemDefinition.ALL_ATTRIBUTES) { attrDef.validateAndSet(operation, model); } // returns early if on domain controller if (!requiresRuntime(context)) { return; } // don't want to try to start server on host controller if (!context.isNormalServer()) { return; } ModelNode webContextNode = resource.getModel().get(KeycloakSubsystemDefinition.WEB_CONTEXT.getName()); if (!webContextNode.isDefined()) { webContextNode = KeycloakSubsystemDefinition.WEB_CONTEXT.getDefaultValue(); } String webContext = webContextNode.asString(); ServerUtil serverUtil = new ServerUtil(operation); serverUtil.addStepToUploadServerWar(context); KeycloakAdapterConfigService.INSTANCE.setWebContext(webContext); } }
protected void populateModel(final OperationContext context, final ModelNode operation, final Resource resource) throws OperationFailedException { ModelNode model = resource.getModel(); // set attribute values from parsed model for (AttributeDefinition attrDef : KeycloakSubsystemDefinition.ALL_ATTRIBUTES) { attrDef.validateAndSet(operation, model); } // returns early if on domain controller if (!requiresRuntime(context)) { return; } // don't want to try to start server on host controller if (!context.isNormalServer()) { return; } ModelNode webContextNode = resource.getModel().get(KeycloakSubsystemDefinition.WEB_CONTEXT.getName()); if (!webContextNode.isDefined()) { webContextNode = KeycloakSubsystemDefinition.WEB_CONTEXT.getDefaultValue(); } String webContext = webContextNode.asString(); ServerUtil serverUtil = new ServerUtil(operation); serverUtil.addStepToUploadServerWar(context); KeycloakAdapterConfigService.INSTANCE.setWebContext(webContext); } }