Class Realm

    • Constructor Detail

      • Realm

        public Realm()
    • Method Detail

      • 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.
        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
        Returns:
        Reference to the new Realm. The Realm class keeps an internal list of all instantiated realms.
        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.
        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
      • 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.
      • 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
      • 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:
        configName -
        name - identifies the realm
        Returns:
        the requested realm
        Throws:
        NoSuchRealmException - if the realm is invalid
      • getRealmNames

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

        public static boolean isValidRealm​(String name)
        Checks if the given realm name is loaded/valid.
        Parameters:
        name - 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:
        configName -
        name - name of the realm to check.
        Returns:
        true if realm present, false otherwise.
      • getRealmStatsProvier

        public static void getRealmStatsProvier()
      • 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:
        configName -
        realm - The new realm instance.
        name - The (previously instantiated) name for this realm.