Class NamingContext


  • public class NamingContext
    extends Object
    Author:
    ilist
    • Field Detail

      • cycleFlag

        public static final Object cycleFlag
    • Constructor Detail

      • NamingContext

        public NamingContext​(NamingContext parent,
                             VDBTemplate template,
                             String addedPrefix,
                             String removedPrefix,
                             boolean export)
        This constructor should be used for the topmost template, which doesn't have template instance
        Parameters:
        parent - parent
        template - template
        addedPrefix - addedPrefix
        removedPrefix - removedPrefix
        export - export
    • Method Detail

      • getParent

        public NamingContext getParent()
        Returns parent, which can be null.
        Returns:
        something
      • getTemplateInstance

        public VDBTemplateInstance getTemplateInstance()
        Returns template instance, which can be null
        Returns:
        something
      • getTemplate

        public VDBTemplate getTemplate()
        Returns template
        Returns:
        something
      • getMap

        public Map getMap()
        Returns full map
        Returns:
        something
      • getMacroMap

        public Map getMacroMap()
        Returns only mapping of macros
        Returns:
        something
      • resolveMacro

        public String resolveMacro​(String name,
                                   String value)
        Recursively resolves macros/ports
        Parameters:
        name - name
        value - value
        Returns:
        something
      • createNamingContextFor

        public NamingContext createNamingContextFor​(VDBTemplateInstance instance)
        Creates or returns NamingContext for specific template
        Parameters:
        instance - instance
        Returns:
        something
      • resolvePort

        public String resolvePort​(VDBPort port)
        Recursively resolves macros/ports
        Parameters:
        port - port
        Returns:
        something
      • getResolvedName

        public String getResolvedName​(String name)
        Used in write VDCT data Should handle exporting single Group
        Parameters:
        name - name
        Returns:
        something
      • addPort

        public void addPort​(String name,
                            String value)
        Adds a port to this naming context
        Parameters:
        name - name
        value - value
      • addMacro

        public void addMacro​(String name,
                             String value)
        Adds a macro to this naming context
        Parameters:
        name - name
        value - value
      • resolveLink

        public String resolveLink​(String target)
        Subtracts record name from link, looks for apropriate record and renames the record in apropriate way. It contructs back the link.
        Parameters:
        target - target
        Returns:
        something
      • findAndResolveMacro

        public String findAndResolveMacro​(String name)
        Searches for the macro in the specific template. Possibly also for global macro definitions.
        Parameters:
        name - name
        Returns:
        something
      • findAndResolvePort

        public String findAndResolvePort​(String temp,
                                         String name)
        Searches for port in the specific template. Notice that port has to be resolved in inner template, but added in outer one.
        Parameters:
        temp - temp
        name - name
        Returns:
        something
      • matchAndReplace

        public String matchAndReplace​(String value)
        Finds $() and $(.) in strings and replaces them. TASK:RECMACROS: currently it doesn't handle something like $($()) very well. I don't think this is a simple problem, which could be done with regex. Hierarchy prevents it.
        Parameters:
        value - value
        Returns:
        something