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

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

本文整理了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

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: com.ning.billing/killbill-catalog

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

代码示例来源:origin: com.ning.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 PlanRules rules = catalog.getPlanRules();

    final PlanSpecifier specifier = new PlanSpecifier("Laser-Scope", ProductCategory.ADD_ON, BillingPeriod.MONTHLY,
                             "DEFAULT");

    final PlanAlignmentCreate alignment = rules.getPlanCreateAlignment(specifier, catalog);
    Assert.assertEquals(alignment, PlanAlignmentCreate.START_OF_SUBSCRIPTION);

    final PlanSpecifier specifier2 = new PlanSpecifier("Extra-Ammo", ProductCategory.ADD_ON, BillingPeriod.MONTHLY,
                              "DEFAULT");

    final PlanAlignmentCreate alignment2 = rules.getPlanCreateAlignment(specifier2, catalog);
    Assert.assertEquals(alignment2, PlanAlignmentCreate.START_OF_BUNDLE);
  }
}

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

@LifecycleHandlerType(LifecycleLevel.LOAD_CATALOG)
public synchronized void loadConfig() throws ServiceException {
  if (!isConfigLoaded) {
    try {
      final URI u = new URI(properties.getConfigURI());
      overdueConfig = XMLLoader.getObjectFromUri(u, OverdueConfig.class);
      // File not found?
      if (overdueConfig == null) {
        log.warn("Unable to load the overdue config from " + properties.getConfigURI());
        overdueConfig = new OverdueConfig();
      }
      isConfigLoaded = true;
    } catch (final URISyntaxException e) {
      overdueConfig = new OverdueConfig();
    } catch (final IllegalArgumentException e) {
      overdueConfig = new OverdueConfig();
    } catch (final Exception e) {
      throw new ServiceException(e);
    }
    factory.setOverdueConfig(overdueConfig);
    ((DefaultOverdueUserApi) userApi).setOverdueConfig(overdueConfig);
  }
}

相关文章