Codota Logo
JdbcDatastore
Code IndexAdd Codota to your IDE (free)

How to use
JdbcDatastore
in
org.datacleaner.connection

Best Java code snippets using org.datacleaner.connection.JdbcDatastore (Showing top 17 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: datacleaner/DataCleaner

ds.setAttribute("name", datastore.getName());
if (!Strings.isNullOrEmpty(datastore.getDescription())) {
  ds.setAttribute("description", datastore.getDescription());
final String jndiUrl = datastore.getDatasourceJndiUrl();
if (Strings.isNullOrEmpty(jndiUrl)) {
  appendElement(ds, "url", datastore.getJdbcUrl());
  appendElement(ds, "driver", datastore.getDriverClass());
  appendElement(ds, "username", datastore.getUsername());
  appendElement(ds, "password", encodePassword(datastore.getPassword()));
  appendElement(ds, "multiple-connections", datastore.isMultipleConnections() + "");
} else {
  appendElement(ds, "datasource-jndi-url", jndiUrl);
final TableType[] tableTypes = datastore.getTableTypes();
if (tableTypes != null && tableTypes.length != 0 && !Arrays.equals(TableType.DEFAULT_TABLE_TYPES, tableTypes)) {
  final Element tableTypesElement = getDocument().createElement("table-types");
final String catalogName = datastore.getCatalogName();
if (!Strings.isNullOrEmpty(catalogName)) {
  appendElement(ds, "catalog-name", catalogName);
origin: datacleaner/DataCleaner

@Override
public void close() {
  try {
    _insertStatement.close();
  } catch (final Exception e) {
    // do nothing
  }
  DatastoreOutputWriterFactory.release(this);
  final Datastore datastore = new JdbcDatastore(_datastoreName, _jdbcUrl, DRIVER_CLASS_NAME, "SA", "", true);
  _datastoreCreationDelegate.createDatastore(datastore);
}
origin: datacleaner/DataCleaner

@Override
protected UsageAwareDatastoreConnection<UpdateableDataContext> createDatastoreConnection() {
  if (StringUtils.isNullOrEmpty(_datasourceJndiUrl)) {
    if (isMultipleConnections()) {
      final DataSource dataSource = createDataSource();
      return new DataSourceDatastoreConnection(dataSource, getTableTypes(), _catalogName, this);
    } else {
      final Connection connection = createConnection();
      try {
        connection.setAutoCommit(false);
      } catch (final SQLException e) {
        logger.error("Could not set autocommit false '{}'", _datasourceJndiUrl);
        throw new IllegalStateException(e);
      }
      final UpdateableDataContext dataContext =
          new JdbcDataContext(connection, getTableTypes(), _catalogName);
      return new UpdateableDatastoreConnectionImpl<>(dataContext, this);
    }
  } else {
    try {
      final Context initialContext = getJndiNamingContext();
      final DataSource dataSource = (DataSource) initialContext.lookup(_datasourceJndiUrl);
      return new DataSourceDatastoreConnection(dataSource, getTableTypes(), _catalogName, this);
    } catch (final Exception e) {
      logger.error("Could not retrieve DataSource '{}'", _datasourceJndiUrl);
      throw new IllegalStateException(e);
    }
  }
}
origin: org.eobjects.datacleaner/DataCleaner-monitor-services

public String getJdbcUrl() {
  if (_datastore instanceof JdbcDatastore) {
    JdbcDatastore jdbcDatastore = (JdbcDatastore) _datastore;
    String url = jdbcDatastore.getJdbcUrl();
    if (url == null) {
      url = jdbcDatastore.getDatasourceJndiUrl();
    }
    return url;
  } else {
    return null;
  }
}
origin: datacleaner/DataCleaner

@Override
public boolean initialize(final JdbcDatastore datastore) {
  _usernameTextField.setText(datastore.getUsername());
  _passwordField.setText(datastore.getPassword());
  return true;
}
origin: datacleaner/DataCleaner

  @Validate
  public void validate() {
    // The first time this method is invoked, the datastoreCatalog and
    // userPreferences fields haven't been populated yet, therefore we just
    // skip the check, because it is called a little bit later again, and
    // then these fields are populated.
    if (datastoreCatalog != null) {
      // Validate that the datastoreName doesn't conflict with one of the
      // datastores in the datastoreCatalog.
      final Datastore datastore = datastoreCatalog.getDatastore(datastoreName);

      if (datastore != null) {
        if (datastore instanceof JdbcDatastore && ((JdbcDatastore) datastore).getDriverClass()
            .equals(H2_DRIVER_CLASS_NAME)) {
          if (!((JdbcDatastore) datastore).getJdbcUrl().startsWith(
              H2_DATABASE_CONNECTION_PROTOCOL + userPreferences.getSaveDatastoreDirectory().getPath())) {
            throw new IllegalStateException("Datastore \"" + datastoreName
                + "\" is not located in \"Written datastores\" directory \"" + userPreferences
                .getSaveDatastoreDirectory().getPath() + "\".");
          }
        } else {
          throw new IllegalStateException("Datastore \"" + datastoreName
              + "\" is not an H2 database, so it can't be used as a staging database.");
        }
      }
    }
  }
}
origin: datacleaner/DataCleaner

_multipleConnectionsCheckBox.setSelected(originalDatastore.isMultipleConnections());
    DatabaseDriverCatalog.getDatabaseDriverByDriverClassName(originalDatastore.getDriverClass());
_databaseDriverComboBox.setSelectedItem(databaseDriver);
_datastoreNameTextField.setText(originalDatastore.getName());
_datastoreNameTextField.setEnabled(false);
_driverClassNameTextField.setText(originalDatastore.getDriverClass());
origin: datacleaner/DataCleaner

if (datastore.isMultipleConnections()) {
  final DataSource ds = datastore.createDataSource();
  for (int i = 0; i < TEST_CONNECTION_COUNT; i++) {
    final Connection connection = ds.getConnection();
  final Connection connnection = datastore.createConnection();
  connections.add(connnection);
origin: datacleaner/DataCleaner

@Override
public boolean initialize(final JdbcDatastore datastore) {
  super.initialize(datastore);
  _connectionStringTextField.setText(datastore.getJdbcUrl());
  return true;
}
origin: datacleaner/DataCleaner

  @Override
  public String toString() {
    final StringBuilder sb = new StringBuilder();
    sb.append("JdbcDatastore[name=");
    sb.append(getName());
    if (_jdbcUrl != null) {
      sb.append(",url=");
      sb.append(_jdbcUrl);
    } else {
      sb.append(",jndi=");
      sb.append(_datasourceJndiUrl);
    }
    sb.append("]");
    return sb.toString();
  }
}
origin: datacleaner/DataCleaner

@Inject
protected DatabaseDriversPanel(final DataCleanerConfiguration configuration, final WindowContext windowContext,
    final UserPreferences userPreferences, final DatabaseDriverCatalog databaseDriverCatalog,
    final CloseableHttpClient httpClient) {
  super(WidgetUtils.COLOR_DEFAULT_BACKGROUND);
  _windowContext = windowContext;
  _userPreferences = userPreferences;
  _databaseDriverCatalog = databaseDriverCatalog;
  _httpClient = httpClient;
  setLayout(new BorderLayout());
  final DatastoreCatalog datastoreCatalog = configuration.getDatastoreCatalog();
  final String[] datastoreNames = datastoreCatalog.getDatastoreNames();
  for (final String name : datastoreNames) {
    final Datastore datastore = datastoreCatalog.getDatastore(name);
    if (datastore instanceof JdbcDatastore) {
      final String driverClass = ((JdbcDatastore) datastore).getDriverClass();
      if (driverClass != null) {
        _usedDriverClassNames.add(driverClass);
      }
    }
  }
  for (final UserDatabaseDriver driver : _userPreferences.getDatabaseDrivers()) {
    _usedDriverClassNames.add(driver.getDriverClassName());
  }
  updateComponents();
}
origin: datacleaner/DataCleaner

@Override
protected void decorateIdentity(final List<Object> identifiers) {
  super.decorateIdentity(identifiers);
  identifiers.add(_driverClass);
  identifiers.add(_jdbcUrl);
  identifiers.add(_datasourceJndiUrl);
  identifiers.add(_username);
  identifiers.add(_password);
  identifiers.add(_multipleConnections);
  identifiers.add(getTableTypes());
}
origin: datacleaner/DataCleaner

} else if (datastore instanceof JdbcDatastore) {
  final JdbcDatastore jdbcDatastore = (JdbcDatastore) datastore;
  final String jdbcUrl = jdbcDatastore.getJdbcUrl();
  final String datasourceJndiUrl = jdbcDatastore.getDatasourceJndiUrl();
  if (StringUtils.isNullOrEmpty(datasourceJndiUrl)) {
    return jdbcUrl;
origin: datacleaner/DataCleaner

final JdbcDatastore jdbcDatastore = (JdbcDatastore) datastore;
if (considerOrderdbSpecialization
    && "jdbc:hsqldb:res:orderdb;readonly=true".equals(jdbcDatastore.getJdbcUrl())) {
  imagePath = "images/datastore-types/orderdb.png";
} else {
  final String driverClass = jdbcDatastore.getDriverClass();
  if (!StringUtils.isNullOrEmpty(driverClass)) {
    final DatabaseDriverDescriptor driver =
origin: datacleaner/DataCleaner

@Override
public boolean initialize(final JdbcDatastore datastore) {
  super.initialize(datastore);
  final String url = datastore.getJdbcUrl();
  NamedPatternMatch<UrlPart> match = null;
  NamedPattern<UrlPart> matchingUrlTemplate = null;
  for (final NamedPattern<UrlPart> urlTemplate : _urlTemplates) {
    matchingUrlTemplate = urlTemplate;
    match = urlTemplate.match(url);
    if (match != null) {
      logger.info("URL '{}' matched with template: {}", url, urlTemplate);
      break;
    }
  }
  if (match == null) {
    logger.info("Cannot handle jdbc url '{}', expected something to match: {}", url, _urlTemplates);
    return false;
  }
  return initializeFromMatch(datastore, matchingUrlTemplate, match);
}
origin: datacleaner/DataCleaner

@Override
protected JdbcDatastore createDatastore() {
  final String datastoreName = _datastoreNameTextField.getText();
  if (StringUtils.isNullOrEmpty(datastoreName)) {
    throw new IllegalStateException("Please enter a datastore name");
  }
  final int connectionPresenterIndex = _tabbedPane.getSelectedIndex();
  final DatabaseConnectionPresenter connectionPresenter = _connectionPresenters[connectionPresenterIndex];
  logger.info("Creating datastore using connection presenter ({}): {}", connectionPresenterIndex,
      connectionPresenter);
  final String driverClass = _driverClassNameTextField.getText();
  final String connectionString = connectionPresenter.getJdbcUrl();
  final String username = connectionPresenter.getUsername();
  final String password = connectionPresenter.getPassword();
  final boolean multipleConnections = _multipleConnectionsCheckBox.isSelected();
  return new JdbcDatastore(datastoreName, connectionString, driverClass, username, password, multipleConnections);
}
origin: datacleaner/DataCleaner

private Datastore createDatastore(final String name, final JdbcDatastoreType jdbcDatastoreType) {
  final JdbcDatastore ds;
  final TableTypes jaxbTableTypes = jdbcDatastoreType.getTableTypes();
  final TableType[] tableTypes;
  if (jaxbTableTypes == null) {
    tableTypes = null;
  } else {
    final List<TableTypeEnum> jaxbTableTypeList = jaxbTableTypes.getTableType();
    tableTypes = new TableType[jaxbTableTypeList.size()];
    for (int i = 0; i < tableTypes.length; i++) {
      final TableTypeEnum tableTypeEnum = jaxbTableTypeList.get(i);
      tableTypes[i] = TableType.valueOf(tableTypeEnum.toString());
    }
  }
  final String catalogName = getStringVariable("catalogName", jdbcDatastoreType.getCatalogName());
  final String datasourceJndiUrl = getStringVariable("jndiUrl", jdbcDatastoreType.getDatasourceJndiUrl());
  if (datasourceJndiUrl == null) {
    final String url = getStringVariable("url", jdbcDatastoreType.getUrl());
    final String driver = getStringVariable("driver", jdbcDatastoreType.getDriver());
    final String username = getStringVariable("username", jdbcDatastoreType.getUsername());
    final String password = getPasswordVariable("password", jdbcDatastoreType.getPassword());
    final boolean multipleConnections =
        getBooleanVariable("multipleConnections", jdbcDatastoreType.isMultipleConnections(), true);
    ds = new JdbcDatastore(name, url, driver, username, password, multipleConnections, tableTypes, catalogName);
  } else {
    ds = new JdbcDatastore(name, datasourceJndiUrl, tableTypes, catalogName);
  }
  return ds;
}
org.datacleaner.connectionJdbcDatastore

Javadoc

Datastore implementation for JDBC based connections. Connections can either be based on JDBC urls or JNDI urls.

Most used methods

  • getJdbcUrl
  • getDatasourceJndiUrl
  • getDriverClass
  • getName
  • isMultipleConnections
  • <init>
    Alternative constructor usable only for in-memory (ie. non-persistent) datastores, because the datas
  • createConnection
  • createDataSource
  • getPassword
  • getTableTypes
  • getUsername
  • getCatalogName
  • getUsername,
  • getCatalogName,
  • getDescription,
  • getJndiNamingContext,
  • getSystemPropertyValue,
  • initializeDriver,
  • setDataContextProvider

Popular in Java

  • Making http requests using okhttp
  • addToBackStack (FragmentTransaction)
  • setContentView (Activity)
  • getSharedPreferences (Context)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • Vector (java.util)
    The Vector class implements a growable array of objects. Like an array, it contains components that
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now