A WebResourceSet implementation that is not backed by a file system and behaves as if it has no resources available. This is primarily used in embedded mode when the web application is configured entirely programmatically and does not use any static resources from the file system.
| 34 | * and does not use any static resources from the file system. |
| 35 | */ |
| 36 | public class EmptyResourceSet extends LifecycleBase implements WebResourceSet { |
| 37 | |
| 38 | private static final String[] EMPTY_STRING_ARRAY = new String[0]; |
| 39 | |
| 40 | private WebResourceRoot root; |
| 41 | private boolean classLoaderOnly; |
| 42 | private boolean staticOnly; |
| 43 | |
| 44 | /** |
| 45 | * Creates a new empty resource set with the given root. |
| 46 | * |
| 47 | * @param root the web resource root |
| 48 | */ |
| 49 | public EmptyResourceSet(WebResourceRoot root) { |
| 50 | this.root = root; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * {@inheritDoc} |
| 55 | * <p> |
| 56 | * This implementation always returns an {@link EmptyResource}. |
| 57 | */ |
| 58 | @Override |
| 59 | public WebResource getResource(String path) { |
| 60 | return new EmptyResource(root, path); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * {@inheritDoc} |
| 65 | * <p> |
| 66 | * This implementation always returns an empty array. |
| 67 | */ |
| 68 | @Override |
| 69 | public String[] list(String path) { |
| 70 | return EMPTY_STRING_ARRAY; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * {@inheritDoc} |
| 75 | * <p> |
| 76 | * This implementation always returns an empty set. |
| 77 | */ |
| 78 | @Override |
| 79 | public Set<String> listWebAppPaths(String path) { |
| 80 | return Collections.emptySet(); |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * {@inheritDoc} |
| 85 | * <p> |
| 86 | * This implementation always returns false. |
| 87 | */ |
| 88 | @Override |
| 89 | public boolean mkdir(String path) { |
| 90 | return false; |
| 91 | } |
| 92 | |
| 93 | /** |
nothing calls this directly
no outgoing calls
no test coverage detected