All Implemented Interfaces:
GlassFishUserManagement, GlassFishUserStore, Comparable<Realm>
Direct Known Subclasses:
CertificateRealm, FileRealm, LDAPRealm, SolarisRealm

@Contract public abstract class Realm extends AbstractGlassFishRealmState implements GlassFishUserStore, GlassFishUserManagement
javadoc
Author:
Harish Prabandham, Harpreet Singh, Jyri Virkki, Shing Wai Chan
See Also:
  • Field Details

    • _logger

      protected static final Logger _logger
  • Constructor Details

    • Realm

      public Realm()
  • Method Details

    • instantiate

      public static Realm instantiate(String name, String className, Properties props) throws BadRealmException
      Instantiate a Realm with the given name and properties using the Class name given. This method is used by iAS and not RI.
      Parameters:
      name - Name of the new realm.
      className - Java Class name of the realm to create.
      props - Properties containing values of the Property element from server.xml
      Throws:
      BadRealmException - If the requested realm cannot be instantiated.
    • instantiate

      public static Realm instantiate(String name, String className, Properties props, String configName) throws BadRealmException
      Instantiate a Realm with the given name and properties using the Class name given. This method is used by iAS and not RI.
      Parameters:
      name - Name of the new realm.
      className - Java Class name of the realm to create.
      props - Properties containing values of the Property element from server.xml
      configName - the config to which this realm belongs
      Throws:
      BadRealmException - If the requested realm cannot be instantiated.
    • getDefaultInstance

      public static Realm getDefaultInstance() throws NoSuchRealmException
      Convenience method which returns the Realm object representing the current default realm. Equivalent to getInstance(getDefaultRealm()).
      Returns:
      Realm representing default realm.
      Throws:
      NoSuchRealmException - if default realm does not exist
    • getInstance

      public static Realm getInstance(String name) throws NoSuchRealmException
      Returns the realm identified by the name which is passed as a parameter. This function knows about all the realms which exist; it is not possible to store (or create) one which is not accessible through this routine.
      Parameters:
      name - identifies the realm
      Returns:
      the requested realm
      Throws:
      NoSuchRealmException - if the realm is invalid
      BadRealmException - if realm data structures are bad
    • getInstance

      public static Realm getInstance(String configName, String name) throws NoSuchRealmException
      Returns the realm identified by the name which is passed as a parameter. This function knows about all the realms which exist; it is not possible to store (or create) one which is not accessible through this routine.
      Parameters:
      name - identifies the realm
      Returns:
      the requested realm
      Throws:
      NoSuchRealmException - if the realm is invalid
      BadRealmException - if realm data structures are bad
    • getDefaultRealm

      public static String getDefaultRealm()
      Returns the name of the default realm.
      Returns:
      Default realm name.
    • setDefaultRealm

      public static void setDefaultRealm(String realmName)
      Sets the name of the default realm.
      Parameters:
      realmName - Name of realm to set as default.
    • isValidRealm

      public static boolean isValidRealm(String name)
      Checks if the given realm name is loaded/valid.
      Parameters:
      String - name of the realm to check.
      Returns:
      true if realm present, false otherwise.
    • isValidRealm

      public static boolean isValidRealm(String configName, String name)
      Checks if the given realm name is loaded/valid.
      Parameters:
      String - name of the realm to check.
      Returns:
      true if realm present, false otherwise.
    • getRealmNames

      public static Enumeration<String> getRealmNames()
      Returns the names of accessible realms.
      Returns:
      set of realm names
    • unloadInstance

      public static void unloadInstance(String realmName) throws NoSuchRealmException
      Remove realm with given name from cache.
      Parameters:
      realmName -
      Throws:
      NoSuchRealmException
    • unloadInstance

      public static void unloadInstance(String configName, String realmName) throws NoSuchRealmException
      Remove realm with given name from cache.
      Parameters:
      realmName -
      Throws:
      NoSuchRealmException
    • updateInstance

      protected static void updateInstance(Realm realm, String name)
      Replace a Realm instance. Can be used by a Realm subclass to replace a previously initialized instance of itself. Future getInstance requests will then obtain the new instance.

      Minimal error checking is done. The realm being replaced must already exist (instantiate() was previously called), the new instance must be fully initialized properly and it must of course be of the same class as the previous instance.

      Parameters:
      realm - The new realm instance.
      name - The (previously instantiated) name for this realm.
    • updateInstance

      protected static void updateInstance(String configName, Realm realm, String name)
      Replace a Realm instance. Can be used by a Realm subclass to replace a previously initialized instance of itself. Future getInstance requests will then obtain the new instance.

      Minimal error checking is done. The realm being replaced must already exist (instantiate() was previously called), the new instance must be fully initialized properly and it must of course be of the same class as the previous instance.

      Parameters:
      realm - The new realm instance.
      name - The (previously instantiated) name for this realm.
    • getRealmStatsProvier

      public static void getRealmStatsProvier()