protected void refreshView(DataNodeDescriptor dataNodeDescriptor) { this.node = dataNodeDescriptor; if (dataNodeDescriptor == null || dataNodeDescriptor.getDataSourceDescriptor() == null) { getView().setVisible(false); return; } for (ObjectBinding binding : bindings) { binding.updateView(); } }
public void validatePasswordEncoderAction() { if (node == null || node.getDataSourceDescriptor() == null) return; DataSourceInfo dsi = node.getDataSourceDescriptor(); if (!view.getPasswordEncoder().getSelectedItem().equals(dsi.getPasswordEncoderClass())) return; if (dsi.getPasswordEncoder() == null) { JOptionPane .showMessageDialog( getView(), "A valid Password Encoder should be specified (check your CLASSPATH).", "Invalid Password Encoder", JOptionPane.ERROR_MESSAGE); } }
protected DataSource cayenneDataSource(DataNodeDescriptor nodeDescriptor) throws Exception { // trying to guess whether Cayenne will be able to provide a DataSource without our help... if (shouldConfigureDataSourceFromProperties(nodeDescriptor) || nodeDescriptor.getDataSourceFactoryType() != null || nodeDescriptor.getDataSourceDescriptor() != null) { return super.getDataSource(nodeDescriptor); } return null; }
protected DataSource cayenneDataSource(DataNodeDescriptor nodeDescriptor) throws Exception { // trying to guess whether Cayenne will be able to provide a DataSource without our help... if (shouldConfigureDataSourceFromProperties(nodeDescriptor) || nodeDescriptor.getDataSourceFactoryType() != null || nodeDescriptor.getDataSourceDescriptor() != null) { return super.getDataSource(nodeDescriptor); } return null; }
protected DataSourceFactory getDataSourceFactory(DataNodeDescriptor nodeDescriptor) { String typeName; if (shouldConfigureDataSourceFromProperties(nodeDescriptor)) { typeName = PropertyDataSourceFactory.class.getName(); } else { typeName = nodeDescriptor.getDataSourceFactoryType(); } if (typeName == null) { if (nodeDescriptor.getDataSourceDescriptor() == null) { throw new CayenneRuntimeException( "DataNodeDescriptor '%s' has null 'dataSourceFactoryType' and 'dataSourceDescriptor' properties", nodeDescriptor.getName()); } typeName = XMLPoolingDataSourceFactory.class.getName(); } return objectFactory.newInstance(DataSourceFactory.class, typeName); }
public DataSource getDataSource(DataNodeDescriptor nodeDescriptor) throws Exception { DataSourceInfo properties = nodeDescriptor.getDataSourceDescriptor(); if (properties == null) { throw new IllegalArgumentException("'nodeDescriptor' contains no datasource descriptor"); } Driver driver = objectFactory.newInstance(Driver.class, properties.getJdbcDriver()); return new DriverDataSource(driver, properties.getDataSourceUrl(), properties.getUserName(), properties.getPassword()); } }
public void passwordLocationChangedAction() { if (node == null || node.getDataSourceDescriptor() == null) return; DataSourceInfo dsi = node.getDataSourceDescriptor(); String selectedItem = (String) view.getPasswordLocation().getSelectedItem(); if (selectedItem.equals(DataSourceInfo.PASSWORD_LOCATION_CLASSPATH)) updatePasswordElements( true, true, dsi.getPassword(), "Password Filename:", dsi.getPasswordSourceFilename()); else if (selectedItem.equals(DataSourceInfo.PASSWORD_LOCATION_EXECUTABLE)) updatePasswordElements(false, true, null, "Password Executable:", dsi .getPasswordSourceExecutable()); else if (selectedItem.equals(DataSourceInfo.PASSWORD_LOCATION_MODEL)) updatePasswordElements( true, false, dsi.getPassword(), "Password Source:", dsi.getPasswordSourceModel()); else if (selectedItem.equals(DataSourceInfo.PASSWORD_LOCATION_URL)) updatePasswordElements(false, true, null, "Password URL:", dsi .getPasswordSourceUrl()); }
@Override public void setNode(DataNodeDescriptor node) { if (!Util.nullSafeEquals(getNode(), node)) { if (node.getDataSourceDescriptor() == null) { node.setDataSourceDescriptor(new DataSourceInfo()); } super.setNode(node); } }
protected DataNodeDescriptor cloneDataNodeDescriptor( DataNodeDescriptor original, DataChannelDescriptor targetOwner) { DataNodeDescriptor clone = new DataNodeDescriptor(original.getName()); // do not clone 'configurationSource' as we may change the structure of the node clone.setAdapterType(original.getAdapterType()); clone.setDataChannelDescriptor(targetOwner); clone.setDataSourceDescriptor(original.getDataSourceDescriptor()); clone.setDataSourceFactoryType(original.getDataSourceFactoryType()); clone.setParameters(original.getParameters()); clone.setSchemaUpdateStrategyType(original.getSchemaUpdateStrategyType()); clone.getDataMapNames().addAll(original.getDataMapNames()); return clone; } }
.getName()); DataSourceInfo dsi = node.getDataSourceDescriptor();
@Override public DataSource getDataSource(DataNodeDescriptor nodeDescriptor) throws Exception { DataSourceInfo descriptor = nodeDescriptor.getDataSourceDescriptor(); if (descriptor == null) { String message = "Null dataSourceDescriptor for nodeDescriptor '" + nodeDescriptor.getName() + "'"; logger.info(message); throw new ConfigurationException(message); } long maxQueueWaitTime = properties.getLong(Constants.JDBC_MAX_QUEUE_WAIT_TIME, UnmanagedPoolingDataSource.MAX_QUEUE_WAIT_DEFAULT); Driver driver = objectFactory.newInstance(Driver.class, descriptor.getJdbcDriver()); return DataSourceBuilder.url(descriptor.getDataSourceUrl()).driver(driver).userName(descriptor.getUserName()) .password(descriptor.getPassword()) .pool(descriptor.getMinConnections(), descriptor.getMaxConnections()) .maxQueueWaitTime(maxQueueWaitTime).build(); }
CayenneModelerController mainController = getApplication().getFrameController(); if (getNode() == null || getNode().getDataSourceDescriptor() == null) { return; DataSourceInfo projectDSI = getNode().getDataSourceDescriptor();