public void resource()

in core/src/main/java/org/apache/sling/testing/mock/sling/loader/LoaderContentHandler.java [51:73]


    public void resource(String path, Map<String, Object> properties) {
        String fullPath = rootPath;
        if (!StringUtils.equals(path, "/")) {
            fullPath += path;
        }
        String parentPath = ResourceUtil.getParent(fullPath);
        String name = ResourceUtil.getName(fullPath);

        if (parentPath == null) {
            throw new IllegalArgumentException("Path has no parent: " + fullPath);
        }

        Resource parentResource = resourceResolver.getResource(parentPath);
        if (parentResource == null) {
            throw new RuntimeException("Parent resource '" + parentPath + "' not found.");
        }
        try {
            createResource(parentResource, name, properties);
        }
        catch (PersistenceException ex) {
            throw new RuntimeException("Unable to create resource at '" + fullPath + "'.", ex);
        }
    }