public synchronized void addDeployer(Deployer deployer)
{
if (deployer == null)
throw new IllegalArgumentException("Null deployer");
DeploymentStage stage = deployer.getStage();
if (stage == null)
throw new IllegalArgumentException("Deployer has no stage: " + deployer);
addDeploymentStage(stage);
DeployerWrapper wrapper = new DeployerWrapper(deployer);
// Ignore duplicates
if (deployers.contains(wrapper))
return;
String stageName = stage.getName();
List<Deployer> deployers = deployersByStage.get(stageName);
if (deployers == null)
deployers = Collections.emptyList();
deployers = insert(deployers, wrapper);
deployersByStage.put(stageName, deployers);