[jboss-user] [Microcontainer] - Re: Attachments eligible for being passed to the deployers?

alesj do-not-reply at jboss.com
Thu Mar 5 05:34:22 EST 2009


"jaikiran" wrote : 
  | So would that mean, the attachment generated by a component deployer is of no pratical use to non-component deployers?
  | 
No, that's exactly what I'm trying to explain.
Component deployers should only consume attachments,
not create/generate them.

"jaikiran" wrote : 
  | So would this be a clean way of doing things in a component deployer:
  | 
  | 
  |   | public void deploy(DeploymentUnit unit) throws DeploymentException
  |   |    {
  |   |       logger.info("Deploying unit : " + unit);
  |   | 
  |   | 	// Am i deploying a component?
  |   | 	if (unit.isComponent())
  |   | 	{
  |   | 		// yes, i am deploying a component
  |   | 		...
  |   | 		// should my attachments be visible to non-component deployers?
  |   | 		if (shouldMyAttachmentsBeVisibleToAll())
  |   | 		{
  |   | 			// should be visible to all, so add to parent
  |   | 			unit.getParent().addAttachment(something,someotherthing);
  |   | 		} 
  |   | 		else
  |   | 		{
  |   | 			// only to component deployers
  |   | 			unit.addAttachment(something,someotherthing);
  |   | 		}		
  |   | 
  |   | 	}
  |   | 
  |   |    }
  | 
  | 
The moment you're hacking with getParent::addAtachment you know 
there is something wrong with how you're doing it.
I know we have something like that in our JPA deployers. :-(

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4215187#4215187

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4215187



More information about the jboss-user mailing list