/**
   * {@inheritDoc}
   *
   * @see org.teiid.designer.vdb.connections.SourceHandler#getDataSourceNames()
   */
  @Override
  public String[] getDataSourceNames() {
    Server defaultServer = getDefaultServer();

    if ((defaultServer != null) && defaultServer.isConnected()) {
      Collection<TeiidDataSource> dataSources = null;

      try {
        dataSources = defaultServer.getAdmin().getDataSources();
      } catch (Exception e) {
        UTIL.log(
            IStatus.ERROR,
            e,
            UTIL.getString(
                "VdbSourceConnectionHandler.errorObtainingDataSources",
                defaultServer.getHost())); // $NON-NLS-1$
      }

      if (dataSources != null) {
        Collection<String> dataSourceNames = new ArrayList<String>();

        for (TeiidDataSource dataSource : dataSources) {
          if (!dataSource.isPreview()) {
            dataSourceNames.add(dataSource.getName());
          }
        }

        return dataSourceNames.toArray(new String[dataSourceNames.size()]);
      }
    }

    return null;
  }
Ejemplo n.º 2
0
        /**
         * {@inheritDoc}
         *
         * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer,
         *     java.lang.Object, java.lang.Object)
         */
        @Override
        public boolean select(Viewer viewer, Object parentElement, Object element) {
          TeiidDataSource dataSource = RuntimeAssistant.adapt(element, TeiidDataSource.class);
          if (dataSource != null && dataSource.isPreview()) return false;

          return true;
        }