# Class MemoryUserDatabaseFactory

java.lang.Object
org.apache.catalina.users.MemoryUserDatabaseFactory

All Implemented Interfaces:
  `ObjectFactory`

public class MemoryUserDatabaseFactory extends Object implements ObjectFactory

JNDI object creation factory for `MemoryUserDatabase` instances. This makes it convenient to configure a user database in the global JNDI resources associated with this Catalina instance, and then link to that resource for web applications that administer the contents of the user database.

The `MemoryUserDatabase` instance is configured based on the following parameter values:

- pathname - Absolute or relative (to the directory path specified by the `catalina.base` system property) pathname to the XML file from which our user information is loaded, and to which it is stored. [conf/tomcat-users.xml]

Since:
  4.1

## Constructor Summary

Constructors
Constructor
Description
`MemoryUserDatabaseFactory()`
Default constructor.

## Method Summary

Modifier and Type
Method
Description
`Object`
`getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment)`
Create and return a new `MemoryUserDatabase` instance that has been configured according to the properties of the specified `Reference`.

### Methods inherited from class Object

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

## Constructor Details

### MemoryUserDatabaseFactory

public MemoryUserDatabaseFactory()
Default constructor.

## Method Details

### getObjectInstance

public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws Exception

Create and return a new `MemoryUserDatabase` instance that has been configured according to the properties of the specified `Reference`. If the instance cannot be created, return `null` instead.

Specified by:
  `getObjectInstance` in interface `ObjectFactory`
Parameters:
  `obj` - The possibly null object containing location or reference information that can be used in creating an object
  `name` - The name of this object relative to `nameCtx`
  `nameCtx` - The context relative to which the `name` parameter is specified, or `null` if `name` is relative to the default initial context
  `environment` - The possibly null environment that is used in creating this object
Throws:
  `Exception`