Package org.opennms.core.utils.url
Class GenericURLFactory
- java.lang.Object
-
- org.opennms.core.utils.url.GenericURLFactory
-
- All Implemented Interfaces:
java.net.URLStreamHandlerFactory
public class GenericURLFactory extends java.lang.Object implements java.net.URLStreamHandlerFactory
Convenience factory class to generate URL connections with customized protocol handler.- Author:
- Christian Pape, Ronny Trommer
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addURLConnection(java.lang.String protocol, java.lang.String classname)
addURLConnectionvoid
addURLConnection(java.lang.String protocol, java.lang.String classname, int defaultPort)
addURLConnectionjava.net.URLStreamHandler
createURLStreamHandler(java.lang.String protocol)
createURLStreamHandlerstatic GenericURLFactory
getInstance()
getInstancejava.util.Map<java.lang.String,java.lang.String>
getURLConnections()
getURLConnectionsstatic void
initialize()
initializevoid
removeURLConnection(java.lang.String protocol)
removeURLConnection
-
-
-
Method Detail
-
initialize
public static void initialize()
initialize
Initializing the URL Factory
-
getInstance
public static GenericURLFactory getInstance()
getInstance
Implement the GenericURLFactory as singleton- Returns:
- a {org.opennms.core.utils.url.GenericURLFactory} object.
-
addURLConnection
public void addURLConnection(java.lang.String protocol, java.lang.String classname, int defaultPort)
addURLConnection
Add protocol URL connection handler with specific class name- Parameters:
protocol
- name asString
object.classname
- full qualified classname asString
object.defaultPort
- the default port for given protocol asInteger
object.
-
addURLConnection
public void addURLConnection(java.lang.String protocol, java.lang.String classname)
addURLConnection
Add protocol URL connection handler with specific class name- Parameters:
protocol
- name asString
object.classname
- full qualified classname asString
object.
-
removeURLConnection
public void removeURLConnection(java.lang.String protocol)
removeURLConnection
Remove a protocol URL connection handler- Parameters:
protocol
- name asString
object.
-
getURLConnections
public java.util.Map<java.lang.String,java.lang.String> getURLConnections()
getURLConnections
Get the map with protocol and implementation classes for customized URL connections- Returns:
- a
HashMap
object
-
createURLStreamHandler
public java.net.URLStreamHandler createURLStreamHandler(java.lang.String protocol)
createURLStreamHandler
Create stream handler- Specified by:
createURLStreamHandler
in interfacejava.net.URLStreamHandlerFactory
- Parameters:
protocol
- name asString
object.- Returns:
- a
URLStreamHandler
object.
-
-