Java Code Examples for org.jboss.msc.service.ServiceName#getSimpleName()
The following examples show how to use
org.jboss.msc.service.ServiceName#getSimpleName() .
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: KeycloakClusteredSsoDeploymentProcessor.java From keycloak with Apache License 2.0 | 4 votes |
private void addSamlReplicationConfiguration(DeploymentUnit deploymentUnit, DeploymentPhaseContext context) { WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); if (warMetaData == null) { return; } JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData(); if (webMetaData == null) { webMetaData = new JBossWebMetaData(); warMetaData.setMergedJBossWebMetaData(webMetaData); } // Find out default names of cache container and cache String cacheContainer = DEFAULT_CACHE_CONTAINER; String deploymentSessionCacheName = (deploymentUnit.getParent() == null ? "" : deploymentUnit.getParent().getName() + ".") + deploymentUnit.getName(); // Update names from jboss-web.xml's <replicationConfig> if (webMetaData.getReplicationConfig() != null && webMetaData.getReplicationConfig().getCacheName() != null) { ServiceName sn = ServiceName.parse(webMetaData.getReplicationConfig().getCacheName()); cacheContainer = (sn.length() > 1) ? sn.getParent().getSimpleName() : sn.getSimpleName(); deploymentSessionCacheName = sn.getSimpleName(); } String ssoCacheName = deploymentSessionCacheName + ".ssoCache"; // Override if they were set in the context parameters List<ParamValueMetaData> contextParams = webMetaData.getContextParams(); if (contextParams == null) { contextParams = new ArrayList<>(); } for (ParamValueMetaData contextParam : contextParams) { if (Objects.equals(contextParam.getParamName(), SSO_CACHE_CONTAINER_NAME_PARAM_NAME)) { cacheContainer = contextParam.getParamValue(); } else if (Objects.equals(contextParam.getParamName(), SSO_CACHE_NAME_PARAM_NAME)) { ssoCacheName = contextParam.getParamValue(); } } LOG.debugv("Determined SSO cache container configuration: container: {0}, cache: {1}", cacheContainer, ssoCacheName); // addCacheDependency(context, deploymentUnit, cacheContainer, cacheName); // Set context parameters for SSO cache container/name ParamValueMetaData paramContainer = new ParamValueMetaData(); paramContainer.setParamName(AdapterConstants.REPLICATION_CONFIG_CONTAINER_PARAM_NAME); paramContainer.setParamValue(cacheContainer); contextParams.add(paramContainer); ParamValueMetaData paramSsoCache = new ParamValueMetaData(); paramSsoCache.setParamName(AdapterConstants.REPLICATION_CONFIG_SSO_CACHE_PARAM_NAME); paramSsoCache.setParamValue(ssoCacheName); contextParams.add(paramSsoCache); webMetaData.setContextParams(contextParams); }
Example 2
Source File: KeycloakClusteredSsoDeploymentProcessor.java From keycloak with Apache License 2.0 | 4 votes |
private void addSamlReplicationConfiguration(DeploymentUnit deploymentUnit, DeploymentPhaseContext context) { WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); if (warMetaData == null) { return; } JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData(); if (webMetaData == null) { webMetaData = new JBossWebMetaData(); warMetaData.setMergedJBossWebMetaData(webMetaData); } // Find out default names of cache container and cache String cacheContainer = DEFAULT_CACHE_CONTAINER; String deploymentSessionCacheName = (deploymentUnit.getParent() == null ? "" : deploymentUnit.getParent().getName() + ".") + deploymentUnit.getName(); // Update names from jboss-web.xml's <replicationConfig> if (webMetaData.getReplicationConfig() != null && webMetaData.getReplicationConfig().getCacheName() != null) { ServiceName sn = ServiceName.parse(webMetaData.getReplicationConfig().getCacheName()); cacheContainer = (sn.length() > 1) ? sn.getParent().getSimpleName() : sn.getSimpleName(); deploymentSessionCacheName = sn.getSimpleName(); } String ssoCacheName = deploymentSessionCacheName + ".ssoCache"; // Override if they were set in the context parameters List<ParamValueMetaData> contextParams = webMetaData.getContextParams(); if (contextParams == null) { contextParams = new ArrayList<>(); } for (ParamValueMetaData contextParam : contextParams) { if (Objects.equals(contextParam.getParamName(), SSO_CACHE_CONTAINER_NAME_PARAM_NAME)) { cacheContainer = contextParam.getParamValue(); } else if (Objects.equals(contextParam.getParamName(), SSO_CACHE_NAME_PARAM_NAME)) { ssoCacheName = contextParam.getParamValue(); } } LOG.debugv("Determined SSO cache container configuration: container: {0}, cache: {1}", cacheContainer, ssoCacheName); addCacheDependency(context, deploymentUnit, cacheContainer, ssoCacheName); // Set context parameters for SSO cache container/name ParamValueMetaData paramContainer = new ParamValueMetaData(); paramContainer.setParamName(AdapterConstants.REPLICATION_CONFIG_CONTAINER_PARAM_NAME); paramContainer.setParamValue(cacheContainer); contextParams.add(paramContainer); ParamValueMetaData paramSsoCache = new ParamValueMetaData(); paramSsoCache.setParamName(AdapterConstants.REPLICATION_CONFIG_SSO_CACHE_PARAM_NAME); paramSsoCache.setParamValue(ssoCacheName); contextParams.add(paramSsoCache); webMetaData.setContextParams(contextParams); }