Examples of DBConnectionInfo


Examples of org.apache.cayenne.modeler.pref.DBConnectionInfo

        // a slight chance that a real datasource is called NO_LOCAL_DATA_SOURCE...
        keys[0] = NO_LOCAL_DATA_SOURCE;
        Iterator it = sources.iterator();
        for (int i = 1; i <= len; i++) {
            DBConnectionInfo info = (DBConnectionInfo) it.next();
            keys[i] = info.getKey();
            localDataSources.put(keys[i], info);
        }

        view.getLocalDataSources().setModel(new DefaultComboBoxModel(keys));
        localDataSourceBinding.updateView();
View Full Code Here

Examples of org.apache.cayenne.modeler.pref.DBConnectionInfo

    protected DBConnectionInfo createDataSource() {
        if (canceled) {
            return null;
        }

        DBConnectionInfo prototype = (DBConnectionInfo) dataSources.get(prototypeKey);
        DBConnectionInfo dataSource = (DBConnectionInfo) editor.createDetail(
                domain,
                getName(),
                DBConnectionInfo.class);

        prototype.copyTo(dataSource);
View Full Code Here

Examples of org.apache.cayenne.modeler.pref.DBConnectionInfo

    protected DBConnectionInfo createDataSource() {
        if (canceled) {
            return null;
        }

        DBConnectionInfo dataSource = (DBConnectionInfo) editor.createDetail(
                domain,
                getName(),
                DBConnectionInfo.class);

        Object adapter = view.getAdapters().getSelectedItem();
        if (NO_ADAPTER.equals(adapter)) {
            adapter = null;
        }

        if (adapter != null) {
            String adapterString = adapter.toString();
            dataSource.setDbAdapter(adapterString);

            // guess adapter defaults...
            AdapterMapping defaultMap = getApplication().getAdapterMapping();
            dataSource.setJdbcDriver(defaultMap.jdbcDriverForAdapter(adapterString));
            dataSource.setUrl(defaultMap.jdbcURLForAdapter(adapterString));
        }

        return dataSource;
    }
View Full Code Here

Examples of org.apache.cayenne.modeler.pref.DBConnectionInfo

     * Shows a dialog to create new local DataSource configuration.
     */
    public void newDataSourceAction() {

        DataSourceCreator creatorWizard = new DataSourceCreator(this);
        DBConnectionInfo dataSource = creatorWizard.startupAction();

        if (dataSource != null) {
            dataSources.put(creatorWizard.getName(), dataSource);

            Object[] keys = dataSources.keySet().toArray();
View Full Code Here

Examples of org.apache.cayenne.modeler.pref.DBConnectionInfo

        super(getActionName(), application);
    }

    public void performAction(ActionEvent e) {

        DBConnectionInfo nodeInfo = preferredDataSource();
        String nodeKey = preferredDataSourceLabel(nodeInfo);

        DataSourceWizard connectWizard = new DataSourceWizard(
                getProjectController(),
                "Migrate DB Schema: Connect to Database",
View Full Code Here

Examples of org.apache.cayenne.modeler.pref.DBConnectionInfo

    public void duplicateDataSourceAction() {
        Object selected = view.getDataSources().getSelectedItem();
        if (selected != null) {
            DataSourceDuplicator wizard = new DataSourceDuplicator(this, selected
                    .toString());
            DBConnectionInfo dataSource = wizard.startupAction();

            if (dataSource != null) {
                dataSources.put(wizard.getName(), dataSource);

                Object[] keys = dataSources.keySet().toArray();
View Full Code Here

Examples of org.apache.cayenne.modeler.pref.DBConnectionInfo

    /**
     * Tries to establish a DB connection, reporting the status of this operation.
     */
    public void testDataSourceAction() {
        DBConnectionInfo currentDataSource = getConnectionInfo();
        if (currentDataSource == null) {
            return;
        }

        if (currentDataSource.getJdbcDriver() == null) {
            JOptionPane.showMessageDialog(
                    null,
                    "No JDBC Driver specified",
                    "Warning",
                    JOptionPane.WARNING_MESSAGE);
            return;
        }

        if (currentDataSource.getUrl() == null) {
            JOptionPane.showMessageDialog(
                    null,
                    "No Database URL specified",
                    "Warning",
                    JOptionPane.WARNING_MESSAGE);
            return;
        }

        try {
            Class driverClass = getApplication().getClassLoadingService().loadClass(
                    currentDataSource.getJdbcDriver());
            Driver driver = (Driver) driverClass.newInstance();

            // connect via Cayenne DriverDataSource - it addresses some driver issues...
            Connection c = new DriverDataSource(
                    driver,
                    currentDataSource.getUrl(),
                    currentDataSource.getUserName(),
                    currentDataSource.getPassword()).getConnection();
            try {
                c.close();
            }
            catch (SQLException e) {
                // i guess we can ignore this...
View Full Code Here

Examples of org.apache.cayenne.modeler.pref.DBConnectionInfo

     * asynchronously.
     */
    public void performAction(ActionEvent event) {

        // guess node connection
        DBConnectionInfo nodeInfo = preferredDataSource();
        String nodeKey = preferredDataSourceLabel(nodeInfo);

        // connect
        ConnectionWizard connectWizard = new ConnectionWizard(
                getProjectController(),
                "Reengineer DB Schema: Connect to Database",
                nodeKey,
                nodeInfo);

        if (!connectWizard.startupAction()) {
            // canceled
            return;
        }

        Connection connection = connectWizard.getConnection();
        DbAdapter adapter = connectWizard.getAdapter();
        DBConnectionInfo dataSourceInfo = connectWizard.getConnectionInfo();

        // from here pass control to DbLoaderHelper, running it from a thread separate
        // from EventDispatch

        final DbLoaderHelper helper = new DbLoaderHelper(
                getProjectController(),
                connection,
                adapter,
                dataSourceInfo.getUserName());
        Thread th = new Thread(new Runnable() {

            public void run() {
                helper.execute();

View Full Code Here

Examples of org.apache.cayenne.modeler.pref.DBConnectionInfo

                .getPreferenceDomainForDataDomain()
                .getDetail(node.getName(), DataNodeDefaults.class, false);

        String key = (nodeDefaults != null) ? nodeDefaults.getLocalDataSource() : null;
        if (key != null) {
            DBConnectionInfo info = (DBConnectionInfo) getApplication()
                    .getPreferenceDomain()
                    .getDetail(key, DBConnectionInfo.class, false);
            if (info != null) {
                return info;
            }
        }

        // extract data from the node
        if (!DriverDataSourceFactory.class.getName().equals(node.getDataSourceFactory())) {
            return null;
        }

        // create transient object..
        DBConnectionInfo nodeInfo = new DBConnectionInfo();

        nodeInfo.copyFrom(((ProjectDataSource) node.getDataSource()).getDataSourceInfo());

        nodeInfo.setDbAdapter(null);
        if (node.getAdapter() instanceof ModelerDbAdapter) {
            nodeInfo.setDbAdapter(((ModelerDbAdapter) node.getAdapter())
                    .getAdapterClassName());
        }

        return nodeInfo;
    }
View Full Code Here

Examples of org.apache.cayenne.modeler.pref.DBConnectionInfo

        this.view = createView();
        this.view.setTitle(title);
        this.altDataSource = altDataSource;
        this.altDataSourceKey = altDataSourceKey;
        this.connectionInfo = new DBConnectionInfo();

        initBindings();
    }
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.