Search in sources :

Example 1 with ServiceAwareObjectFactory

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);
    }
}
Also used : DirObjectFactory(javax.naming.spi.DirObjectFactory) ServiceAwareObjectFactory(org.jboss.as.naming.ServiceAwareObjectFactory) ObjectFactory(javax.naming.spi.ObjectFactory) ServiceAwareObjectFactory(org.jboss.as.naming.ServiceAwareObjectFactory)

Aggregations

DirObjectFactory (javax.naming.spi.DirObjectFactory)1 ObjectFactory (javax.naming.spi.ObjectFactory)1 ServiceAwareObjectFactory (org.jboss.as.naming.ServiceAwareObjectFactory)1