Class InstanceKeyObjectFactory

  • All Implemented Interfaces:
    javax.naming.spi.ObjectFactory
    Direct Known Subclasses:
    PerUserPoolDataSourceFactory, SharedPoolDataSourceFactory

    abstract class InstanceKeyObjectFactory
    extends java.lang.Object
    implements javax.naming.spi.ObjectFactory
    A JNDI ObjectFactory which creates SharedPoolDataSources or PerUserPoolDataSources
    Version:
    $Revision: 814246 $ $Date: 2009-09-12 18:44:58 -0400 (Sat, 12 Sep 2009) $
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Map instanceMap  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static void closeAll()
      Close all pools associated with this class.
      protected static java.lang.Object deserialize​(byte[] data)
      used to set some properties saved within a Reference
      protected abstract InstanceKeyDataSource getNewInstance​(javax.naming.Reference ref)
      Creates an instance of the subclass and sets any properties contained in the Reference.
      java.lang.Object getObjectInstance​(java.lang.Object refObj, javax.naming.Name name, javax.naming.Context context, java.util.Hashtable env)
      implements ObjectFactory to create an instance of SharedPoolDataSource or PerUserPoolDataSource
      protected abstract boolean isCorrectClass​(java.lang.String className)  
      (package private) static java.lang.String registerNewInstance​(InstanceKeyDataSource ds)  
      (package private) static void removeInstance​(java.lang.String key)  
      private void setCommonProperties​(javax.naming.Reference ref, InstanceKeyDataSource ikds)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • instanceMap

        private static final java.util.Map instanceMap
    • Constructor Detail

      • InstanceKeyObjectFactory

        InstanceKeyObjectFactory()
    • Method Detail

      • removeInstance

        static void removeInstance​(java.lang.String key)
      • closeAll

        public static void closeAll()
                             throws java.lang.Exception
        Close all pools associated with this class.
        Throws:
        java.lang.Exception
      • getObjectInstance

        public java.lang.Object getObjectInstance​(java.lang.Object refObj,
                                                  javax.naming.Name name,
                                                  javax.naming.Context context,
                                                  java.util.Hashtable env)
                                           throws java.io.IOException,
                                                  java.lang.ClassNotFoundException
        implements ObjectFactory to create an instance of SharedPoolDataSource or PerUserPoolDataSource
        Specified by:
        getObjectInstance in interface javax.naming.spi.ObjectFactory
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • setCommonProperties

        private void setCommonProperties​(javax.naming.Reference ref,
                                         InstanceKeyDataSource ikds)
                                  throws java.io.IOException,
                                         java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • isCorrectClass

        protected abstract boolean isCorrectClass​(java.lang.String className)
        Returns:
        true if and only if className is the value returned from getClass().getName().toString()
      • getNewInstance

        protected abstract InstanceKeyDataSource getNewInstance​(javax.naming.Reference ref)
                                                         throws java.io.IOException,
                                                                java.lang.ClassNotFoundException
        Creates an instance of the subclass and sets any properties contained in the Reference.
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • deserialize

        protected static final java.lang.Object deserialize​(byte[] data)
                                                     throws java.io.IOException,
                                                            java.lang.ClassNotFoundException
        used to set some properties saved within a Reference
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException