Class NamingEntryUtil


  • public class NamingEntryUtil
    extends Object
    • Constructor Detail

      • NamingEntryUtil

        public NamingEntryUtil()
    • Method Detail

      • bindToENC

        public static boolean bindToENC​(Object scope,
                                        String asName,
                                        String mappedName)
                                 throws NamingException
        Link a name in a webapp's java:/comp/evn namespace to a pre-existing resource. The pre-existing resource can be either in the webapp's naming environment, or in the container's naming environment. Webapp's environment takes precedence over the server's namespace.
        Parameters:
        scope - the scope of the lookup
        asName - the name to bind as
        mappedName - the name from the environment to link to asName
        Returns:
        true if bind success, false if not bound
        Throws:
        NamingException - if unable to bind
      • lookupNamingEntry

        public static NamingEntry lookupNamingEntry​(Object scope,
                                                    String jndiName)
                                             throws NamingException
        Find a NamingEntry in the given scope.
        Parameters:
        scope - the object scope
        jndiName - the jndi name
        Returns:
        the naming entry for the given scope
        Throws:
        NamingException - if unable to lookup naming entry
      • lookupNamingEntries

        public static List<Object> lookupNamingEntries​(Object scope,
                                                       Class<?> clazz)
                                                throws NamingException
        Get all NameEntries of a certain type in the given naming environment scope (server-wide names or context-specific names)
        Parameters:
        scope - the object scope
        clazz - the type of the entry
        Returns:
        all NameEntries of a certain type in the given naming environment scope (server-wide names or context-specific names)
        Throws:
        NamingException - if unable to lookup the naming entries
      • getNameForScope

        public static Name getNameForScope​(Object scope)