How does this take care of DeploymentControllerContext?
Since it's not a part of Deployers.
Or just treating this ControllerContext lookup differently?
Via AttachmentCreator this was transparent. :-)
public class ControllerContextAttachmentChecker extends
AbstractAttachmentChecker<ControllerContext>
{
public ControllerContextAttachmentChecker()
{
super(ControllerContext.class);
}
protected ControllerContext getControllerContext(Controller
controller, ControllerContext attachment)
{
return attachment;
}
}
You don't need to do anything so complicated.
You just need the relevant deployers to record the context names in some
well defined place, e.g. the Deployment{Unit|Context}
It's probably important enough to use a special method rather than
an attachment.
e.g.
public class BeanMetaDataDeployer extends
AbstractSimpleRealDeployer<BeanMetaData>
{
/** The kernel controller */
private final KernelController controller;
/**
* Create a new BeanDeployer.
*
* @param kernel the kernel
* @throws IllegalArgumentException for a null kernel
*/
public BeanMetaDataDeployer(Kernel kernel)
{
super(BeanMetaData.class);
if (kernel == null)
throw new IllegalArgumentException("Null kernel");
controller = kernel.getController();
setComponentsOnly(true);
}
@Override
public void deploy(DeploymentUnit unit, BeanMetaData deployment)
throws DeploymentException
{
KernelControllerContext context = new
AbstractKernelControllerContext(null, deployment, null);
try
{
controller.install(context);
+ unit.addControllerContextName(deployment.getName());
}
catch (Throwable t)
{
throw DeploymentException.rethrowAsDeploymentException("Error
deploying: " + deployment.getName(), t);
}
}
@Override
public void undeploy(DeploymentUnit unit, BeanMetaData deployment)
{
+ unit.removeControllerContextName(deployment.getName());
controller.uninstall(deployment.getName());
}
}
In practice, the component deployment unit name should be the context
name.
This is at least true for the POJO and Service deployers.
So you could just add it as some kind of easy declaration in the
constructor:
public BeanMetaDataDeployer(Kernel kernel)
{
super(BeanMetaData.class);
if (kernel == null)
throw new IllegalArgumentException("Null kernel");
controller = kernel.getController();
setComponentsOnly(true);
// obviously some shorter property name ;-)
setComponentDeploymentNameIsControllerContextName(true);
}
and handle it in the abstract classes:
deploy(...); // will throw an error if not registered in the
controller
if (unit.isComponent() &&
isComponentDeploymentNameControllerContextName())
addComponentContextName(unit.getSimpleName());
> View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104658#...
>
> Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...
> _______________________________________________
> jboss-dev-forums mailing list
> jboss-dev-forums(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/jboss-dev-forums