use of org.jboss.as.naming.ServiceAwareObjectFactory in project wildfly by wildfly.
the class ObjectFactoryBuilder method factoryFromReference.
private ObjectFactory factoryFromReference(final Reference reference, final ClassLoader classLoader, final Hashtable<?, ?> environment) throws Exception {
try {
final Class<?> factoryClass = classLoader.loadClass(reference.getFactoryClassName());
ObjectFactory factory = ObjectFactory.class.cast(factoryClass.newInstance());
if (factory instanceof ServiceAwareObjectFactory) {
((ServiceAwareObjectFactory) factory).injectServiceRegistry(currentServiceContainer());
}
return factory;
} catch (Throwable t) {
throw NamingLogger.ROOT_LOGGER.objectFactoryCreationFailure(t);
}
}
Aggregations