@Override public GridFSResourcePath subPath() { return new GridFSResourcePath(super.subPath()); }
public ObjectsTree<T> findLeaf(ResourcePath path) { if (path.isEmpty()) { return this; } String id = path.head().name(); ObjectsTree<T> child = this.children.get(id); if (child == null) { child = new ObjectsTree<>(); this.children.put(path.head().name(), child); } // For now, support * just at the end if (id.equals("*") && !path.subPath().isEmpty()) { throw new IllegalArgumentException("* supported just at the end. Remaining path is " + path.subPath()); } return child.findLeaf(path.subPath()); }
public Stream<T> objects(ResourcePath path) { if (path.isEmpty()) { return this.objects.stream(); } String name = path.head().name(); ObjectsTree<T> wildcardChild = this.children.get("*"); Stream<T> wildcardSubs = null; if ( wildcardChild != null ) { wildcardSubs = wildcardChild.objects.stream(); } ObjectsTree<T> child = this.children.get(name); Stream<T> childSubs = null; if (child != null) { childSubs = child.objects(path.subPath()); } if ( wildcardSubs != null && childSubs != null ) { return Stream.concat( childSubs, wildcardSubs ); } if ( wildcardSubs != null ) { return wildcardSubs; } if ( childSubs != null ) { return childSubs; } List<T> empty = Collections.emptyList(); return empty.stream(); }
public synchronized void updateApplication(InternalApplication application) throws IOException { ObjectNode tree = read(); tree.put("name", application.name()); ResourcePath htmlAppPath = application.htmlApplicationResourcePath(); if (htmlAppPath != null) { if (htmlAppPath.head().name().equals(application.id())) { htmlAppPath = htmlAppPath.subPath(); } tree.put("html-app", htmlAppPath.toString()); } tree.put("visible", application.visible()); String versioningResourceId = application.versionResourceId(); if (versioningResourceId != null) { tree.put("version-resource-id", versioningResourceId); } write(tree); }