Search in sources :

Example 11 with InitializationException

use of org.xwiki.component.phase.InitializationException in project xwiki-platform by xwiki.

the class AbstractSheetBinder method initialize.

@Override
public void initialize() throws InitializationException {
    try {
        String statement = "select doc.fullName, prop.value from XWikiDocument doc, BaseObject obj, StringProperty prop where " + "obj.className=:sheetBindingClass and obj.name=doc.fullName and obj.id=prop.id.id and " + "prop.id.name=:sheetProperty order by doc.fullName";
        this.sheetBindingsQuery = this.queryManager.createQuery(statement, Query.HQL);
        this.sheetBindingsQuery.bindValue("sheetBindingClass", getSheetBindingClass());
        this.sheetBindingsQuery.bindValue("sheetProperty", SHEET_PROPERTY);
    } catch (QueryException e) {
        throw new InitializationException("Failed to create query for retrieving the list of sheet bindings.", e);
    }
}
Also used : QueryException(org.xwiki.query.QueryException) InitializationException(org.xwiki.component.phase.InitializationException)

Example 12 with InitializationException

use of org.xwiki.component.phase.InitializationException in project xwiki-platform by xwiki.

the class CacheImageStorage method initialize.

@Override
public void initialize() throws InitializationException {
    CacheConfiguration configuration = new CacheConfiguration();
    configuration.setConfigurationId("xwiki.plugin.formula");
    try {
        this.cache = this.cacheManager.createNewCache(configuration);
    } catch (CacheException e) {
        throw new InitializationException("Failed to create cache", e);
    }
}
Also used : CacheException(org.xwiki.cache.CacheException) InitializationException(org.xwiki.component.phase.InitializationException) CacheConfiguration(org.xwiki.cache.config.CacheConfiguration)

Example 13 with InitializationException

use of org.xwiki.component.phase.InitializationException in project xwiki-platform by xwiki.

the class DefaultIconSetCache method initialize.

@Override
public void initialize() throws InitializationException {
    try {
        CacheConfiguration configuration = new CacheConfiguration(ICON_SET_CACHE_ID);
        CacheFactory cacheFactory = cacheManager.getCacheFactory();
        this.cache = cacheFactory.newCache(configuration);
    } catch (ComponentLookupException | CacheException e) {
        throw new InitializationException("Failed to initialize the IconSet Cache.", e);
    }
}
Also used : CacheException(org.xwiki.cache.CacheException) ComponentLookupException(org.xwiki.component.manager.ComponentLookupException) CacheFactory(org.xwiki.cache.CacheFactory) InitializationException(org.xwiki.component.phase.InitializationException) CacheConfiguration(org.xwiki.cache.config.CacheConfiguration)

Example 14 with InitializationException

use of org.xwiki.component.phase.InitializationException in project xwiki-platform by xwiki.

the class RepositoryManager method initialize.

@Override
public void initialize() throws InitializationException {
    // Init cache
    CacheConfiguration cacheConfiguration = new CacheConfiguration();
    cacheConfiguration.setConfigurationId("repository.extensionid.documentreference");
    LRUEvictionConfiguration lru = new LRUEvictionConfiguration();
    lru.setMaxEntries(10000);
    cacheConfiguration.put(LRUEvictionConfiguration.CONFIGURATIONID, lru);
    try {
        this.documentReferenceCache = this.cacheManager.createNewCache(cacheConfiguration);
    } catch (CacheException e) {
        throw new InitializationException("Failed to initialize cache", e);
    }
    // Listen to modifications
    this.observation.addListener(listener);
}
Also used : CacheException(org.xwiki.cache.CacheException) LRUEvictionConfiguration(org.xwiki.cache.eviction.LRUEvictionConfiguration) InitializationException(org.xwiki.component.phase.InitializationException) CacheConfiguration(org.xwiki.cache.config.CacheConfiguration)

Example 15 with InitializationException

use of org.xwiki.component.phase.InitializationException in project xwiki-platform by xwiki.

the class StubVelocityManager method initialize.

@Override
public void initialize() throws InitializationException {
    try {
        // Configure the Velocity Engine not to use the Resource Webapp Loader since we don't
        // need it and we would need to setup the Container component's ApplicationContext
        // otherwise.
        Properties properties = new Properties();
        properties.setProperty("resource.loader", "file");
        this.velocityEngine.initialize(properties);
    } catch (XWikiVelocityException e) {
        throw new InitializationException("Failed to initialize Velocity Engine", e);
    }
}
Also used : XWikiVelocityException(org.xwiki.velocity.XWikiVelocityException) Properties(java.util.Properties) InitializationException(org.xwiki.component.phase.InitializationException)

Aggregations

InitializationException (org.xwiki.component.phase.InitializationException)24 ComponentLookupException (org.xwiki.component.manager.ComponentLookupException)9 CacheException (org.xwiki.cache.CacheException)8 CacheConfiguration (org.xwiki.cache.config.CacheConfiguration)8 IOException (java.io.IOException)4 CacheFactory (org.xwiki.cache.CacheFactory)4 InputStream (java.io.InputStream)3 LRUEvictionConfiguration (org.xwiki.cache.eviction.LRUEvictionConfiguration)3 DefaultComponentDescriptor (org.xwiki.component.descriptor.DefaultComponentDescriptor)2 ComponentRepositoryException (org.xwiki.component.manager.ComponentRepositoryException)2 CompositeFilterStreamDescriptor (org.xwiki.filter.descriptor.CompositeFilterStreamDescriptor)2 FilterStreamDescriptor (org.xwiki.filter.descriptor.FilterStreamDescriptor)2 EntityReference (org.xwiki.model.reference.EntityReference)2 XWikiContext (com.xpn.xwiki.XWikiContext)1 XWikiException (com.xpn.xwiki.XWikiException)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 StringReader (java.io.StringReader)1 Type (java.lang.reflect.Type)1 ArrayList (java.util.ArrayList)1