| Method from org.jboss.mail.MailService Detail: |
public Element getConfiguration() {
return config;
}
Configuration for the mail service. |
public String getDefaultSender() {
if (ourProps != null)
return ourProps.getProperty("mail.from");
else
return null;
}
|
public String getJNDIName() {
return jndiName;
}
|
protected ObjectName getObjectName(MBeanServer server,
ObjectName name) throws MalformedObjectNameException {
return name == null ? OBJECT_NAME : name;
}
|
public String getPOP3ServerHost() {
if (ourProps != null)
return ourProps.getProperty("mail.pop3.host");
else
return null;
}
|
protected String getPassword() {
return password;
}
|
protected Properties getProperties() throws Exception {
Properties props = new Properties();
if (config == null)
{
log.warn("No configuration specified; using empty properties map");
return props;
}
NodeList list = config.getElementsByTagName("property");
int len = list.getLength();
for (int i = 0; i < len; i++)
{
Node node = list.item(i);
switch (node.getNodeType())
{
case Node.ELEMENT_NODE:
Element child = (Element) node;
String name, value;
// get the name
if (child.hasAttribute("name"))
{
name = child.getAttribute("name");
}
else
{
log.warn("Ignoring invalid element; missing 'name' attribute: " + child);
break;
}
// get the value
if (child.hasAttribute("value"))
{
value = child.getAttribute("value");
}
else
{
log.warn("Ignoring invalid element; missing 'value' attribute: " + child);
break;
}
if (log.isTraceEnabled())
{
log.trace("setting property " + name + "=" + value);
}
props.setProperty(name, value);
break;
case Node.COMMENT_NODE:
// ignore
break;
default:
log.debug("ignoring unsupported node type: " + node);
break;
}
}
log.debug("Using properties: " + props);
return props;
}
|
public String getSMTPServerHost() {
if (ourProps != null)
return ourProps.getProperty("mail.smtp.host");
else
return null;
}
|
public String getStoreProtocol() {
if (ourProps != null)
return ourProps.getProperty("mail.store.protocol");
else
return null;
}
|
public String getTransportProtocol() {
if (ourProps != null)
return ourProps.getProperty("mail.transport.protocol");
else
return null;
}
|
public String getUser() {
return user;
}
|
public void setConfiguration(Element element) {
config = element;
}
Configuration for the mail service. |
public void setJNDIName(String name) {
jndiName = name;
}
The JNDI name under which javax.mail.Session objects are bound. |
public void setPassword(String password) {
this.password = password;
}
Password used to connect to a mail server |
public void setUser(String user) {
this.user = user;
}
User id used to connect to a mail server |
protected void startService() throws Exception {
// Setup password authentication
final PasswordAuthentication pa = new PasswordAuthentication(getUser(), getPassword());
Authenticator a = new Authenticator()
{
protected PasswordAuthentication getPasswordAuthentication()
{
return pa;
}
};
Properties props = getProperties();
// Finally create a mail session
Session session = Session.getInstance(props, a);
bind(session);
// now make the properties available
ourProps = props;
}
|
protected void stopService() throws Exception {
unbind();
}
|