@Override public void loadMetadata(MetadataFactory factory, ExecutionFactory executionFactory, Object connectionFactory) throws TranslatorException { if (executionFactory == null ) { throw new TranslatorException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30591, factory.getName())); } if (connectionFactory == null && executionFactory.isSourceRequiredForMetadata()) { throw new TranslatorException(QueryPlugin.Event.TEIID31097, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31097)); } ClassLoader originalCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(executionFactory.getClass().getClassLoader()); getMetadata(factory, executionFactory, connectionFactory); } finally { Thread.currentThread().setContextClassLoader(originalCL); } }
@Override public void loadMetadata(MetadataFactory factory, ExecutionFactory executionFactory, Object connectionFactory) throws TranslatorException { if (executionFactory == null ) { throw new TranslatorException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30591, factory.getName())); } if (connectionFactory == null && executionFactory.isSourceRequiredForMetadata()) { throw new TranslatorException(QueryPlugin.Event.TEIID31097, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31097)); } ClassLoader originalCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(executionFactory.getClass().getClassLoader()); getMetadata(factory, executionFactory, connectionFactory); } finally { Thread.currentThread().setContextClassLoader(originalCL); } }
@Override public void loadMetadata(MetadataFactory factory, ExecutionFactory executionFactory, Object connectionFactory) throws TranslatorException { if (executionFactory == null ) { throw new TranslatorException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30591, factory.getName())); } if (connectionFactory == null && executionFactory.isSourceRequiredForMetadata()) { throw new TranslatorException(QueryPlugin.Event.TEIID31097, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31097)); } ClassLoader originalCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(executionFactory.getClass().getClassLoader()); getMetadata(factory, executionFactory, connectionFactory); } finally { Thread.currentThread().setContextClassLoader(originalCL); } }
private void addForeignKey(MetadataFactory mf, String name, List<String> columnNames, String referenceTable, Table table) throws TranslatorException { ForeignKey fk = mf.addForeignKey("FK_"+name, columnNames, referenceTable, table); for (String column:columnNames) { Column c = table.getColumnByName(column); c.setProperty(KEY_ASSOSIATED_WITH_FOREIGN_TABLE, mf.getName()+Tokens.DOT+referenceTable); } fk.setNameInSource(name); }
@Override public synchronized void loadMetadata(MetadataFactory factory, ExecutionFactory executionFactory, Object connectionFactory) throws TranslatorException { try { loadAll(factory.getDataTypes().values(), factory.getVDBResources()); } catch (IOException e) { throw new TranslatorException(e); } String modelName = factory.getName(); // the index map below is keyed by uuid not modelname, so map lookup is not possible Collection<AbstractMetadataRecord> modelRecords = getByType(MetadataConstants.RECORD_TYPE.MODEL).values(); for (AbstractMetadataRecord modelRecord:modelRecords) { Schema s = (Schema) modelRecord; if (!s.getName().equalsIgnoreCase(modelName)) { continue; } getTables(s); getProcedures(s); factory.setSchema(s); return; } throw new TranslatorException(RuntimeMetadataPlugin.Util.gs(RuntimeMetadataPlugin.Event.TEIID80004, factory.getName())); }
@Override public synchronized void loadMetadata(MetadataFactory factory, ExecutionFactory executionFactory, Object connectionFactory) throws TranslatorException { try { loadAll(factory.getDataTypes().values(), factory.getVDBResources()); } catch (IOException e) { throw new TranslatorException(e); } String modelName = factory.getName(); // the index map below is keyed by uuid not modelname, so map lookup is not possible Collection<AbstractMetadataRecord> modelRecords = getByType(MetadataConstants.RECORD_TYPE.MODEL).values(); for (AbstractMetadataRecord modelRecord:modelRecords) { Schema s = (Schema) modelRecord; if (!s.getName().equalsIgnoreCase(modelName)) { continue; } getTables(s); getProcedures(s); factory.setSchema(s); return; } throw new TranslatorException(RuntimeMetadataPlugin.Util.gs(RuntimeMetadataPlugin.Event.TEIID80004, factory.getName())); }
throw new TranslatorException(QueryPlugin.Event.TEIID31178, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31178, factory.getName())); } catch (Exception e) { if (executionFactory.isSourceRequiredForMetadata()) { throw new TranslatorException(QueryPlugin.Event.TEIID30477, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30477, factory.getName()));
throw new TranslatorException(QueryPlugin.Event.TEIID31178, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31178, factory.getName())); } catch (Exception e) { if (executionFactory.isSourceRequiredForMetadata()) { throw new TranslatorException(QueryPlugin.Event.TEIID30477, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30477, factory.getName()));
throw new TranslatorException(QueryPlugin.Event.TEIID31178, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31178, factory.getName())); } catch (ResourceException e) { if (executionFactory.isSourceRequiredForMetadata()) { throw new TranslatorException(QueryPlugin.Event.TEIID30477, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30477, factory.getName()));