3 Replies Latest reply on Feb 25, 2005 10:51 AM by Adrian Brock

    Boston meeting notes: Two phase join point factory construct

    Adrian Brock Master

      We need to satisfy the needs of
      * dynamic classloading (hot deployment of classes),
      * "hot" dependency injection (hot deployment of dependent beans)
      * AOP bytecode engineering
      * dynamic pointcut resultion (including from jboss-aop xml or MicroContainer configuration)
      * annotation overrides (including from jboss-aop.xml or MicroContainer configuration)

      The solution is two phase join point factory resolution.

      The MicroContainer already has this notion in the lifecycle.

      State:
      NOT_INSTALLED - The bean has been registered but the class is not available, some dependencies are known but others may come from the class annotations
      DESCRIBED - The bean's class is available and a description has been retrieved, including dependency information
      INSTANTIATED - All the class/constructor dependencies were satisified and the bean has been created

      But the implementation needs to change to use the ClassAdaptor

      DESCRIBE:
      The Class is available but we don't load it yet because AOP or annotations may
      introduce extra dependencies we don't know about yet.
      Instead we:
      1) Use the ClassAdaptor to obtain the ClassData (which maybe overridden by aop config)
      2) Use the ClassAdaptor to tell it about annotation overrides at the BeanMetaData level (i.e. the microcontainer instance configuration)
      3) Use the ClassAdaptor to obtain dependencies needed by annotations
      4) Use the ClassAdaptor to obtain dependencies needed by linked AspectFactories/Advices

      INSTANTIATE
      Once all the dependencies have been satisfied the MicroContainer asks for
      the JoinPointFactory which will load the class (if not already done so) and link
      the relevent class advisor.
      This will give the MicroContainer a ConstructorJoinPoint that can be used
      to create the instance (including any InstanceAdvisor if required)

        • 1. Re: Boston meeting notes: Two phase join point factory const
          Bill Burke Master

          I don't see in the current ClassAdapter or ClassAdapterFactory interfaces how it receives annotation overrides.

          • 2. Re: Boston meeting notes: Two phase join point factory const
            Bill Burke Master

            Does the getInstanceAdapter get called if there are annotation overrides?

            • 3. Re: Boston meeting notes: Two phase join point factory const
              Adrian Brock Master

              Yes, The intention is that if the user of ClassAdapter wants to override at the
              instance level it will do the following:

              // Get a class level adapter (one per class) and its info
              ClassAdapter classLevelAdapter = classAdapterFactory(myClass);
              ClassInfo classLevelInfo = classLevelAdapter.getClassInfo();

              // Override annotations (if required) and get an instance adapter
              ClassInfo overrideInfo = (ClassInfo) classLevelInfo.clone();
              overrideAnnotations(overrideInfo);
              ClassAdapter instanceAdapter = classLevelAdapter.getInstanceAdapter(overrideInfo);

              // After class can be loaded (this might be what forces the actual class load)
              JoinpointFactory jpf = instanceAdapter (or classLevelAdapter).getJoinPointFactory();

              If it is not clear in the javadoc of ClassAdapter, please fix it.

              If you want to change it, please feel free. We discussed the classes
              and how they fit in the scheme, but we didn't discuss the exact methods
              a client uses to get an instance adapter with overridden annotations.
              This seemed like the most logical solution to me?