Class DefaultCockpitResourceLoader
- java.lang.Object
-
- com.hybris.cockpitng.core.persistence.packaging.impl.AbstractCockpitResourceReader
-
- com.hybris.cockpitng.core.persistence.packaging.impl.DefaultCockpitResourceLoader
-
- All Implemented Interfaces:
CockpitResourceLoader,ResourceLoader,org.springframework.core.Ordered
public class DefaultCockpitResourceLoader extends AbstractCockpitResourceReader implements org.springframework.core.Ordered
Implementation ofResourceLoaderthat allows scanning files specified by a list of root directories.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringENABLED_KEYstatic intORDER-
Fields inherited from class com.hybris.cockpitng.core.persistence.packaging.impl.AbstractCockpitResourceReader
LOG
-
-
Constructor Summary
Constructors Constructor Description DefaultCockpitResourceLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CockpitPropertiesgetCockpitProperties()intgetOrder()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.java.io.InputStreamgetResourceAsStream(WidgetJarLibInfo jarLibInfo, java.lang.String filename)Returns a resource file for the given path andWidgetJarLibInfoas aInputStreamjava.io.InputStreamgetResourceAsStream(java.lang.String path)Returns resource identified by path asInputStreamornullif resource does not exist.booleanhasResource(WidgetJarLibInfo jarLibInfo, java.lang.String path)Checks whether a resource exists and may be readbooleanhasResource(java.lang.String path)Checks whether this loader can load resource identified by path.protected booleanisEnabled()Whether or not to use the whole mechanism, specified byENABLED_KEYcockpit property.protected java.io.FileresolveFile(java.lang.String path)Tries to locate the file in one of the specified path entries.voidsetCockpitProperties(CockpitProperties cockpitProperties)-
Methods inherited from class com.hybris.cockpitng.core.persistence.packaging.impl.AbstractCockpitResourceReader
adaptResourceName, getFullResourceName, getFullResourceName, getViewResourceAsStream, getViewResourceAsString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.hybris.cockpitng.core.persistence.packaging.CockpitResourceLoader
getResourceAsStream, hasResource
-
-
-
-
Field Detail
-
ORDER
public static final int ORDER
- See Also:
- Constant Field Values
-
ENABLED_KEY
public static final java.lang.String ENABLED_KEY
- See Also:
- Constant Field Values
-
-
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:ResourceLoaderReturns resource identified by path asInputStreamornullif resource does not exist.- Specified by:
getResourceAsStreamin interfaceResourceLoader- Parameters:
path- the path identifying resource.- Returns:
- Resource as
InputStreamornull.
-
hasResource
public boolean hasResource(java.lang.String path)
Description copied from interface:ResourceLoaderChecks whether this loader can load resource identified by path.- Specified by:
hasResourcein interfaceCockpitResourceLoader- Specified by:
hasResourcein interfaceResourceLoader- Parameters:
path- the path identifying resource.- Returns:
truewhether this loader can load resource, otherwisefalse.
-
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.
-
getResourceAsStream
public java.io.InputStream getResourceAsStream(WidgetJarLibInfo jarLibInfo, java.lang.String filename)
Description copied from interface:CockpitResourceLoaderReturns a resource file for the given path andWidgetJarLibInfoas aInputStream- Specified by:
getResourceAsStreamin interfaceCockpitResourceLoader
-
hasResource
public boolean hasResource(WidgetJarLibInfo jarLibInfo, java.lang.String path)
Description copied from interface:CockpitResourceLoaderChecks whether a resource exists and may be read- Specified by:
hasResourcein interfaceCockpitResourceLoader- Parameters:
jarLibInfo- widget, which resource is searchedpath- path to resource- Returns:
trueif resource is available
-
isEnabled
protected boolean isEnabled()
Whether or not to use the whole mechanism, specified byENABLED_KEYcockpit property.- Returns:
- If false is returned,
getResourceAsStream(String)will always return null.
-
setCockpitProperties
public void setCockpitProperties(CockpitProperties cockpitProperties)
-
getCockpitProperties
public CockpitProperties getCockpitProperties()
-
getOrder
public int getOrder()
- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
-