org.opennms.netmgt.provision.service.dns
Class DnsRequisitionUrlConnection

java.lang.Object
  extended by java.net.URLConnection
      extended by org.opennms.netmgt.provision.service.dns.DnsRequisitionUrlConnection

public class DnsRequisitionUrlConnection
extends URLConnection

Implementation of java.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
static String PROTOCOL
          Constant PROTOCOL="dns"
static String URL_SCHEME
          Constant URL_SCHEME="dns://"
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Constructor Summary
protected DnsRequisitionUrlConnection(URL url)
          Constructor for DnsRequisitionUrlConnection.
 
Method Summary
 void connect()
           This is a no op.
protected static String decodeQueryString(URL url)
          decodeQueryString
protected static String determineExpressionFromUrl(URL url)
          determineExpressionFromUrl
 String getDescription()
          getDescription
 Boolean getFallback()
          getFallback
 String getForeignSource()
          getForeignSource
 InputStream getInputStream()
           Creates a ByteArrayInputStream implementation of InputStream of the XML marshaled version of the Requisition class.
 org.xbill.DNS.TSIG getKey()
          getKey
 Long getSerial()
          getSerial
 URL getUrl()
          getUrl
 String getZone()
          getZone
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:///[/][/>
 void setFallback(Boolean fallback)
          setFallback
 void setForeignSource(String foreignSource)
          setForeignSource
 void setKey(org.xbill.DNS.TSIG key)
          setKey
 void setSerial(Long serial)
          setSerial
 String toString()
          toString
protected static 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, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFields, getIfModifiedSince, getLastModified, getOutputStream, getPermission, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

URL_SCHEME

public static final String URL_SCHEME
Constant URL_SCHEME="dns://"

See Also:
Constant Field Values

PROTOCOL

public static final String PROTOCOL
Constant PROTOCOL="dns"

See Also:
Constant Field Values
Constructor Detail

DnsRequisitionUrlConnection

protected DnsRequisitionUrlConnection(URL url)
                               throws MalformedURLException

Constructor for DnsRequisitionUrlConnection.

Parameters:
url - a URL object.
Throws:
MalformedURLException - if any.
Method Detail

connect

public void connect()
             throws IOException
This is a no op.

Specified by:
connect in class URLConnection
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 class URLConnection
Throws:
IOException

getZone

public String getZone()

getZone

Returns:
a String object.

getSerial

public Long getSerial()

getSerial

Returns:
a Long object.

setSerial

public void setSerial(Long serial)

setSerial

Parameters:
serial - a Long object.

getFallback

public Boolean getFallback()

getFallback

Returns:
a Boolean object.

setFallback

public void setFallback(Boolean fallback)

setFallback

Parameters:
fallback - a Boolean object.

getKey

public org.xbill.DNS.TSIG getKey()

getKey

Returns:
a TSIG object.

setKey

public void setKey(org.xbill.DNS.TSIG key)

setKey

Parameters:
key - a TSIG object.

getDescription

public String getDescription()

getDescription

Returns:
a String object.

toString

public String toString()

toString

Overrides:
toString in class URLConnection
Returns:
a String object.

getUrl

public URL getUrl()

getUrl

Returns:
a URL object.

determineExpressionFromUrl

protected static String determineExpressionFromUrl(URL url)

determineExpressionFromUrl

Parameters:
url - a URL object.
Returns:
a String object.

decodeQueryString

protected static String decodeQueryString(URL url)

decodeQueryString

Parameters:
url - a URL object.
Returns:
a String object.

validateDnsUrl

protected static 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 - a URL object.
Throws:
MalformedURLException - if any.

parseZone

protected static String parseZone(URL url)
Zone should be the first path entity dns:///[/][/>

Parameters:
url - a URL object.
Returns:
a String object.

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:///[/][/>

Parameters:
url - a URL object.
Returns:
a String object.

setForeignSource

public void setForeignSource(String foreignSource)

setForeignSource

Parameters:
foreignSource - a String object.

getForeignSource

public String getForeignSource()

getForeignSource

Returns:
a String object.


Copyright © 2011. All Rights Reserved.