0 Replies Latest reply on Jul 1, 2004 12:44 AM by ericmacau

    Urgent: Please give me a hand  !!!

    ericmacau

      REPOST FROM BILL BURKE

      Its more like

      DynamicProxy -> interceptor stack -> Target MBean

      There should be no concept of server or client.

      I also believe the interceptor chain, Aspect Oriented framework should be a generic framework and should work with any type of Object. It should be core to JMX. Sure, the MBeanDeployer could look at some XML and be the bridge between Aspects and MBeans, but lets keep Aspects a separate, lightweight framework.

      We have totaly freedom as far as MBean XML config files go, right?

      Here was my idea for an Aspect framework. I drew up the API while in Germany. The features were:

      - Interceptors could be services/singletons OR instantiated per chain.
      - You could prepend or append an interceptor to the chain globally at runtime
      - You could prepend or append an interceptor to an individual chain.
      - DynamicProxies would have a generic Aspect interface



      interface AspectManager
      {
      void createChain(String name);
      void registerInterceptorSingleton(String name, Interceptor interceptor);

      // These methods globally modify the chain of any Aspect in system with the given name
      void prependAspect(String chainname, String interceptorName, Class clazz, Element metadata);
      void appendAspect(String chainname, String interceptorName, Class clazz, Element metadata);

      void prependAspect(String chainname, String singletonName);
      void appendAspect(String chainname, String singletonName);

      void removeAspect(String chainname, String interceptorName);


      /**
      * Given any old object, make it Aspect Oriented.
      * metadata could hold InvocationContext-like information
      */
      Aspect metamorphisis(String chainName, Class[] interfaces, Element metadata, Object targetObject);

      /**
      * No target object, useful for remote invocations.
      * metadata could hold InvocationContext-like information like MBean name to invoke on
      * and stuff like that.
      */
      Aspect createAspect(String chainName, Class[] interfaces, Element metadata); }

      /**
      * Every DynamicProxy would implement this interface
      */
      interface Aspect
      {
      String getAspectName();

      /**
      * Allows you to detach this particular aspect
      */
      void setAspectName(String newName);

      Object[] getInterceptors();
      Interceptor findInterceptor(String name);

      Object getTargetObject();

      }


      So, XML would look something like this. An AspectChain MBean would create chains within the AspectManager. Add a new keyword to XML <aspect-chain>. This would give the deployer a reference to the name of the interceptor chain to use. The Deployer would create a Proxy via the AspectManager with this chain name and register this Proxy with the MBeanServer.


      <!-- add new keyword -->
      <aspect-chain>jboss.AspectChains:name=SomeOldChain</aspect-chain>


      <mbean code="org.jboss.aspect.AspectChain"
      name="jboss.AspectChains:name=ClientProxyChain>

      <aspect-chain>

      <!--

      </aspect-chain>





      <aspect-chain>


      <!-- etc... -->
      </aspect-chain>