Class 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 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 as String object.
        classname - full qualified classname as String object.
        defaultPort - the default port for given protocol as Integer 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 as String object.
        classname - full qualified classname as String object.
      • removeURLConnection

        public void removeURLConnection​(java.lang.String protocol)

        removeURLConnection

        Remove a protocol URL connection handler
        Parameters:
        protocol - name as String 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 interface java.net.URLStreamHandlerFactory
        Parameters:
        protocol - name as String object.
        Returns:
        a URLStreamHandler object.