/** * Registers a content type engine if no other engine has been registered * for the content type. * * @param engineClass * @return the engine instance, if it is registered */ public ContentTypeEngine registerContentTypeEngine(Class<? extends ContentTypeEngine> engineClass) { ContentTypeEngine engine; try { engine = engineClass.newInstance(); } catch (Exception e) { throw new PippoRuntimeException(e, "Failed to instantiate '{}'", engineClass.getName()); } if (!engines.containsKey(engine.getContentType())) { setContentTypeEngine(engine); return engine; } else { log.debug("'{}' content engine already registered, ignoring '{}'", engine.getContentType(), engineClass.getName()); return null; } }