Examples of JdbcConnectionDefinition


Examples of org.pentaho.reporting.ui.datasources.jdbc.connection.JdbcConnectionDefinition

    {
      final DriverConnectionProvider dcp = (DriverConnectionProvider) currentJNDISource;
      final ListModel model = dialogModel.getConnections();
      for (int i = 0; i < model.getSize(); i++)
      {
        final JdbcConnectionDefinition definition = (JdbcConnectionDefinition) model.getElementAt(i);
        if (definition instanceof DriverConnectionDefinition == false)
        {
          continue;
        }
        final DriverConnectionDefinition dcd = (DriverConnectionDefinition) definition;
        if (ObjectUtilities.equal(dcd.getUsername(), dcp.getProperty("JdbcUser")) &&
            ObjectUtilities.equal(dcd.getPassword(), dcp.getProperty("JdbcPassword")) &&
            ObjectUtilities.equal(dcd.getConnectionString(), dcp.getProperty("Jdbc")) &&
            ObjectUtilities.equal(dcd.getDriverClass(), dcp.getProperty("JdbcDrivers")) &&
            ObjectUtilities.equal(dcd.getName(), dcp.getProperty("::pentaho-reporting::name")))
        {
          return definition;
        }
      }

      String customName = dcp.getProperty("::pentaho-reporting::name");
      if (customName == null)
      {
        customName = Messages.getString("Olap4JDataSourceEditor.CustomConnection");
      }

      final String[] strings = dcp.getPropertyNames();
      final Properties p = new Properties();
      for (int i = 0; i < strings.length; i++)
      {
        final String string = strings[i];
        p.put(string, dcp.getProperty(string));
      }

      return new DriverConnectionDefinition
          (customName, dcp.getDriver(), dcp.getUrl(),
              dcp.getProperty("user"), dcp.getProperty("password"),
              dcp.getProperty("::pentaho-reporting::hostname"),
              dcp.getProperty("::pentaho-reporting::database-name"),
              dcp.getProperty("::pentaho-reporting::database-type"),
              dcp.getProperty("::pentaho-reporting::port"),
              p);
    }
    if (currentJNDISource instanceof JndiConnectionProvider)
    {
      final JndiConnectionProvider jcp = (JndiConnectionProvider) currentJNDISource;
      final ListModel model = dialogModel.getConnections();
      for (int i = 0; i < model.getSize(); i++)
      {
        final JdbcConnectionDefinition definition = (JdbcConnectionDefinition) model.getElementAt(i);
        if (definition instanceof JndiConnectionDefinition == false)
        {
          continue;
        }
        final JndiConnectionDefinition dcd = (JndiConnectionDefinition) definition;
View Full Code Here

Examples of org.pentaho.reporting.ui.datasources.jdbc.connection.JdbcConnectionDefinition

          queryNameList.setSelectedIndex(i);
        }
      }

      final ConnectionProvider currentConnectionProvider = dataFactory.getConnectionProvider();
      final JdbcConnectionDefinition definition = connectionComponent.createConnectionDefinition(currentConnectionProvider);
      dialogModel.addConnection(definition);
      dialogModel.getConnections().setSelectedItem(definition);

      String selectedQuery = selectedQueryName;
      if (StringUtils.isEmpty(selectedQuery))
      {
        DataSetQuery query = dialogModel.getFirstQueryName();
        if (query != null)
        {
          selectedQuery = query.getQueryName();
        }
      }

      if(StringUtils.isEmpty(selectedQuery) == false)
      {
        dialogModel.setSelectedQuery(selectedQuery);
        queryNameList.setSelectedIndex(dialogModel.getQueries().getIndexForQuery(selectedQuery));
      }
    }

    // Enable the dialog
    if (performEdit() == false)
    {
      return null;
    }

    final JdbcConnectionDefinition connectionDefinition = (JdbcConnectionDefinition) dialogModel.getConnections().getSelectedItem();
    if (connectionDefinition == null)
    {
      return null;
    }
View Full Code Here

Examples of org.pentaho.reporting.ui.datasources.jdbc.connection.JdbcConnectionDefinition

    }

    public void actionPerformed(final ActionEvent evt)
    {
      final NamedDataSourceDialogModel dialogModel = getDialogModel();
      final JdbcConnectionDefinition connectionDefinition = (JdbcConnectionDefinition) dialogModel.getConnections().getSelectedItem();
      if (connectionDefinition == null)
      {
        return;
      }
View Full Code Here

Examples of org.pentaho.reporting.ui.datasources.jdbc.connection.JdbcConnectionDefinition

    }

    public void actionPerformed(final ActionEvent e)
    {
      final NamedDataSourceDialogModel dialogModel = getDialogModel();
      final JdbcConnectionDefinition connectionDefinition = (JdbcConnectionDefinition) dialogModel.getConnections().getSelectedItem();
      if (connectionDefinition == null)
      {
        return;
      }
View Full Code Here

Examples of org.pentaho.reporting.ui.datasources.jdbc.connection.JdbcConnectionDefinition

      setEnabled(dialogModel.isConnectionSelected() && dialogModel.isQuerySelected());
    }

    public void actionPerformed(final ActionEvent evt)
    {
      final JdbcConnectionDefinition connectionDefinition =
          (JdbcConnectionDefinition) dialogModel.getConnections().getSelectedItem();
      if (connectionDefinition == null)
      {
        return;
      }
View Full Code Here

Examples of org.pentaho.reporting.ui.datasources.jdbc.connection.JdbcConnectionDefinition

    setPreviewPossible(false);

    final JdbcConnectionDefinition[] jdbcConnectionDefinitions = connectionDefinitionManager.getSources();
    for (int i = 0; i < jdbcConnectionDefinitions.length; i++)
    {
      final JdbcConnectionDefinition definition = jdbcConnectionDefinitions[i];
      connections.addElement(definition);
    }
    connections.setSelectedItem(null);
  }
View Full Code Here

Examples of org.pentaho.reporting.ui.datasources.jdbc.connection.JdbcConnectionDefinition

    {
      final DriverConnectionProvider dcp = (DriverConnectionProvider) currentJNDISource;
      final ListModel model = dialogModel.getConnections();
      for (int i = 0; i < model.getSize(); i++)
      {
        final JdbcConnectionDefinition definition = (JdbcConnectionDefinition) model.getElementAt(i);
        if (definition instanceof DriverConnectionDefinition == false)
        {
          continue;
        }
        final DriverConnectionDefinition dcd = (DriverConnectionDefinition) definition;
        if (ObjectUtilities.equal(dcd.getDriverClass(), dcp.getDriver()) &&
            ObjectUtilities.equal(dcd.getUsername(), dcp.getProperty("user")) &&
            ObjectUtilities.equal(dcd.getPassword(), dcp.getProperty("password")) &&
            ObjectUtilities.equal(dcd.getConnectionString(), dcp.getUrl()) &&
            ObjectUtilities.equal(dcd.getName(), dcp.getProperty("::pentaho-reporting::name")))
        {
          return definition;
        }
      }

      String customName = dcp.getProperty("::pentaho-reporting::name");
      if (customName == null)
      {
        customName = getBundleSupport().getString("JdbcConnectionPanel.CustomConnection");
      }

      final String[] strings = dcp.getPropertyNames();
      final Properties p = new Properties();
      for (int i = 0; i < strings.length; i++)
      {
        final String string = strings[i];
        p.put(string, dcp.getProperty(string));
      }

      return new DriverConnectionDefinition
          (customName, dcp.getDriver(), dcp.getUrl(),
              dcp.getProperty("user"), dcp.getProperty("password"),
              dcp.getProperty("::pentaho-reporting::hostname"),
              dcp.getProperty("::pentaho-reporting::database-name"),
              dcp.getProperty("::pentaho-reporting::database-type"),
              dcp.getProperty("::pentaho-reporting::port"),
              p);
    }
    else if (currentJNDISource instanceof JndiConnectionProvider)
    {
      final JndiConnectionProvider jcp = (JndiConnectionProvider) currentJNDISource;
      final ListModel model = dialogModel.getConnections();
      for (int i = 0; i < model.getSize(); i++)
      {
        final JdbcConnectionDefinition definition = (JdbcConnectionDefinition) model.getElementAt(i);
        if (definition instanceof JndiConnectionDefinition == false)
        {
          continue;
        }
        final JndiConnectionDefinition dcd = (JndiConnectionDefinition) definition;
View Full Code Here

Examples of org.pentaho.reporting.ui.datasources.jdbc.connection.JdbcConnectionDefinition

      setEnabled(getDialogModel().isConnectionSelected());
    }

    public void actionPerformed(final ActionEvent e)
    {
      final JdbcConnectionDefinition existingConnection =
          (JdbcConnectionDefinition) dataSourceList.getSelectedValue();

      final DesignTimeContext designTimeContext = getDesignTimeContext();
      try
      {
        final Window parentWindow = LibSwingUtil.getWindowAncestor(ConnectionPanel.this);
        final XulDatabaseDialog connectionDialog = new XulDatabaseDialog(parentWindow, designTimeContext);
        final JdbcConnectionDefinition connectionDefinition = connectionDialog.open(existingConnection);

        // See if the edit completed...
        if (connectionDefinition != null)
        {
          // If the name changed, delete it before the update is performed
          if (existingConnection.getName().equals(connectionDefinition.getName()) == false)
          {
            getDialogModel().getConnectionDefinitionManager().removeSource(existingConnection.getName());
          }
          final DataSourceDialogModel dialogModel = getDialogModel();
          // Add / update the JNDI source
View Full Code Here

Examples of org.pentaho.reporting.ui.datasources.jdbc.connection.JdbcConnectionDefinition

      setEnabled(getDialogModel().isConnectionSelected());
    }

    public void actionPerformed(final ActionEvent e)
    {
      final JdbcConnectionDefinition source = (JdbcConnectionDefinition) dataSourceList.getSelectedValue();
      if (source != null)
      {
        getDialogModel().getConnectionDefinitionManager().removeSource(source.getName());
        getDialogModel().removeConnection(source);
      }
    }
View Full Code Here

Examples of org.pentaho.reporting.ui.datasources.jdbc.connection.JdbcConnectionDefinition

      final DesignTimeContext designTimeContext = getDesignTimeContext();
      try
      {
        final Window parentWindow = LibSwingUtil.getWindowAncestor(ConnectionPanel.this);
        final XulDatabaseDialog connectionDialog = new XulDatabaseDialog(parentWindow, designTimeContext);
        final JdbcConnectionDefinition connectionDefinition = connectionDialog.open(null);

        if (connectionDefinition != null &&
            !StringUtils.isEmpty(connectionDefinition.getName()))
        {
          // A new JNDI source was created
          if (getDialogModel().getConnectionDefinitionManager().updateSourceList(connectionDefinition) == false)
          {
            getDialogModel().addConnection(connectionDefinition);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.