@Override public void initialize() throws InitializationException { // Try to find a WikiModel implementation and set it if it can be found. If not it means we're in // non wiki mode (i.e. no attachment in wiki documents and no links to documents for example). try { this.wikiModel = this.componentManager.getInstance(WikiModel.class); } catch (ComponentLookupException e) { // There's no WikiModel implementation available. this.wikiModel stays null. } }
/** * @param syntaxId the syntax for which to verify if there's a Parser * @return true if a Parser exists for the passed syntax, false otherwise */ private boolean hasParserForSyntax(String syntaxId) { return this.componentManager.hasComponent(Parser.class, syntaxId); }
/** * @return true if we're in wiki mode (ie there's no implementing class for {@link * org.xwiki.rendering.wiki.WikiModel}) */ private boolean isInWikiMode() { boolean result = true; try { this.componentManager.lookup(WikiModel.class); } catch (ComponentLookupException e) { result = false; } return result; }
private PatientAccessHelper getHelper() { try { return this.componentManager.get().getInstance(PatientAccessHelper.class); } catch (ComponentLookupException ex) { this.logger.error("Mandatory component [PatientAccessHelper] missing: {}", ex.getMessage(), ex); } return null; }
private XarObjectPropertySerializer getInstance(String type, ComponentManager componentManager) throws ComponentLookupException { return componentManager.getInstance(XarObjectPropertySerializer.class, type); } }
/** * @return true if we're in wiki mode (ie there's no implementing class for {@link WikiModel}) */ private boolean isInWikiMode() { boolean result = true; try { this.componentManager.lookup(WikiModel.class); } catch (ComponentLookupException e) { result = false; } return result; } }
/** * @param syntaxId the syntax for which to verify if there's a Renderer * @return true if a Renderer exists for the passed syntax, false otherwise */ private boolean hasRendererForSyntax(String syntaxId) { return this.componentManager.hasComponent(BlockRenderer.class, syntaxId); } }
public static void initializeComponent(ComponentManager componentManager) throws Exception { TestUtils.componentManager = componentManager; TestUtils.relativeReferenceResolver = TestUtils.componentManager.getInstance(EntityReferenceResolver.TYPE_STRING, "relative"); TestUtils.referenceResolver = TestUtils.componentManager.getInstance(EntityReferenceResolver.TYPE_STRING); TestUtils.referenceSerializer = TestUtils.componentManager.getInstance(EntityReferenceSerializer.TYPE_STRING); }
/** * {@inheritDoc} * * @see Initializable#initialize() */ public void initialize() throws InitializationException { // Try to find a WikiModel implementation and set it if it can be found. If not it means we're in // non wiki mode (i.e. no attachment in wiki documents and no links to documents for example). try { this.wikiModel = this.componentManager.lookup(WikiModel.class); } catch (ComponentLookupException e) { // There's no WikiModel implementation available. this.wikiModel stays null. } }
/** * Lookup the cache creation component with provided hint return it. * * @param cacheHint the role hint to lookup. * @return a cache creation service. * @throws ComponentLookupException error when searching for cache component. */ public CacheFactory getCacheFactory(String cacheHint) throws ComponentLookupException { return this.componentManager.getInstance(CacheFactory.class, cacheHint); }
/** * @return true if we're in wiki mode (ie there's no implementing class for {@link * org.xwiki.rendering.wiki.WikiModel}) */ private boolean isInWikiMode() { boolean result = true; try { this.componentManager.lookup(WikiModel.class); } catch (ComponentLookupException e) { result = false; } return result; } }
private Captcha getCaptcha(String captchaName) throws ComponentLookupException { return componentManager.getInstance(Captcha.class, captchaName); } }
/** * {@inheritDoc} * * @see Initializable#initialize() */ public void initialize() throws InitializationException { // Try to find a WikiModel implementation and set it if it can be found. If not it means we're in // non wiki mode (i.e. no attachment in wiki documents and no links to documents for example). try { this.wikiModel = this.componentManager.lookup(WikiModel.class); } catch (ComponentLookupException e) { // There's no WikiModel implementation available. this.wikiModel stays null. } }
@Override public void initialize() throws InitializationException { // Try to find a WikiModel implementation and set it if it can be found. If not it means we're in // non wiki mode (i.e. no attachment in wiki documents and no links to documents for example). try { this.wikiModel = this.componentManager.getInstance(WikiModel.class); } catch (ComponentLookupException e) { // There's no WikiModel implementation available. this.wikiModel stays null. } }
/** * @return the ObservationManager implementation * @throws ComponentLookupException failed to get ObservationManager implementation */ private ObservationManager getObservationManager() throws ComponentLookupException { return this.componentManager.getInstance(ObservationManager.class); }
protected T getInstance(Type type, String hint) throws ComponentLookupException { return this.componentManager.getInstance(type, hint); } }
@Override public void initialize() throws InitializationException { // Try to find a WikiModel implementation and set it if it can be found. If not it means we're in // non wiki mode (i.e. no attachment in wiki documents and no links to documents for example). try { this.wikiModel = this.componentManager.getInstance(WikiModel.class); } catch (ComponentLookupException e) { // There's no WikiModel implementation available. this.wikiModel stays null. } }
/** * Lookup the cache creation component with provided hint return it. * * @param cacheHint the role hint to lookup. * @return a cache creation service. * @throws ComponentLookupException error when searching for cache component. */ public CacheFactory getCacheFactory(String cacheHint) throws ComponentLookupException { return this.componentManager.getInstance(CacheFactory.class, cacheHint); }
/** * @param repository the repository * @param rootFolder the repository folder * @param componentManager used to lookup needed components * @throws ComponentLookupException can't find ExtensionSerializer */ public LocalExtensionStorage(DefaultLocalExtensionRepository repository, File rootFolder, ComponentManager componentManager) throws ComponentLookupException { this.repository = repository; this.rootFolder = rootFolder; this.extensionSerializer = componentManager.getInstance(ExtensionSerializer.class); }
/** * @param baseObject the object containing panel setup * @param id the ID of this UI extension * @param componentManager The XWiki content manager * @throws ComponentLookupException If module dependencies are missing * @throws WikiComponentException When failing to parse content */ public PanelWikiUIExtension(BaseObject baseObject, String id, ComponentManager componentManager) throws ComponentLookupException, WikiComponentException { super(baseObject, UIExtension.class, id, componentManager); // TODO: handle scope dynamically, in the meantime it's hardcoded to "global" for backward compatibility this.scope = WikiComponentScope.GLOBAL; this.scriptContextManager = componentManager.getInstance(ScriptContextManager.class); this.xcontextProvider = componentManager.getInstance(XWikiContext.TYPE_PROVIDER); }