Search in sources :

Example 1 with EPluginNotAvailable

use of com.accenture.trac.common.exception.EPluginNotAvailable in project tracdap by finos.

the class PluginManager method createService.

@Override
public <T> T createService(Class<T> serviceClass, String protocol, Properties properties) {
    var pluginKey = new PluginKey(serviceClass, protocol);
    if (!PluginServiceInfo.SERVICE_NAMES.containsKey(serviceClass.getName()))
        throw new EUnexpected();
    if (!plugins.containsKey(pluginKey)) {
        var rawTypeName = PluginServiceInfo.SERVICE_NAMES.get(serviceClass.getName());
        var message = String.format("Plugin not available for %s protocol: [%s]", prettyTypeName(rawTypeName, false), protocol);
        log.error(message);
        throw new EPluginNotAvailable(message);
    }
    var plugin = plugins.get(pluginKey);
    return plugin.createService(serviceClass, protocol, properties);
}
Also used : EPluginNotAvailable(com.accenture.trac.common.exception.EPluginNotAvailable) EUnexpected(com.accenture.trac.common.exception.EUnexpected)

Example 2 with EPluginNotAvailable

use of com.accenture.trac.common.exception.EPluginNotAvailable in project tracdap by finos.

the class TracDataService method checkDefaultStorageAndFormat.

private void checkDefaultStorageAndFormat(IStorageManager storage, ICodecManager formats, DataServiceConfig config) {
    try {
        storage.getFileStorage(config.getDefaultStorageKey());
        storage.getDataStorage(config.getDefaultStorageKey());
        formats.getCodec(config.getDefaultStorageFormat());
    } catch (EStorageConfig e) {
        var msg = String.format("Storage not configured for default storage key: [%s]", config.getDefaultStorageKey());
        log.error(msg);
        throw new EStartup(msg, e);
    } catch (EPluginNotAvailable e) {
        var msg = String.format("Codec not available for default storage format: [%s]", config.getDefaultStorageFormat());
        log.error(msg);
        throw new EStartup(msg, e);
    }
}
Also used : EPluginNotAvailable(com.accenture.trac.common.exception.EPluginNotAvailable) EStorageConfig(com.accenture.trac.common.exception.EStorageConfig) EStartup(com.accenture.trac.common.exception.EStartup)

Aggregations

EPluginNotAvailable (com.accenture.trac.common.exception.EPluginNotAvailable)2 EStartup (com.accenture.trac.common.exception.EStartup)1 EStorageConfig (com.accenture.trac.common.exception.EStorageConfig)1 EUnexpected (com.accenture.trac.common.exception.EUnexpected)1