use of org.killbill.billing.util.cache.CacheLoaderArgument in project killbill by killbill.
the class EhCacheOverriddenPlanCache method getOverriddenPlan.
@Override
public DefaultPlan getOverriddenPlan(final String planName, final StaticCatalog catalog, final InternalTenantContext context) {
final ObjectType irrelevant = null;
final Object[] args = new Object[2];
args[0] = loaderCallback;
args[1] = catalog;
final CacheLoaderArgument argument = new CacheLoaderArgument(irrelevant, args, context);
return (DefaultPlan) cacheController.get(planName, argument);
}
use of org.killbill.billing.util.cache.CacheLoaderArgument in project killbill by killbill.
the class EhCacheStateMachineConfigCache method createCacheLoaderArgument.
private CacheLoaderArgument createCacheLoaderArgument(final String pluginName) {
final Object[] args = new Object[2];
args[0] = loaderCallback;
args[1] = pluginName;
final ObjectType irrelevant = null;
final InternalTenantContext notUsed = null;
return new CacheLoaderArgument(irrelevant, args, notUsed);
}
use of org.killbill.billing.util.cache.CacheLoaderArgument in project killbill by killbill.
the class DefaultAccountInternalApi method getBCD.
@Override
public int getBCD(final UUID accountId, final InternalTenantContext context) throws AccountApiException {
final CacheLoaderArgument arg = createBCDCacheLoaderArgument(context);
final Integer result = (Integer) bcdCacheController.get(accountId, arg);
return result != null ? result : DefaultMutableAccountData.DEFAULT_BILLING_CYCLE_DAY_LOCAL;
}
use of org.killbill.billing.util.cache.CacheLoaderArgument in project killbill by killbill.
the class DefaultAccountInternalApi method createBCDCacheLoaderArgument.
private CacheLoaderArgument createBCDCacheLoaderArgument(final InternalTenantContext context) {
final AccountBCDCacheLoader.LoaderCallback loaderCallback = new AccountBCDCacheLoader.LoaderCallback() {
@Override
public Object loadAccountBCD(final UUID accountId, final InternalTenantContext context) {
Object result = accountDao.getAccountBCD(accountId, context);
if (result != null) {
// If the value is 0, then account BCD was not set so we don't want to create a cache entry
result = result.equals(DefaultMutableAccountData.DEFAULT_BILLING_CYCLE_DAY_LOCAL) ? null : result;
}
return result;
}
};
final Object[] args = new Object[1];
args[0] = loaderCallback;
final ObjectType irrelevant = null;
return new CacheLoaderArgument(irrelevant, args, context);
}
use of org.killbill.billing.util.cache.CacheLoaderArgument in project killbill by killbill.
the class EhCacheOverdueConfigCache method initializeCacheLoaderArgument.
private CacheLoaderArgument initializeCacheLoaderArgument() {
final LoaderCallback loaderCallback = new LoaderCallback() {
@Override
public Object loadOverdueConfig(final String overdueConfigXML) throws OverdueApiException {
final InputStream overdueConfigStream = new ByteArrayInputStream(overdueConfigXML.getBytes());
final URI uri;
try {
uri = new URI("/overdueConfig");
final DefaultOverdueConfig overdueConfig = XMLLoader.getObjectFromStream(uri, overdueConfigStream, DefaultOverdueConfig.class);
return overdueConfig;
} catch (final Exception e) {
throw new OverdueApiException(ErrorCode.OVERDUE_INVALID_FOR_TENANT, "Problem encountered loading overdue config ", e);
}
}
};
final Object[] args = new Object[1];
args[0] = loaderCallback;
final ObjectType irrelevant = null;
final InternalTenantContext notUsed = null;
return new CacheLoaderArgument(irrelevant, args, notUsed);
}
Aggregations