This content has been marked as final.
Show 22 replies
-
15. Re: Why do Topic/Queue descriptors need extra metadata in or
adrian.brock Nov 21, 2008 9:53 AM (in response to ccrouch)+ + /** + * 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.brock Nov 21, 2008 10:09 AM (in response to ccrouch)"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 Nov 21, 2008 10:11 AM (in response to ccrouch)Meaning definition should also have populator?
-
18. Re: Why do Topic/Queue descriptors need extra metadata in or
alesj Nov 21, 2008 10:14 AM (in response to ccrouch)"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.brock Nov 21, 2008 10:16 AM (in response to ccrouch)"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 Nov 21, 2008 10:30 AM (in response to ccrouch)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 Dec 3, 2008 1:52 AM (in response to ccrouch)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 Dec 3, 2008 4:09 AM (in response to ccrouch)I've changed it to be more OO + use newly added mechanisms.
e.g. QueueMODefinitionpublic 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; } } }