Search in sources :

Example 1 with InjectableObjectFactory

use of org.atmosphere.inject.InjectableObjectFactory in project atmosphere by Atmosphere.

the class AtmosphereFramework method lookupDefaultObjectFactoryType.

protected AtmosphereObjectFactory lookupDefaultObjectFactoryType() {
    if (objectFactory != null && !DefaultAtmosphereObjectFactory.class.getName().equals(objectFactory.getClass().getName()))
        return objectFactory;
    for (String b : objectFactoryType) {
        try {
            Class<?> c = Class.forName(b);
            objectFactory = (AtmosphereObjectFactory) c.newInstance();
            break;
        } catch (ClassNotFoundException e) {
            logger.trace(e.getMessage() + " not found");
        } catch (Exception e) {
            logger.trace("", e);
        }
    }
    if (objectFactory == null || DefaultAtmosphereObjectFactory.class.getName().equals(objectFactory.getClass().getName())) {
        try {
            IOUtils.loadClass(getClass(), INJECT_LIBARY);
            objectFactory = new InjectableObjectFactory();
        } catch (Exception e) {
            logger.trace("javax.inject.Inject nor installed. Using DefaultAtmosphereObjectFactory");
            objectFactory = new DefaultAtmosphereObjectFactory();
        }
    }
    objectFactory.configure(config);
    return objectFactory;
}
Also used : InjectableObjectFactory(org.atmosphere.inject.InjectableObjectFactory) IOException(java.io.IOException) ServletException(javax.servlet.ServletException) URISyntaxException(java.net.URISyntaxException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) MalformedURLException(java.net.MalformedURLException)

Aggregations

IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 MalformedURLException (java.net.MalformedURLException)1 URISyntaxException (java.net.URISyntaxException)1 ServletException (javax.servlet.ServletException)1 InjectableObjectFactory (org.atmosphere.inject.InjectableObjectFactory)1