Class DomainLookupGenerator

    • Field Detail

      • numId

        protected final java.lang.String numId
      • appContext

        protected final AppContext appContext
      • branch

        protected java.lang.String branch
      • domain

        protected java.lang.String domain
    • Constructor Detail

      • DomainLookupGenerator

        public DomainLookupGenerator​(AppContext appContext,
                                     @NonNull
                                     @NonNull java.lang.String numId)
    • Method Detail

      • normaliseDomainName

        protected static java.lang.String normaliseDomainName​(@NonNull
                                                              @NonNull java.lang.String numId)
        Convert a domain name or URL into a normalised name by removing 'www.' and any trailing '.'.
        Parameters:
        numId - java.lang.String The Not Null domain name string or URL.
        Returns:
        A normalised java.lang.String domain name.
      • normalisePath

        protected static java.lang.String normalisePath​(java.lang.String path)
        Accept the 'path' part of a URL and convert it to a format for use in NUM Protocol Queries. I.e. split by '/' and '.', reverse the results and join with '.', prefix with an underscore and replace all spaces by underscores.
        Parameters:
        path - java.lang.String the path part of the URL - i.e. the result of URL.getPath()
        Returns:
        java.lang.String the normalised path.
      • getIndependentLocation

        public java.lang.String getIndependentLocation​(@NonNull
                                                       @NonNull java.lang.String moduleId)
        Specified by:
        getIndependentLocation in interface LookupGenerator
      • getHostedLocation

        public java.lang.String getHostedLocation​(@NonNull
                                                  @NonNull java.lang.String moduleId)
        Specified by:
        getHostedLocation in interface LookupGenerator
      • transformBranch

        protected java.lang.String transformBranch​(java.lang.String s)
        Convert "foo/bar" into "bar.foo"
        Parameters:
        s - the branch part of a location specifier
        Returns:
        the transformed branch part
      • getPopulatorLocation

        public java.lang.String getPopulatorLocation​(@NonNull
                                                     @NonNull java.lang.String moduleId)
        Specified by:
        getPopulatorLocation in interface LookupGenerator
      • getRootHostedLocation

        public java.lang.String getRootHostedLocation​(@NonNull
                                                      @NonNull java.lang.String moduleId)
        Specified by:
        getRootHostedLocation in interface LookupGenerator