Search in sources :

Example 1 with VersionedPluginCatalog

use of org.killbill.billing.catalog.plugin.api.VersionedPluginCatalog in project killbill by killbill.

the class EhCacheCatalogCache method getCatalogFromPlugins.

private VersionedCatalog getCatalogFromPlugins(final InternalTenantContext internalTenantContext) throws CatalogApiException {
    final TenantContext tenantContext = internalCallContextFactory.createTenantContext(internalTenantContext);
    for (final String service : pluginRegistry.getAllServices()) {
        final CatalogPluginApi plugin = pluginRegistry.getServiceForName(service);
        final VersionedPluginCatalog pluginCatalog = plugin.getVersionedPluginCatalog(ImmutableList.<PluginProperty>of(), tenantContext);
        // First plugin that gets something (for that tenant) returns it
        if (pluginCatalog != null) {
            logger.info("Returning catalog from plugin {} on tenant {} ", service, internalTenantContext.getTenantRecordId());
            return versionedCatalogMapper.toVersionedCatalog(pluginCatalog, internalTenantContext);
        }
    }
    return null;
}
Also used : VersionedPluginCatalog(org.killbill.billing.catalog.plugin.api.VersionedPluginCatalog) InternalTenantContext(org.killbill.billing.callcontext.InternalTenantContext) TenantContext(org.killbill.billing.util.callcontext.TenantContext) CatalogPluginApi(org.killbill.billing.catalog.plugin.api.CatalogPluginApi)

Aggregations

InternalTenantContext (org.killbill.billing.callcontext.InternalTenantContext)1 CatalogPluginApi (org.killbill.billing.catalog.plugin.api.CatalogPluginApi)1 VersionedPluginCatalog (org.killbill.billing.catalog.plugin.api.VersionedPluginCatalog)1 TenantContext (org.killbill.billing.util.callcontext.TenantContext)1