@Override public Datastore getDatastore() { return _delegate.getDatastore(); }
private void openConnection(final Datastore datastore) { if (_connection != null && _connection.getDatastore() == datastore) { return; } if (_connection != null) { _connection.close(); _connection = null; } if (datastore != null) { try { _connection = datastore.openConnection(); } catch (final Exception e) { logger.warn("Could not open connection to datastore: {}", datastore); } } }
public AnalysisJobBuilder setDatastoreConnection(final DatastoreConnection datastoreConnection) { if (_datastoreConnection != null) { _datastoreConnection.close(); } _datastoreConnection = datastoreConnection; if (datastoreConnection != null && _datastore == null) { final Datastore datastore = datastoreConnection.getDatastore(); if (datastore != null) { setDatastore(datastore); } } return this; }
private void updateTree() { final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(); final DefaultMutableTreeNode datastoreNode = new DefaultMutableTreeNode(); rootNode.add(datastoreNode); datastoreNode.setUserObject(_datastoreConnection.getDatastore()); final SchemaNavigator schemaNavigator = _datastoreConnection.getSchemaNavigator(); schemaNavigator.refreshSchemas(); final Schema[] schemas = schemaNavigator.getSchemas(); // make sure that information schemas are arranged at the top Arrays.sort(schemas, new SchemaComparator()); for (final Schema schema : schemas) { final DefaultMutableTreeNode schemaNode = new DefaultMutableTreeNode(schema); schemaNode.add(new DefaultMutableTreeNode(LOADING_TABLES_STRING)); datastoreNode.add(schemaNode); } if (_includeLibraryNode) { final DefaultMutableTreeNode libraryRoot = new DefaultMutableTreeNode(LIBRARY_STRING); createLibrary(libraryRoot); rootNode.add(libraryRoot); } final DefaultTreeModel treeModel = new DefaultTreeModel(rootNode); setModel(treeModel); }
@Override public void configureForTransformedData(final AnalysisJobBuilder ajb, final TransformerDescriptor<?> descriptor) { final String dsName = ajb.getDatastoreConnection().getDatastore().getName(); tableName = "output-" + dsName + "-" + descriptor.getDisplayName(); }
@Override public void configureForFilterOutcome(final AnalysisJobBuilder ajb, final FilterDescriptor<?, ?> descriptor, final String categoryName) { final String dsName = ajb.getDatastoreConnection().getDatastore().getName(); tableName = "output-" + dsName + "-" + descriptor.getDisplayName() + "-" + categoryName; }
WidgetFactory.createMenuItem("Create dictionary from column", IconUtils.DICTIONARY_IMAGEPATH); createDictionaryItem.addActionListener(e1 -> { final String datastoreName = _analysisJobBuilder.getDatastoreConnection().getDatastore().getName(); final DatastoreDictionary dictionary = new DatastoreDictionary(column.getName(), datastoreName, column.getQualifiedLabel());
public SimpleDictionary loadIntoMemory(final DatastoreConnection datastoreConnection) { final DataContext dataContext = datastoreConnection.getDataContext(); final Column column = getColumn(datastoreConnection); final Query query = dataContext.query().from(column.getTable()).select(column).toQuery(); if (datastoreConnection.getDatastore().getPerformanceCharacteristics().isQueryOptimizationPreferred()) { query.getSelectClause().setDistinct(true); } final Set<String> values = new HashSet<>(); try (DataSet dataSet = dataContext.executeQuery(query)) { while (dataSet.next()) { final Object value = dataSet.getRow().getValue(0); if (value != null) { values.add(value.toString()); } } } return new SimpleDictionary(getName(), values); }
final DatastoreConnection con = _analysisJobBuilder.getDatastoreConnection(); if (con != null) { _datastore = con.getDatastore();