protected void resolveImports(TaskContext aContext) { for (Entry<String, String> e : aContext.getMetadata().getImports().entrySet()) { URI uri = URI.create(e.getValue()); // Try resolving by type if (LATEST_CONTEXT_SCHEME.equals(uri.getScheme()) || CONTEXT_ID_SCHEME.equals(uri.getScheme())) { String uuid; uuid = aContext.resolve(uri).getId(); if (!getStorageService().containsKey(uuid, uri.getPath())) { throw new UnresolvedImportException(aContext, e.getKey(), e.getValue(), "Key not found"); } String resolvedUri = CONTEXT_ID_SCHEME + "://" + uuid + uri.getPath(); log.debug("Resolved import ["+e.getValue()+"] -> ["+resolvedUri+"]"); e.setValue(resolvedUri); } } }
protected void resolveImports(TaskContext aContext) { for (Entry<String, String> e : aContext.getMetadata().getImports().entrySet()) { URI uri = URI.create(e.getValue()); // Try resolving by type if (LATEST_CONTEXT_SCHEME.equals(uri.getScheme()) || CONTEXT_ID_SCHEME.equals(uri.getScheme())) { String uuid; uuid = aContext.resolve(uri).getId(); if (!getStorageService().containsKey(uuid, uri.getPath())) { throw new UnresolvedImportException(aContext, e.getKey(), e.getValue(), "Key not found"); } String resolvedUri = CONTEXT_ID_SCHEME + "://" + uuid + uri.getPath(); log.debug("Resolved import ["+e.getValue()+"] -> ["+resolvedUri+"]"); e.setValue(resolvedUri); } } }
@Override public Map<String, String> getResolvedDescriminators(TaskContext aContext) { StorageService storageService = aContext.getStorageService(); Map<String, String> descs = new HashMap<String, String>(); descs.putAll(getDescriminators()); // Load previous discriminators and check that the do not conflict with discriminators // defined in this task for (String rawUri : aContext.getMetadata().getImports().values()) { URI uri = URI.create(rawUri); if (isStaticImport(uri)) { continue; } final TaskContextMetadata meta = aContext.resolve(uri); Map<String, String> prerequisiteDiscriminators = storageService.retrieveBinary( meta.getId(), DISCRIMINATORS_KEY, new PropertiesAdapter()).getMap(); for (Entry<String, String> e : prerequisiteDiscriminators.entrySet()) { if (descs.containsKey(e.getKey()) && !descs.get(e.getKey()).equals(e.getValue())) { throw new IllegalStateException("Discriminator [" + e.getKey() + "] in task [" + getType() + "] conflicts with dependency [" + meta.getType() + "]"); } descs.put(e.getKey(), e.getValue()); } } return descs; }
@Override public Map<String, String> getResolvedDescriminators(TaskContext aContext) { StorageService storageService = aContext.getStorageService(); Map<String, String> descs = new HashMap<String, String>(); descs.putAll(getDescriminators()); // Load previous discriminators and check that the do not conflict with discriminators // defined in this task for (String rawUri : aContext.getMetadata().getImports().values()) { URI uri = URI.create(rawUri); if (isStaticImport(uri)) { continue; } final TaskContextMetadata meta = aContext.resolve(uri); Map<String, String> prerequisiteDiscriminators = storageService.retrieveBinary( meta.getId(), DISCRIMINATORS_KEY, new PropertiesAdapter()).getMap(); for (Entry<String, String> e : prerequisiteDiscriminators.entrySet()) { if (descs.containsKey(e.getKey()) && !descs.get(e.getKey()).equals(e.getValue())) { throw new IllegalStateException("Discriminator [" + e.getKey() + "] in task [" + getType() + "] conflicts with dependency [" + meta.getType() + "]"); } descs.put(e.getKey(), e.getValue()); } } return descs; }