/** * Adds the passed-in provider to the Smooks {@link ApplicationContext}. * * @param context The Smooks {@link ApplicationContext}. * @param provider The {@link RuleProvider} that is to be added. */ public static final void add(final ApplicationContext context, final RuleProvider provider) { AssertArgument.isNotNull(context, "context"); AssertArgument.isNotNull(provider, "provider"); Map<String, RuleProvider> providers = getRuleProviders(context); if (providers == null) { providers = new HashMap<String, RuleProvider>(); context.setAttribute(RuleProvider.class, providers); } providers.put(provider.getName(), provider); }
/** * Adds the passed-in provider to the Smooks {@link ApplicationContext}. * * @param context The Smooks {@link ApplicationContext}. * @param provider The {@link RuleProvider} that is to be added. */ public static final void add(final ApplicationContext context, final RuleProvider provider) { AssertArgument.isNotNull(context, "context"); AssertArgument.isNotNull(provider, "provider"); Map<String, RuleProvider> providers = getRuleProviders(context); if (providers == null) { providers = new HashMap<String, RuleProvider>(); context.setAttribute(RuleProvider.class, providers); } providers.put(provider.getName(), provider); }
/** * Adds the passed-in provider to the Smooks {@link ApplicationContext}. * * @param context The Smooks {@link ApplicationContext}. * @param provider The {@link RuleProvider} that is to be added. */ public static final void add(final ApplicationContext context, final RuleProvider provider) { AssertArgument.isNotNull(context, "context"); AssertArgument.isNotNull(provider, "provider"); Map<String, RuleProvider> providers = getRuleProviders(context); if (providers == null) { providers = new HashMap<String, RuleProvider>(); context.setAttribute(RuleProvider.class, providers); } providers.put(provider.getName(), provider); }
/** * Gets a {@link RuleProvider} matching the passed in ruleProviderName. * * @param context The Smooks {@link ApplicationContext}. * @param ruleProviderName The name of the rule provider to lookup. * @return {@link RuleProvider} The {@link RuleProvider} matching the passed in ruleProviderName. * * @throws SmooksException * If no providers have been previously set in the {@link ApplicationContext}, or if * the specified ruleProviderName cannot be found. */ public static final RuleProvider get(final ApplicationContext context, final String ruleProviderName) { AssertArgument.isNotNull(context, "context"); Map<String, RuleProvider> providers = getRuleProviders(context); if ( providers == null || providers.isEmpty()) { throw new SmooksException("No RuleProviders were found. Have you configured a rules section in your Smooks configuration?"); } final RuleProvider provider = providers.get(ruleProviderName); if (provider == null) { throw new SmooksException("Not provider with name '" + ruleProviderName + "' was found in the execution context. Have you configured the rules section properly?"); } return provider; }
/** * Gets a {@link RuleProvider} matching the passed in ruleProviderName. * * @param context The Smooks {@link ApplicationContext}. * @param ruleProviderName The name of the rule provider to lookup. * @return {@link RuleProvider} The {@link RuleProvider} matching the passed in ruleProviderName. * * @throws SmooksException * If no providers have been previously set in the {@link ApplicationContext}, or if * the specified ruleProviderName cannot be found. */ public static final RuleProvider get(final ApplicationContext context, final String ruleProviderName) { AssertArgument.isNotNull(context, "context"); Map<String, RuleProvider> providers = getRuleProviders(context); if ( providers == null || providers.isEmpty()) { throw new SmooksException("No RuleProviders were found. Have you configured a rules section in your Smooks configuration?"); } final RuleProvider provider = providers.get(ruleProviderName); if (provider == null) { throw new SmooksException("Not provider with name '" + ruleProviderName + "' was found in the execution context. Have you configured the rules section properly?"); } return provider; }
/** * Gets a {@link RuleProvider} matching the passed in ruleProviderName. * * @param context The Smooks {@link ApplicationContext}. * @param ruleProviderName The name of the rule provider to lookup. * @return {@link RuleProvider} The {@link RuleProvider} matching the passed in ruleProviderName. * * @throws SmooksException * If no providers have been previously set in the {@link ApplicationContext}, or if * the specified ruleProviderName cannot be found. */ public static final RuleProvider get(final ApplicationContext context, final String ruleProviderName) { AssertArgument.isNotNull(context, "context"); Map<String, RuleProvider> providers = getRuleProviders(context); if ( providers == null || providers.isEmpty()) { throw new SmooksException("No RuleProviders were found. Have you configured a rules section in your Smooks configuration?"); } final RuleProvider provider = providers.get(ruleProviderName); if (provider == null) { throw new SmooksException("Not provider with name '" + ruleProviderName + "' was found in the execution context. Have you configured the rules section properly?"); } return provider; }