[Design the new POJO MicroContainer] - Too much implicity
by bill.burke@jboss.com
"adrian(a)jboss.org" wrote : As an aside, with those classes, it will also know that you don't want to be
| invoked for deploy/undeploy if there is no such attachment.
| i.e. no longer any need for the boiler place
|
| | if (unit.getAttachment(MyMetaData.class) == null)
| | return;
| |
| If you don't want this filtering, you can turn it off with
|
| | public MyDeployer()
| | {
| | super(MyMetaData.class);
| | setAllInputs(true);
| | }
| |
|
IMO, there's just too much implicity in both the old and new deployment architecture. My experience writing the first deployer in this new architecture was that I had to dive through a lot of internal code to figure out what the hell was going on. It seems like this is getting worse with the new refactoring you did. I honestly don't care about saving one line of if attachment exists code. It actually makes the code more readable and more importantly, more understandable for people using your deployer as an example for writing their own.
But back the attachment flow. You can also be explicit about
what other information you want. i.e. what deployers should be before/after you.
e.g.
| public MyDeployer()
| {
| super(MyMetaData.class);
| setInputs(SomeOtherMetaData1.class, SomeOtherMetaData2.class);
| setOutputs(MyOutput.class);
| }
|
You can see this in the DEBUG where it shows the calcualted ordering
and input/outputs, e.g.
| 2007-06-28 14:34:27,112 DEBUG [org.jboss.deployers.plugins.deployers.DeployersImpl] Added deployer org.jboss.deployment.ClientDeployer@39471b for stage Real
| org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer(a)121df2a{inputs=[org.jboss.beans.metadata.spi.BeanMetaData, org.jboss.kernel.spi.deployment.KernelDeplo
| yment] outputs=[org.jboss.beans.metadata.spi.BeanMetaData]}
| org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer(a)1e46a68{inputs=[org.jboss.beans.metadata.spi.BeanMetaData] outputs=[]}
| org.jboss.deployment.ClientDeployer@39471b{inputs=[] outputs=[org.jboss.metadata.ClientMetaData]}
| org.jboss.deployment.security.SecurityDeployer@18b4ccb{inputs=[] outputs=[jboss.jacc]}
| org.jboss.ejb.deployers.EjbDeployer(a)5e5c15{inputs=[org.jboss.metadata.ApplicationMetaData] outputs=[org.jboss.system.metadata.ServiceMetaData]}
| org.jboss.ejb3.deployers.AppClientScanningDeployer(a)1743ff4{inputs=[org.jboss.ejb3.metamodel.ApplicationClientDD] outputs=[org.jboss.ejb3.metamodel.ApplicationClientDD]
| }
| org.jboss.ejb3.deployers.EJBRegistrationDeployer@d1afd3{inputs=[] outputs=[org.jboss.ejb3.Ejb3Deployment]}
| org.jboss.ejb3.deployers.EJBStage2Deployer(a)1ee2ea8{inputs=[org.jboss.ejb3.Ejb3Deployment] outputs=[]}
| org.jboss.ejb3.deployers.Ejb3ClientDeployer(a)182b9b5{inputs=[org.jboss.ejb3.metamodel.ApplicationClientDD] outputs=[org.jboss.ejb3.clientmodule.ClientENCInjectionContai
| ner]}
| org.jboss.resource.deployers.RARDeployer(a)f04dae{inputs=[org.jboss.resource.metadata.ConnectorMetaData] outputs=[org.jboss.system.metadata.ServiceMetaData]}
| org.jboss.web.tomcat.service.deployers.TomcatDeployer(a)133926{inputs=[org.jboss.metadata.WebMetaData] outputs=[org.jboss.system.metadata.ServiceMetaData]}
| org.jboss.system.deployers.ServiceDeploymentDeployer(a)1b7c76{inputs=[org.jboss.system.metadata.ServiceMetaData, org.jboss.system.metadata.ServiceDeployment] outputs=[or
| g.jboss.system.metadata.ServiceMetaData]}
| org.jboss.system.deployers.ServiceDeployer(a)147e668{inputs=[org.jboss.system.metadata.ServiceMetaData] outputs=[]}
|
You'll notice the Service deployer is after many of the other deployers that create
ServiceMetaData (even though it was one of the first deployers deployed).
NOTE: The old relativeOrder still exists, but it is probably not as a good a way
to determine ordering.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4058932#4058932
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4058932
16 years, 10 months
[Design the new POJO MicroContainer] - Re: New VFSDeployer Change Question
by adrian@jboss.org
A deployer for seam should just be a case of something that modifies
the WebMetaData to add the seam servlet context listener (or whatever
mechanism it uses).
| public MySeamDeployer extends AbstractSimpleVFSRealDeployer<WebMetaData>
|
| public MySeamDeployer()
| {
| super(WebMetaData.class);
| // We modify the web metadata - i.e. we are filter that inputs/outputs WebMetaData
| setOutputs(WebMetaData.class);
| }
|
| public void deploy(VFSDeploymentUnit unit, WebMetaData webMetaData) throws DeploymentException
| {
| if (isSeamDeployment(unit))
| modifyWebMetaDataToAddSeamIfNotAlreadyPresent(webMetaData);
| }
|
WebMetaData is the object model for [jboss-]web.xml
Once that is done, you can just deploy a normal war with seam metadata
(or annotated classes) and it will automatically make the necessary
configuration changes to web.xml
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4058864#4058864
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4058864
16 years, 10 months
[Design the new POJO MicroContainer] - Parsing Deployers
by adrian@jboss.org
The parsing deployers are now almost entirely declaritive.
In many cases, you could consider that we don't need seperate classes
and the whole thing could be done with xml.
You no longer need to do
| public void deploy(...)
| {
| createMetaData(unit, null, "-ds.xml");
| }
|
Instead you can do
| public MyParsingDeployer
| {
| setSuffix("-ds.xml");
| }
|
The only reason for a class is if you need to do "after" processing.
Many deployers had overridden "random" parts of the api without
spotting that this callback already existed in init() and it already
does the "null" checking.
| public class BeanDeployer extends SchemaResolverDeployer<KernelDeployment>
| {
| /**
| * Create a new BeanDeployer.
| */
| public BeanDeployer()
| {
| super(KernelDeployment.class);
| setSuffix("-beans.xml");
| }
|
| @Override
| protected void init(VFSDeploymentUnit unit, KernelDeployment metaData, VirtualFile file) throws Exception
| {
| String name = file.toURI().toString();
| metaData.setName(name);
| }
|
Some other deployers were also doing other checks besides the metadata
file existed. IMHO most of these are HACKs that should be fixed.
But to make this easier, I added the accepts() callback to the parsing deployers
so each deployer doesn't have to put this wiring in themselves.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4058861#4058861
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4058861
16 years, 10 months