/** * Returns <code>true</code> if path contains a DataDomain object. */ public boolean enableForPath(ConfigurationNode object) { return object != null && ((DataNodeDescriptor) object).getDataChannelDescriptor() != null; }
/** * Returns <code>true</code> if path contains a DataDomain object. */ public boolean enableForPath(ConfigurationNode object) { if (object == null) { return false; } return ((DataNodeDescriptor) object).getDataChannelDescriptor() != null; } }
@Override public ConfigurationNode visitDataNodeDescriptor(DataNodeDescriptor nodeDescriptor) { return nodeDescriptor.getDataChannelDescriptor(); }
protected ConfigurationNode[] getLastMultipleObjects(DataNodeDescriptor dataNode) { List<ConfigurationNode> configurationNodeList = new ArrayList<ConfigurationNode>(); ConfigurationNode[] nodes = new ConfigurationNode[0]; String multipleObjects = preferences.getMultipleObjects(); if (multipleObjects.isEmpty()) { return configurationNodeList.toArray(nodes); } for (String objectName : multipleObjects.split(",")) { if (dataNode.getDataMapNames().contains(objectName)) { configurationNodeList.add(dataNode.getDataChannelDescriptor().getDataMap(objectName)); } } return configurationNodeList.toArray(nodes); }
private String getDataNodePropertyName(DataNodeDescriptor nodeDescriptor, String propertyConstant) { return propertyConstant + "." + nodeDescriptor.getDataChannelDescriptor().getName() + "." + nodeDescriptor.getName(); }
private void findUnusedProperties(DataNodeDescriptor nodeDescriptor) { if(!logger.isInfoEnabled() || nodeDescriptor.getDataChannelDescriptor() == null) { return; String nodeName = nodeDescriptor.getDataChannelDescriptor().getName() + "." + nodeDescriptor.getName();
void validateName(DataNodeDescriptor node, ValidationResult validationResult) { String name = node.getName(); if (Util.isEmptyString(name)) { addFailure(validationResult, node, "Unnamed DataNode"); return; } DataChannelDescriptor dataChannelDescriptor = node.getDataChannelDescriptor(); // check for duplicate names in the parent context for (DataNodeDescriptor otherNode : dataChannelDescriptor.getNodeDescriptors()) { if (otherNode == node) { continue; } if (name.equals(otherNode.getName())) { addFailure(validationResult, node, "Duplicate DataNode name: %s", name); break; } } } }
protected boolean shouldConfigureDataSourceFromProperties( DataNodeDescriptor nodeDescriptor) { String channelName = nodeDescriptor.getDataChannelDescriptor() != null ? nodeDescriptor.getDataChannelDescriptor().getName() : null; String driver = properties.get(Constants.JDBC_DRIVER_PROPERTY); if (driver == null && channelName != null) { driver = properties.get(getDataNodePropertyName(nodeDescriptor, Constants.JDBC_DRIVER_PROPERTY)); } if (driver == null) { findUnusedProperties(nodeDescriptor); return false; } String url = properties.get(Constants.JDBC_URL_PROPERTY); if (url == null && channelName != null) { url = properties.get(getDataNodePropertyName(nodeDescriptor, Constants.JDBC_URL_PROPERTY)); } if (url == null) { findUnusedProperties(nodeDescriptor); return false; } logger .info(String .format( "Found DataSourceFactory system property overrides for URL and Driver " + "of '%s.%s' node. Will ignore project DataSource configuration.", channelName, nodeDescriptor.getName())); return true; }
channelDescriptors.add(defaultNodeDescriptor.getDataChannelDescriptor()); nodeDescriptor.getDataMapNames().addAll(defaultNodeDescriptor.getDataMapNames());
@Override public DataSource getDataSource(DataNodeDescriptor nodeDescriptor) throws Exception { String suffix = "." + nodeDescriptor.getDataChannelDescriptor().getName() + "." + nodeDescriptor.getName(); String driverClass = getProperty(Constants.JDBC_DRIVER_PROPERTY, suffix); String url = getProperty(Constants.JDBC_URL_PROPERTY, suffix); String username = getProperty(Constants.JDBC_USERNAME_PROPERTY, suffix); String password = getProperty(Constants.JDBC_PASSWORD_PROPERTY, suffix); int minConnections = getIntProperty(Constants.JDBC_MIN_CONNECTIONS_PROPERTY, suffix, 1); int maxConnections = getIntProperty(Constants.JDBC_MAX_CONNECTIONS_PROPERTY, suffix, 1); long maxQueueWaitTime = properties.getLong(Constants.JDBC_MAX_QUEUE_WAIT_TIME, UnmanagedPoolingDataSource.MAX_QUEUE_WAIT_DEFAULT); String validationQuery = properties.get(Constants.JDBC_VALIDATION_QUERY_PROPERTY); Driver driver = objectFactory.newInstance(Driver.class, driverClass); return DataSourceBuilder.url(url).driver(driver).userName(username).password(password) .pool(minConnections, maxConnections).maxQueueWaitTime(maxQueueWaitTime) .validationQuery(validationQuery).build(); }