public class ContainerDeployer implements EventHandler<ClassEvent>
{
public void callback(Context context, ClassEvent event) throws Exception
{
DeployableContainer container = context.get(DeployableContainer.class);
Validate.stateNotNull(container, "No " + DeployableContainer.class.getName() + " found in context");
Archive<?> deployment = context.get(Archive.class);
Validate.stateNotNull(deployment, "No " + Archive.class.getName() + " found in context");
context.fire(new BeforeDeploy());
ContainerMethodExecutor executor = container.deploy(context, deployment);
context.add(ContainerMethodExecutor.class, executor);
context.fire(new AfterDeploy());
}