1 /*****************************************************************
2 * Licensed to the Apache Software Foundation (ASF) under one *
3 * or more contributor license agreements. See the NOTICE file *
4 * distributed with this work for additional information *
5 * regarding copyright ownership. The ASF licenses this file *
6 * to you under the Apache License, Version 2.0 (the *
7 * "License"); you may not use this file except in compliance *
8 * with the License. You may obtain a copy of the License at *
9 * *
10 * http://www.apache.org/licenses/LICENSE-2.0 *
11 * *
12 * Unless required by applicable law or agreed to in writing, *
13 * software distributed under the License is distributed on an *
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
15 * KIND, either express or implied. See the License for the *
16 * specific language governing permissions and limitations *
17 * under the License. *
18 ****************************************************************/
19
20 package org.apache.james.services;
21
22 import java.util.Collection;
23 import java.util.Iterator;
24
25 /***
26 * Provides abstraction for DNS resolutions. The interface is Mail specific.
27 * It may be a good idea to make the interface more generic or expose
28 * commonly needed DNS methods.
29 *
30 */
31 public interface DNSServer {
32
33 /***
34 * The component role used by components implementing this service
35 */
36 String ROLE = "org.apache.james.services.DNSServer";
37
38 /***
39 * <p>Get a priority-sorted collection of DNS MX records for a given hostname</p>
40 *
41 * <p>TODO: Change this to a list, as not all collections are sortable</p>
42 *
43 * @param hostname the hostname to check
44 * @return collection of strings representing MX record values.
45 */
46 Collection findMXRecords(String hostname);
47
48
49 /***
50 * Performs DNS lookups as needed to find servers which should or might
51 * support SMTP. Returns one SMTPHostAddresses for each such host
52 * discovered by DNS. If no host is found for domainName, the Iterator
53 * returned will be empty and the first call to hasNext() will return
54 * false.
55 * @param domainName the String domain for which SMTP host addresses are
56 * sought.
57 * @return an Enumeration in which the Objects returned by next()
58 * are instances of SMTPHostAddresses.
59 */
60 Iterator getSMTPHostAddresses(String domainName);
61
62 }