ResourceLinkFactory (Apache Tomcat 10.1.57 API Documentation)
Description: declaration: package: org.apache.naming.factory, class: ResourceLinkFactory

# Class ResourceLinkFactory

java.lang.Object
org.apache.naming.factory.ResourceLinkFactory

All Implemented Interfaces:
  `ObjectFactory`

Direct Known Subclasses:
  `DataSourceLinkFactory`

public class ResourceLinkFactory extends Object implements ObjectFactory

Object factory for resource links.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final StringManager`
  `sm`
  The string manager for this package.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ResourceLinkFactory()`
  Default constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `deregisterGlobalResourceAccess(Context globalContext)`
  Deregister all global resource access for the current web application.
  `static void`
  `deregisterGlobalResourceAccess(Context globalContext, String localName)`
  Deregister access to a specific global resource for the current web application.
  `Object`
  `getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment)`
  Create a new resource instance.
  `static void`
  `registerGlobalResourceAccess(Context globalContext, String localName, String globalName)`
  Register access to a global resource for the current web application.
  `static void`
  `setGlobalContext(Context newGlobalContext)`
  Set the global context (note: can only be used once).

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### sm

    protected static final StringManager sm
    The string manager for this package.

- ## Constructor Details

  - ### ResourceLinkFactory

    public ResourceLinkFactory()
    Default constructor.

- ## Method Details

  - ### setGlobalContext

    public static void setGlobalContext(Context newGlobalContext)
    Set the global context (note: can only be used once).
    Parameters:
      `newGlobalContext` - new global context value

  - ### registerGlobalResourceAccess

    public static void registerGlobalResourceAccess(Context globalContext, String localName, String globalName)
    Register access to a global resource for the current web application.
    Parameters:
      `globalContext` - The global naming context
      `localName` - The local name of the resource
      `globalName` - The global name of the resource

  - ### deregisterGlobalResourceAccess

    public static void deregisterGlobalResourceAccess(Context globalContext, String localName)
    Deregister access to a specific global resource for the current web application.
    Parameters:
      `globalContext` - The global naming context
      `localName` - The local name of the resource

  - ### deregisterGlobalResourceAccess

    public static void deregisterGlobalResourceAccess(Context globalContext)
    Deregister all global resource access for the current web application.
    Parameters:
      `globalContext` - The global naming context

  - ### getObjectInstance

    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws NamingException
    Create a new resource instance.
    Specified by:
      `getObjectInstance` in interface `ObjectFactory`
    Parameters:
      `name` - the bound name
      `nameCtx` - unused
      `environment` - unused
    Returns:
      the object instance
    Throws:
      `NamingException` - if an error occur creating the instance