/** * Get the named parameter String value. * @param name Name of parameter to get. * @param config The {@link ContentDeliveryConfig} for the requesting device. * @return Parameter value, or null if not set. */ public static String getStringParameter(String name, ContentDeliveryConfig config) { Parameter param = getParamter(name, config); if(param != null) { return param.getValue(); } return null; }
/** * Get the named parameter String value. * @param name Name of parameter to get. * @param defaultVal Default value returned if the parameter is not defined. * @param config The {@link ContentDeliveryConfig} for the requesting device. * @return Parameter value, or null if not set. */ public static String getStringParameter(String name, String defaultVal, ContentDeliveryConfig config) { Parameter param = getParamter(name, config); if(param != null) { return param.getValue(); } return defaultVal; }
/** * Get the named parameter String value. * @param name Name of parameter to get. * @param config The {@link ContentDeliveryConfig} for the requesting device. * @return Parameter value, or null if not set. */ public static String getStringParameter(String name, ContentDeliveryConfig config) { Parameter param = getParamter(name, config); if(param != null) { return param.getValue(); } return null; }
/** * Get the named parameter String value. * @param name Name of parameter to get. * @param config The {@link ContentDeliveryConfig} for the requesting device. * @return Parameter value, or null if not set. */ public static String getStringParameter(String name, ContentDeliveryConfig config) { Parameter param = getParamter(name, config); if(param != null) { return param.getValue(); } return null; }
/** * Get the named parameter String value. * @param name Name of parameter to get. * @param config The {@link ContentDeliveryConfig} for the requesting device. * @return Parameter value, or null if not set. */ public static String getStringParameter(String name, ContentDeliveryConfig config) { Parameter param = getParamter(name, config); if(param != null) { return param.getValue(); } return null; }
/** * Get the named parameter from the supplied resource config map. * * @param name The parameter name. * @param resourceConfigurations The resource configuration map. * @return The parameter value, or null if not found. */ public static String getStringParameter(String name, Map<String, List<SmooksResourceConfiguration>> resourceConfigurations) { Parameter parameter = getParameter(name, resourceConfigurations); if(parameter != null) { return parameter.getValue(); } return null; }
/** * Get the named parameter from the supplied resource config map. * * @param name The parameter name. * @param resourceConfigurations The resource configuration map. * @return The parameter value, or null if not found. */ public static String getStringParameter(String name, Map<String, List<SmooksResourceConfiguration>> resourceConfigurations) { Parameter parameter = getParameter(name, resourceConfigurations); if(parameter != null) { return parameter.getValue(); } return null; }
/** * Get the named parameter String value. * @param name Name of parameter to get. * @param defaultVal Default value returned if the parameter is not defined. * @param config The {@link ContentDeliveryConfig} for the requesting device. * @return Parameter value, or null if not set. */ public static String getStringParameter(String name, String defaultVal, ContentDeliveryConfig config) { Parameter param = getParamter(name, config); if(param != null) { return param.getValue(); } return defaultVal; }
/** * Get the named parameter from the supplied resource config map. * * @param name The parameter name. * @param resourceConfigurations The resource configuration map. * @return The parameter value, or null if not found. */ public static String getStringParameter(String name, Map<String, List<SmooksResourceConfiguration>> resourceConfigurations) { Parameter parameter = getParameter(name, resourceConfigurations); if(parameter != null) { return parameter.getValue(); } return null; }
/** * Get the named parameter String value. * @param name Name of parameter to get. * @param defaultVal Default value returned if the parameter is not defined. * @param config The {@link ContentDeliveryConfig} for the requesting device. * @return Parameter value, or null if not set. */ public static String getStringParameter(String name, String defaultVal, ContentDeliveryConfig config) { Parameter param = getParamter(name, config); if(param != null) { return param.getValue(); } return defaultVal; }
/** * Get the named parameter String value. * @param name Name of parameter to get. * @param defaultVal Default value returned if the parameter is not defined. * @param config The {@link ContentDeliveryConfig} for the requesting device. * @return Parameter value, or null if not set. */ public static String getStringParameter(String name, String defaultVal, ContentDeliveryConfig config) { Parameter param = getParamter(name, config); if(param != null) { return param.getValue(); } return defaultVal; }
/** * Get the named parameter instance (decode). * @param name Parameter name. * @param config Device Delivery Configuration. * @return The Parameter instance for the named parameter (<a href="#decode">decoded to an Object</a>), * or null if not defined. */ public static Object getParameterObject(String name, ContentDeliveryConfig config) { Parameter param = getParamter(name, config); if(param != null) { return param.getValue(config); } return null; }
/** * Get the named parameter instance (decode). * @param name Parameter name. * @param config Device Delivery Configuration. * @return The Parameter instance for the named parameter (<a href="#decode">decoded to an Object</a>), * or null if not defined. */ public static Object getParameterObject(String name, ContentDeliveryConfig config) { Parameter param = getParamter(name, config); if(param != null) { return param.getValue(config); } return null; }
/** * Get the named parameter instance (decode). * @param name Parameter name. * @param config Device Delivery Configuration. * @return The Parameter instance for the named parameter (<a href="#decode">decoded to an Object</a>), * or null if not defined. */ public static Object getParameterObject(String name, ContentDeliveryConfig config) { Parameter param = getParamter(name, config); if(param != null) { return param.getValue(config); } return null; }
/** * Get the named parameter from the supplied resource config map. * * @param name The parameter name. * @param resourceConfigurations The resource configuration map. * @return The parameter value, or null if not found. */ public static String getStringParameter(String name, Map<String, List<SmooksResourceConfiguration>> resourceConfigurations) { Parameter parameter = getParameter(name, resourceConfigurations); if(parameter != null) { return parameter.getValue(); } return null; }
/** * Get the named parameter instance (decode). * @param name Parameter name. * @param config Device Delivery Configuration. * @return The Parameter instance for the named parameter (<a href="#decode">decoded to an Object</a>), * or null if not defined. */ public static Object getParameterObject(String name, ContentDeliveryConfig config) { Parameter param = getParamter(name, config); if(param != null) { return param.getValue(config); } return null; }
private static boolean isFeature(String name, FeatureValue featureValue, SmooksResourceConfiguration saxDriverConfig) { if (saxDriverConfig != null) { List<Parameter> features; if (featureValue == FeatureValue.ON) { features = saxDriverConfig.getParameters(FEATURE_ON); } else { features = saxDriverConfig.getParameters(FEATURE_OFF); } if (features != null) { for (Parameter feature : features) { if (feature.getValue().equals(name)) { return true; } } } } return false; }
private void bindParameter(Parameter parameter, ExecutionContext executionContext, Fragment source) { Map<String, Object> params = null; BeanContext beanContext = executionContext.getBeanContext(); try { @SuppressWarnings("unchecked") Map<String, Object> castParams = (Map<String, Object>) beanContext.getBean(beanId); params = castParams; } catch(ClassCastException e) { throw new SmooksException("Illegal use of reserved beanId '" + STATVAR + "'. Must be a Map. Is a " + params.getClass().getName(), e); } if(params == null) { params = new HashMap<String, Object>(); beanContext.addBean(beanId, params, source); } params.put(parameter.getName(), parameter.getValue(executionContext.getDeliveryConfig())); } }
public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException { ExtensionContext extensionContext = ExtensionContext.getExtensionContext(executionContext); SmooksResourceConfiguration config = extensionContext.getResourceStack().peek(); if(config.getSelector() == null || config.getSelector().equals("none")) { Parameter beanIdParam = config.getParameter("beanId"); String beanId = beanIdParam.getValue(); SmooksResourceConfiguration beanCreatorConfig = findBeanCreatorConfig(beanId, extensionContext); if(beanCreatorConfig == null) { throw new SmooksConfigurationException("No <jb:bean> configurations is found yet for beanId '" + beanId + "'. " + "This can mean that no <jb:bean> is present that creates the bean with the bean id or that it is configured after the <" + element.getNodeName() + ">. " + "In this case you must set the selector in the '" + selectorAttrName + "' attribute."); } else { config.setSelector(beanCreatorConfig.getSelector()); } } }
public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException { ExtensionContext extensionContext = ExtensionContext.getExtensionContext(executionContext); SmooksResourceConfiguration config = extensionContext.getResourceStack().peek(); if(config.getSelector() == null || config.getSelector().equals("none")) { Parameter beanIdParam = config.getParameter("beanId"); String beanId = beanIdParam.getValue(); SmooksResourceConfiguration beanCreatorConfig = findBeanCreatorConfig(beanId, extensionContext); if(beanCreatorConfig == null) { throw new SmooksConfigurationException("No <jb:wiring> configurations is found yet for beanId '" + beanId + "'. " + "This can mean that no <jb:wiring> is present that wires the bean with the bean id or that it is configured after the <" + element.getNodeName() + ">. " + "In this case you must set the selector in the '" + selectorAttrName + "' attribute."); } else { config.setSelector(beanCreatorConfig.getSelector()); } } }