org.killbill.xmlloader.XMLLoader.getObjectFromUri()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中org.killbill.xmlloader.XMLLoader.getObjectFromUri()方法的一些代码示例,展示了XMLLoader.getObjectFromUri()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLLoader.getObjectFromUri()方法的具体详情如下:
包路径:org.killbill.xmlloader.XMLLoader
类名称:XMLLoader
方法名:getObjectFromUri

XMLLoader.getObjectFromUri介绍

暂无

代码示例

代码示例来源:origin: killbill/killbill

  1. public static void main(final String[] args) throws Exception {
  2. if (args.length != 1) {
  3. System.err.println("Usage: <catalog filepath>");
  4. System.exit(0);
  5. }
  6. File file = new File(args[0]);
  7. if(!file.exists()) {
  8. System.err.println("Error: '" + args[0] + "' does not exist");
  9. }
  10. StandaloneCatalog catalog = XMLLoader.getObjectFromUri(file.toURI(), StandaloneCatalog.class);
  11. if (catalog != null) {
  12. System.out.println("Success: Catalog loads!");
  13. }
  14. }

代码示例来源:origin: killbill/killbill

  1. @Override
  2. public void loadDefaultOverdueConfig(@Nullable final String configURI) throws OverdueApiException {
  3. boolean missingOrCorruptedDefaultConfig;
  4. try {
  5. if (configURI == null || configURI.isEmpty()) {
  6. missingOrCorruptedDefaultConfig = true;
  7. } else {
  8. final URI u = new URI(configURI);
  9. defaultOverdueConfig = XMLLoader.getObjectFromUri(u, DefaultOverdueConfig.class);
  10. missingOrCorruptedDefaultConfig = (defaultOverdueConfig == null);
  11. }
  12. } catch (final Exception e) {
  13. missingOrCorruptedDefaultConfig = true;
  14. log.warn("Exception loading default overdue config from " + configURI, e);
  15. }
  16. if (missingOrCorruptedDefaultConfig) {
  17. log.warn("Overdue system disabled: unable to load the overdue config from " + configURI);
  18. }
  19. }

代码示例来源:origin: killbill/killbill

  1. @Inject
  2. public DefaultOverdueConfigCache(final CacheControllerDispatcher cacheControllerDispatcher) {
  3. this.cacheController = cacheControllerDispatcher.getCacheController(CacheType.TENANT_OVERDUE_CONFIG);
  4. this.cacheLoaderArgument = initializeCacheLoaderArgument();
  5. try {
  6. // Provided in the classpath
  7. final URI noOverdueConfigURI = new URI("NoOverdueConfig.xml");
  8. defaultOverdueConfig = XMLLoader.getObjectFromUri(noOverdueConfigURI, DefaultOverdueConfig.class);
  9. } catch (final Exception e) {
  10. defaultOverdueConfig = new DefaultOverdueConfig();
  11. log.error("Exception loading NoOverdueConfig - should never happen!", e);
  12. }
  13. }

代码示例来源:origin: killbill/killbill

  1. final StandaloneCatalog catalog = XMLLoader.getObjectFromUri(u, StandaloneCatalog.class);
  2. result.add(new StandaloneCatalogWithPriceOverride(catalog, priceOverride, InternalCallContextFactory.INTERNAL_TENANT_RECORD_ID, internalCallContextFactory));

代码示例来源:origin: killbill/killbill

  1. @Test(groups = "fast")
  2. public void test() throws Exception {
  3. final URI uri = new URI(Resources.getResource("WeaponsHireSmall.xml").toExternalForm());
  4. final StandaloneCatalog catalog = XMLLoader.getObjectFromUri(uri, StandaloneCatalog.class);
  5. Assert.assertNotNull(catalog);
  6. final DefaultPlanRules rules = catalog.getPlanRules();
  7. final PlanSpecifier specifier = new PlanSpecifier("Laser-Scope", BillingPeriod.MONTHLY,
  8. "DEFAULT");
  9. final PlanAlignmentCreate alignment = rules.getPlanCreateAlignment(specifier, catalog);
  10. Assert.assertEquals(alignment, PlanAlignmentCreate.START_OF_SUBSCRIPTION);
  11. final PlanSpecifier specifier2 = new PlanSpecifier("Extra-Ammo", BillingPeriod.MONTHLY,
  12. "DEFAULT");
  13. final PlanAlignmentCreate alignment2 = rules.getPlanCreateAlignment(specifier2, catalog);
  14. Assert.assertEquals(alignment2, PlanAlignmentCreate.START_OF_BUNDLE);
  15. }
  16. }

代码示例来源:origin: org.kill-bill.billing/killbill-catalog

  1. public static void main(final String[] args) throws Exception {
  2. if (args.length != 1) {
  3. System.err.println("Usage: <catalog filepath>");
  4. System.exit(0);
  5. }
  6. File file = new File(args[0]);
  7. if(!file.exists()) {
  8. System.err.println("Error: '" + args[0] + "' does not exist");
  9. }
  10. StandaloneCatalog catalog = XMLLoader.getObjectFromUri(file.toURI(), StandaloneCatalog.class);
  11. if (catalog != null) {
  12. System.out.println("Success: Catalog loads!");
  13. }
  14. }

代码示例来源:origin: org.kill-bill.billing/killbill-overdue

  1. @Override
  2. public void loadDefaultOverdueConfig(@Nullable final String configURI) throws OverdueApiException {
  3. boolean missingOrCorruptedDefaultConfig;
  4. try {
  5. if (configURI == null || configURI.isEmpty()) {
  6. missingOrCorruptedDefaultConfig = true;
  7. } else {
  8. final URI u = new URI(configURI);
  9. defaultOverdueConfig = XMLLoader.getObjectFromUri(u, DefaultOverdueConfig.class);
  10. missingOrCorruptedDefaultConfig = (defaultOverdueConfig == null);
  11. }
  12. } catch (final Exception e) {
  13. missingOrCorruptedDefaultConfig = true;
  14. log.warn("Exception loading default overdue config from " + configURI, e);
  15. }
  16. if (missingOrCorruptedDefaultConfig) {
  17. log.warn("Overdue system disabled: unable to load the overdue config from " + configURI);
  18. }
  19. }

代码示例来源:origin: org.kill-bill.billing/killbill-overdue

  1. @Inject
  2. public DefaultOverdueConfigCache(final CacheControllerDispatcher cacheControllerDispatcher) {
  3. this.cacheController = cacheControllerDispatcher.getCacheController(CacheType.TENANT_OVERDUE_CONFIG);
  4. this.cacheLoaderArgument = initializeCacheLoaderArgument();
  5. try {
  6. // Provided in the classpath
  7. final URI noOverdueConfigURI = new URI("NoOverdueConfig.xml");
  8. defaultOverdueConfig = XMLLoader.getObjectFromUri(noOverdueConfigURI, DefaultOverdueConfig.class);
  9. } catch (final Exception e) {
  10. defaultOverdueConfig = new DefaultOverdueConfig();
  11. log.error("Exception loading NoOverdueConfig - should never happen!", e);
  12. }
  13. }

代码示例来源:origin: org.kill-bill.billing/killbill-catalog

  1. final StandaloneCatalog catalog = XMLLoader.getObjectFromUri(u, StandaloneCatalog.class);
  2. result.add(new StandaloneCatalogWithPriceOverride(catalog, priceOverride, InternalCallContextFactory.INTERNAL_TENANT_RECORD_ID, internalCallContextFactory));

代码示例来源:origin: org.kill-bill.billing/killbill-catalog

  1. @Test(groups = "fast")
  2. public void test() throws Exception {
  3. final URI uri = new URI(Resources.getResource("WeaponsHireSmall.xml").toExternalForm());
  4. final StandaloneCatalog catalog = XMLLoader.getObjectFromUri(uri, StandaloneCatalog.class);
  5. Assert.assertNotNull(catalog);
  6. final DefaultPlanRules rules = catalog.getPlanRules();
  7. final PlanSpecifier specifier = new PlanSpecifier("Laser-Scope", BillingPeriod.MONTHLY,
  8. "DEFAULT");
  9. final PlanAlignmentCreate alignment = rules.getPlanCreateAlignment(specifier, catalog);
  10. Assert.assertEquals(alignment, PlanAlignmentCreate.START_OF_SUBSCRIPTION);
  11. final PlanSpecifier specifier2 = new PlanSpecifier("Extra-Ammo", BillingPeriod.MONTHLY,
  12. "DEFAULT");
  13. final PlanAlignmentCreate alignment2 = rules.getPlanCreateAlignment(specifier2, catalog);
  14. Assert.assertEquals(alignment2, PlanAlignmentCreate.START_OF_BUNDLE);
  15. }
  16. }

相关文章