private StringBuffer appendConfigProperties (Set props, StringBuffer buf) { buf.append("\n------------"); for (Iterator i = props.iterator(); i.hasNext();) { ConnectorConfigProperty config = (ConnectorConfigProperty) i.next(); buf.append("[Name : " + config.getName() + "], "); buf.append("[Value: " + config.getValue() + "], "); buf.append("[Type : " + config.getType() + "]"); buf.append("[Confidential : " + config.isConfidential() + "]"); buf.append("[Ignore : " + config.isIgnore() + "]"); buf.append("[SupportsDynamicUpdates : " + config.isSupportsDynamicUpdates() + "]"); } buf.append("\n------------"); return buf; }
public void setConfidential(boolean confidential) { this.confidential = confidential; setSetConfidentialCalled(true); }
public void setIgnore(boolean ignore) { this.ignore = ignore; setSetIgnoreCalled(true); }
/** * The ConnectorConfigProperty ::equals method only checks for name equality * So we need to write a custom equals * * @param e1 property * @param e2 property * @return boolean - equality result */ private boolean isEnvPropEqual(ConnectorConfigProperty e1, ConnectorConfigProperty e2) { if (e1 != null && e2 != null && e1.getName() != null && e2.getName() != null && e1.getName().equals(e2.getName())) { if (e1.getValue() != null && e2.getValue() != null && e1.getValue().equals(e2.getValue())) { return true; } } return false; } }
private static ConnectorConfigProperty getConfigProperty(String defaultValue, String description, boolean ignore, boolean supportsDynamicUpdates, boolean confidential, Class type, String propertyName) { ConnectorConfigProperty ep = new ConnectorConfigProperty(); //use description if specified if (!description.equals("")) { ep.setDescription(description); } //use default value if specified if ( defaultValue!= null && !defaultValue.equals("")) { ep.setValue(defaultValue); } ep.setType(type.getName()); ep.setName(propertyName); if (!ep.isSetIgnoreCalled()) { ep.setIgnore(ignore); } if (!ep.isSetConfidentialCalled()) { ep.setConfidential(confidential); } if (!ep.isSupportsDynamicUpdates()) { ep.setSupportsDynamicUpdates(supportsDynamicUpdates); } return ep; }
ConnectorConfigProperty ep = new ConnectorConfigProperty ( property.getName(), property.getValue(), null); if (defaultMCFProps.contains(ep)) { if (envProp.equals(ep)) { if (envProp.getType() != null) { ep.setType(envProp.getType()); _logger.log(Level.FINER, "After merging props with defaultMCFProps: envPropName: " + ep.getName() + " envPropValue : " + ep.getValue());
private Set mergeProps(List<Property> props, Set defaultMCFProps, String rarName) { HashSet mergedSet = new HashSet(); Object[] defaultProps = (defaultMCFProps == null) ? new Object[0] : defaultMCFProps.toArray(); for (int i = 0; i < defaultProps.length; i++) { if (rarName.trim().equals(ConnectorRuntime.DEFAULT_JMS_ADAPTER)) { ConnectorConfigProperty ep1 = (ConnectorConfigProperty) defaultProps[i]; if (ep1.getName().equals("AddressList") && ep1.getValue().equals("localhost")) { continue; } } mergedSet.add(defaultProps[i]); } for (Property property : props) { if (property != null) { ConnectorConfigProperty ep = new ConnectorConfigProperty( property.getName(), property.getValue(), null); if (defaultMCFProps.contains(ep)) { mergedSet.remove(ep); } mergedSet.add(ep); } } return mergedSet; }
String name = envProp.getName(); String userValue = (String) props.remove(name); if (userValue != null) aor.addConfigProperty(new ConnectorConfigProperty ( name, userValue, userValue, envProp.getType())); else aor.addConfigProperty(envProp); String userValue = props.getProperty(name); if (userValue != null) aor.addConfigProperty(new ConnectorConfigProperty ( name, userValue, userValue));
private static boolean isConfigDefined(Set configProperties, ConnectorConfigProperty ep) { boolean result = false; for (Object o : configProperties) { ConnectorConfigProperty ddEnvProperty = (ConnectorConfigProperty) o; if (ddEnvProperty.getName().equals(ep.getName())) { result = true; break; } } return result; }
propList.add(new ConnectorConfigProperty("ClassName", adminPool.getDriverClassname() == null ? "" : adminPool.getDriverClassname(), "The driver class name", "java.lang.String")); } else { propList.add(new ConnectorConfigProperty("ClassName", adminPool.getDatasourceClassname() == null ? "" : adminPool.getDatasourceClassname(), "The datasource class name", "java.lang.String")); propList.add(new ConnectorConfigProperty("ClassName", adminPool.getDriverClassname() == null ? "" : adminPool.getDriverClassname(), "The driver class name", "java.lang.String")); } else if (adminPool.getDatasourceClassname() != null) { propList.add(new ConnectorConfigProperty("ClassName", adminPool.getDatasourceClassname() == null ? "" : adminPool.getDatasourceClassname(), "The datasource class name", "java.lang.String")); propList.add(new ConnectorConfigProperty("ConnectionValidationRequired", adminPool.getIsConnectionValidationRequired() + "", "Is connection validation required", "java.lang.String")); propList.add(new ConnectorConfigProperty("ValidationMethod", adminPool.getConnectionValidationMethod() == null ? "" : adminPool.getConnectionValidationMethod(), propList.add(new ConnectorConfigProperty("ValidationTableName", adminPool.getValidationTableName() == null ? "" : adminPool.getValidationTableName(),
public void setSupportsDynamicUpdates(boolean supportsDynamicUpdates) { this.supportsDynamicUpdates = supportsDynamicUpdates; setSetSupportsDynamicUpdatesCalled(true); }
private void logMergedProperties(Set mergedProps) { if (_logger.isLoggable(Level.FINE)) { _logger.fine("Passing in the following properties " + "before calling RA.start of " + this.moduleName_); StringBuffer b = new StringBuffer(); for (Iterator iter = mergedProps.iterator(); iter.hasNext();) { ConnectorConfigProperty element = (ConnectorConfigProperty ) iter.next(); b.append("\nName: " + element.getName() + " Value: " + element.getValue()); } _logger.fine(b.toString()); } }
/** * Checks whether the property pertaining to the method is already presenti * in the array of Properties passed as second argument. * The properties already present in ra.xml for the corresponding * javabean is passed as the second argument. */ private boolean presentInDDProps(Method method,Object[] ddProps) { String name = null; String ddPropName = null; int length = "set".length(); if(method != null) { name = method.getName().substring(length); } for(int i=0; name != null && ddProps != null && i<ddProps.length;++i) { ddPropName = ((ConnectorConfigProperty )ddProps[i]).getName(); if(name.equalsIgnoreCase(ddPropName) == true) { return true; } } return false; }
public void setSupportsDynamicUpdates(boolean supportsDynamicUpdates) { this.supportsDynamicUpdates = supportsDynamicUpdates; setSetSupportsDynamicUpdatesCalled(true); }
private StringBuffer appendConfigProperties (Set props, StringBuffer buf) { buf.append("\n------------"); for (Iterator i = props.iterator(); i.hasNext();) { ConnectorConfigProperty config = (ConnectorConfigProperty) i.next(); buf.append("[Name : " + config.getName() + "], "); buf.append("[Value: " + config.getValue() + "], "); buf.append("[Type : " + config.getType() + "]"); buf.append("[Confidential : " + config.isConfidential() + "]"); buf.append("[Ignore : " + config.isIgnore() + "]"); buf.append("[SupportsDynamicUpdates : " + config.isSupportsDynamicUpdates() + "]"); } buf.append("\n------------"); return buf; }
/** * Merges the properties obtained by introspecting the javabean and the * properties present in ra.xml for the corresponding javabean. * * @param ddVals Properties obtained from ra.xml for the javabean * @param introspectedVals Properties obtained by introspecting javabean * @return Merged Properties present in ra.xml and introspected properties * of javabean. * */ public Properties mergeProps(Set ddVals, Properties introspectedVals) { Properties mergedVals = new Properties(introspectedVals); if(ddVals != null) { Object[] ddProps = ddVals.toArray(); String name = null; String value = null; for (int i = 0; i < ddProps.length; i++) { name = ((ConnectorConfigProperty )ddProps[i]).getName(); value =((ConnectorConfigProperty )ddProps[i]).getValue(); mergedVals.setProperty(name,value); } } return mergedVals; }
public String getValue() { String value = super.getValue(); if(confidential){ try { return RelativePathResolver.getRealPasswordFromAlias(value); } catch (Exception e) { _logger.log(Level.WARNING,"Unable to resolve alias value [ "+value+" ] " + "for connector config-property [ "+getName()+" ]", e); } } return value; } @Override
public void setConfidential(boolean confidential) { this.confidential = confidential; setSetConfidentialCalled(true); }
public void setIgnore(boolean ignore) { this.ignore = ignore; setSetIgnoreCalled(true); }