Class Pkg3Resource

java.lang.Object
org.ctan.site.resources.catalogue.Pkg3Resource

@Path("/3.0") @Produces({"application/json","application/xml"}) public class Pkg3Resource extends Object
The class Pkg3Resource contains the controller for the package resource.
  • Constructor Details

    • Pkg3Resource

      public Pkg3Resource(@NonNull @NonNull CtanConfiguration.CtanConfig config, @NonNull @NonNull PkgStore store, @NonNull @NonNull ContentService contentService, @NonNull @NonNull BibtexService bibtexService, @NonNull @NonNull PostingsService postingService, @NonNull @NonNull PkgAliasStore aliasStore)
      This is the constructor for Pkg3Resource.
      Parameters:
      config - the configuration
      store - the underlying store
      contentService - the content service
      bibtexService - the BibTeX service
      postingService - the posting cache
      aliasStore - the store for package aliases
  • Method Details

    • getPkgByKey

      @GET @Path("/pkg/{id}") @PermitAll @UnitOfWork("siteDb") public Pkg3Resource.PkgTo getPkgByKey(@NonNull @PathParam("id") @NonNull String key, @QueryParam("lang") String language)
      The method getPkgByKey provides means to retrieve a package by its id.
      Parameters:
      key - the id
      language - the locale code
      Returns:
      the package or null
    • getPkgs

      @GET @Path("/pkgs") @PermitAll @UnitOfWork("siteDb") public List<Pkg3Resource.PkgSummaryTo> getPkgs(@QueryParam("lang") String lang)
      The method getPkgs provides means to retrieve a list of all packages.
      Parameters:
      lang - the language code
      Returns:
      a list of matching package summaries
    • getPkgs

      @GET @Path("/pkgs/{pattern}") @PermitAll @UnitOfWork("siteDb") public List<Pkg3Resource.PkgSummaryTo> getPkgs(@PathParam("pattern") String pattern, @QueryParam("lang") String lang)
      The method getPkgs provides means to retrieve a list of packages starting with a given pattern.
      Parameters:
      pattern - the initial string of the key
      lang - the language code
      Returns:
      a list of matching package summaries
    • getRandomPackages

      @GET @Path("/rnd/pkgs") @PermitAll @UnitOfWork("siteDb") public List<Pkg3Resource.PkgInfoTo> getRandomPackages(@QueryParam("size") @DefaultValue("3") int count, @QueryParam("lang") @DefaultValue("en") String lang, @QueryParam("obsolete") @DefaultValue("false") boolean obsolete)
      The method getRandomPackages provides means to retrieve a random list of packages.
      Parameters:
      count - the number of packages
      lang - the locale
      obsolete - the indicator whether to include obsolete packages
      Returns:
      the configuration