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

Print this page




 240     private static final SQLPermission SET_SYNCFACTORY_PERMISSION =
 241             new SQLPermission("setSyncFactory");
 242     /**
 243      * The initial JNDI context where <code>SyncProvider</code> implementations can
 244      * be stored and from which they can be invoked.
 245      */
 246     private static Context ic;
 247     /**
 248      * The <code>Logger</code> object to be used by the <code>SyncFactory</code>.
 249      */
 250     private static volatile Logger rsLogger;
 251     /**
 252      *
 253      */
 254     private static Level rsLevel;
 255     /**
 256      * The registry of available <code>SyncProvider</code> implementations.
 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.
 259      */
 260     private static Hashtable implementations;
 261     /**
 262      * Internal sync object used to maintain the SPI as a singleton
 263      */
 264     private static Object logSync = new Object();
 265     /**
 266      * Internal PrintWriter field for logging facility
 267      */
 268     private static java.io.PrintWriter logWriter = null;
 269 
 270     /**
 271      * Adds the the given synchronization provider to the factory register. Guidelines
 272      * are provided in the <code>SyncProvider</code> specification for the
 273      * required naming conventions for <code>SyncProvider</code>
 274      * implementations.
 275      * <p>
 276      * Synchronization providers bound to a JNDI context can be
 277      * registered by binding a SyncProvider instance to a JNDI namespace.
 278      * <ul>
 279      * <pre>
 280      * SyncProvider p = new MySyncProvider();


 327      * unregister a SyncProvider implementation that was not registered.
 328      */
 329     public static synchronized void unregisterProvider(String providerID)
 330             throws SyncFactoryException {
 331         initMapIfNecessary();
 332         if (implementations.containsKey(providerID)) {
 333             implementations.remove(providerID);
 334         }
 335     }
 336     private static String colon = ":";
 337     private static String strFileSep = "/";
 338 
 339     private static synchronized void initMapIfNecessary() throws SyncFactoryException {
 340 
 341         // Local implementation class names and keys from Properties
 342         // file, translate names into Class objects using Class.forName
 343         // and store mappings
 344         Properties properties = new Properties();
 345 
 346         if (implementations == null) {
 347             implementations = new Hashtable();
 348 
 349             try {
 350 
 351                 // check if user is supplying his Synchronisation Provider
 352                 // Implementation if not using Oracle's implementation.
 353                 // properties.load(new FileInputStream(ROWSET_PROPERTIES));
 354 
 355                 // The rowset.properties needs to be in jdk/jre/lib when
 356                 // integrated with jdk.
 357                 // else it should be picked from -D option from command line.
 358 
 359                 // -Drowset.properties will add to standard properties. Similar
 360                 // keys will over-write
 361 
 362                 /*
 363                  * Dependent on application
 364                  */
 365                 String strRowsetProperties = System.getProperty("rowset.properties");
 366                 if (strRowsetProperties != null) {
 367                     // Load user's implementation of SyncProvider




 240     private static final SQLPermission SET_SYNCFACTORY_PERMISSION =
 241             new SQLPermission("setSyncFactory");
 242     /**
 243      * The initial JNDI context where <code>SyncProvider</code> implementations can
 244      * be stored and from which they can be invoked.
 245      */
 246     private static Context ic;
 247     /**
 248      * The <code>Logger</code> object to be used by the <code>SyncFactory</code>.
 249      */
 250     private static volatile Logger rsLogger;
 251     /**
 252      *
 253      */
 254     private static Level rsLevel;
 255     /**
 256      * The registry of available <code>SyncProvider</code> implementations.
 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.
 259      */
 260     private static Hashtable<String, SyncProvider> implementations;
 261     /**
 262      * Internal sync object used to maintain the SPI as a singleton
 263      */
 264     private static Object logSync = new Object();
 265     /**
 266      * Internal PrintWriter field for logging facility
 267      */
 268     private static java.io.PrintWriter logWriter = null;
 269 
 270     /**
 271      * Adds the the given synchronization provider to the factory register. Guidelines
 272      * are provided in the <code>SyncProvider</code> specification for the
 273      * required naming conventions for <code>SyncProvider</code>
 274      * implementations.
 275      * <p>
 276      * Synchronization providers bound to a JNDI context can be
 277      * registered by binding a SyncProvider instance to a JNDI namespace.
 278      * <ul>
 279      * <pre>
 280      * SyncProvider p = new MySyncProvider();


 327      * unregister a SyncProvider implementation that was not registered.
 328      */
 329     public static synchronized void unregisterProvider(String providerID)
 330             throws SyncFactoryException {
 331         initMapIfNecessary();
 332         if (implementations.containsKey(providerID)) {
 333             implementations.remove(providerID);
 334         }
 335     }
 336     private static String colon = ":";
 337     private static String strFileSep = "/";
 338 
 339     private static synchronized void initMapIfNecessary() throws SyncFactoryException {
 340 
 341         // Local implementation class names and keys from Properties
 342         // file, translate names into Class objects using Class.forName
 343         // and store mappings
 344         Properties properties = new Properties();
 345 
 346         if (implementations == null) {
 347             implementations = new Hashtable<String, SyncProvider>();
 348 
 349             try {
 350 
 351                 // check if user is supplying his Synchronisation Provider
 352                 // Implementation if not using Oracle's implementation.
 353                 // properties.load(new FileInputStream(ROWSET_PROPERTIES));
 354 
 355                 // The rowset.properties needs to be in jdk/jre/lib when
 356                 // integrated with jdk.
 357                 // else it should be picked from -D option from command line.
 358 
 359                 // -Drowset.properties will add to standard properties. Similar
 360                 // keys will over-write
 361 
 362                 /*
 363                  * Dependent on application
 364                  */
 365                 String strRowsetProperties = System.getProperty("rowset.properties");
 366                 if (strRowsetProperties != null) {
 367                     // Load user's implementation of SyncProvider