com.ning.billing.util.config.catalog.XMLLoader.getObjectFromUri()方法的使用及代码示例

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

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

XMLLoader.getObjectFromUri介绍

暂无

代码示例

代码示例来源:origin: com.ning.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: com.ning.billing/killbill-catalog

  1. final StandaloneCatalog catalog = XMLLoader.getObjectFromUri(u, StandaloneCatalog.class);
  2. result.add(catalog);

代码示例来源:origin: com.ning.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 PlanRules rules = catalog.getPlanRules();
  7. final PlanSpecifier specifier = new PlanSpecifier("Laser-Scope", ProductCategory.ADD_ON, 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", ProductCategory.ADD_ON, BillingPeriod.MONTHLY,
  12. "DEFAULT");
  13. final PlanAlignmentCreate alignment2 = rules.getPlanCreateAlignment(specifier2, catalog);
  14. Assert.assertEquals(alignment2, PlanAlignmentCreate.START_OF_BUNDLE);
  15. }
  16. }

代码示例来源:origin: com.ning.billing/killbill-overdue

  1. @LifecycleHandlerType(LifecycleLevel.LOAD_CATALOG)
  2. public synchronized void loadConfig() throws ServiceException {
  3. if (!isConfigLoaded) {
  4. try {
  5. final URI u = new URI(properties.getConfigURI());
  6. overdueConfig = XMLLoader.getObjectFromUri(u, OverdueConfig.class);
  7. // File not found?
  8. if (overdueConfig == null) {
  9. log.warn("Unable to load the overdue config from " + properties.getConfigURI());
  10. overdueConfig = new OverdueConfig();
  11. }
  12. isConfigLoaded = true;
  13. } catch (final URISyntaxException e) {
  14. overdueConfig = new OverdueConfig();
  15. } catch (final IllegalArgumentException e) {
  16. overdueConfig = new OverdueConfig();
  17. } catch (final Exception e) {
  18. throw new ServiceException(e);
  19. }
  20. factory.setOverdueConfig(overdueConfig);
  21. ((DefaultOverdueUserApi) userApi).setOverdueConfig(overdueConfig);
  22. }
  23. }

相关文章