* @param userName the new username
* @param password the new password
* @return a new adaptor channel
*/
public static EOAdaptorChannel adaptorChannelWithUserAndPassword(String adaptorName, NSDictionary originalConnectionDictionary, String userName, String password) {
EOAdaptor adaptor = EOAdaptor.adaptorWithName(adaptorName);
NSMutableDictionary newConnectionDictionary = originalConnectionDictionary.mutableClone();
if (userName == null) {
newConnectionDictionary.removeObjectForKey(JDBCAdaptor.UsernameKey);
}
else {
newConnectionDictionary.setObjectForKey(userName, JDBCAdaptor.UsernameKey);
}
if (password == null) {
newConnectionDictionary.removeObjectForKey(JDBCAdaptor.PasswordKey);
}
else {
newConnectionDictionary.setObjectForKey(password, JDBCAdaptor.PasswordKey);
}
adaptor.setConnectionDictionary(newConnectionDictionary);
return adaptor.createAdaptorContext().createAdaptorChannel();
}