Class BeanClassRefreshAgent


  • public class BeanClassRefreshAgent
    extends Object
    Handle definition and redefinition of bean classes in BeanManager. If the bean class already exists than, according reloading policy, either bean instance re-injection or bean context reloading is processed.
    Author:
    Vladimir Dvorak, alpapad@gmail.com
    • Field Detail

      • reloadFlag

        public static boolean reloadFlag
        Flag for checking reload status. It is used in unit tests for waiting for reload finish. Set flag to true in the unit test class and wait until the flag is false again.
    • Method Detail

      • registerArchive

        public static void registerArchive​(ClassLoader appClassLoader,
                                           org.jboss.weld.bootstrap.spi.BeanDeploymentArchive beanArchive,
                                           String beanArchiveType)
        Register bean archive into BdaAgentRegistry and into WeldPlugin. Current classLoader is set to beanArchive classLoader.
        Parameters:
        appClassLoader - the class loader - container or application class loader.
        beanArchive - the bean archive to be registered
        beanArchiveType - the bean archive type
      • getInstances

        public static Collection<BeanClassRefreshAgent> getInstances()
        Gets the collection of registered BeanDeploymentArchive(s)
        Returns:
        the instances
      • getBdaId

        public String getBdaId()
        Gets the Bean deployment ID - bdaId.
        Returns:
        the bdaId
      • getArchivePath

        public String getArchivePath()
        Gets the archive path.
        Returns:
        the archive path
      • getDeploymentArchive

        public org.jboss.weld.bootstrap.spi.BeanDeploymentArchive getDeploymentArchive()
        Gets the deployment archive.
        Returns:
        the deployment archive
      • reloadBean

        public static void reloadBean​(ClassLoader classLoader,
                                      String archivePath,
                                      String beanClassName,
                                      Map<String,​String> oldFullSignatures,
                                      Map<String,​String> oldSignatures,
                                      String strReloadStrategy)
                               throws IOException
        Reload bean according strategy, reinject bean instances. Called from BeanClassRefreshCommand.
        Parameters:
        classLoader - the class loader
        archivePath - the archive path
        beanClassName - the bean class name
        oldFullSignatures - the old full signatures
        oldSignatures - the map of className to old signature
        strReloadStrategy - the str reload strategy
        Throws:
        IOException - error working with classDefinition
      • recreateProxy

        public static void recreateProxy​(ClassLoader classLoader,
                                         String archivePath,
                                         Map registeredProxiedBeans,
                                         String beanClassName,
                                         String oldSignatureForProxyCheck)
                                  throws IOException
        Recreate proxy classes, Called from BeanClassRefreshCommand.
        Parameters:
        classLoader - the class loader
        archivePath - the bean archive path
        registeredProxiedBeans - the registered proxied beans
        beanClassName - the bean class name
        oldSignatureForProxyCheck - the old signature for proxy check
        Throws:
        IOException - error working with classDefinition