public OioOjbectChannelFactory(Properties props) { this.props = props; PropertiesUtils.setBeanProperties(this, props, "org.teiid.sockets"); //$NON-NLS-1$ }
/** * Returns the hex string representing the binary value. */ @Override public String toString() { return PropertiesUtils.toHex(bytes); }
/** * Performs a correct deep clone of the properties object by capturing * all properties in the default(s) and placing them directly into the * new Properties object. */ public static Properties clone( Properties props ) { return clone(props, null, false); }
/** * Performs a correct deep clone of the properties object by capturing * all properties in the default(s) and placing them directly into the * new Properties object. */ public static Properties clone( Properties props, Properties defaults, boolean deepClone ) { Properties result = null; if ( defaults != null ) { if ( deepClone ) { defaults = clone(defaults); } result = new Properties(defaults); } else { result = new Properties(); } putAll(result, props); return result; }
@Test public void testCombinedProperties() { String old = System.setProperty("org.teiid.val", "200"); try { MyBean test = new MyBean(); PropertiesUtils.setBeanProperties(test, PropertiesUtils.getCombinedProperties(), "org.teiid", true); assertEquals(200, test.getVal()); } finally { if (old != null) { System.setProperty("org.teiid.val", old); } else { System.clearProperty("org.teiid.val"); } } } }
private static Locale getSymbolLocale() { return PropertiesUtils.getBooleanProperty(System.getProperties(), "org.teiid.enDateNames", false)?Locale.ENGLISH:Locale.getDefault(); //$NON-NLS-1$ }
/** * Search for the property first in the environment, then in the system properties * @param key * @param defaultValue * @param clazz * @return */ public static String getHierarchicalProperty(String key, String defaultValue) { return getHierarchicalProperty(key, defaultValue, String.class); }
public DQPConfiguration() { properties = PropertiesUtils.getCombinedProperties(); }
public static SSLSocketFactory getSSLSocketFactory(Properties props) throws IOException, GeneralSecurityException{ String keystore = props.getProperty(KEYSTORE_FILENAME); String keystorePassword = props.getProperty(KEYSTORE_PASSWORD); String keystoreType = props.getProperty(KEYSTORE_TYPE, DEFAULT_KEYSTORE_TYPE); String keystoreProtocol = props.getProperty(PROTOCOL, DEFAULT_PROTOCOL); String keystoreAlgorithm = props.getProperty(KEYSTORE_ALGORITHM); String truststore = props.getProperty(TRUSTSTORE_FILENAME, keystore); String truststorePassword = props.getProperty(TRUSTSTORE_PASSWORD, keystorePassword); String keyAlias = props.getProperty(KEYSTORE_ALIAS); String keyPassword = props.getProperty(KEY_PASSWORD); boolean anon = PropertiesUtils.getBooleanProperty(props, ALLOW_ANON, true); boolean trustAll = PropertiesUtils.getBooleanProperty(props, TRUST_ALL, false); boolean checkExpired = PropertiesUtils.getBooleanProperty(props, CHECK_EXPIRED, false); SSLContext result = null; // 1) keystore != null = 2 way SSL (can define a separate truststore too) // 2) truststore != null = 1 way SSL (here we can define custom properties for truststore; useful when // client like a appserver have to define multiple certs without importing // all the certificates into one single certificate // 3) else = javax properties; this is default way to define the SSL anywhere. if (keystore != null || truststore != null || trustAll || checkExpired) { result = getSSLContext(keystore, keystorePassword, truststore, truststorePassword, keystoreAlgorithm, keystoreType, keystoreProtocol, keyAlias, keyPassword, trustAll, checkExpired); } else { result = SSLContext.getDefault(); } //TODO: could allow a custom SSLSocketFactory to be plugged in like the pg jdbc driver return new SSLSocketFactory(result, anon); }
/** * Search for the property first in the environment, then in the system properties * @param key * @param defaultValue * @param clazz * @return */ public static String getHierarchicalProperty(String key, String defaultValue) { return getHierarchicalProperty(key, defaultValue, String.class); }
/** * Performs a correct deep clone of the properties object by capturing * all properties in the default(s) and placing them directly into the * new Properties object. */ public static Properties clone( Properties props, Properties defaults, boolean deepClone ) { Properties result = null; if ( defaults != null ) { if ( deepClone ) { defaults = clone(defaults); } result = new Properties(defaults); } else { result = new Properties(); } putAll(result, props); return result; }
public DQPConfiguration() { properties = PropertiesUtils.getCombinedProperties(); }
public OioOjbectChannelFactory(Properties props) { this.props = props; PropertiesUtils.setBeanProperties(this, props, "org.teiid.sockets"); //$NON-NLS-1$ }
/** * Returns the hex string representing the binary value. */ @Override public String toString() { return PropertiesUtils.toHex(bytes); }
/** * Performs a correct deep clone of the properties object by capturing * all properties in the default(s) and placing them directly into the * new Properties object. */ public static Properties clone( Properties props ) { return clone(props, null, false); }
public <T> T getService(Class<T> iface) { return iface.cast(Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {iface}, new SocketServerInstanceImpl.RemoteInvocationHandler(iface, PropertiesUtils.getBooleanProperty(connProps, TeiidURL.CONNECTION.ENCRYPT_REQUESTS, false)) { @Override protected SocketServerInstance getInstance() throws CommunicationException {
private static Locale getSymbolLocale() { return PropertiesUtils.getHierarchicalProperty("org.teiid.enDateNames", false, Boolean.class)?Locale.ENGLISH:Locale.getDefault(); //$NON-NLS-1$ }
public static synchronized SocketServerConnectionFactory getInstance() { if (INSTANCE == null) { INSTANCE = new SocketServerConnectionFactory(); Properties props = PropertiesUtils.getCombinedProperties(); InputStream is = SocketServerConnectionFactory.class.getResourceAsStream("/teiid-client-settings.properties"); //$NON-NLS-1$ if (is != null) { Properties newProps = new Properties(); try { newProps.load(is); } catch (IOException e) { } finally { try { is.close(); } catch (IOException e) { } } props.putAll(newProps); } INSTANCE.initialize(props); } return INSTANCE; }
public static void setBeanProperties(Object bean, Properties props, String prefix) { setBeanProperties(bean, props, prefix, false); }