Class DefaultCockpitResourceLoader

  • All Implemented Interfaces:
    CockpitResourceLoader, ResourceLoader, org.springframework.core.Ordered

    public class DefaultCockpitResourceLoader
    extends AbstractCockpitResourceReader
    implements org.springframework.core.Ordered
    Implementation of ResourceLoader that allows scanning files specified by a list of root directories.
    • Constructor Detail

      • DefaultCockpitResourceLoader

        public DefaultCockpitResourceLoader()
    • Method Detail

      • getPathEntries

        protected java.util.List<java.lang.String> getPathEntries()
        Initializes the list of path entries according to the cockpit property value if necessary and returns it.
      • getResourceAsStream

        public java.io.InputStream getResourceAsStream​(java.lang.String path)
        Description copied from interface: ResourceLoader
        Returns resource identified by path as InputStream or null if resource does not exist.
        Specified by:
        getResourceAsStream in interface ResourceLoader
        Parameters:
        path - the path identifying resource.
        Returns:
        Resource as InputStream or null.
      • hasResource

        public boolean hasResource​(java.lang.String path)
        Description copied from interface: ResourceLoader
        Checks whether this loader can load resource identified by path.
        Specified by:
        hasResource in interface CockpitResourceLoader
        Specified by:
        hasResource in interface ResourceLoader
        Parameters:
        path - the path identifying resource.
        Returns:
        true whether this loader can load resource, otherwise false.
      • resolveFile

        protected java.io.File resolveFile​(java.lang.String path)
        Tries to locate the file in one of the specified path entries.
        Returns:
        The file for the given path or null, if not existing.
      • hasResource

        public boolean hasResource​(WidgetJarLibInfo jarLibInfo,
                                   java.lang.String path)
        Description copied from interface: CockpitResourceLoader
        Checks whether a resource exists and may be read
        Specified by:
        hasResource in interface CockpitResourceLoader
        Parameters:
        jarLibInfo - widget, which resource is searched
        path - path to resource
        Returns:
        true if resource is available
      • isEnabled

        protected boolean isEnabled()
        Whether or not to use the whole mechanism, specified by ENABLED_KEY cockpit property.
        Returns:
        If false is returned, getResourceAsStream(String) will always return null.
      • setCockpitProperties

        public void setCockpitProperties​(CockpitProperties cockpitProperties)
      • getOrder

        public int getOrder()
        Specified by:
        getOrder in interface org.springframework.core.Ordered