public void inject(InjectionContainer c)
{
if(!(c instanceof ExtendedInjectionContainer))
throw new UnsupportedOperationException("RemotePuEncInjector only works for ExtendedInjectionContainer");
ExtendedInjectionContainer container = (ExtendedInjectionContainer) c;
String name = container.resolvePersistenceUnitSupplier(unitName);
PersistenceUnitDeployment deployment = ((PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(name));
RemotelyInjectEntityManagerFactory factory = new RemotelyInjectEntityManagerFactory(deployment.getXml(), "FIXME");
try
{
Util.rebind(container.getEnc(), encName, factory);
}
catch (NamingException e)
{
throw new RuntimeException(e);
}