*/
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
final ServicesAttachment servicesAttachment = deploymentUnit.getAttachment(Attachments.SERVICES);
if (module != null && servicesAttachment != null) {
final ModuleClassLoader deploymentModuleClassLoader = module.getClassLoader();
PersistenceProvider provider = null;
// collect list of persistence providers packaged with the application
final List<String> providerNames = servicesAttachment.getServiceImplementations(PersistenceProvider.class.getName());
if (providerNames.size() > 1) { // TODO: support more than one provider to be packaged, which requires
// knowing which adapter belongs with it.
throw new DeploymentUnitProcessingException(
"only one persistence provider can be packaged with an application " + providerNames);
}