/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* A DnsContextFactory serves as the initial context factory for DNS.
*
* <p> When an initial context is being created, the environment
* property "java.naming.provider.url" should contain a DNS pseudo-URL
* (see DnsUrl) or a space-separated list of them. Multiple URLs must
* all have the same domain value.
* If the property is not set, the default "dns:" is used.
*
* @author Scott Seligman
*/
}
}
throws NamingException {
}
/*
* "urls" are used to determine the servers, but any domain
* components are overridden by "domain".
*/
throws NamingException {
if (platformServersUsed(urls)) {
}
return ctx;
}
/*
* Public for use by product test suite.
*/
public static boolean platformServersAvailable() {
return !filterNameServers(
).isEmpty();
}
throws NamingException {
try {
} catch (MalformedURLException e) {
throw new ConfigurationException(e.getMessage());
}
throw new ConfigurationException(
"Invalid DNS pseudo-URL(s): " + url);
}
// If multiple urls, all must have the same domain.
throw new ConfigurationException(
"Conflicting domains: " + url);
}
}
}
/*
* Returns all the servers specified in a set of URLs.
* If a URL has no host (or port), the servers configured on the
* underlying platform are used if possible. If no configured
* servers can be found, then fall back to the old behavior of
* using "localhost".
* There must be at least one URL.
*/
throws NamingException {
throw new ConfigurationException("DNS pseudo-URL required");
}
// No server or port given, so look to underlying platform.
// ResolverConfiguration does some limited caching, so the
// following is reasonably efficient even if called rapid-fire.
if (!platformServers.isEmpty()) {
continue; // on to next URL (if any, which is unlikely)
}
}
server = "localhost";
}
? server
}
}
/*
* Returns true if serversForUrls(urls) would make use of servers
* from the underlying platform.
*/
if (!platformServersAvailable()) {
return false;
}
return true;
}
}
return false;
}
/*
* Returns a value for the PROVIDER_URL property (space-separated URL
* Strings) that reflects the given domain and servers.
* Each server is of the form "server[:port]".
* There must be at least one server.
* IPv6 literal host names include delimiting brackets.
*/
try {
// assert false : "ISO-Latin-1 charset unavailable";
}
}
if (i > 0) {
}
}
}
/*
* Reads environment to find URL(s) of initial context.
* Default URL is "dns:".
*/
}
/**
* Removes any DNS server that's not permitted to access
* @param input the input server[:port] list, must not be null
* @param oneIsEnough return output once there exists one ok
* @return the filtered list, all non-permitted input removed
*/
return input;
} else {
if (o instanceof String) {
int p = (colon < 0)
try {
security.checkConnect(s, p);
if (oneIsEnough) {
return output;
}
} catch (SecurityException se) {
continue;
}
}
}
return output;
}
}
}