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 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; } }
/** * 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); } }
/** * 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); }
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"); } }
/** * 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); } }
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; } }
String dataSources = MiscellaneousUtil.getProperty(dsProperties, DataSourceConstants.PROP_SYNAPSE_PREFIX_DS, null);
String dataSources = MiscellaneousUtil.getProperty(dsProperties, DataSourceConstants.PROP_SYNAPSE_PREFIX_DS, null);
namingFactory = MiscellaneousUtil.getProperty( dsProperties, rootPrefix + DataSourceConstants.PROP_IC_FACTORY, DataSourceConstants.DEFAULT_IC_FACTORY); providerUrl = MiscellaneousUtil.getProperty( dsProperties, rootPrefix + DataSourceConstants.PROP_PROVIDER_URL, null); providerPort = MiscellaneousUtil.getProperty(dsProperties, rootPrefix + DataSourceConstants.PROP_PROVIDER_PORT, String.valueOf(DataSourceConstants.DEFAULT_PROVIDER_PORT));
String beanstalkNameList = MiscellaneousUtil.getProperty(props, EnterpriseBeanstalkConstants.SYNAPSE_BEANSTALK_PREFIX, null);
namingFactory = MiscellaneousUtil.getProperty( dsProperties, rootPrefix + DataSourceConstants.PROP_IC_FACTORY, DataSourceConstants.DEFAULT_IC_FACTORY); providerUrl = MiscellaneousUtil.getProperty( dsProperties, rootPrefix + DataSourceConstants.PROP_PROVIDER_URL, null); providerPort = MiscellaneousUtil.getProperty(dsProperties, rootPrefix + DataSourceConstants.PROP_PROVIDER_PORT, String.valueOf(DataSourceConstants.DEFAULT_PROVIDER_PORT));
String beanstalkNameList = MiscellaneousUtil.getProperty(props, EnterpriseBeanstalkConstants.SYNAPSE_BEANSTALK_PREFIX, null);
String driver = MiscellaneousUtil.getProperty( properties, prefix + DataSourceConstants.PROP_DRIVER_CLS_NAME, null); if (driver == null) { String url = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_URL, null); if (url == null) { String dataSourceName = MiscellaneousUtil.getProperty( properties, prefix + DataSourceConstants.PROP_DS_NAME, dsName, String.class); datasourceInformation.setDatasourceName(dataSourceName); String dsType = MiscellaneousUtil.getProperty( properties, prefix + DataSourceConstants.PROP_TYPE, DataSourceConstants.PROP_BASIC_DATA_SOURCE, String.class); String repositoryType = MiscellaneousUtil.getProperty( properties, prefix + DataSourceConstants.PROP_REGISTRY, DataSourceConstants.PROP_REGISTRY_MEMORY, String.class); Integer maxActive = MiscellaneousUtil.getProperty( properties, prefix + DataSourceConstants.PROP_MAX_ACTIVE, GenericObjectPool.DEFAULT_MAX_ACTIVE, Integer.class); datasourceInformation.setMaxActive(maxActive); Integer maxIdle = MiscellaneousUtil.getProperty( properties, prefix + DataSourceConstants.PROP_MAX_IDLE, GenericObjectPool.DEFAULT_MAX_IDLE, Integer.class);
String driver = MiscellaneousUtil.getProperty( properties, prefix + DataSourceConstants.PROP_DRIVER_CLS_NAME, null); if (driver == null) { String url = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_URL, null); if (url == null) { String dataSourceName = MiscellaneousUtil.getProperty( properties, prefix + DataSourceConstants.PROP_DS_NAME, dsName, String.class); datasourceInformation.setDatasourceName(dataSourceName); String dsType = MiscellaneousUtil.getProperty( properties, prefix + DataSourceConstants.PROP_TYPE, DataSourceConstants.PROP_BASIC_DATA_SOURCE, String.class); String repositoryType = MiscellaneousUtil.getProperty( properties, prefix + DataSourceConstants.PROP_REGISTRY, DataSourceConstants.PROP_REGISTRY_MEMORY, String.class); Integer maxActive = MiscellaneousUtil.getProperty( properties, prefix + DataSourceConstants.PROP_MAX_ACTIVE, GenericObjectPool.DEFAULT_MAX_ACTIVE, Integer.class); datasourceInformation.setMaxActive(maxActive); Integer maxIdle = MiscellaneousUtil.getProperty( properties, prefix + DataSourceConstants.PROP_MAX_IDLE, GenericObjectPool.DEFAULT_MAX_IDLE, Integer.class);
int jndiPort = MiscellaneousUtil.getProperty( properties, prefix + JmxConfigurationConstants.PROP_JNDI_PORT, -1, Integer.class); jmxInformation.setJndiPort(jndiPort); int rmiPort = MiscellaneousUtil.getProperty( properties, prefix + JmxConfigurationConstants.PROP_RMI_PORT, 0, Integer.class); jmxInformation.setRmiPort(rmiPort); String jmxHostName = MiscellaneousUtil.getProperty( properties, prefix + JmxConfigurationConstants.PROP_HOSTNAME, null); if (jmxHostName == null || jmxHostName.trim().length() == 0) { value = MiscellaneousUtil.getProperty( properties, prefix + JmxConfigurationConstants.PROP_REMOTE_ACCESS_FILE, null); remoteSSL = Boolean.valueOf(value); } else { remoteSSL = MiscellaneousUtil.getProperty( properties, prefix + JmxConfigurationConstants.PROP_REMOTE_SSL, Boolean.FALSE, Boolean.class);
int jndiPort = MiscellaneousUtil.getProperty( properties, prefix + JmxConfigurationConstants.PROP_JNDI_PORT, -1, Integer.class); jmxInformation.setJndiPort(jndiPort); int rmiPort = MiscellaneousUtil.getProperty( properties, prefix + JmxConfigurationConstants.PROP_RMI_PORT, 0, Integer.class); jmxInformation.setRmiPort(rmiPort); String jmxHostName = MiscellaneousUtil.getProperty( properties, prefix + JmxConfigurationConstants.PROP_HOSTNAME, null); if (jmxHostName == null || jmxHostName.trim().length() == 0) { value = MiscellaneousUtil.getProperty( properties, prefix + JmxConfigurationConstants.PROP_REMOTE_ACCESS_FILE, null); remoteSSL = Boolean.valueOf(value); } else { remoteSSL = MiscellaneousUtil.getProperty( properties, prefix + JmxConfigurationConstants.PROP_REMOTE_SSL, Boolean.FALSE, Boolean.class);
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 {