@Override public AppRegistration save(String name, ApplicationType type, String version, URI uri, URI metadataUri) { return this.save(new AppRegistration(name, type, version, uri, metadataUri)); }
/** * Deletes an {@link AppRegistration}. If the {@link AppRegistration} does not exist, a * {@link NoSuchAppRegistrationException} will be thrown. * * @param name Name of the AppRegistration to delete * @param type Type of the AppRegistration to delete * @param version Version of the AppRegistration to delete */ public void delete(String name, ApplicationType type, String version) { this.appRegistrationRepository.deleteAppRegistrationByNameAndTypeAndVersion(name, type, version); populateAuditData(AuditActionType.DELETE, new AppRegistration(name, type, version, URI.create(""), URI.create(""))); }
/** * Builds a {@link Stream} from key/value mapping. * @return * <ul> * <li>valid AppRegistration as single element Stream</li> * <li>silently ignores well malformed metadata entries (0 element Stream) or</li> * <li>fails otherwise.</li> * </ul> * * @param kv key/value representing app key (key) and app URI (value) * @param metadataURI metadataUri computed from a given app key */ protected Stream<AppRegistration> toValidAppRegistration(Map.Entry<String, URI> kv, URI metadataURI) { String key = kv.getKey(); String[] tokens = key.split("\\."); if (tokens.length == 2) { String name = tokens[1]; ApplicationType type = ApplicationType.valueOf(tokens[0]); URI appURI = warnOnMalformedURI(key, kv.getValue()); String version = getVersionOrBroken(appURI.toString()); return Stream.of(new AppRegistration(name, type, version, appURI, metadataURI)); } else { Assert.isTrue(tokens.length == 3 && METADATA_KEY_SUFFIX.equals(tokens[2]), "Invalid format for app key '" + key + "'in file. Must be <type>.<name> or <type>.<name>" + ".metadata"); return Stream.empty(); } }