当前位置: 首页>>代码示例>>Java>>正文


Java JDBCDataSourceType类代码示例

本文整理汇总了Java中ca.sqlpower.sql.JDBCDataSourceType的典型用法代码示例。如果您正苦于以下问题:Java JDBCDataSourceType类的具体用法?Java JDBCDataSourceType怎么用?Java JDBCDataSourceType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JDBCDataSourceType类属于ca.sqlpower.sql包,在下文中一共展示了JDBCDataSourceType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applyChanges

import ca.sqlpower.sql.JDBCDataSourceType; //导入依赖的package包/类
/**
 * Copies all the data source types and their properties back to the
 * DataSourceCollection we're editing.
 */
public boolean applyChanges() {
    logger.debug("Applying changes to all data source types"); //$NON-NLS-1$
    applyCurrentChanges();
    ListModel lm = dsTypeList.getModel();
    for (int i = 0; i < lm.getSize(); i++) {
        JDBCDataSourceType dst = (JDBCDataSourceType) lm.getElementAt(i);
        dataSourceCollection.mergeDataSourceType(dst);
    }
    
    if (!enterprise) {
    	try {
    		dataSourceCollection.write();
    	} catch (IOException ex) {
    		SPSUtils.showExceptionDialogNoReport(panel, Messages.getString("DataSourceTypeEditor.errorSavingToPlDotIni"), ex); //$NON-NLS-1$
    	}
    }
    undoManager.discardAllEdits();
    return true;
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:24,代码来源:DataSourceTypeEditor.java

示例2: discardChanges

import ca.sqlpower.sql.JDBCDataSourceType; //导入依赖的package包/类
/**
 * This method is a no-op implementation, since all we have to do to discard the
 * changes is not copy them back to the model.
 */
public void discardChanges() {
	logger.debug("Discarding changes to all data source types.");
	int undoCount = 0;
	while (undoManager.canUndo()) {
		undoCount++;
		undoManager.undo();
	}
	logger.debug("There were " + undoCount + " changes.");
	
	dsTypePanel.discardChanges();
	
	dsTypeListModel.clear();
	for (JDBCDataSourceType type : dataSourceCollection.getDataSourceTypes()) {
		dsTypeListModel.addElement(type);
	}
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:21,代码来源:DataSourceTypeEditor.java

示例3: DataSourceTypeCopyPropertiesPanel

import ca.sqlpower.sql.JDBCDataSourceType; //导入依赖的package包/类
public DataSourceTypeCopyPropertiesPanel(JDBCDataSourceType type, DataSourceCollection collection) {
	this.dsType = type;
	
	List<JDBCDataSourceType> types = new ArrayList<JDBCDataSourceType>(collection.getDataSourceTypes());
	types.remove(dsType);
	dsTypesComboBox = new JComboBox(types.toArray());
	dsTypesComboBox.setRenderer(new DefaultListCellRenderer() {
		public Component getListCellRendererComponent(JList list, Object value,
				int index, boolean isSelected, boolean cellHasFocus) {
			Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
			if (c instanceof JLabel && value != null) {
				((JLabel) c).setText(((JDBCDataSourceType) value).getName());
			}
			return c;
		}
	});
	
	panel = buildUI();
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:20,代码来源:DataSourceTypeCopyPropertiesPanel.java

示例4: applyChanges

import ca.sqlpower.sql.JDBCDataSourceType; //导入依赖的package包/类
public boolean applyChanges() {
	if (copyOption.isSelected()) {
		JDBCDataSourceType defaultDSType = (JDBCDataSourceType) existingDSTypes.getSelectedItem();
		if (defaultDSType != null && defaultDSType != dsType) {
			for (String key : defaultDSType.getPropertyNames()) {
				if (JDBCDataSourceType.TYPE_NAME.equals(key)) {
					continue;
				}
				dsType.putProperty(key, defaultDSType.getProperty(key));
			}
		}
	}

	editor.addDsType(dsType);
	return true;
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:17,代码来源:NewDataSourceTypePanel.java

示例5: setUp

import ca.sqlpower.sql.JDBCDataSourceType; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
	
	collection = new StubDataSourceCollection<JDBCDataSource>();
	firstDSType = new JDBCDataSourceType();
	firstDSType.setJdbcUrl("First Testing URL");
       firstDSType.putProperty(JDBCDataSourceType.SUPPORTS_UPDATEABLE_RESULT_SETS, String.valueOf(true));
	firstDSType.setComment("First testing comment");
	collection.addDataSourceType(firstDSType);
	
	secondDSType = new JDBCDataSourceType();
	secondDSType.setJdbcUrl("Second Testing URL");
	secondDSType.putProperty(JDBCDataSourceType.SUPPORTS_UPDATEABLE_RESULT_SETS, String.valueOf(false));
	secondDSType.setComment("Second testing comment");
	
	editor = new DataSourceTypeEditor(collection, null);
	
	newDSTypePanel = new NewDataSourceTypePanel(editor, collection);
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:20,代码来源:NewDataSourceTypePanelTest.java

示例6: testCreatingNewBlankDSType

import ca.sqlpower.sql.JDBCDataSourceType; //导入依赖的package包/类
public void testCreatingNewBlankDSType() throws Exception {
	newDSTypePanel.setBlankOptionSelected(true);
	newDSTypePanel.applyChanges();
	
	JDBCDataSourceType newType = null;
	for (JDBCDataSourceType type : collection.getDataSourceTypes()) {
		if (type != firstDSType && type != secondDSType) {
			newType = type;
			break;
		}
	}
	
	assertNull(newType.getComment());
	assertNull(newType.getJdbcUrl());
	assertNull(newType.getJdbcDriver());
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:17,代码来源:NewDataSourceTypePanelTest.java

示例7: testCreatingNewCopiedDSType

import ca.sqlpower.sql.JDBCDataSourceType; //导入依赖的package包/类
public void testCreatingNewCopiedDSType() throws Exception {
	newDSTypePanel.setBlankOptionSelected(false);
	newDSTypePanel.setCopyDSType(firstDSType);
	newDSTypePanel.applyChanges();
	
	JDBCDataSourceType newType = null;
	for (JDBCDataSourceType type : collection.getDataSourceTypes()) {
		if (type != firstDSType && type != secondDSType) {
			newType = type;
			break;
		}
	}
	
	assertEquals(firstDSType.getComment(), newType.getComment());
	assertEquals(firstDSType.getJdbcUrl(), newType.getJdbcUrl());
	assertEquals(firstDSType.getSupportsUpdateableResultSets(), newType.getSupportsUpdateableResultSets());
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:18,代码来源:NewDataSourceTypePanelTest.java

示例8: setUp

import ca.sqlpower.sql.JDBCDataSourceType; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
	
	dsType = new JDBCDataSourceType();
	dsType.setName("Testing DS Name Shouldn't Change");
	
	DataSourceCollection collection = new StubDataSourceCollection();
	JDBCDataSourceType firstDSType = new JDBCDataSourceType();
	firstDSType.setJdbcUrl("First Testing URL");
	firstDSType.putProperty(JDBCDataSourceType.SUPPORTS_UPDATEABLE_RESULT_SETS, String.valueOf(true));
	firstDSType.setComment("First testing comment");
	collection.addDataSourceType(firstDSType);
	
	JDBCDataSourceType secondDSType = new JDBCDataSourceType();
	secondDSType.setJdbcUrl("Second Testing URL");
       secondDSType.putProperty(JDBCDataSourceType.SUPPORTS_UPDATEABLE_RESULT_SETS, String.valueOf(false));
	secondDSType.setComment("Second testing comment");
	
	dsTypeCopyPanel = new DataSourceTypeCopyPropertiesPanel(dsType, collection);
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:21,代码来源:DataSourceTypeCopyPropertiesPanelTest.java

示例9: setUp

import ca.sqlpower.sql.JDBCDataSourceType; //导入依赖的package包/类
/**
 * Sets up a MockJDBC database with one table in it called "table".
 */
@Override
protected void setUp() throws Exception {
    logger.debug("=====setUp=====");
    super.setUp();
    
    DataSourceCollection<SPDataSource> dscol = new PlDotIni();
    JDBCDataSourceType dstype = new JDBCDataSourceType();
    dstype.setJdbcDriver("ca.sqlpower.testutil.MockJDBCDriver");
    JDBCDataSource ds = new JDBCDataSource(dscol);
    ds.setParentType(dstype);
    ds.setUrl("jdbc:mock:name=refresh_test&tables=table");
    ds.setUser("");
    ds.setPass("");
    db = new SQLDatabase(ds);
    db.getConnection().close(); // just make sure the connection gets made
    table = db.getTableByName("table");
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:21,代码来源:SQLTableLazyLoadTest.java

示例10: setUp

import ca.sqlpower.sql.JDBCDataSourceType; //导入依赖的package包/类
/**
 * Sets up a MockJDBC database with nothing in it. Individual tests can specify
 * the structure as required.
 */
@Override
protected void setUp() throws Exception {
    logger.debug("=====setUp=====");
    super.setUp();
    
    DataSourceCollection<SPDataSource> dscol = new PlDotIni();
    JDBCDataSourceType dstype = new JDBCDataSourceType();
    dstype.setJdbcDriver("ca.sqlpower.testutil.MockJDBCDriver");
    JDBCDataSource ds = new JDBCDataSource(dscol);
    ds.setParentType(dstype);
    ds.setUrl("jdbc:mock:name=refresh_test");
    ds.setUser("");
    ds.setPass("");
    db = new SQLDatabase(ds);
    db.getConnection().close(); // just make sure the connection gets made
    con = MockJDBCDriver.getConnection("refresh_test");
    assertNotNull(con);
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:23,代码来源:RefreshTablesTest.java

示例11: testReverseEngineerAutoInc

import ca.sqlpower.sql.JDBCDataSourceType; //导入依赖的package包/类
public void testReverseEngineerAutoInc() throws Exception {
    PlDotIni plini = new PlDotIni();

    JDBCDataSourceType dst = new JDBCDataSourceType();
    dst.setJdbcDriver("ca.sqlpower.testutil.MockJDBCDriver");
    plini.addDataSourceType(dst);

    JDBCDataSource ds = new JDBCDataSource(plini);
    String url = "jdbc:mock:tables=table1" +
    		"&columns.table1=pkcol,normalcol" +
    		"&autoincrement_cols=table1.pkcol";
    ds.setUrl(url);
    ds.setParentType(dst);
    ds.setUser("x");
    ds.setPass("x");
    plini.addDataSource(ds);
    
    SQLDatabase db = new SQLDatabase(ds);
    SQLTable t = db.getTableByName("table1");
    SQLColumn pkcol = t.getColumnByName("pkcol");
    SQLColumn normalcol = t.getColumnByName("normalcol");
    
    assertTrue(pkcol.isAutoIncrement());
    assertFalse(normalcol.isAutoIncrement());
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:26,代码来源:TestSQLColumn.java

示例12: FakeSQLDatabase

import ca.sqlpower.sql.JDBCDataSourceType; //导入依赖的package包/类
public FakeSQLDatabase(String url) throws SQLException {
    super((JDBCDataSource) null);
    MockJDBCDriver driver = new MockJDBCDriver();
    con = (MockJDBCConnection) driver.connect(url, new Properties());
    ds = new JDBCDataSource(new StubDataSourceCollection()) {
        
        @Override
        public String getName() {
            return "mock database";
        }
        
        @Override
        public JDBCDataSourceType getParentType() {
            return new JDBCDataSourceType() {
                @Override
                public boolean getSupportsUpdateableResultSets() {
                    return true;
                }
            };
        }
    };
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:23,代码来源:FakeSQLDatabase.java

示例13: ensureHSQLDBIsSetup

import ca.sqlpower.sql.JDBCDataSourceType; //导入依赖的package包/类
/**
 * Makes sure the built-in HSQLDB database type is set up correctly in the
 * given data source collection.
 */
private void ensureHSQLDBIsSetup() {
    List<JDBCDataSourceType> types = plDotIni.getDataSourceTypes();
    JDBCDataSourceType hsql = null;
    for (JDBCDataSourceType dst : types) {
        if ("HSQLDB".equals(dst.getName())) {
            hsql = dst;
            break;
        }
    }
    if (hsql == null) {
        logger.error("HSQLDB connection type is missing! Built-in repository is unlikely to work properly!");
        return;
    }
    if (hsql.getJdbcJarList().isEmpty()) {
        hsql.addJdbcJar("builtin:hsqldb-1.8.0.9.jar");
    }
    List<String> jdbcJarList = hsql.getJdbcJarList();
    for (String jar : jdbcJarList) {
        File jarFile = new File(jar);
        if (!jarFile.exists()) {
            logger.error("HSQLDB Driver File missing: " + jarFile);
        }
    }
}
 
开发者ID:SQLPower,项目名称:power-matchmaker,代码行数:29,代码来源:MatchMakerSessionContextImpl.java

示例14: makeDefaultDataSource

import ca.sqlpower.sql.JDBCDataSourceType; //导入依赖的package包/类
/**
* Creates a new hsqldb infile database and adds it to the list.
*/
  private JDBCDataSource makeDefaultDataSource() {
      JDBCDataSource ds = new JDBCDataSource(getPlDotIni());
      ds.setName(DEFAULT_REPOSITORY_DATA_SOURCE_NAME);
      ds.setPlSchema("public");
      ds.setUser("sa");
      ds.setPass("");
      ds.setUrl("jdbc:hsqldb:file:"+System.getProperty("user.home")+"/.mm/hsql_repository;shutdown=true");

      // find HSQLDB parent type
      JDBCDataSourceType hsqldbType = null;
      for (JDBCDataSourceType type : getPlDotIni().getDataSourceTypes()) {
          if ("HSQLDB".equals(type.getName())) {
              hsqldbType = type;
              break;
          }
      }
      if (hsqldbType == null) {
          throw new RuntimeException("HSQLDB Database type is missing in pl.ini");
      }
      ds.setParentType(hsqldbType);
      
      getPlDotIni().addDataSource(ds);
  return ds;
  }
 
开发者ID:SQLPower,项目名称:power-matchmaker,代码行数:28,代码来源:MatchMakerSessionContextImpl.java

示例15: editDsType

import ca.sqlpower.sql.JDBCDataSourceType; //导入依赖的package包/类
/**
 * Modifies the fields in the editor panel and all tabbed panels to match those of the given SPDataSourceType
 * @param dst The SPDataSourceType that is being edited
 */
public void editDsType(JDBCDataSourceType dst) {
    dsType = dst;
    if (dst == null) {
        name.setText(""); //$NON-NLS-1$
        name.setEnabled(false);
        
        driverClass.setText(""); //$NON-NLS-1$
        driverClass.setEnabled(false);
        
        connectionStringTemplate.setText(""); //$NON-NLS-1$
        connectionStringTemplate.setEnabled(false);
        
        copyPropertiesButton.setEnabled(false);
        
        // template will get updated by document listener
    } else {
        name.setText(dst.getName());
        name.setEnabled(true);
        
        driverClass.setText(dst.getJdbcDriver());
        driverClass.setEnabled(true);
        
        connectionStringTemplate.setText(dst.getJdbcUrl());
        connectionStringTemplate.setEnabled(true);
        
        copyPropertiesButton.setEnabled(true);
        
        // template will get updated by document listener
    }
    // Also update all tab panels
    for (DataSourceTypeEditorTabPanel panel: tabPanels) {
        panel.editDsType(dst);
    }
    
    jdbcPanel.editDsType(dst);
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:41,代码来源:DataSourceTypeEditorPanel.java


注:本文中的ca.sqlpower.sql.JDBCDataSourceType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。