ps.addDeployment(ctx1);
// Deploy security domain1
Deployment secCtx1 = createSimpleDeployment("sec-domain1");
MutableAttachments sda1 = (MutableAttachments) secCtx1.getPredeterminedManagedObjects();
SecurityDeployment sd1 = new SecurityDeployment();
sd1.setDomainName("java:/jaas/domain1");
sda1.addAttachment(SecurityDeployment.class, sd1);
ps.addDeployment(secCtx1);
// Deploy security domain2
Deployment secCtx2 = createSimpleDeployment("sec-domain2");
MutableAttachments sda2 = (MutableAttachments) secCtx2.getPredeterminedManagedObjects();
SecurityDeployment sd2 = new SecurityDeployment();
sd2.setDomainName("java:/jaas/domain2");
sda2.addAttachment(SecurityDeployment.class, sd2);
ps.addDeployment(secCtx2);
// Process the deployments to build the ManagedObjects
ps.process();