protected void applySettings(Smooks smooks) { // Remove the old params... ParameterAccessor.removeParameter(Filter.STREAM_FILTER_TYPE, smooks); ParameterAccessor.removeParameter(Filter.ENTITIES_REWRITE, smooks); ParameterAccessor.removeParameter(Filter.DEFAULT_SERIALIZATION_ON, smooks); ParameterAccessor.removeParameter(Filter.TERMINATE_ON_VISITOR_EXCEPTION, smooks); ParameterAccessor.removeParameter(Filter.MAINTAIN_ELEMENT_STACK, smooks); ParameterAccessor.removeParameter(Filter.CLOSE_SOURCE, smooks); ParameterAccessor.removeParameter(Filter.CLOSE_RESULT, smooks); ParameterAccessor.removeParameter(Filter.READER_POOL_SIZE, smooks); // Set the params... ParameterAccessor.setParameter(Filter.STREAM_FILTER_TYPE, filterType.toString(), smooks); ParameterAccessor.setParameter(Filter.ENTITIES_REWRITE, Boolean.toString(rewriteEntities), smooks); ParameterAccessor.setParameter(Filter.DEFAULT_SERIALIZATION_ON, Boolean.toString(defaultSerializationOn), smooks); ParameterAccessor.setParameter(Filter.TERMINATE_ON_VISITOR_EXCEPTION, Boolean.toString(terminateOnException), smooks); ParameterAccessor.setParameter(Filter.MAINTAIN_ELEMENT_STACK, Boolean.toString(maintainElementStack), smooks); ParameterAccessor.setParameter(Filter.CLOSE_SOURCE, Boolean.toString(closeSource), smooks); ParameterAccessor.setParameter(Filter.CLOSE_RESULT, Boolean.toString(closeResult), smooks); ParameterAccessor.setParameter(Filter.READER_POOL_SIZE, Integer.toString(readerPoolSize), smooks); }
public boolean isDefaultSerializationOn() { if(isDefaultSerializationOn == null) { isDefaultSerializationOn = ParameterAccessor.getBoolParameter(Filter.DEFAULT_SERIALIZATION_ON, true, this); } return isDefaultSerializationOn; }
/** * Get the named SmooksResourceConfiguration parameter as a boolean. * @param name Name of parameter to get. * @param defaultVal The default value to be returned if there are no * parameters on the this SmooksResourceConfiguration instance, or the parameter is not defined. * @param config The config map. * @return true if the parameter is set to true, defaultVal if not defined, otherwise false. */ public static boolean getBoolParameter(String name, boolean defaultVal, Map<String, List<SmooksResourceConfiguration>> config) { Parameter param = getParameter(name, config); return toBoolean(param, defaultVal); }
/** * Get the named SmooksResourceConfiguration parameter as a boolean. * @param name Name of parameter to get. * @param defaultVal The default value to be returned if there are no * parameters on the this SmooksResourceConfiguration instance, or the parameter is not defined. * @param config The {@link ContentDeliveryConfig} for the requesting device. * @return true if the parameter is set to true, defaultVal if not defined, otherwise false. */ public static boolean getBoolParameter(String name, boolean defaultVal, ContentDeliveryConfig config) { Parameter param = getParamter(name, config); return toBoolean(param, defaultVal); }
/** * Set the default stream filter type on the supplied Smooks instance. * @param smooks The Smooks instance. * @param filterType The filter type. * @deprecated Use {@link #setFilterType(org.milyn.Smooks, org.milyn.StreamFilterType)}. */ public static void setFilterType(Smooks smooks, StreamFilterType filterType) { ParameterAccessor.setParameter(STREAM_FILTER_TYPE, filterType.toString(), smooks); }
public String getConfigParameter(String name, String defaultVal) { return ParameterAccessor.getStringParameter(name, defaultVal, deliveryConfig); }
/** * 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; }
/** * Set the default stream filter type on the supplied Smooks instance. * @param smooks The Smooks instance. * @param filterType The filter type. */ public static void setFilterType(Smooks smooks, org.milyn.StreamFilterType filterType) { ParameterAccessor.setParameter(STREAM_FILTER_TYPE, filterType.toString(), smooks); }
public String getConfigParameter(String name, String defaultVal) { return ParameterAccessor.getStringParameter(name, defaultVal, deliveryConfig); }
/** * Get the named SmooksResourceConfiguration parameter as a boolean. * @param name Name of parameter to get. * @param defaultVal The default value to be returned if there are no * parameters on the this SmooksResourceConfiguration instance, or the parameter is not defined. * @param config The {@link ContentDeliveryConfig} for the requesting device. * @return true if the parameter is set to true, defaultVal if not defined, otherwise false. */ public static boolean getBoolParameter(String name, boolean defaultVal, ContentDeliveryConfig config) { Parameter param = getParamter(name, config); return toBoolean(param, 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 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; }
public boolean isDefaultSerializationOn() { if(isDefaultSerializationOn == null) { isDefaultSerializationOn = ParameterAccessor.getBoolParameter(Filter.DEFAULT_SERIALIZATION_ON, true, this); } return isDefaultSerializationOn; }
protected void applySettings(Smooks smooks) { // Remove the old params... ParameterAccessor.removeParameter(Filter.STREAM_FILTER_TYPE, smooks); ParameterAccessor.removeParameter(Filter.ENTITIES_REWRITE, smooks); ParameterAccessor.removeParameter(Filter.DEFAULT_SERIALIZATION_ON, smooks); ParameterAccessor.removeParameter(Filter.TERMINATE_ON_VISITOR_EXCEPTION, smooks); ParameterAccessor.removeParameter(Filter.MAINTAIN_ELEMENT_STACK, smooks); ParameterAccessor.removeParameter(Filter.CLOSE_SOURCE, smooks); ParameterAccessor.removeParameter(Filter.CLOSE_RESULT, smooks); ParameterAccessor.removeParameter(Filter.READER_POOL_SIZE, smooks); // Set the params... ParameterAccessor.setParameter(Filter.STREAM_FILTER_TYPE, filterType.toString(), smooks); ParameterAccessor.setParameter(Filter.ENTITIES_REWRITE, Boolean.toString(rewriteEntities), smooks); ParameterAccessor.setParameter(Filter.DEFAULT_SERIALIZATION_ON, Boolean.toString(defaultSerializationOn), smooks); ParameterAccessor.setParameter(Filter.TERMINATE_ON_VISITOR_EXCEPTION, Boolean.toString(terminateOnException), smooks); ParameterAccessor.setParameter(Filter.MAINTAIN_ELEMENT_STACK, Boolean.toString(maintainElementStack), smooks); ParameterAccessor.setParameter(Filter.CLOSE_SOURCE, Boolean.toString(closeSource), smooks); ParameterAccessor.setParameter(Filter.CLOSE_RESULT, Boolean.toString(closeResult), smooks); ParameterAccessor.setParameter(Filter.READER_POOL_SIZE, Integer.toString(readerPoolSize), smooks); }
/** * Set the default stream filter type on the supplied Smooks instance. * @param smooks The Smooks instance. * @param filterType The filter type. * @deprecated Use {@link #setFilterType(org.milyn.Smooks, org.milyn.StreamFilterType)}. */ public static void setFilterType(Smooks smooks, StreamFilterType filterType) { ParameterAccessor.setParameter(STREAM_FILTER_TYPE, filterType.toString(), smooks); }
public String getConfigParameter(String name, String defaultVal) { return ParameterAccessor.getStringParameter(name, defaultVal, deliveryConfig); }
/** * Get the named SmooksResourceConfiguration parameter as a boolean. * @param name Name of parameter to get. * @param defaultVal The default value to be returned if there are no * parameters on the this SmooksResourceConfiguration instance, or the parameter is not defined. * @param config The {@link ContentDeliveryConfig} for the requesting device. * @return true if the parameter is set to true, defaultVal if not defined, otherwise false. */ public static boolean getBoolParameter(String name, boolean defaultVal, ContentDeliveryConfig config) { Parameter param = getParamter(name, config); return toBoolean(param, defaultVal); }
/** * Get the named SmooksResourceConfiguration parameter as a boolean. * @param name Name of parameter to get. * @param defaultVal The default value to be returned if there are no * parameters on the this SmooksResourceConfiguration instance, or the parameter is not defined. * @param config The config map. * @return true if the parameter is set to true, defaultVal if not defined, otherwise false. */ public static boolean getBoolParameter(String name, boolean defaultVal, Map<String, List<SmooksResourceConfiguration>> config) { Parameter param = getParameter(name, config); return toBoolean(param, 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; }