Package org.apache.activemq.artemis.jndi

## Class JNDIReferenceFactory

- java.lang.Object
- - org.apache.activemq.artemis.jndi.JNDIReferenceFactory

- All Implemented Interfaces:
    `javax.naming.spi.ObjectFactory`

      public class JNDIReferenceFactory
      extends java.lang.Object
      implements javax.naming.spi.ObjectFactory

  Converts objects implementing JNDIStorable into a property fields so they can be stored and regenerated from JNDI
  Since:
    1.0

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JNDIReferenceFactory()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static javax.naming.Reference` | `createReference​(java.lang.String instanceClassName, JNDIStorable po)` | Create a Reference instance from a JNDIStorable object
    `java.lang.Object` | `getObjectInstance​(java.lang.Object object, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable<?,​?> environment)` | This will be called by a JNDIprovider when a Reference is retrieved from a JNDI store - and generates the original instance
    `static java.util.Properties` | `getProperties​(javax.naming.Reference reference)` |
    `static java.lang.Class<?>` | `loadClass​(java.lang.Object thisObj, java.lang.String className)` | Retrieve the class loader for a named class

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### JNDIReferenceFactory

          public JNDIReferenceFactory()

  - ### Method Detail

    - #### getObjectInstance

          public java.lang.Object getObjectInstance​(java.lang.Object object,
                                                    javax.naming.Name name,
                                                    javax.naming.Context nameCtx,
                                                    java.util.Hashtable<?,​?> environment)
                                             throws java.lang.Exception

      This will be called by a JNDIprovider when a Reference is retrieved from a JNDI store - and generates the original instance
      Specified by:
        `getObjectInstance` in interface `javax.naming.spi.ObjectFactory`
      Parameters:
        `object` - the Reference object
        `name` - the JNDI name
        `nameCtx` - the context
        `environment` - the environment settings used by JNDI
      Returns:
        the instance built from the Reference object
      Throws:
        `java.lang.Exception` - if building the instance from Reference fails (usually class not found)

    - #### getProperties

          public static java.util.Properties getProperties​(javax.naming.Reference reference)

    - #### createReference

          public static javax.naming.Reference createReference​(java.lang.String instanceClassName,
                                                               JNDIStorable po)
                                                        throws javax.naming.NamingException

      Create a Reference instance from a JNDIStorable object
      Parameters:
        `instanceClassName` - The name of the class that is being created.
        `po` - The properties object to use when configuring the new instance.
      Returns:
        Reference
      Throws:
        `javax.naming.NamingException` - if an error occurs while creating the new instance.

    - #### loadClass

          public static java.lang.Class<?> loadClass​(java.lang.Object thisObj,
                                                     java.lang.String className)
                                              throws java.lang.ClassNotFoundException

      Retrieve the class loader for a named class
      Parameters:
        `thisObj` - Local object to use when doing the lookup.
        `className` - The name of the class being loaded.
      Returns:
        the class that was requested.
      Throws:
        `java.lang.ClassNotFoundException` - if a matching class cannot be created.