com.sun.pkg.client

## Class Fmri

- java.lang.Object
- - com.sun.pkg.client.Fmri

- All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Comparable<Fmri>

      public class Fmri
      extends java.lang.Object
      implements java.lang.Comparable<Fmri>, java.lang.Cloneable

  An `Fmri` is an identifier for a package. The acronym stands for Fault Management Resource Identifier (even though IPS has little to do with fault management). The Fmri includes the name and version for the package. For more information about the format and behavior of the version part of the Fmri, see the `Version` class.
  Author:
    trm
  See Also:
    `Version`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Fmri` | `nullFmri`
    `static java.lang.String` | `PREF_AUTH_PFX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Fmri(java.lang.String p)` Create an Fmri from a string representation.
    `Fmri(java.lang.String name, java.lang.String version)` Create an Fmri from a package name and version.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Fmri` | `clone()`
    `int` | `compareTo(Fmri fmri)` Compare two Fmris.
    `boolean` | `equals(java.lang.Object o)` Compare to Fmris for equality.
    `java.lang.String` | `getAuthority()` Obtain the authority from the Fmri.
    `java.lang.String` | `getName()` Obtain the name of the package
    `java.io.File` | `getPkgDir(java.io.File pkgdir)` Return the directory that is used to store information about all versions of this package
    `java.io.File` | `getPkgVersionDir(java.io.File pkgdir)` Return the directory that is used to store information about this particular package version.
    `java.lang.String` | `getURLPath()` Return the URL path that is used to look up information about this Fmri.
    `Version` | `getVersion()` Obtain the version of the package
    `int` | `hashCode()`
    `boolean` | `isSamePackage(Fmri f)` Determine whether the given Fmri is for the same package as this Fmri, even if for different versions.
    `boolean` | `isSuccessor(Fmri f)` Determine whether this Fmri is a successor to the given Fmri
    `boolean` | `matches(Fmri f)` Check if the given Fmri matches this Fmri.
    `java.lang.String` | `toString()` Return the String representation of the Fmri.

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### PREF_AUTH_PFX

          public static final java.lang.String PREF_AUTH_PFX

      See Also:
        Constant Field Values

    - #### nullFmri

          public static final Fmri nullFmri

  - ### Constructor Detail

    - #### Fmri

          public Fmri(java.lang.String p)

      Create an Fmri from a string representation.

    - #### Fmri

          public Fmri(java.lang.String name,
              java.lang.String version)

      Create an Fmri from a package name and version.

  - ### Method Detail

    - #### clone

          public Fmri clone()

      Overrides:
        `clone` in class `java.lang.Object`

    - #### getAuthority

          public java.lang.String getAuthority()

      Obtain the authority from the Fmri.
      Returns:
        The name of the authority. If the authority hasn't been set, return the empty string.

    - #### getName

          public java.lang.String getName()

      Obtain the name of the package
      Returns:
        The name of the package

    - #### getVersion

          public Version getVersion()

      Obtain the version of the package
      Returns:
        The version of the package

    - #### getPkgDir

          public java.io.File getPkgDir(java.io.File pkgdir)
                                 throws java.io.IOException

      Return the directory that is used to store information about all versions of this package
      Parameters:
        `pkgdir` - The directory within the image for storing all package meta data
      Returns:
        The directory used for storing information about Fmris having the same name as this Fmri
      Throws:
        `java.io.IOException`

    - #### getPkgVersionDir

          public java.io.File getPkgVersionDir(java.io.File pkgdir)
                                        throws java.io.IOException

      Return the directory that is used to store information about this particular package version.
      Parameters:
        `pkgdir` - The directory within the image for storing all package meta data
      Returns:
        The directory where information about this Fmri is stored.
      Throws:
        `java.io.IOException`

    - #### getURLPath

          public java.lang.String getURLPath()
                                      throws java.io.IOException

      Return the URL path that is used to look up information about this Fmri.
      Returns:
        A String that is used in a URL to get information about this Fmri.
      Throws:
        `java.io.IOException`

    - #### toString

          public java.lang.String toString()

      Return the String representation of the Fmri.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        the String representation of the Fmri.

    - #### equals

          public boolean equals(java.lang.Object o)

      Compare to Fmris for equality.
      Overrides:
        `equals` in class `java.lang.Object`
      Returns:
        True if the two Fmris are equal

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### compareTo

          public int compareTo(Fmri fmri)

      Compare two Fmris.
      Specified by:
        `compareTo` in interface `java.lang.Comparable<Fmri>`
      Parameters:
        `fmri` - the Fmri to compare with this Fmri
      Returns:
        -1 if this Fmri is less than fmri, 0 if the Fmris are equal, 1 if this Fmri is greater than fmri.

    - #### matches

          public boolean matches(Fmri f)

      Check if the given Fmri matches this Fmri.
      Returns:
        True if the given Fmri matches this Fmri

    - #### isSamePackage

          public boolean isSamePackage(Fmri f)

      Determine whether the given Fmri is for the same package as this Fmri, even if for different versions.
      Parameters:
        `f` - a given Fmri
      Returns:
        True if the Fmris are for the same package

    - #### isSuccessor

          public boolean isSuccessor(Fmri f)

      Determine whether this Fmri is a successor to the given Fmri
      Parameters:
        `f` - the given Fmri
      Returns:
        True if the two Fmris are for the same package, and the version of this Fmri is greater than the version of the given Fmri