Refine search
/** * Component used to extract a {@link DocumentReference} from a {@link SolrDocument}. * * @version $Id: b9acc4bf7fb4cacbc213962daa183f491ef9d856 $ * @since 7.2M2 */ @Component @Singleton public class SolrDocumentReferenceResolver implements DocumentReferenceResolver<SolrDocument> { @Inject private EntityReferenceResolver<SolrDocument> entityReferenceResolver; @Override public DocumentReference resolve(SolrDocument documentReferenceRepresentation, Object... parameters) { return new DocumentReference(this.entityReferenceResolver.resolve(documentReferenceRepresentation, EntityType.DOCUMENT, parameters)); } }
@Component("elasticsearch") public class ElasticSearchManaged implements Managed { @Inject @Named("elasticsearch") private SearchEngine searchEngine; @Override public void start() throws Exception { ((ElasticSearchSearchEngine) searchEngine).start(); } @Override public void stop() throws Exception { ((ElasticSearchSearchEngine) searchEngine).stop(); } }
/** * Default implementation of {@link CacheFactory}. * * @version $Id: 20909c519f62b6d63fcdbca9808a715ab6fcccf6 $ */ @Component @Singleton public class DefaultCacheFactory implements CacheFactory { @Override public <T> Cache<T> newCache(CacheConfiguration config) throws CacheException { return new DefaultCache<T>(); } }
/** * Handle XHTML rendering for icon images. * * @version $Id: 2ffe56658a713e3cab85bbdb727367fcd3b1b399 $ * @since 5.4RC1 */ @Component @Named("icon") @InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP) public class IconXHTMLImageTypeRenderer extends AttachmentXHTMLImageTypeRenderer { }
@Component("xwiki") public class XWikiVelocityContextInitializer implements VelocityContextInitializer { @Requirement private Execution execution; public void initialize(VelocityContext context) { // TODO: Move the Velocity Context initialization code currently located in // VelocityManager.getVelocityContext() here. This requires some refactoring as // it means the XWiki object must be initialized before this code is called. } }
/** * Each syntax should have its own resource reference parser. However while we wait for syntax specific parser to be * implemented this generic parser should provide a good approximation. * * @version $Id$ * @since 2.5RC1 */ @Component("default/image") public class GenericImageReferenceParser extends XWiki20ImageReferenceParser { }
@Override public String getDigestAlgorithmName() { String hint = null; Named named = this.getClass().getAnnotation(Named.class); if (named != null) { hint = named.value(); } else { Component component = this.getClass().getAnnotation(Component.class); if (component != null && component.hints().length > 0) { hint = component.hints()[0]; } } return hint; }
/** * {@inheritDoc} */ public void initialize() throws InitializationException { MacroId macroId = null; // Try to get macro id from component hint - only possible for XWiki Java Macros Component annotation = this.getClass().getAnnotation(Component.class); if (annotation != null && !"".equals(annotation)) { macroId = new MacroId(annotation.value()); } DefaultMacroDescriptor descriptor = new DefaultMacroDescriptor(macroId, this.name, this.description, this.contentDescriptor, this.beanManager .getBeanDescriptor(this.parametersBeanClass)); descriptor.setDefaultCategory(this.defaultCategory); setDescriptor(descriptor); }
/** * Default implementation of {@link MessageStreamConfiguration}. * * @version $Id: 6f28d742d44d00a352263ec0ddca056e0b64fbb2 $ * @since 10.5RC1 * @since 9.11.6 */ @Component @Singleton public class DefaultMessageStreamConfiguration implements MessageStreamConfiguration { @Inject private DocumentAccessBridge documentAccessBridge; @Override public boolean isActive(String wikiId) { DocumentReference configPage = new DocumentReference(wikiId, "XWiki", "MessageStreamConfig"); return Integer.valueOf(1).equals(documentAccessBridge.getProperty(configPage, configPage, "active")); } }
/** * Default implementation of {@link CacheFactory}. * * @version $Id: 20909c519f62b6d63fcdbca9808a715ab6fcccf6 $ */ @Component @Singleton public class DefaultCacheFactory implements CacheFactory { @Override public <T> Cache<T> newCache(CacheConfiguration config) throws CacheException { return new DefaultCache<T>(); } }
/** * Handle XHTML rendering for links to spaces. * * @version $Id: c369e980f739528d13b728cd38c374c274572a64 $ * @since 7.4.1 * @since 8.0M1 */ @Component @Named("space") @InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP) public class SpaceXHTMLLinkTypeRenderer extends DocumentXHTMLLinkTypeRenderer { // Since we can`t currently have more than one @Named annotation on a component (until we get java 8), we need to // add this class instead which just extends DocumentXHTMLLinkTypeRenderer and uses a different @Named annotation. }
@Component public class ConfigurationExtensionRepositorySource implements ExtensionRepositorySource { @Requirement private ExtensionManagerConfiguration configuration; public List<ExtensionRepositoryId> getExtensionRepositories() { return configuration.getRepositories(); } }
@Component public interface DBIProvider { DBI get(); }
@Override public String getDigestAlgorithmName() { String hint = null; Named named = this.getClass().getAnnotation(Named.class); if (named != null) { hint = named.value(); } else { Component component = this.getClass().getAnnotation(Component.class); if (component != null && component.hints().length > 0) { hint = component.hints()[0]; } } return hint; }
/** * Default implementation for {@link CaptchaConfiguration}. * * @version $Id: 1834827b33ae612bb4fe0369ad395505ca58d4e4 $ * @since 10.8RC1 */ @Component @Singleton public class DefaultCaptchaConfiguration implements CaptchaConfiguration { @Inject @Named("captcha") private ConfigurationSource configuration; @Override public String getDefaultName() { return configuration.getProperty("captcha", "jcaptcha"); } }