public static boolean isDependencyLoop(ClientLibraryDependency parent, String path) { while (parent != null) { if (path.equals(parent.library.getPath())) { return true; } parent = parent.parent; } return false; }
public String toString() { return library.getPath() + "[cat:" + StringUtils.join(library.getCategories()) + ", embed:"+ isEmbed +", type: "+ library.getTypes() +"]"; } }
public ClientLibraryDependency(ClientLibraryDependency parent, ClientLibrary library, Set<String> requestedCategories, boolean isEmbed, LibraryType type) { this.library = library; this.parent = parent; if (isDependencyLoop(parent, library.getPath())) { throw new DependencyLoopException("Dependency loop detected: " + getStackTrace(parent, library.getPath())); } this.type = type; this.isEmbed = isEmbed; this.requestedCategories = new TreeSet<String>(java.util.Collections.reverseOrder()); // only the requested categories are relevant (from all the categories of this library) for (String category : library.getCategories()) { if (requestedCategories.contains(category)) { this.requestedCategories.add(category); } } }
DumplibsClientLibrary(ClientLibrary lib) { this.path = lib.getPath(); this.types = lib.getTypes(); this.categories = lib.getCategories(); this.channels = lib.getChannels(); }
log.debug("Giving out dependencies for {}", getStackTrace(parent, library.getPath())); log.debug("Category {} already in list, not adding twice!", category, library.getPath()); if (currentPosition < categories.indexOf(category)) { log.debug("Processing embedded JS libraries of library with path {}", library.getPath()); addLibraries(categories, true, library.getEmbedded(LibraryType.JS), library.getEmbeddedCategories(), currentPosition); log.debug("Processing embedded CSS libraries of library with path {}", library.getPath()); addLibraries(categories, true, library.getEmbedded(LibraryType.CSS), library.getEmbeddedCategories(), currentPosition); log.debug("Processing dependent libraries of library with path {}", library.getPath());
private String getProxyPath(ClientLibrary lib) { String path = lib.getPath(); if (lib.allowProxy()) { for (String searchPath : request.getResourceResolver().getSearchPath()) { if (path.startsWith(searchPath)) { path = request.getContextPath() + "/etc.clientlibs/" + path.replaceFirst(searchPath, ""); } } } else { if (request.getResourceResolver().getResource(lib.getPath()) == null) { path = null; } } if (path != null) { path = path + "/resources"; } return path; }
HtmlLibrary currentJsLibrary = htmlLibraryManager.getLibrary(LibraryType.JS, currentClientLibrary.getPath());