jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java
changeset 11129 f9ad1aadf3fa
parent 9035 1255eb81cc2f
child 14176 9864fbbedb87
equal deleted inserted replaced
11128:ffb869e392cf 11129:f9ad1aadf3fa
   255     /**
   255     /**
   256      * The registry of available <code>SyncProvider</code> implementations.
   256      * The registry of available <code>SyncProvider</code> implementations.
   257      * See section 2.0 of the class comment for <code>SyncFactory</code> for an
   257      * See section 2.0 of the class comment for <code>SyncFactory</code> for an
   258      * explanation of how a provider can be added to this registry.
   258      * explanation of how a provider can be added to this registry.
   259      */
   259      */
   260     private static Hashtable implementations;
   260     private static Hashtable<String, SyncProvider> implementations;
   261     /**
   261     /**
   262      * Internal sync object used to maintain the SPI as a singleton
   262      * Internal sync object used to maintain the SPI as a singleton
   263      */
   263      */
   264     private static Object logSync = new Object();
   264     private static Object logSync = new Object();
   265     /**
   265     /**
   342         // file, translate names into Class objects using Class.forName
   342         // file, translate names into Class objects using Class.forName
   343         // and store mappings
   343         // and store mappings
   344         Properties properties = new Properties();
   344         Properties properties = new Properties();
   345 
   345 
   346         if (implementations == null) {
   346         if (implementations == null) {
   347             implementations = new Hashtable();
   347             implementations = new Hashtable<>();
   348 
   348 
   349             try {
   349             try {
   350 
   350 
   351                 // check if user is supplying his Synchronisation Provider
   351                 // check if user is supplying his Synchronisation Provider
   352                 // Implementation if not using Oracle's implementation.
   352                 // Implementation if not using Oracle's implementation.
   443 
   443 
   444         ProviderImpl impl = null;
   444         ProviderImpl impl = null;
   445         String key = null;
   445         String key = null;
   446         String[] propertyNames = null;
   446         String[] propertyNames = null;
   447 
   447 
   448         for (Enumeration e = p.propertyNames(); e.hasMoreElements();) {
   448         for (Enumeration<?> e = p.propertyNames(); e.hasMoreElements();) {
   449 
   449 
   450             String str = (String) e.nextElement();
   450             String str = (String) e.nextElement();
   451 
   451 
   452             int w = str.length();
   452             int w = str.length();
   453 
   453 
   539             // Requested SyncProvider is unavailable. Return default provider.
   539             // Requested SyncProvider is unavailable. Return default provider.
   540             return new com.sun.rowset.providers.RIOptimisticProvider();
   540             return new com.sun.rowset.providers.RIOptimisticProvider();
   541         }
   541         }
   542 
   542 
   543         // Attempt to invoke classname from registered SyncProvider list
   543         // Attempt to invoke classname from registered SyncProvider list
   544         Class c = null;
   544         Class<?> c = null;
   545         try {
   545         try {
   546             ClassLoader cl = Thread.currentThread().getContextClassLoader();
   546             ClassLoader cl = Thread.currentThread().getContextClassLoader();
   547 
   547 
   548             /**
   548             /**
   549              * The SyncProvider implementation of the user will be in
   549              * The SyncProvider implementation of the user will be in
   738      * Parses the set JNDI Context and passes bindings to the enumerateBindings
   738      * Parses the set JNDI Context and passes bindings to the enumerateBindings
   739      * method when complete.
   739      * method when complete.
   740      */
   740      */
   741     private static Properties parseJNDIContext() throws NamingException {
   741     private static Properties parseJNDIContext() throws NamingException {
   742 
   742 
   743         NamingEnumeration bindings = ic.listBindings("");
   743         NamingEnumeration<?> bindings = ic.listBindings("");
   744         Properties properties = new Properties();
   744         Properties properties = new Properties();
   745 
   745 
   746         // Hunt one level below context for available SyncProvider objects
   746         // Hunt one level below context for available SyncProvider objects
   747         enumerateBindings(bindings, properties);
   747         enumerateBindings(bindings, properties);
   748 
   748 
   753      * Scans each binding on JNDI context and determines if any binding is an
   753      * Scans each binding on JNDI context and determines if any binding is an
   754      * instance of SyncProvider, if so, add this to the registry and continue to
   754      * instance of SyncProvider, if so, add this to the registry and continue to
   755      * scan the current context using a re-entrant call to this method until all
   755      * scan the current context using a re-entrant call to this method until all
   756      * bindings have been enumerated.
   756      * bindings have been enumerated.
   757      */
   757      */
   758     private static void enumerateBindings(NamingEnumeration bindings,
   758     private static void enumerateBindings(NamingEnumeration<?> bindings,
   759             Properties properties) throws NamingException {
   759             Properties properties) throws NamingException {
   760 
   760 
   761         boolean syncProviderObj = false; // move to parameters ?
   761         boolean syncProviderObj = false; // move to parameters ?
   762 
   762 
   763         try {
   763         try {