1 2 Previous Next 22 Replies Latest reply on Dec 3, 2008 4:09 AM by alesj Go to original post
      • 15. Re: Why do Topic/Queue descriptors need extra metadata in or

         

        +
        + /**
        + * Add builder to factory.
        + */
        + public void start()
        + {
        + if (factory == null)
        + throw new IllegalArgumentException("Missing managed object factory");
        + if (type == null)
        + throw new IllegalArgumentException("Missing type");
        + if (builder == null)
        + throw new IllegalArgumentException("Missing builder");
        +
        + factory.setBuilder(type, builder);
        + }
        


        You should just use the singleton if they don't provide a managed object factory.
        ManagedObjectFactoryBuilder.create();

        • 16. Re: Why do Topic/Queue descriptors need extra metadata in or

           

          "adrian@jboss.org" wrote:


          No I was talking about something like:

          <bean code="...ManagedObjectDefinition">
           <property name="type">org.jboss.jms.server.destination.QueueService</property>
           <property name="builder">
           <javabean xmlns="..." class="...QueueMOBuilder"/>
           <property>
          </bean>
          



          Now that I refresh my memory on how this works. :-)
          You also need to be able to specify the ManagedObjectPopulator as well.

          The Builder defines what goes in the ManagedObject (i.e. it is like the class)
          (and whether it should even be a ManagedObject ;-)

          The Populator fills in the underlying data for a given object (i.e. for the instance)

          • 17. Re: Why do Topic/Queue descriptors need extra metadata in or
            alesj

            Meaning definition should also have populator?

            • 18. Re: Why do Topic/Queue descriptors need extra metadata in or
              alesj

               

              "alesj" wrote:
              Meaning definition should also have populator?

              Actually this is already taken care of here:
               protected <X> ManagedObjectPopulator<X> getPopulator(Class<X> clazz)
               {
               ManagedObjectBuilder builder = getBuilder(clazz);
               if (builder instanceof ManagedObjectPopulator)
               return (ManagedObjectPopulator) builder;
               ManagedObjectPopulator<X> mop = (ManagedObjectPopulator<X>) defaultManagedObjectPopulator;
               return mop;
               }
              


              • 19. Re: Why do Topic/Queue descriptors need extra metadata in or

                 

                "adrian@jboss.org" wrote:

                Now that I refresh my memory on how this works. :-)
                You also need to be able to specify the ManagedObjectPopulator as well.


                Actually scrap that. ;-)

                The plugin mechanism works by allowing the builder to optionally implement the Populator
                interface as well.

                Its optional because a simple ManagedObjectBuilder can just define
                which javabean properties the default populator should look at.


                • 20. Re: Why do Topic/Queue descriptors need extra metadata in or
                  alesj

                  I've added this to deployers.xml (see commented code)

                   <!-- The ManagedObjectFactory -->
                   <bean name="ManagedObjectFactory">
                   <constructor factoryClass="org.jboss.managed.api.factory.ManagedObjectFactory" factoryMethod="getInstance"/>
                   <!-- Accept any implementor of InstanceClassFactory -->
                   <incallback method="addInstanceClassFactory"/>
                   <uncallback method="removeInstanceClassFactory"/>
                   <!-- Accept any ManagedObjectDefinition
                   <incallback method="addManagedObjectDefinition"/>
                   <uncallback method="removeManagedObjectDefinition"/>
                   -->
                   </bean>
                  

                  This should be un-commented once new jboss-man is released.

                  • 21. Re: Why do Topic/Queue descriptors need extra metadata in or
                    starksm64

                    There is a DestinationMOBuilder that builds the QueueService and TopicService destination classes ManageObjects from the QueueServiceMO and TopicServiceMO skeleton classes so that all destinations have the correct ManagedObject created without having to be annotated.

                    • 22. Re: Why do Topic/Queue descriptors need extra metadata in or
                      alesj

                      I've changed it to be more OO + use newly added mechanisms.
                      e.g. QueueMODefinition

                      public class QueueMODefinition extends ManagedObjectDefinition
                      {
                       private static Logger log = Logger.getLogger(QueueMODefinition.class);
                      
                       public QueueMODefinition(ManagedObjectFactory factory)
                       {
                       super(QueueService.class, new QueueMOBuilder(factory));
                       }
                      
                       private static class QueueMOBuilder implements ManagedObjectBuilder
                       {
                       private ManagedObjectFactory factory;
                      
                       private QueueMOBuilder(ManagedObjectFactory factory)
                       {
                       this.factory = factory;
                       }
                      
                       /**
                       * Create a ManagedObject from QueueService to QueueServiceMO.
                       *
                       * @param clazz - the mbean class to create the ManagedObject for
                       * @param metaData - the MDR MetaData view
                       */
                       public ManagedObject buildManagedObject(Class<?> clazz, MetaData metaData)
                       {
                       ManagedObjectFactory mof = getMOFactory();
                       log.debug("Creating QueueServiceMO template for: " + clazz);
                       return mof.createManagedObject(QueueServiceMO.class, metaData);
                       }
                      
                       /**
                       * Get MO factory.
                       *
                       * @return the MO factory
                       */
                       protected ManagedObjectFactory getMOFactory()
                       {
                       if (factory == null)
                       factory = ManagedObjectFactory.getInstance();
                      
                       return factory;
                       }
                       }
                      }
                      


                      1 2 Previous Next