String osgiJndiName = module.getEarContext().getNaming().toOsgiJndiName(abstractName);
String filter = "(osgi.jndi.service.name=" + osgiJndiName + ')';
put("java:comp/ValidatorFactory", new ValidatorFactoryResourceReference(filter, ValidatorFactory.class.getName()), ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget>emptySet(), sharedContext);
} catch (GBeanNotFoundException e) {
// if we can't find one on the module, then bind to a default validator factory
put("java:comp/ValidatorFactory", new DefaultValidatorFactoryReference(), ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget>emptySet(), sharedContext);
}
put("java:comp/Validator", new DefaultValidatorReference(), ReferenceType.RESOURCE_ENV, module.getJndiContext(), Collections.<InjectionTarget>emptySet(), sharedContext);
}