Class RepositoryService

  • All Implemented Interfaces:
    de.willuhn.boot.Bootable

    public class RepositoryService
    extends java.lang.Object
    implements de.willuhn.boot.Bootable
    Dieser Service verwaltet den Zugriff auf Online-Repositories mit Jameica-Plugins.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String SYSTEM_REPOSITORY
      Die URL des System-Repository.
      static java.lang.String[] WELL_KNOWN
      Liste von bekannten Repositories, die wir mit ausliefern, die der User aber wieder loeschen kann
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRepository​(java.net.URL url)
      Fuegt ein neues Online-Repository hinzu.
      void checkSignature​(PluginData plugin, java.io.File archive, java.io.File sig)
      Prueft die Signatur eines Plugins.
      boolean contains​(java.net.URL url)
      Prueft, ob die angegebene URL als Repository hinterlegt ist.
      java.lang.Class<de.willuhn.boot.Bootable>[] depends()  
      void downloadMulti​(PluginData... plugins)
      Laedt mehrere Plugins von ggf.
      java.util.List<java.net.URL> getRepositories()
      Liefert eine Liste mit URLs zu aktiven Online-Repositories mit Plugins.
      java.util.List<java.net.URL> getRepositories​(boolean all)
      Liefert eine Liste mit URLs zu Online-Repositories mit Plugins.
      void init​(de.willuhn.boot.BootLoader arg0, de.willuhn.boot.Bootable arg1)  
      boolean isEnabled​(java.net.URL url)
      Liefert true, wenn das Repository aktiv ist und verwendet werden soll.
      Repository open​(java.net.URL url)
      Oeffnet ein Repository.
      void removeRepository​(java.net.URL url)
      Entfernt ein Online-Repository.
      ResolverResult resolve​(PluginData plugin)
      Loest die zu installierenden Abhaengigkeiten fuer das Plugin auf.
      java.util.List<RepositorySearchResult> search​(java.net.URL url, java.lang.String query)
      Sucht Plugins Repository-uebergreifend.
      void setEnabled​(java.net.URL url, boolean enabled)
      Markiert ein Repository als aktiv/inaktiv.
      void shutdown()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SYSTEM_REPOSITORY

        public static final java.lang.String SYSTEM_REPOSITORY
        Die URL des System-Repository.
        See Also:
        Constant Field Values
      • WELL_KNOWN

        public static final java.lang.String[] WELL_KNOWN
        Liste von bekannten Repositories, die wir mit ausliefern, die der User aber wieder loeschen kann
    • Constructor Detail

      • RepositoryService

        public RepositoryService()
    • Method Detail

      • depends

        public java.lang.Class<de.willuhn.boot.Bootable>[] depends()
        Specified by:
        depends in interface de.willuhn.boot.Bootable
        See Also:
        Bootable.depends()
      • init

        public void init​(de.willuhn.boot.BootLoader arg0,
                         de.willuhn.boot.Bootable arg1)
                  throws de.willuhn.boot.SkipServiceException
        Specified by:
        init in interface de.willuhn.boot.Bootable
        Throws:
        de.willuhn.boot.SkipServiceException
        See Also:
        Bootable.init(de.willuhn.boot.BootLoader, de.willuhn.boot.Bootable)
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface de.willuhn.boot.Bootable
        See Also:
        Bootable.shutdown()
      • getRepositories

        public java.util.List<java.net.URL> getRepositories​(boolean all)
        Liefert eine Liste mit URLs zu Online-Repositories mit Plugins.
        Parameters:
        all - true, wenn auch die inaktiven Repositories geliefert werden sollen.
        Returns:
        Liste mit URLs zu Online-Repositories mit Plugins.
      • getRepositories

        public java.util.List<java.net.URL> getRepositories()
        Liefert eine Liste mit URLs zu aktiven Online-Repositories mit Plugins.
        Returns:
        Liste mit URLs zu den aktiven Online-Repositories mit Plugins.
      • resolve

        public ResolverResult resolve​(PluginData plugin)
                               throws de.willuhn.util.ApplicationException
        Loest die zu installierenden Abhaengigkeiten fuer das Plugin auf.
        Parameters:
        plugin - das zu installierende Plugin.
        Returns:
        das Ergebnis der Aufloesung.
        Throws:
        de.willuhn.util.ApplicationException
      • downloadMulti

        public void downloadMulti​(PluginData... plugins)
                           throws de.willuhn.util.ApplicationException
        Laedt mehrere Plugins von ggf. unterschiedlichen Repositories in einem Rutsch herunter. Einen Nicht-interaktiven Modus gibt es hier nicht.
        Parameters:
        plugins - die Liste der Plugins.
        Throws:
        de.willuhn.util.ApplicationException
      • checkSignature

        public void checkSignature​(PluginData plugin,
                                   java.io.File archive,
                                   java.io.File sig)
                            throws java.lang.Exception
        Prueft die Signatur eines Plugins.
        Parameters:
        plugin - das Plugin.
        archive - Datei, dessen Signatur gecheckt werden soll.
        sig - die Signatur.
        Throws:
        java.lang.Exception
      • search

        public java.util.List<RepositorySearchResult> search​(java.net.URL url,
                                                             java.lang.String query)
                                                      throws de.willuhn.util.ApplicationException
        Sucht Plugins Repository-uebergreifend.
        Parameters:
        query - optionaler Suchbegriff.
        url - optionale URL des Repository.
        Returns:
        Liste mit den Suchergebnissen.
        Throws:
        de.willuhn.util.ApplicationException
      • open

        public Repository open​(java.net.URL url)
                        throws de.willuhn.util.ApplicationException
        Oeffnet ein Repository.
        Parameters:
        url - URL zum Repository.
        Returns:
        das Repository.
        Throws:
        de.willuhn.util.ApplicationException
      • isEnabled

        public boolean isEnabled​(java.net.URL url)
        Liefert true, wenn das Repository aktiv ist und verwendet werden soll.
        Parameters:
        url - die URL.
        Returns:
        true, wenn die URL verwendet werden soll.
      • setEnabled

        public void setEnabled​(java.net.URL url,
                               boolean enabled)
        Markiert ein Repository als aktiv/inaktiv.
        Parameters:
        url - die URL.
        enabled - true, wenn das Repository verwendet werden soll.
      • addRepository

        public void addRepository​(java.net.URL url)
                           throws de.willuhn.util.ApplicationException
        Fuegt ein neues Online-Repository hinzu.
        Parameters:
        url - URL des Online-Repositories.
        Throws:
        de.willuhn.util.ApplicationException
      • removeRepository

        public void removeRepository​(java.net.URL url)
                              throws de.willuhn.util.ApplicationException
        Entfernt ein Online-Repository.
        Parameters:
        url - URL des Online-Repositories.
        Throws:
        de.willuhn.util.ApplicationException
      • contains

        public boolean contains​(java.net.URL url)
        Prueft, ob die angegebene URL als Repository hinterlegt ist.
        Parameters:
        url - die zu pruefende URL
        Returns:
        true, wenn die URL bereits hinterlegt ist.