Class TenantSpecificResourceLoader

java.lang.Object
org.chenile.utils.tenancy.TenantSpecificResourceLoader

public class TenantSpecificResourceLoader extends Object
A class that looks for a specific resource (using tenantSpecificPath) from the class path. If the tenant specific resource is not found then a generic path (genericPath is used. The resource is then opened and the name and URL are returned by calling obtainFileName(String, String) and obtainURL(String, String) Variable %{name} and %{tenantId} can be used for finding the name of the resource in both the generic and tenant specific paths.
Author:
Raja Shankar Kolluru
  • Field Details

  • Constructor Details

    • TenantSpecificResourceLoader

      public TenantSpecificResourceLoader(String tenantSpecificPath, String genericPath)
  • Method Details

    • obtainURL

      public URL obtainURL(String name, String tenantId)
    • obtainFileName

      public String obtainFileName(String name, String tenantId)
    • obtainValue

      protected CachedValue obtainValue(String name, String tenantId)
    • lookup

      protected CachedValue lookup(Key key) throws Exception
      Throws:
      Exception
    • populateValue

      protected CachedValue populateValue(String filename, URL url) throws Exception
      Override this to store cached values that have information specific to the particular sub class By default the Cached Value stores URL and filename. But the specific sub class might choose to cache additional resources.
      Parameters:
      filename - the filename to look for
      url - - URL
      Returns:
      the cached value
      Throws:
      Exception - if there is a problem