Class DnsRequisitionUrlConnection
- java.lang.Object
-
- java.net.URLConnection
-
- org.opennms.netmgt.provision.service.dns.DnsRequisitionUrlConnection
-
public class DnsRequisitionUrlConnection extends URLConnection
Implementation ofjava.net.URLConnection
for handling URLs specified in the Provisiond configuration requesting an import requisition based on the A records of a zone transfer for a DNS server.- Version:
- $Id: $
- Author:
- David Hustace
-
-
Field Summary
Fields Modifier and Type Field Description static String
PROTOCOL
ConstantPROTOCOL="dns"
static String
URL_SCHEME
ConstantURL_SCHEME="dns://"
-
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
-
-
Constructor Summary
Constructors Constructor Description DnsRequisitionUrlConnection(URL url)
Constructor for DnsRequisitionUrlConnection.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect()
This is a no op.protected static String
decodeQueryString(URL url)
decodeQueryStringprotected static String
determineExpressionFromUrl(URL url)
determineExpressionFromUrlprotected static String
determineLocationFromUrl(URL url)
InputStream
getInputStream()
Creates a ByteArrayInputStream implementation of InputStream of the XML marshaled version of the Requisition class.DnsRequisitionRequest
getRequest()
protected static Map<String,String>
getUrlArgs(URL url)
protected static String
parseForeignSource(URL url)
Foreign Source should be the second path entity, if it exists, otherwise it is set to the value of the zone.protected static String
parseZone(URL url)
Zone should be the first path entity dns:/// [/ ][/> protected void
validateDnsUrl(URL url)
Validate the format is: dns:/// /?expression= there should be only one arguement in the path there should only be one query parameter -
Methods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentLengthLong, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFieldLong, getHeaderFields, getIfModifiedSince, getLastModified, getOutputStream, getPermission, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
-
-
-
-
Field Detail
-
URL_SCHEME
public static final String URL_SCHEME
ConstantURL_SCHEME="dns://"
- See Also:
- Constant Field Values
-
PROTOCOL
public static final String PROTOCOL
ConstantPROTOCOL="dns"
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DnsRequisitionUrlConnection
public DnsRequisitionUrlConnection(URL url) throws MalformedURLException
Constructor for DnsRequisitionUrlConnection.
- Parameters:
url
- aURL
object.- Throws:
MalformedURLException
- if any.
-
-
Method Detail
-
getRequest
public DnsRequisitionRequest getRequest()
-
connect
public void connect() throws IOException
This is a no op.- Specified by:
connect
in classURLConnection
- Throws:
IOException
-
getInputStream
public InputStream getInputStream() throws IOException
Creates a ByteArrayInputStream implementation of InputStream of the XML marshaled version of the Requisition class. Calling close on this stream is safe.- Overrides:
getInputStream
in classURLConnection
- Throws:
IOException
-
determineExpressionFromUrl
protected static String determineExpressionFromUrl(URL url)
determineExpressionFromUrl
-
validateDnsUrl
protected void validateDnsUrl(URL url) throws MalformedURLException
Validate the format is: dns:/// /?expression= there should be only one arguement in the path there should only be one query parameter - Parameters:
url
- aURL
object.- Throws:
MalformedURLException
- if any.
-
parseZone
protected static String parseZone(URL url)
Zone should be the first path entity dns:/// [/ ][/>
-
parseForeignSource
protected static String parseForeignSource(URL url)
Foreign Source should be the second path entity, if it exists, otherwise it is set to the value of the zone. dns:/// [/ ][/>
-
-