public void destroyInstance(Object obj) throws IllegalAccessException, InvocationTargetException { container.destroyInstance(obj); }
public Object newInstance(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException, InvocationTargetException { return container.newInstance(className); }
public MyFacesLifecycleProvider() { this.container = WebInjectionContainer.getCurrentInjectionContainer(); if (this.container == null) { throw JSFMessages.MESSAGES.noThreadLocalInjectionContainer(); } }
public static boolean isDistributable(final DeploymentUnit deploymentUnit) { WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); if (warMetaData == null) { return false; } JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData(); if (webMetaData == null) { return false; } return webMetaData.getDistributable() != null || webMetaData.getReplicationConfig() != null; }
private void addXMLData(String xml, WarMetaData warMetaData) { JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData(); if (webMetaData == null) { webMetaData = new JBossWebMetaData(); warMetaData.setMergedJBossWebMetaData(webMetaData); } List<ParamValueMetaData> contextParams = webMetaData.getContextParams(); if (contextParams == null) { contextParams = new ArrayList<>(); } ParamValueMetaData param = new ParamValueMetaData(); param.setParamName(AdapterConstants.AUTH_DATA_PARAM_NAME); param.setParamValue(xml); contextParams.add(param); webMetaData.setContextParams(contextParams); }
JBossWebMetaData mergedJBossWebMetaData = warMetaData.getMergedJBossWebMetaData(); List<ListenerMetaData> listeners = mergedJBossWebMetaData.getListeners(); if(listeners == null) { WebComponentDescription paWebComponent = new WebComponentDescription(paClassName, paClassName, eeModuleDescription, deploymentUnit.getAttachment(WebAttachments.WEB_COMPONENT_INSTANTIATORS).put(paWebComponent.getComponentClassName(), new WebComponentInstantiator(deploymentUnit, paWebComponent));
/** * Creates web meta data for EJB deployments. * * @param dep webservice deployment */ void create(final Deployment dep) { final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class); WarMetaData warMD = ASHelper.getOptionalAttachment(unit, WarMetaData.ATTACHMENT_KEY); JBossWebMetaData jbossWebMD = warMD != null ? warMD.getMergedJBossWebMetaData() : null; if (warMD == null) { warMD = new WarMetaData(); } if (jbossWebMD == null) { jbossWebMD = new JBossWebMetaData(); warMD.setMergedJBossWebMetaData(jbossWebMD); unit.putAttachment(WarMetaData.ATTACHMENT_KEY, warMD); } createWebAppDescriptor(dep, jbossWebMD); createJBossWebAppDescriptor(dep, jbossWebMD); dep.addAttachment(JBossWebMetaData.class, jbossWebMD); }
/** * Gets the JBossWebMetaData from the WarMetaData attached to the provided deployment unit, if any. * * @param unit * @return the JBossWebMetaData or null if either that or the parent WarMetaData are not found. */ public static JBossWebMetaData getJBossWebMetaData(final DeploymentUnit unit) { final WarMetaData warMetaData = getOptionalAttachment(unit, WarMetaData.ATTACHMENT_KEY); JBossWebMetaData result = null; if (warMetaData != null) { result = warMetaData.getMergedJBossWebMetaData(); if (result == null) { result = warMetaData.getJBossWebMetaData(); } } else { result = getOptionalAttachment(unit, WSAttachmentKeys.JBOSSWEB_METADATA_KEY); } return result; }
private String getPartitionManagerJNDIUrl(final DeploymentUnit deployment) { WarMetaData warMetadata = deployment.getAttachment(ATTACHMENT_KEY); if (warMetadata != null && warMetadata.getWebMetaData() != null && warMetadata.getWebMetaData().getResourceReferences() != null) { ResourceReferencesMetaData resourceReferences = warMetadata.getWebMetaData().getResourceReferences(); Iterator<ResourceReferenceMetaData> iterator = resourceReferences.iterator(); while (iterator.hasNext()) { ResourceReferenceMetaData resourceReferenceMetaData = iterator.next(); if (PartitionManager.class.getName().equals(resourceReferenceMetaData.getType())) { return resourceReferenceMetaData.getName(); } } } return null; }
private String preferredDeploymentName(DeploymentUnit deploymentUnit) { String deploymentName = deploymentUnit.getName(); WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); if (warMetaData == null) { return deploymentName; } JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData(); if (webMetaData == null) { return deploymentName; } String moduleName = webMetaData.getModuleName(); if (moduleName != null) return moduleName + ".war"; return deploymentName; } }
private void addJSONData(String json, WarMetaData warMetaData) { JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData(); if (webMetaData == null) { webMetaData = new JBossWebMetaData(); warMetaData.setMergedJBossWebMetaData(webMetaData); } List<ParamValueMetaData> contextParams = webMetaData.getContextParams(); if (contextParams == null) { contextParams = new ArrayList<ParamValueMetaData>(); } ParamValueMetaData param = new ParamValueMetaData(); param.setParamName(AUTH_DATA_PARAM_NAME); param.setParamValue(json); contextParams.add(param); webMetaData.setContextParams(contextParams); }
@Override public void invokePreDestroy(final Object managedBean) throws InjectionProviderException { try { container.destroyInstance(managedBean); } catch (IllegalAccessException e) { throw JSFMessages.MESSAGES.instanceDestructionFailed(e); } catch (InvocationTargetException e) { throw JSFMessages.MESSAGES.instanceDestructionFailed(e); } }
@Override public void invokePostConstruct(final Object managedBean) throws InjectionProviderException { try { container.newInstance(managedBean); } catch (IllegalAccessException e) { throw JSFMessages.MESSAGES.instanceCreationFailed(e); } catch (InvocationTargetException e) { throw JSFMessages.MESSAGES.instanceCreationFailed(e); } catch (NamingException e) { throw JSFMessages.MESSAGES.instanceCreationFailed(e); } } }
public JSFInjectionProvider() { this.container = WebInjectionContainer.getCurrentInjectionContainer(); if (this.container == null) { throw JSFMessages.MESSAGES.noThreadLocalInjectionContainer(); } }
private String preferredDeploymentName(DeploymentUnit deploymentUnit) { String deploymentName = deploymentUnit.getName(); WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); if (warMetaData == null) { return deploymentName; } JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData(); if (webMetaData == null) { return deploymentName; } String moduleName = webMetaData.getModuleName(); if (moduleName != null) return moduleName + ".war"; return deploymentName; } }
return; JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData(); if (webMetaData == null) { webMetaData = new JBossWebMetaData(); warMetaData.setMergedJBossWebMetaData(webMetaData);
/** * <p>Configures the {@link WarMetaData}.</p> * * @param deploymentUnit */ private void configureWarMetadata(DeploymentUnit deploymentUnit) { WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); warMetaData.getMergedJBossWebMetaData().setSecurityDomain(this.getConfiguration().getSecurityDomain()); }
public static boolean isKeycloakSamlAuthMethod(final DeploymentUnit deploymentUnit) { WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); if (warMetaData == null) { return false; } JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData(); if (webMetaData == null) { return false; } if (Configuration.INSTANCE.isSecureDeployment(deploymentUnit)) { return true; } LoginConfigMetaData loginConfig = webMetaData.getLoginConfig(); return loginConfig != null && Objects.equals(loginConfig.getAuthMethod(), "KEYCLOAK-SAML"); }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (Configuration.INSTANCE.getSecureDeployment(deploymentUnit) == null) { WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); if (warMetaData == null) { return; } JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData(); if (webMetaData == null) { return; } LoginConfigMetaData loginConfig = webMetaData.getLoginConfig(); if (loginConfig == null) return; if (loginConfig.getAuthMethod() == null) return; if (!loginConfig.getAuthMethod().equals("KEYCLOAK-SAML")) return; } final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); addCommonModules(moduleSpecification, moduleLoader); addPlatformSpecificModules(moduleSpecification, moduleLoader); }
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if (!KeycloakAdapterConfigService.getInstance().isSecureDeployment(deploymentUnit)) { WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); if (warMetaData == null) { return; } JBossWebMetaData webMetaData = warMetaData.getMergedJBossWebMetaData(); if (webMetaData == null) { return; } LoginConfigMetaData loginConfig = webMetaData.getLoginConfig(); if (loginConfig == null) return; if (loginConfig.getAuthMethod() == null) return; if (!loginConfig.getAuthMethod().equals("KEYCLOAK")) return; } final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); addCommonModules(moduleSpecification, moduleLoader); addPlatformSpecificModules(moduleSpecification, moduleLoader); }