Search in sources :

Example 1 with WebDAVResource

use of org.eclipse.ceylon.cmr.repository.webdav.WebDAVResource in project ceylon by eclipse.

the class WebDAVContentStore method find.

@Override
public Iterable<? extends OpenNode> find(Node parent) {
    if (!connectionAllowed()) {
        return Collections.emptyList();
    }
    final String url = getUrlAsString(parent);
    try {
        final List<OpenNode> nodes = new ArrayList<>();
        final List<WebDAVResource> resources = repository.list(url);
        for (WebDAVResource dr : resources) {
            final String label = dr.getName();
            final RemoteNode node = new RemoteNode(label);
            if (dr.isDirectory())
                node.setContentMarker();
            else
                node.setHandle(new WebDAVContentHandle(url + label));
            nodes.add(node);
        }
        return nodes;
    } catch (IOException e) {
        log.debug("Failed to list url: " + url);
        return Collections.emptyList();
    }
}
Also used : ArrayList(java.util.ArrayList) WebDAVResource(org.eclipse.ceylon.cmr.repository.webdav.WebDAVResource) IOException(java.io.IOException) OpenNode(org.eclipse.ceylon.cmr.spi.OpenNode)

Aggregations

IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 WebDAVResource (org.eclipse.ceylon.cmr.repository.webdav.WebDAVResource)1 OpenNode (org.eclipse.ceylon.cmr.spi.OpenNode)1