本文整理了Java中org.killbill.xmlloader.XMLLoader.getObjectFromUri()
方法的一些代码示例,展示了XMLLoader.getObjectFromUri()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLLoader.getObjectFromUri()
方法的具体详情如下:
包路径:org.killbill.xmlloader.XMLLoader
类名称:XMLLoader
方法名:getObjectFromUri
暂无
代码示例来源:origin: killbill/killbill
public static void main(final String[] args) throws Exception {
if (args.length != 1) {
System.err.println("Usage: <catalog filepath>");
System.exit(0);
}
File file = new File(args[0]);
if(!file.exists()) {
System.err.println("Error: '" + args[0] + "' does not exist");
}
StandaloneCatalog catalog = XMLLoader.getObjectFromUri(file.toURI(), StandaloneCatalog.class);
if (catalog != null) {
System.out.println("Success: Catalog loads!");
}
}
代码示例来源:origin: killbill/killbill
@Override
public void loadDefaultOverdueConfig(@Nullable final String configURI) throws OverdueApiException {
boolean missingOrCorruptedDefaultConfig;
try {
if (configURI == null || configURI.isEmpty()) {
missingOrCorruptedDefaultConfig = true;
} else {
final URI u = new URI(configURI);
defaultOverdueConfig = XMLLoader.getObjectFromUri(u, DefaultOverdueConfig.class);
missingOrCorruptedDefaultConfig = (defaultOverdueConfig == null);
}
} catch (final Exception e) {
missingOrCorruptedDefaultConfig = true;
log.warn("Exception loading default overdue config from " + configURI, e);
}
if (missingOrCorruptedDefaultConfig) {
log.warn("Overdue system disabled: unable to load the overdue config from " + configURI);
}
}
代码示例来源:origin: killbill/killbill
@Inject
public DefaultOverdueConfigCache(final CacheControllerDispatcher cacheControllerDispatcher) {
this.cacheController = cacheControllerDispatcher.getCacheController(CacheType.TENANT_OVERDUE_CONFIG);
this.cacheLoaderArgument = initializeCacheLoaderArgument();
try {
// Provided in the classpath
final URI noOverdueConfigURI = new URI("NoOverdueConfig.xml");
defaultOverdueConfig = XMLLoader.getObjectFromUri(noOverdueConfigURI, DefaultOverdueConfig.class);
} catch (final Exception e) {
defaultOverdueConfig = new DefaultOverdueConfig();
log.error("Exception loading NoOverdueConfig - should never happen!", e);
}
}
代码示例来源:origin: killbill/killbill
final StandaloneCatalog catalog = XMLLoader.getObjectFromUri(u, StandaloneCatalog.class);
result.add(new StandaloneCatalogWithPriceOverride(catalog, priceOverride, InternalCallContextFactory.INTERNAL_TENANT_RECORD_ID, internalCallContextFactory));
代码示例来源:origin: killbill/killbill
@Test(groups = "fast")
public void test() throws Exception {
final URI uri = new URI(Resources.getResource("WeaponsHireSmall.xml").toExternalForm());
final StandaloneCatalog catalog = XMLLoader.getObjectFromUri(uri, StandaloneCatalog.class);
Assert.assertNotNull(catalog);
final DefaultPlanRules rules = catalog.getPlanRules();
final PlanSpecifier specifier = new PlanSpecifier("Laser-Scope", BillingPeriod.MONTHLY,
"DEFAULT");
final PlanAlignmentCreate alignment = rules.getPlanCreateAlignment(specifier, catalog);
Assert.assertEquals(alignment, PlanAlignmentCreate.START_OF_SUBSCRIPTION);
final PlanSpecifier specifier2 = new PlanSpecifier("Extra-Ammo", BillingPeriod.MONTHLY,
"DEFAULT");
final PlanAlignmentCreate alignment2 = rules.getPlanCreateAlignment(specifier2, catalog);
Assert.assertEquals(alignment2, PlanAlignmentCreate.START_OF_BUNDLE);
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-catalog
public static void main(final String[] args) throws Exception {
if (args.length != 1) {
System.err.println("Usage: <catalog filepath>");
System.exit(0);
}
File file = new File(args[0]);
if(!file.exists()) {
System.err.println("Error: '" + args[0] + "' does not exist");
}
StandaloneCatalog catalog = XMLLoader.getObjectFromUri(file.toURI(), StandaloneCatalog.class);
if (catalog != null) {
System.out.println("Success: Catalog loads!");
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-overdue
@Override
public void loadDefaultOverdueConfig(@Nullable final String configURI) throws OverdueApiException {
boolean missingOrCorruptedDefaultConfig;
try {
if (configURI == null || configURI.isEmpty()) {
missingOrCorruptedDefaultConfig = true;
} else {
final URI u = new URI(configURI);
defaultOverdueConfig = XMLLoader.getObjectFromUri(u, DefaultOverdueConfig.class);
missingOrCorruptedDefaultConfig = (defaultOverdueConfig == null);
}
} catch (final Exception e) {
missingOrCorruptedDefaultConfig = true;
log.warn("Exception loading default overdue config from " + configURI, e);
}
if (missingOrCorruptedDefaultConfig) {
log.warn("Overdue system disabled: unable to load the overdue config from " + configURI);
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-overdue
@Inject
public DefaultOverdueConfigCache(final CacheControllerDispatcher cacheControllerDispatcher) {
this.cacheController = cacheControllerDispatcher.getCacheController(CacheType.TENANT_OVERDUE_CONFIG);
this.cacheLoaderArgument = initializeCacheLoaderArgument();
try {
// Provided in the classpath
final URI noOverdueConfigURI = new URI("NoOverdueConfig.xml");
defaultOverdueConfig = XMLLoader.getObjectFromUri(noOverdueConfigURI, DefaultOverdueConfig.class);
} catch (final Exception e) {
defaultOverdueConfig = new DefaultOverdueConfig();
log.error("Exception loading NoOverdueConfig - should never happen!", e);
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-catalog
final StandaloneCatalog catalog = XMLLoader.getObjectFromUri(u, StandaloneCatalog.class);
result.add(new StandaloneCatalogWithPriceOverride(catalog, priceOverride, InternalCallContextFactory.INTERNAL_TENANT_RECORD_ID, internalCallContextFactory));
代码示例来源:origin: org.kill-bill.billing/killbill-catalog
@Test(groups = "fast")
public void test() throws Exception {
final URI uri = new URI(Resources.getResource("WeaponsHireSmall.xml").toExternalForm());
final StandaloneCatalog catalog = XMLLoader.getObjectFromUri(uri, StandaloneCatalog.class);
Assert.assertNotNull(catalog);
final DefaultPlanRules rules = catalog.getPlanRules();
final PlanSpecifier specifier = new PlanSpecifier("Laser-Scope", BillingPeriod.MONTHLY,
"DEFAULT");
final PlanAlignmentCreate alignment = rules.getPlanCreateAlignment(specifier, catalog);
Assert.assertEquals(alignment, PlanAlignmentCreate.START_OF_SUBSCRIPTION);
final PlanSpecifier specifier2 = new PlanSpecifier("Extra-Ammo", BillingPeriod.MONTHLY,
"DEFAULT");
final PlanAlignmentCreate alignment2 = rules.getPlanCreateAlignment(specifier2, catalog);
Assert.assertEquals(alignment2, PlanAlignmentCreate.START_OF_BUNDLE);
}
}
内容来源于网络,如有侵权,请联系作者删除!