public OioOjbectChannelFactory(Properties props) { this.props = props; PropertiesUtils.setBeanProperties(this, props, "org.teiid.sockets"); //$NON-NLS-1$ }
public OioOjbectChannelFactory(Properties props) { this.props = props; PropertiesUtils.setBeanProperties(this, props, "org.teiid.sockets"); //$NON-NLS-1$ }
public static void setBeanProperties(Object bean, Properties props, String prefix) { setBeanProperties(bean, props, prefix, false); }
public static void setBeanProperties(Object bean, Properties props, String prefix) { setBeanProperties(bean, props, prefix, false); }
public void initialize(Properties info) { PropertiesUtils.setBeanProperties(this, info, "org.teiid.sockets"); //$NON-NLS-1$ this.channelFactory = new OioOjbectChannelFactory(info); }
public void initialize(Properties info) { PropertiesUtils.setBeanProperties(this, info, "org.teiid.sockets"); //$NON-NLS-1$ this.channelFactory = new OioOjbectChannelFactory(info); }
public MetadataFactory(String vdbName, Object vdbVersion, String schemaName, Map<String, Datatype> runtimeTypes, Properties modelProperties, String rawMetadata) { this.vdbName = vdbName; this.vdbVersion = vdbVersion.toString(); this.dataTypes = Collections.unmodifiableMap(runtimeTypes); this.schema.setName(schemaName); long msb = longHash(vdbName, 0); try { //if this is just an int, we'll use the old style hash int val = Integer.parseInt(this.vdbVersion); msb = 31*msb + val; } catch (NumberFormatException e) { msb = 31*msb + vdbVersion.hashCode(); } msb = longHash(schemaName, msb); this.idPrefix = "tid:" + hex(msb, 12); //$NON-NLS-1$ setUUID(this.schema); if (modelProperties != null) { for (Map.Entry<Object, Object> entry : modelProperties.entrySet()) { if (entry.getKey() instanceof String && entry.getValue() instanceof String) { this.schema.setProperty(resolvePropertyKey(this, (String) entry.getKey()), (String) entry.getValue()); } } PropertiesUtils.setBeanProperties(this, modelProperties, "importer"); //$NON-NLS-1$ } this.modelProperties = modelProperties; this.rawMetadata = rawMetadata; }
/** * Implement to provide metadata to the metadata for use by the engine. This is the * primary method of creating metadata for dynamic VDBs. * @param metadataFactory * @param conn may be null if the source is not required * @throws TranslatorException to indicate a recoverable error, otherwise a RuntimeException * @see #isSourceRequiredForMetadata() */ public void getMetadata(MetadataFactory metadataFactory, C conn) throws TranslatorException { MetadataProcessor mp = getMetadataProcessor(); if (mp != null) { PropertiesUtils.setBeanProperties(mp, metadataFactory.getModelProperties(), "importer"); //$NON-NLS-1$ mp.process(metadataFactory, conn); } }
@Override public void getMetadata(MetadataFactory metadataFactory, WSConnection conn) throws TranslatorException { ODataMetadataProcessor metadataProcessor = (ODataMetadataProcessor)getMetadataProcessor(); PropertiesUtils.setBeanProperties(metadataProcessor, metadataFactory.getModelProperties(), "importer"); //$NON-NLS-1$ metadataProcessor.setExecutionfactory(this); metadataProcessor.process(metadataFactory, conn); }
@Override public void getMetadata(MetadataFactory metadataFactory, WSConnection conn) throws TranslatorException { ODataMetadataProcessor metadataProcessor = (ODataMetadataProcessor)getMetadataProcessor(); PropertiesUtils.setBeanProperties(metadataProcessor, metadataFactory.getModelProperties(), "importer"); //$NON-NLS-1$ metadataProcessor.setExecutionfactory(this); metadataProcessor.process(metadataFactory, conn); }
@Override public void getMetadata(MetadataFactory metadataFactory, Connection conn) throws TranslatorException { try { if (conn == null) { throw new TranslatorException(JDBCPlugin.Event.TEIID11018, JDBCPlugin.Util.gs(JDBCPlugin.Event.TEIID11018)); } JDBCMetadataProcessor metadataProcessor = createMetadataProcessor(); PropertiesUtils.setBeanProperties(metadataProcessor, metadataFactory.getModelProperties(), "importer"); //$NON-NLS-1$ metadataProcessor.getConnectorMetadata(conn, metadataFactory); } catch (SQLException e) { throw new TranslatorException(JDBCPlugin.Event.TEIID11010, e); } }
@Test public void testCaseSensitive() { Properties p = new Properties(); p.setProperty("org.teiid.val", "100"); //$NON-NLS-1$ //$NON-NLS-2$ MyBean test = new MyBean(); PropertiesUtils.setBeanProperties(test, p, "org.teiid", true); assertEquals(100, test.getVal()); }
@Test public void testSetBeanProperties() { Bean bean = new Bean(); Properties p = new Properties(); p.setProperty("prop", "0"); //$NON-NLS-1$//$NON-NLS-2$ p.setProperty("prop1", "1"); //$NON-NLS-1$ //$NON-NLS-2$ p.setProperty("prop2", "2"); //$NON-NLS-1$ //$NON-NLS-2$ p.setProperty("prop3", "3"); //$NON-NLS-1$ //$NON-NLS-2$ p = new Properties(p); p.put("object", new Object()); //$NON-NLS-1$ PropertiesUtils.setBeanProperties(bean, p, null); assertEquals(0, bean.getProp()); assertEquals("1", bean.getProp1()); //$NON-NLS-1$ assertEquals(2d, bean.getProp2(), 0); assertEquals(Arrays.asList("3"), bean.getProp3()); //$NON-NLS-1$ p.setProperty("prop", "?"); //$NON-NLS-1$ //$NON-NLS-2$ try { PropertiesUtils.setBeanProperties(bean, p, null); fail("expected exception"); //$NON-NLS-1$ } catch (InvalidPropertyException e) { } }
@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"); } } } }
PropertiesUtils.setBeanProperties(dt, p, null); if ("string".equals(dt.getName())) { //$NON-NLS-1$ dt.setLength(DataTypeManager.MAX_STRING_LENGTH);
PropertiesUtils.setBeanProperties(dt, p, null); if ("string".equals(dt.getName())) { //$NON-NLS-1$ dt.setLength(DataTypeManager.MAX_STRING_LENGTH);
PropertiesUtils.setBeanProperties(dt, p, null); if ("string".equals(dt.getName())) { //$NON-NLS-1$ dt.setLength(DataTypeManager.MAX_STRING_LENGTH);
options.setAssumeMatchingCollation(false); options.setProperties(config.getProperties()); PropertiesUtils.setBeanProperties(options, options.getProperties(), "org.teiid", true); //$NON-NLS-1$
options.setAssumeMatchingCollation(false); options.setProperties(config.getProperties()); PropertiesUtils.setBeanProperties(options, options.getProperties(), "org.teiid", true); //$NON-NLS-1$
options.setAssumeMatchingCollation(false); options.setProperties(config.getProperties()); PropertiesUtils.setBeanProperties(options, options.getProperties(), "org.teiid", true); //$NON-NLS-1$