public ThreadingView(String threadNamePrefix, boolean periodicLogs, double alertMargin) { this(threadNamePrefix); Properties props = MiscellaneousUtil.loadProperties("synapse.properties"); String jmxEnabled = MiscellaneousUtil.getProperty(props, JmxConfigurationConstants.PROP_THREAD_JMX_ENABLE,"true"); if("false".equals(jmxEnabled)){ this.threadJMXViewEnabled = false; } this.periodicLogs = periodicLogs; if (alertMargin > 0 && alertMargin < 100) { this.alertMargin = alertMargin; } else { log.warn("Invalid alert margin for the thread group: " + threadNamePrefix + " - " + "Using default value"); } }
result = binOut.toByteArray(); } catch (IOException e) { handleException("Error serializing object : " + data); } finally { if (binOut != null) {
private boolean isValid(Properties dsProperties) { String dataSources = MiscellaneousUtil.getProperty(dsProperties, DataSourceConstants.PROP_SYNAPSE_PREFIX_DS, null); if (dataSources != null && !"".equals(dataSources)) { String[] dataSourcesNames = dataSources.split(","); return !(dataSourcesNames == null || dataSourcesNames.length == 0); } return false; } }
private NHttpConfiguration() { try { props = MiscellaneousUtil.loadProperties("nhttp.properties"); populatePreserveHttpHeaders(); } catch (Exception ignore) {} }
MiscellaneousUtil.serialize(jndiEvn))); ref.add(new StringRefAddr( DataSourceConstants.PROP_DATA_SOURCE_NAME, name));
List<SynapseHandler> handlers = new ArrayList<>(); OMElement handlersConfig = MiscellaneousUtil.loadXMLConfig(SynapseConstants.SYNAPSE_HANDLER_FILE); if (handlersConfig != null) {
private boolean isValid(Properties dsProperties) { String dataSources = MiscellaneousUtil.getProperty(dsProperties, DataSourceConstants.PROP_SYNAPSE_PREFIX_DS, null); if (dataSources != null && !"".equals(dataSources)) { String[] dataSourcesNames = dataSources.split(","); return !(dataSourcesNames == null || dataSourcesNames.length == 0); } return false; } }
/** * Loads the properties * This happen only cached properties are null. * * @return Synapse Properties */ public static Properties loadSynapseProperties() { if (reload) { if (log.isDebugEnabled()) { log.debug("Loading synapse properties from a property file"); } cacheProperties.putAll(MiscellaneousUtil.loadProperties( SynapseConstants.SYNAPSE_PROPERTIES)); reload = false; } else { if (log.isDebugEnabled()) { log.debug("Retrieving synapse properties from the cache"); } } // Original properties needed to be preserved Properties tempProperties = new Properties(); tempProperties.putAll(cacheProperties); return tempProperties; }
MiscellaneousUtil.serialize(jndiEvn))); ref.add(new StringRefAddr( DataSourceConstants.PROP_DATA_SOURCE_NAME, name));
public TargetHandler(DeliveryAgent deliveryAgent, ClientConnFactory connFactory, TargetConfiguration configuration) { this.deliveryAgent = deliveryAgent; this.connFactory = connFactory; this.targetConfiguration = configuration; this.targetErrorHandler = new TargetErrorHandler(targetConfiguration); this.metrics = targetConfiguration.getMetrics(); Properties props = MiscellaneousUtil.loadProperties(PROPERTY_FILE); String validationProperty = MiscellaneousUtil.getProperty(props, MESSAGE_SIZE_VALIDATION, "false"); String validMaxMessageSizeStr = MiscellaneousUtil .getProperty(props, VALID_MAX_MESSAGE_SIZE, String.valueOf(Integer.MAX_VALUE)); isMessageSizeValidationEnabled = Boolean.valueOf(validationProperty); try { validMaxMessageSize = Integer.valueOf(validMaxMessageSizeStr); } catch (NumberFormatException e) { log.warn("Invalid max message size configured for property \"valid.max.message.size.in.bytes\", " + "setting the Integer MAX_VALUE as the valid maximum message size", e); validMaxMessageSize = Integer.MAX_VALUE; } }
/** * Load a value of the property from the synapse properties * * @param key Key of the property * @param defaultValue Default value * @return Value of the property */ public static String getPropertyValue(String key, String defaultValue) { return MiscellaneousUtil.getProperty(loadSynapseProperties(), key, defaultValue); } }
/** * Get instance of TenantInfoInitiator loaded based on synapse property path * * @return TenantInfoInitiator instance */ public static TenantInfoInitiator getTenantInfoInitiator() { if (tenantInfoInitiatorInstance == null) { try { Properties properties = MiscellaneousUtil.loadProperties(PROPERTY_FILE_PATH); String property = properties.getProperty(CARBON_TENANT_INFO_INITIATOR); if (property != null) { Class clazz = TenantInfoInitiator.class.getClassLoader(). loadClass(property.trim()); tenantInfoInitiatorInstance = (TenantInfoInitiator) clazz.newInstance(); } } catch (Exception e) { logger.error("Error while initializing tenant info configuration provider. Error:" + e.getLocalizedMessage()); } } return tenantInfoInitiatorInstance; } }
result = binOut.toByteArray(); } catch (IOException e) { handleException("Error serializing object : " + data); } finally { if (binOut != null) {
Properties props = MiscellaneousUtil.loadProperties(PROPERTY_FILE); String validationProperty = MiscellaneousUtil.getProperty(props, MESSAGE_SIZE_VALIDATION, "false"); String validMaxMessageSizeStr = MiscellaneousUtil .getProperty(props, VALID_MAX_MESSAGE_SIZE, String.valueOf(Integer.MAX_VALUE)); isMessageSizeValidationEnabled = Boolean.valueOf(validationProperty); try {
/** * Load a value of the property from the synapse properties * * @param key Key of the property * @param defaultValue Default value * @return Value of the property */ public static String getPropertyValue(String key, String defaultValue) { return MiscellaneousUtil.getProperty(loadSynapseProperties(), key, defaultValue); }
/** * Loads the properties * This happen only cached properties are null. * * @return Synapse Properties */ public static Properties loadSynapseProperties() { if (reload) { if (log.isDebugEnabled()) { log.debug("Loading synapse properties from a property file"); } cacheProperties.putAll(MiscellaneousUtil.loadProperties( SynapseConstants.SYNAPSE_PROPERTIES)); reload = false; } else { if (log.isDebugEnabled()) { log.debug("Retrieving synapse properties from the cache"); } } // Original properties needed to be preserved Properties tempProperties = new Properties(); tempProperties.putAll(cacheProperties); return tempProperties; }
return (T) Long.valueOf(Long.parseLong(result)); } else { handleException("Unsupported type : " + type);
/** * Get the boolean value of the property from the synapse properties. * * @param name name of the config property * @param def default value to return if the property is not set * @return the value of the property to be used */ public static Boolean getBooleanProperty(String name, Boolean def) { String val = MiscellaneousUtil.getProperty(loadSynapseProperties(), name, String.valueOf(def)); if (val == null) { if (log.isDebugEnabled()) { log.debug("Parameter : " + name + " is not defined in the synapse.properties file."); } return def; } if (log.isDebugEnabled()) { log.debug("synapse.properties parameter : " + name + " = " + val); } return Boolean.valueOf(val); } }
/** * Create a script mediator for the given language and given script entry key and function. * * @param language the BSF language * @param includeKeysMap Include script keys * @param key the registry entry key to load the script * @param function the function to be invoked */ public ScriptMediator(String language, Map<Value, Object> includeKeysMap, Value key, String function, ClassLoader classLoader) { this.language = language; this.key = key; this.setLoader(classLoader); this.includes = includeKeysMap; if (function != null) { this.function = function; } Properties properties = MiscellaneousUtil.loadProperties("synapse.properties"); poolSize = Integer.parseInt(properties.getProperty(POOL_SIZE_PROPERTY, String.valueOf(DEFAULT_POOL_SIZE))); initScriptEngine(); if (!(scriptEngine instanceof Invocable)) { throw new SynapseException("Script engine is not an Invocable" + " engine for language: " + language); } }
return (T) Long.valueOf(Long.parseLong(result)); } else { handleException("Unsupported type : " + type);