< prev index next >

src/java.sql.rowset/share/classes/javax/sql/rowset/spi/SyncFactory.java

Print this page




 565         try {
 566             ReflectUtil.checkPackageAccess(providerID);
 567         } catch (java.security.AccessControlException e) {
 568             SyncFactoryException sfe = new SyncFactoryException();
 569             sfe.initCause(e);
 570             throw sfe;
 571         }
 572 
 573         // Attempt to invoke classname from registered SyncProvider list
 574         Class<?> c = null;
 575         try {
 576             ClassLoader cl = Thread.currentThread().getContextClassLoader();
 577 
 578             /**
 579              * The SyncProvider implementation of the user will be in
 580              * the classpath. We need to find the ClassLoader which loads
 581              * this SyncFactory and try to load the SyncProvider class from
 582              * there.
 583              **/
 584             c = Class.forName(providerID, true, cl);
 585             return (SyncProvider) c.newInstance();


 586 
 587         } catch (IllegalAccessException e) {
 588             throw new SyncFactoryException("IllegalAccessException: " + e.getMessage());
 589         } catch (InstantiationException e) {
 590             throw new SyncFactoryException("InstantiationException: " + e.getMessage());
 591         } catch (ClassNotFoundException e) {
 592             throw new SyncFactoryException("ClassNotFoundException: " + e.getMessage());
 593         }
 594     }
 595 
 596     /**
 597      * Returns an Enumeration of currently registered synchronization
 598      * providers.  A <code>RowSet</code> implementation may use any provider in
 599      * the enumeration as its <code>SyncProvider</code> object.
 600      * <p>
 601      * At a minimum, the reference synchronization provider allowing
 602      * RowSet content data to be stored using a JDBC driver should be
 603      * possible.
 604      *
 605      * @return Enumeration  A enumeration of available synchronization
 606      * providers that are registered with this Factory
 607      * @throws SyncFactoryException If an error occurs obtaining the registered
 608      * providers
 609      */
 610     public static Enumeration<SyncProvider> getRegisteredProviders()
 611             throws SyncFactoryException {
 612         initMapIfNecessary();




 565         try {
 566             ReflectUtil.checkPackageAccess(providerID);
 567         } catch (java.security.AccessControlException e) {
 568             SyncFactoryException sfe = new SyncFactoryException();
 569             sfe.initCause(e);
 570             throw sfe;
 571         }
 572 
 573         // Attempt to invoke classname from registered SyncProvider list
 574         Class<?> c = null;
 575         try {
 576             ClassLoader cl = Thread.currentThread().getContextClassLoader();
 577 
 578             /**
 579              * The SyncProvider implementation of the user will be in
 580              * the classpath. We need to find the ClassLoader which loads
 581              * this SyncFactory and try to load the SyncProvider class from
 582              * there.
 583              **/
 584             c = Class.forName(providerID, true, cl);
 585             @SuppressWarnings("deprecation")
 586             Object result =  c.newInstance();
 587             return (SyncProvider)result;
 588 
 589         } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
 590             throw new SyncFactoryException("IllegalAccessException: " + e.getMessage());




 591         }
 592     }
 593 
 594     /**
 595      * Returns an Enumeration of currently registered synchronization
 596      * providers.  A <code>RowSet</code> implementation may use any provider in
 597      * the enumeration as its <code>SyncProvider</code> object.
 598      * <p>
 599      * At a minimum, the reference synchronization provider allowing
 600      * RowSet content data to be stored using a JDBC driver should be
 601      * possible.
 602      *
 603      * @return Enumeration  A enumeration of available synchronization
 604      * providers that are registered with this Factory
 605      * @throws SyncFactoryException If an error occurs obtaining the registered
 606      * providers
 607      */
 608     public static Enumeration<SyncProvider> getRegisteredProviders()
 609             throws SyncFactoryException {
 610         initMapIfNecessary();


< prev index next >