/** * Creates the instance. * * @return the new instance. */ public PropertiesContext build() { return new PropertiesContext(this); }
@Override protected String calcPath(final PropertyDescriptor descriptor, final Locale locale) { return context.createMetaInfPath(descriptor, locale); }
/** * Returns the URL to the property set XML report in the META-INF directory of * the given descriptor. * * @param descriptor the properties descriptor whose property set XML report * URL is requested. * @return the class loader root rooted path. */ public String createMetaInfPathPropertySet(final PropertyDescriptor descriptor) { return createMetaInfPathPropertySet(descriptor, null); }
/** * Returns the URL to the report documentation for the given descriptor. * * @param descriptor the properties descriptor whose report documentation URL * is requested. * @return the absolute URL to the report. */ public String createReportUrl(final PropertyDescriptor descriptor) { final String target = resolve(descriptor); final String url = createReportUrl(target); return url; }
private static void handleAliases(final PropertiesContext context, final Element root) { if (context.hasAliases()) { final Element aliases = new Element("aliases"); final AliasTraverser traverser = new AliasTraverser() { @Override public void handle(final String alias, final String physical) { final Element aliasElement = new Element("alias"); aliasElement.setAttribute("for", physical); aliasElement.addContent(alias); aliases.addContent(aliasElement); } }; context.traverseAliases(traverser); root.addContent(aliases); } }
/** * Writes the configuration to the given stream. * * @param context the context to write. * @param out the stream to write to. * @throws IOException on any problem writing to the stream. */ public void write(final PropertiesContext context, final OutputStream out) throws IOException { final Element root = new Element("config"); final Document document = new Document(root); root.addContent(new Element("homepage-url").addContent(context .getHomePageUrl())); root.addContent(new Element("properties-report-url").addContent(context .getPropertiesReportUrl())); handleAliases(context, root); final XMLOutputter outputter = new XMLOutputter(); outputter.output(document, out); }
@Override public String getPropertyReportUrl() { return propertiesContext.createReportUrl(descriptor); }
@Override public String getHomePageUrl() { return propertiesContext.getHomePageUrl(); }
@Override public String getPropertiesReportIndexUrl() { return propertiesContext.getPropertiesReportIndexUrl(); }
@Override public String getPropertiesReportUrl() { return propertiesContext.getPropertiesReportUrl(); }
@Override public List<Locale> getSupportedLocales() { return propertiesContext.getLocales(); }
return PropertiesContext.createEmptyContext(); return PropertiesContext.createEmptyContext();
/** * Returns the URL to the index document of smartics properties reports. * * @return the URL to the index document of smartics properties reports. May * be <code>null</code>. */ @CheckForNull public String getPropertiesReportIndexUrl() { return createReportUrl("smartics-properties-report"); }
/** * Returns the string representation of the object. * * @return the string representation of the object. */ @Override public String toString() { final StringBuilder buffer = new StringBuilder(); for (final Entry<String, PropertiesContext> entry : contexts.entrySet()) { buffer.append(entry.getKey()).append('=') .append(entry.getValue().getHomePageUrl()); } return buffer.toString(); } }
/** * Returns the URL to the XML report in the META-INF directory of the given * descriptor. * * @param descriptor the properties descriptor whose XML report URL is * requested. * @return the class loader root rooted path. */ public String createMetaInfPath(final PropertyDescriptor descriptor) { return createMetaInfPath(descriptor, null); }
@Override public final String getDocumentationUrl(final PropertyDescriptor descriptor) throws ConfigException { final PropertiesContext context = getContext(descriptor); return context.createReportUrl(descriptor); }
@Override protected String calcPath(final PropertyDescriptor descriptor, final Locale locale) { return context.createMetaInfPathPropertySet(descriptor, locale); }
@Override public final String getMetaInfPath(final PropertyDescriptor descriptor) throws ConfigException { final PropertiesContext context = getContext(descriptor); return context.createMetaInfPath(descriptor); }
final Locale locale) final String path = context.createMetaInfPath(descriptor, locale); final ClassLoader loader = descriptor.getDeclaringType().getClassLoader(); // NOPMD