/** * Get temp bean info. * * @param clazz the class * @return bean info */ @SuppressWarnings({"unchecked"}) protected static BeanInfo getTempBeanInfo(Class<?> clazz) { return new DefaultBeanInfo(DeploymentReflectionIndex.create(), clazz); }
@SuppressWarnings("unchecked") public Object create() throws Throwable { Module module = bmd.getModule().getInjectedModule().getValue(); final SecurityManager sm = System.getSecurityManager(); ClassLoader moduleClassLoader; if (sm == null) { moduleClassLoader = module.getClassLoader(); } else { moduleClassLoader = AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> module.getClassLoader()); } Class<?> beanClass = moduleClassLoader.loadClass(bmd.getBeanClass()); DeploymentReflectionIndex index; if (sm == null) { index = DeploymentReflectionIndex.create(); } else { index = AccessController.doPrivileged((PrivilegedAction<DeploymentReflectionIndex>) () -> DeploymentReflectionIndex.create()); } BeanInfo beanInfo = new DefaultBeanInfo(index, beanClass); Object result = BeanUtils.instantiateBean(bmd, beanInfo, index, module); BeanUtils.configure(bmd, beanInfo, module, result, false); BeanUtils.dispatchLifecycleJoinpoint(beanInfo, result, bmd.getCreate(), "create"); BeanUtils.dispatchLifecycleJoinpoint(beanInfo, result, bmd.getStart(), "start"); return result; }
/** * Get temp bean info. * * @param clazz the class * @return bean info */ @SuppressWarnings({"unchecked"}) protected static BeanInfo getTempBeanInfo(Class<?> clazz) { return new DefaultBeanInfo(DeploymentReflectionIndex.create(), clazz); }
/** * Get temp bean info. * * @param clazz the class * @return bean info */ @SuppressWarnings({"unchecked"}) protected static BeanInfo getTempBeanInfo(Class<?> clazz) { return new DefaultBeanInfo(DeploymentReflectionIndex.create(), clazz); }
@SuppressWarnings("unchecked") public Object create() throws Throwable { Module module = bmd.getModule().getInjectedModule().getValue(); final SecurityManager sm = System.getSecurityManager(); ClassLoader moduleClassLoader; if (sm == null) { moduleClassLoader = module.getClassLoader(); } else { moduleClassLoader = AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> module.getClassLoader()); } Class<?> beanClass = moduleClassLoader.loadClass(bmd.getBeanClass()); DeploymentReflectionIndex index; if (sm == null) { index = DeploymentReflectionIndex.create(); } else { index = AccessController.doPrivileged((PrivilegedAction<DeploymentReflectionIndex>) () -> DeploymentReflectionIndex.create()); } BeanInfo beanInfo = new DefaultBeanInfo(index, beanClass); Object result = BeanUtils.instantiateBean(bmd, beanInfo, index, module); BeanUtils.configure(bmd, beanInfo, module, result, false); BeanUtils.dispatchLifecycleJoinpoint(beanInfo, result, bmd.getCreate(), "create"); BeanUtils.dispatchLifecycleJoinpoint(beanInfo, result, bmd.getStart(), "start"); return result; }
@SuppressWarnings("unchecked") public Object create() throws Throwable { Module module = bmd.getModule().getInjectedModule().getValue(); Class<?> beanClass = module.getClassLoader().loadClass(bmd.getBeanClass()); DeploymentReflectionIndex index = DeploymentReflectionIndex.create(); BeanInfo beanInfo = new DefaultBeanInfo(index, beanClass); Object result = BeanUtils.instantiateBean(bmd, beanInfo, index, module); BeanUtils.configure(bmd, beanInfo, module, result, false); BeanUtils.dispatchLifecycleJoinpoint(beanInfo, result, bmd.getCreate(), "create"); BeanUtils.dispatchLifecycleJoinpoint(beanInfo, result, bmd.getStart(), "start"); return result; }
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (module == null) { throw ServerLogger.ROOT_LOGGER.nullModuleAttachment(deploymentUnit); } if(deploymentUnit.getParent() == null) { final DeploymentReflectionIndex index = DeploymentReflectionIndex.create(); deploymentUnit.putAttachment(Attachments.REFLECTION_INDEX, index); deploymentUnit.putAttachment(Attachments.PROXY_REFLECTION_INDEX, new ProxyMetadataSource(index)); } else { final DeploymentReflectionIndex index = deploymentUnit.getParent().getAttachment(Attachments.REFLECTION_INDEX); deploymentUnit.putAttachment(Attachments.REFLECTION_INDEX, index); deploymentUnit.putAttachment(Attachments.PROXY_REFLECTION_INDEX, deploymentUnit.getParent().getAttachment(Attachments.PROXY_REFLECTION_INDEX)); } }
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (module == null) { throw ServerLogger.ROOT_LOGGER.nullModuleAttachment(deploymentUnit); } if(deploymentUnit.getParent() == null) { final DeploymentReflectionIndex index = DeploymentReflectionIndex.create(); deploymentUnit.putAttachment(Attachments.REFLECTION_INDEX, index); deploymentUnit.putAttachment(Attachments.PROXY_REFLECTION_INDEX, new ProxyMetadataSource(index)); } else { final DeploymentReflectionIndex index = deploymentUnit.getParent().getAttachment(Attachments.REFLECTION_INDEX); deploymentUnit.putAttachment(Attachments.REFLECTION_INDEX, index); deploymentUnit.putAttachment(Attachments.PROXY_REFLECTION_INDEX, deploymentUnit.getParent().getAttachment(Attachments.PROXY_REFLECTION_INDEX)); } }
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); // OSGi fragments do not have a module Manifest manifest = deploymentUnit.getAttachment(Attachments.OSGI_MANIFEST); if (ManifestHelper.hasMainAttributeValue(manifest, "Fragment-Host")) { return; } Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (module == null) { throw MESSAGES.nullModuleAttachment(deploymentUnit); } if(deploymentUnit.getParent() == null) { final DeploymentReflectionIndex index = DeploymentReflectionIndex.create(); deploymentUnit.putAttachment(Attachments.REFLECTION_INDEX, index); deploymentUnit.putAttachment(Attachments.PROXY_REFLECTION_INDEX, new ProxyMetadataSource(index)); deploymentUnit.putAttachment(Attachments.CLASS_INDEX, new DeploymentClassIndex(index, module)); } else { final DeploymentReflectionIndex index = deploymentUnit.getParent().getAttachment(Attachments.REFLECTION_INDEX); deploymentUnit.putAttachment(Attachments.REFLECTION_INDEX, index); deploymentUnit.putAttachment(Attachments.PROXY_REFLECTION_INDEX, deploymentUnit.getParent().getAttachment(Attachments.PROXY_REFLECTION_INDEX)); deploymentUnit.putAttachment(Attachments.CLASS_INDEX, new DeploymentClassIndex(index, module)); } }
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); // OSGi fragments do not have a module Manifest manifest = deploymentUnit.getAttachment(Attachments.OSGI_MANIFEST); if (ManifestHelper.hasMainAttributeValue(manifest, "Fragment-Host")) { return; } Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (module == null) { throw MESSAGES.nullModuleAttachment(deploymentUnit); } if(deploymentUnit.getParent() == null) { final DeploymentReflectionIndex index = DeploymentReflectionIndex.create(); deploymentUnit.putAttachment(Attachments.REFLECTION_INDEX, index); deploymentUnit.putAttachment(Attachments.PROXY_REFLECTION_INDEX, new ProxyMetadataSource(index)); deploymentUnit.putAttachment(Attachments.CLASS_INDEX, new DeploymentClassIndex(index, module)); } else { final DeploymentReflectionIndex index = deploymentUnit.getParent().getAttachment(Attachments.REFLECTION_INDEX); deploymentUnit.putAttachment(Attachments.REFLECTION_INDEX, index); deploymentUnit.putAttachment(Attachments.PROXY_REFLECTION_INDEX, deploymentUnit.getParent().getAttachment(Attachments.PROXY_REFLECTION_INDEX)); deploymentUnit.putAttachment(Attachments.CLASS_INDEX, new DeploymentClassIndex(index, module)); } }