-
1. Re: Confused about POJO service
alesj Oct 8, 2009 6:55 AM (in response to karypid)Simply create a POJO - drop the MBean stuff - and place it any META-INF/somename-jboss-beans.xml.
See JBoss5 config files on how MC's schema looks like.
MC tries to execute create/start/stop/destroy parameterless methods on the bean by default if they exist.
So, just keep the start() and stop() and you're fine. -
2. Re: Confused about POJO service
karypid Oct 8, 2009 7:43 AM (in response to karypid)Would that be packaged in a JAR for JBoss to pick it up?
My current test (which does not get activated) is a JAR with one class and one interface (the interface defines the start/stop methods) as follows:public class MyServiceImpl implements MyService { private Logger logger; public void start() { logger = LoggerFactory.getLogger(MyServiceImpl.class); logger.info("has been started"); } public void stop() { logger.info("has been shut down"); logger = null; } }
It contains a META-INF/my-service-beans.xml as follows:<?xml version="1.0" encoding="UTF-8"?> <deployment xmlns="urn:jboss:bean-deployer:2.0"> <bean name="MyService" class="test.MyServiceImpl" /> </deployment>
I drop it into the deploy folder (archived, not exploded) but nothing happens. -
3. Re: Confused about POJO service
karypid Oct 8, 2009 7:46 AM (in response to karypid)Ok, I got it. The deployment descriptor filename must be "jboss-beans.xml" otherwise the jar is ignored.
BTW, this is an opportunity to document in the forum the naming issue: When can you use a different filename? You mentioned it in your reply and I've also seen it in various articles (e.g. the DZone article).
Thanks for your help. -
4. Re: Confused about POJO service
alesj Oct 9, 2009 5:34 AM (in response to karypid)"karypid" wrote:
When can you use a different filename?
It depends on the BeanDeployer:
- http://anonsvn.jboss.org/repos/jbossas/projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/deployer/kernel/BeanDeployer.java