Class MCRComponent

java.lang.Object
org.mycore.common.config.MCRComponent
All Implemented Interfaces:
Comparable<MCRComponent>

public class MCRComponent extends Object implements Comparable<MCRComponent>
This class abstracts different MyCoRe component types. As every component (mycore component, application module) holds it configuration in different places, you can use this class to get uniform access to these configuration resources. As this class is immutable it could be used as key in a Map
Since:
2013.12
Author:
Thomas Scheffler (yagee)
See Also:
  • Constructor Details

    • MCRComponent

      public MCRComponent(String artifactId, Manifest manifest)
    • MCRComponent

      public MCRComponent(String artifactId, Manifest manifest, File jarFile)
  • Method Details

    • getConfigFileStream

      public InputStream getConfigFileStream(String filename)
    • getConfigURL

      public URL getConfigURL(String filename)
    • getResourceBase

      public String getResourceBase()
      Returns resource base path to this components config resources.
    • isMyCoReComponent

      public boolean isMyCoReComponent()
      Returns true, if this component is part of MyCoRe
    • isAppModule

      public boolean isAppModule()
      Returns true, if this component is application module
    • getName

      public String getName()
      A short name for this component. E.g. mycore-base would return "base" here.
    • getJarFile

      public File getJarFile()
      Returns the jar file or null if nothing was set.
      Returns:
      the jar file
    • getManifestMainAttribute

      public String getManifestMainAttribute(String name)
      Returns the mainfest main attribute value for given attribute name.
      Parameters:
      name - the attribute name
      Returns:
      the attribute value
    • compareTo

      public int compareTo(MCRComponent o)
      Compares this component to other component. Basic order is:
      1. complete
      2. base
      3. component
      4. module
      If more than one component is in one of these groups, they are sorted alphabetically via getName().
      Specified by:
      compareTo in interface Comparable<MCRComponent>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object