Class BeanClassRefreshAgent


  • public class BeanClassRefreshAgent
    extends java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      static boolean reloadFlag
      Flag for checking reload status.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getArchivePath()
      Gets the archive path.
      java.lang.String getBdaId()
      Gets the Bean deployment ID - bdaId.
      org.jboss.weld.bootstrap.spi.BeanDeploymentArchive getDeploymentArchive()
      Gets the deployment archive.
      static java.util.Collection<BeanClassRefreshAgent> getInstances()
      Gets the collection of registered BeanDeploymentArchive(s)
      static void recreateProxy​(java.lang.ClassLoader classLoader, java.lang.String archivePath, java.util.Map registeredProxiedBeans, java.lang.String beanClassName, java.lang.String oldSignatureForProxyCheck)
      Recreate proxy classes, Called from BeanClassRefreshCommand.
      static void registerArchive​(java.lang.ClassLoader appClassLoader, org.jboss.weld.bootstrap.spi.BeanDeploymentArchive beanArchive, java.lang.String beanArchiveType)
      Register bean archive into BdaAgentRegistry and into WeldPlugin.
      static void reloadBean​(java.lang.ClassLoader classLoader, java.lang.String archivePath, java.lang.String beanClassName, java.util.Map<java.lang.String,​java.lang.String> oldFullSignatures, java.util.Map<java.lang.String,​java.lang.String> oldSignatures, java.lang.String strReloadStrategy)
      Reload bean according strategy, reinject bean instances.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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​(java.lang.ClassLoader appClassLoader,
                                           org.jboss.weld.bootstrap.spi.BeanDeploymentArchive beanArchive,
                                           java.lang.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 java.util.Collection<BeanClassRefreshAgent> getInstances()
        Gets the collection of registered BeanDeploymentArchive(s)
        Returns:
        the instances
      • getBdaId

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

        public java.lang.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​(java.lang.ClassLoader classLoader,
                                      java.lang.String archivePath,
                                      java.lang.String beanClassName,
                                      java.util.Map<java.lang.String,​java.lang.String> oldFullSignatures,
                                      java.util.Map<java.lang.String,​java.lang.String> oldSignatures,
                                      java.lang.String strReloadStrategy)
                               throws java.io.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:
        java.io.IOException - error working with classDefinition
      • recreateProxy

        public static void recreateProxy​(java.lang.ClassLoader classLoader,
                                         java.lang.String archivePath,
                                         java.util.Map registeredProxiedBeans,
                                         java.lang.String beanClassName,
                                         java.lang.String oldSignatureForProxyCheck)
                                  throws java.io.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:
        java.io.IOException - error working with classDefinition