001package jmri.server.web.spi;
002
003import java.net.URI;
004import java.net.URL;
005import java.util.List;
006import java.util.Locale;
007import java.util.Set;
008import javax.annotation.Nonnull;
009
010/**
011 * Provide integration for the JMRI web services so servlets can visually
012 * integrate into the JMRI web site.
013 *
014 * @author Randall Wood (C) 2016
015 */
016public interface WebManifest {
017
018    /**
019     * Get the navigation menu items that provide access to the servlet
020     * associated with the manifest.
021     *
022     * @return a set of menu items; provide an empty set if the item should not
023     *         be in the navigation menu
024     */
025    @Nonnull
026    Set<WebMenuItem> getNavigationMenuItems();
027
028    /**
029     * Get any scripts the servlet associated with the manifest requires in the
030     * order required.
031     *
032     * @return a set of script URLs; provide an empty set if the item needs no
033     *         scripts
034     */
035    @Nonnull
036    List<String> getScripts();
037
038    /**
039     * Get any CSS style sheets the servlet associated with the manifest
040     * requires in the order required.
041     *
042     * @return a set of style sheet URLs; provide an empty set if the item needs
043     *         no style sheets
044     */
045    @Nonnull
046    List<String> getStyles();
047
048    /**
049     * Get the Angular dependencies required by the servlet associated with the
050     * manifest.
051     *
052     * @return an ordered list of angular dependencies
053     */
054    @Nonnull
055    List<String> getAngularDependencies();
056
057    /**
058     * Get the Angular routes supported by the servlet associated with the
059     * manifest.
060     *
061     * @return a map of angular path to angular routing instructions
062     */
063    @Nonnull
064    Set<AngularRoute> getAngularRoutes();
065
066    /**
067     * Get the sources for the Angular module components required by the servlet
068     * associated with the manifest.
069     *
070     * @return a list of sources to include in the web app
071     */
072    @Nonnull
073    List<URL> getAngularSources();
074
075    /**
076     * Get the paths for JSON translation dictionaries to pre-load. If
077     * translation dictionaries exist, but not for the requested Locale,
078     * fallback onto the requested language, and, if that is also not available,
079     * to the English language with no country specified.
080     *
081     * @param locale the requested locale for the translations
082     * @return a list of translation sources
083     */
084    Set<URI> getPreloadedTranslations(Locale locale);
085}