public ModuleDescriptorStub(WebResourceModuleDescriptor descriptor) { super(ModuleFactory.LEGACY_MODULE_FACTORY); this.completeKey = descriptor.getCompleteKey(); }
@Override public List<PluginResource> getPluginResources(final String moduleCompleteKey) { if (moduleCompleteKey.contains(":")) { // If it's the web resource. Option<WebResourceModuleDescriptor> option = getDescriptor(moduleCompleteKey); if (option.isEmpty()) { return Collections.emptyList(); } WebResourceModuleDescriptor wrmd = option.get(); final Set<PluginResource> resources = new LinkedHashSet<PluginResource>(); for (final ResourceDescriptor resourceDescriptor : wrmd.getResourceDescriptors()) { resources.add(new BatchPluginResource(moduleCompleteKey, wrmd.getCompleteKey())); } return ImmutableList.copyOf(resources); } else { // If it's the module. List<PluginResource> resources = new ArrayList<>(); resources.add(new BatchPluginResource(moduleCompleteKey, moduleCompleteKey)); return resources; } }
public Iterable<ModuleDescriptorStub> getDependenciesInContext(RequestCache requestCache, UrlBuildingStrategy urlBuildingStrategy, final String context, boolean excludeSuperBatchedResources, final Set<String> skippedResources, boolean includeDependenciesForFailedUrlReadingConditions) { final Set<ModuleDescriptorStub> contextResources = new LinkedHashSet<>(); final Class<WebResourceModuleDescriptor> clazz = WebResourceModuleDescriptor.class; List<String> contextDependencies = new ArrayList<>(); for (final WebResourceModuleDescriptor descriptor : webResourceIntegration.getPluginAccessor().getEnabledModuleDescriptorsByClass(clazz)) { if (descriptor != null && descriptor.getContexts().contains(context)) { contextDependencies.add(descriptor.getCompleteKey()); } } // Adding modules. Bundle bundle = requestCache.getSnapshot().get(Config.CONTEXT_PREFIX + ":" + context); if (bundle != null) { contextDependencies.addAll(bundle.getDependencies()); } for (String key : contextDependencies) { final LinkedHashMap<String, ModuleDescriptorStub> dependencies = new LinkedHashMap<>(); final Iterable<String> superBatchResources = excludeSuperBatchedResources ? getSuperBatchDependencyKeys() : Collections.<String> emptyList(); resolveDependencies(requestCache, urlBuildingStrategy, key, dependencies, superBatchResources, new Stack<String>(), skippedResources, includeDependenciesForFailedUrlReadingConditions); for (final ModuleDescriptorStub dependency : dependencies.values()) { contextResources.add(dependency); } } return unmodifiableCollection(contextResources); }
@Override public void init(final Plugin plugin, final Element element) throws PluginParseException { super.init(plugin, element); this.dependencies = parseDependencies(element, "web-resource", "dependency"); this.moduleDependencies = parseDependencies(element, "web-module", "module-dependency"); this.contextDependencies = parseDependencySet(element, "dependencies", "context"); this.asyncDependencies = parseDependencySet(element, "async-dependencies", "web-resource"); this.asyncContextDependencies = parseDependencySet(element, "async-dependencies", "context"); this.isRootPage = element.element("root-page") != null; final LinkedHashSet<String> ctxs = new LinkedHashSet<>(contexts.size()); ctxs.add(getCompleteKey()); // every <web-resource> has an implicit context based on its name List<Element> contexts = (List<Element>) element.elements("context"); if (!contexts.isEmpty()) { for (Element contextElement : contexts) { ctxs.add(contextElement.getTextTrim()); } } this.contexts = Collections.unmodifiableSet(ctxs); webResourceTransformations = parseTransformations(element); deprecation = parseDeprecation(element, getCompleteKey()); dataProviderParser = new WebResourceDataProviderParser(hostContainer, element.elements("data")); final Attribute minifiedAttribute = element.attribute("disable-minification"); disableMinification = minifiedAttribute == null ? false : Boolean.valueOf(minifiedAttribute.getValue()); this.element = element; }
String key = descriptor.getCompleteKey(); Set<String> ctx = new HashSet<String>(descriptor.getContexts()); Set<String> transforms = descriptor.getDeprecatedTransformKeys(transformerCache); if (!(conditions.isEmpty() && transforms.isEmpty())) { String completeKey = descriptor.getCompleteKey(); WebresourceDescriptor d = new WebresourceDescriptor(completeKey); d.condition1keys = nullIfEmpty(conditions);
final String completeKey = webResourceDescriptor.getCompleteKey(); webResourceDeprecationWarnings.put(completeKey, webResourceDescriptor.getDeprecation()); Date updatedAt = (plugin.getDateLoaded() == null) ? new Date() : plugin.getDateLoaded(); final String completeKey = webResourceDescriptor.getCompleteKey();
Bundle bundle = requestCache.getSnapshot().get(webResourceModuleDescriptor.getCompleteKey()); if (bundle != null)