Class Bindings

java.lang.Object
de.businesscode.bcdui.binding.Bindings

public class Bindings extends Object
A singleton container class for all the bindings defined in the application. These
bindings are defined in static XML files under "/WEB-INF/bcdui/bindings" and read
as soon as the first access to the getInstance method occurs. In non-debug mode
the bindings are cached so that the files are read only once.
Don't use de.businesscode.bcdui.toolbox.Configuration instance here to avoid cyclic dependencies (Configuration itself uses Bindings to get parameters from database, etc), Instead use the static BareConfiguration.getInstance() to read static configuration
  • Field Details

  • Constructor Details

  • Method Details

    • getBndWrsAttributes

      public static List<String> getBndWrsAttributes()
    • getBndMetaWrsAttributes

      public static List<String> getBndMetaWrsAttributes()
    • fillBndWrsAttributes

      public static void fillBndWrsAttributes(List<String> attrList)
    • fillBndMetaWrsAttributes

      public static void fillBndMetaWrsAttributes(List<String> attrList)
    • isInitialized

      public static boolean isInitialized()
      a special method for internal usage to resolve cyclic dependencies, if your class is using Bindings (i.e. to write to database) and the Binding itself directly or transitively depends on your class. If this method returns FALSE, then calling getInstance() will end-up in a dead-lock in case your class is also used during Binding initialization process.
      Returns:
    • initWarMap

      protected void initWarMap() throws BindingException
      /* EnterpriseEdition has a more powerful BindingSet reader
      Throws:
      BindingException
    • getInstance

      public static Bindings getInstance() throws BindingException
      to use the method - Bindings must be first loaded by calling getInstance(String directory) or getInstance(HttpServletRequest request). Method getInstance
      Returns:
      Throws:
      BindingException
    • readBindings

      protected Map<String,Collection<StandardBindingSet>> readBindings(Class<? extends ReadBindingSet> rbs) throws BindingException
      Start of folder recursion
      Parameters:
      rbs -
      Returns:
      Throws:
      BindingException
    • getBindingSetUnchecked

      protected Collection<StandardBindingSet> getBindingSetUnchecked(String bindingSetId)
      Allows overwriting if there are multiple sources for BindingSets
      Parameters:
      bindingSetId -
      Returns:
    • get

      @Deprecated public StandardBindingSet get(String bindingSetId) throws BindingException
      Deprecated.
      This getter is deprecated because it prevents the BindingSetGroup feature from being totally transparent to the user.
      Fetches the specified BindingSet. This method does not work with BindingSetGroups therefore it should not be used anymore.
      Parameters:
      bindingSetId - The id of the BindingSet to be returned.
      Returns:
      The BindingSet registered under the id.
      Throws:
      BindingException
    • hasBindingSet

      public boolean hasBindingSet(String bindingSetId)
      tells silently if one or more BindingSet exists, this method can be used for classes which feature availability depends on a Binding.
      Parameters:
      bindingSetId -
      Returns:
      true if at least one binding-set exists which such name, false otherwise.
    • get

      public StandardBindingSet get(String bindingSetId, Collection<String> items) throws BindingException
      EnterpriseEdition allows us to search for a "best-match" BindingSet here, which allows for deep optimizations at runtime
      Parameters:
      bindingSetId -
      items -
      Returns:
      Throws:
      BindingException
    • clear

      public static void clear()
      clears the bindings so that getInstance() would return a new instance, reading BindingSets fresh
    • getWrqModifiers

      public List<Class<? extends Modifier>> getWrqModifiers(String bindingSetId) throws BindingException
      Potential extension point
      Throws:
      BindingException
    • readDependentBindings

      public void readDependentBindings() throws BindingException
      Optional extension point
      Throws:
      BindingException
    • readAdditionalBindings

      public void readAdditionalBindings() throws BindingException
      Optional extension point
      Throws:
      BindingException
    • readBindingDefaults

      public void readBindingDefaults(String bindingsDefaultFolder, Map<String,Map<String,String>> bindingItemDefaults) throws BindingException
      recursively reading binding default files and creating a map of bindingItem id and a map of the collected attributes
      Parameters:
      bindingsDefaultFolder - initially bcdDefaults subfolder in bindings folder
      bindingItemDefaults - initially empty map, will hold the collected bindingItem ids and their attributes
      Throws:
      BindingException
    • getBindingsDefaultMap

      public static Map<String,String> getBindingsDefaultMap(String bindingItem)
      Helper function to get the default attribute map of a given binding item id
      Parameters:
      bindingItem -
      Returns:
      map with attribute name/value pairs for the specified id, can be empty map if item has no defaults