String password = "";
String host = "";
String protocol = "";
String port = "";
URLName urlName;
for (Iterator iterator = mailParameters.iterator(); iterator.hasNext();) {
Parameter param = (Parameter) iterator.next();
String paramKey = param.getName();
String paramValue = Utils.getParameterValue(param);
if (paramKey == null || paramValue == null) {
throw new AxisFault(Messages.getMessage("canNotBeNull",
"Parameter name nor value should be null"));
}
pop3Properties.setProperty(paramKey, paramValue);
if (paramKey.equals(org.apache.axis2.transport.mail.Constants.POP3_USER)) {
user = paramValue;
}
if (paramKey.equals(org.apache.axis2.transport.mail.Constants.POP3_PASSWORD)) {
password = paramValue;
}
if (paramKey.equals(org.apache.axis2.transport.mail.Constants.POP3_HOST)) {
host = paramValue;
}
if (paramKey.equals(org.apache.axis2.transport.mail.Constants.STORE_PROTOCOL)) {
protocol = paramValue;
}
if (paramKey.equals(org.apache.axis2.transport.mail.Constants.POP3_PORT)) {
port = paramValue;
}
}
if (password.length() == 0 || user.length() == 0 || host.length() == 0 || protocol.length() == 0) {
throw new AxisFault("One or more of Password, User, Host and Protocol are null or empty");
}
if (port.length() == 0) {
urlName = new URLName(protocol, host, -1, "", user, password);
} else {
urlName = new URLName(protocol, host, Integer.parseInt(port), "", user, password);
}
receiver = new EmailReceiver();
receiver.setPop3Properties(pop3Properties);
receiver.setUrlName(urlName);