use of org.xwiki.component.phase.InitializationException in project xwiki-platform by xwiki.
the class EmbeddedSolrInstance method initialize.
@Override
public void initialize() throws InitializationException {
String solrHome = determineHomeDirectory();
try {
// Validate and initialize the home directory if needed.
validateAndInitializeHomeDirectory(solrHome);
// Start embedded Solr server.
this.logger.info("Starting embedded Solr server...");
this.logger.info("Using Solr home directory: [{}]", solrHome);
// Initialize the SOLR back-end using an embedded server.
this.container = createCoreContainer(solrHome);
// If we get here then there is at least one core found. We there are more, we use the first one.
String coreName = this.container.getCores().iterator().next().getName();
this.server = new EmbeddedSolrServer(container, coreName);
this.logger.info("Started embedded Solr server.");
} catch (Exception e) {
throw new InitializationException(String.format("Failed to initialize the Solr embedded server with home directory set to [%s]", solrHome), e);
}
}
use of org.xwiki.component.phase.InitializationException in project xwiki-platform by xwiki.
the class InstanceInputFilterStreamFactory method initialize.
@Override
public void initialize() throws InitializationException {
super.initialize();
List<InstanceInputEventGenerator> eventGenerators;
try {
eventGenerators = this.componentManagerProvider.get().getInstanceList(InstanceInputEventGenerator.class);
} catch (ComponentLookupException e) {
throw new InitializationException("Failed to get registered instance of InstanceInputEventGenerator components", e);
}
FilterStreamDescriptor[] descriptors = new FilterStreamDescriptor[eventGenerators.size() + 1];
descriptors[0] = this.descriptor;
for (int i = 0; i < eventGenerators.size(); ++i) {
descriptors[i + 1] = eventGenerators.get(i).getDescriptor();
}
setDescriptor(new CompositeFilterStreamDescriptor(this.descriptor.getName(), this.descriptor.getDescription(), descriptors));
}
use of org.xwiki.component.phase.InitializationException in project xwiki-platform by xwiki.
the class DefaultSecurityCache method newCache.
/**
* @return a new configured security cache
* @throws InitializationException if a CacheException arise during creation
*/
private Cache<SecurityCacheEntry> newCache() throws InitializationException {
CacheConfiguration cacheConfig = new CacheConfiguration();
cacheConfig.setConfigurationId("platform.security.authorization.cache");
LRUEvictionConfiguration lru = new LRUEvictionConfiguration();
lru.setMaxEntries(DEFAULT_CAPACITY);
cacheConfig.put(LRUEvictionConfiguration.CONFIGURATIONID, lru);
try {
return cacheManager.createNewCache(cacheConfig);
} catch (Exception e) {
throw new InitializationException(String.format("Unable to create the security cache with a capacity of [%d] entries", lru.getMaxEntries()), e);
}
}
use of org.xwiki.component.phase.InitializationException in project xwiki-platform by xwiki.
the class DefaultColorThemeCache method initialize.
@Override
public void initialize() throws InitializationException {
try {
// Create the cache
CacheConfiguration configuration = new CacheConfiguration(LESS_COLOR_THEMES_CACHE_ID);
CacheFactory cacheFactory = cacheManager.getCacheFactory();
super.cache = cacheFactory.newCache(configuration);
// The Color Theme only depends on colors which do not depend on the XWikiContext. So we don't handle the
// XWikiContext in this cache.
super.isContextHandled = false;
} catch (ComponentLookupException | CacheException e) {
throw new InitializationException(String.format("Failed to initialize LESS color themes cache [%s].", LESS_COLOR_THEMES_CACHE_ID), e);
}
}
use of org.xwiki.component.phase.InitializationException in project xwiki-platform by xwiki.
the class DefaultLESSResourcesCache method initialize.
@Override
public void initialize() throws InitializationException {
try {
CacheConfiguration configuration = new CacheConfiguration(LESS_FILES_CACHE_ID);
CacheFactory cacheFactory = cacheManager.getCacheFactory();
this.cache = cacheFactory.newCache(configuration);
} catch (ComponentLookupException | CacheException e) {
throw new InitializationException(String.format("Failed to initialize LESS skin files cache [%s].", LESS_FILES_CACHE_ID), e);
}
}
Aggregations