Class Realms

java.lang.Object
org.forgerock.openam.core.realms.Realms

public final class Realms extends Object
A class to statically obtain Realm instances.
  • Method Details

    • root

      public static Realm root()
      Gets the root realm.
      Returns:
      The root realm.
    • of

      public static Realm of(String realm) throws RealmLookupException
      Uses the realm String to lookup the Realm.
      Parameters:
      realm - The realm to lookup, in either path or DN format.
      Returns:
      A Realm instance of the realm.
      Throws:
      RealmLookupException - If the provided realm is not valid or failed to be resolved.
    • getAsOptional

      public static Optional<Realm> getAsOptional(String realm) throws RealmLookupException
      Uses the realm String to lookup the Realm.
      Parameters:
      realm - The realm to lookup, in either path or DN format.
      Returns:
      A Realm instance of the realm or null if realm is not valid.
      Throws:
      RealmLookupException - If the provided realm failed to be resolved.
    • of

      public static Realm of(Realm realm, String subRealm) throws RealmLookupException
      Uses the realm as the parent realm and the subRealm as sub-realm to lookup the Realm.
      Parameters:
      realm - The parent realm.
      subRealm - The sub-realm.
      Returns:
      A Realm instance of the concatenation of realm and subRealm.
      Throws:
      RealmLookupException - If the provided realm and subRealm do not constitute a valid realm or failed to be resolved/
    • onRealmCreation

      public static void onRealmCreation(Consumer<Realm> action)
      Add a listener for realm creation events.
      Parameters:
      action - The action to invoke when a realm is created.
    • onRealmDeletion

      public static void onRealmDeletion(Consumer<Realm> action)
      Add a listener for realm deletion events.
      Parameters:
      action - The action to invoke when a realm is deleted.