@Override public SubjectConfig getConfig() { return delegate.getConfig(); }
@Override public SubjectConfig getConfig() { return delegate.getConfig(); }
@GET @Path("{subject}/config") public String subjectConfig(@HeaderParam("Accept") String mediaType, @PathParam("subject") String subject) { Subject s = repo.lookup(subject); if (null == s) { throw new NotFoundException(MessageStrings.SUBJECT_DOES_NOT_EXIST_ERROR); } Properties props = new Properties(); props.putAll(s.getConfig().asMap()); return getRenderer(mediaType).renderProperties(props, "Configuration of subject " + subject); }
@GET @Path("{subject}/config") public String subjectConfig(@HeaderParam("Accept") String mediaType, @PathParam("subject") String subject) { Subject s = repo.lookup(subject); if (null == s) { throw new NotFoundException(MessageStrings.SUBJECT_DOES_NOT_EXIST_ERROR); } Properties props = new Properties(); props.putAll(s.getConfig().asMap()); return getRenderer(mediaType).renderProperties(props, "Configuration of subject " + subject); }
/** * This retrieves mutable data, hence it is not cache-able and will always * result in a call to the underlying schema repo implementation. * * @param subjectName to get the config for * @return the requested subject's config, or null if the subject does not exist */ public SubjectConfig getConfig(SUBJECT subjectName) { Subject subject = repo.lookup(convertSubject.toString(subjectName)); if (subject != null) { return subject.getConfig(); } else { return null; // or throw exception? } }
/** * This retrieves mutable data, hence it is not cache-able and will always * result in a call to the underlying schema repo implementation. * * @param subjectName to get the config for * @return the requested subject's config, or null if the subject does not exist */ public SubjectConfig getConfig(SUBJECT subjectName) { Subject subject = repo.lookup(convertSubject.toString(subjectName)); if (subject != null) { return subject.getConfig(); } else { return null; // or throw exception? } }
/** * Create a {@link Subject} that validates schemas as configured. */ public static Subject validatingSubject(Subject subject, ValidatorFactory factory) { if (null == subject) { return subject; } List<Validator> validators; SubjectConfig config = subject.getConfig(); // if the validators key is not specified in the subject config, get the default ones. // ensure that even an empty set is honored as "no validators" if (config.get(SubjectConfig.VALIDATORS_KEY) != null) validators = factory.getValidators(config.getValidators()); else validators = factory.getValidators(factory.getDefaultSubjectValidators()); if (!validators.isEmpty()) { return new ValidatingSubject(subject, new CompositeValidator(validators)); } else { return subject; } }
/** * Create a {@link Subject} that validates schemas as configured. */ public static Subject validatingSubject(Subject subject, ValidatorFactory factory) { if (null == subject) { return subject; } List<Validator> validators; SubjectConfig config = subject.getConfig(); // if the validators key is not specified in the subject config, get the default ones. // ensure that even an empty set is honored as "no validators" if (config.get(SubjectConfig.VALIDATORS_KEY) != null) validators = factory.getValidators(config.getValidators()); else validators = factory.getValidators(factory.getDefaultSubjectValidators()); if (!validators.isEmpty()) { return new ValidatingSubject(subject, new CompositeValidator(validators)); } else { return subject; } }