242 private static final SQLPermission SET_SYNCFACTORY_PERMISSION =
243 new SQLPermission("setSyncFactory");
244 /**
245 * The initial JNDI context where <code>SyncProvider</code> implementations can
246 * be stored and from which they can be invoked.
247 */
248 private static Context ic;
249 /**
250 * The <code>Logger</code> object to be used by the <code>SyncFactory</code>.
251 */
252 private static volatile Logger rsLogger;
253
254 /**
255 * The registry of available <code>SyncProvider</code> implementations.
256 * See section 2.0 of the class comment for <code>SyncFactory</code> for an
257 * explanation of how a provider can be added to this registry.
258 */
259 private static Hashtable<String, SyncProvider> implementations;
260
261 /**
262 * Adds the the given synchronization provider to the factory register. Guidelines
263 * are provided in the <code>SyncProvider</code> specification for the
264 * required naming conventions for <code>SyncProvider</code>
265 * implementations.
266 * <p>
267 * Synchronization providers bound to a JNDI context can be
268 * registered by binding a SyncProvider instance to a JNDI namespace.
269 *
270 * <pre>
271 * {@code
272 * SyncProvider p = new MySyncProvider();
273 * InitialContext ic = new InitialContext();
274 * ic.bind ("jdbc/rowset/MySyncProvider", p);
275 * } </pre>
276 *
277 * Furthermore, an initial JNDI context should be set with the
278 * <code>SyncFactory</code> using the <code>setJNDIContext</code> method.
279 * The <code>SyncFactory</code> leverages this context to search for
280 * available <code>SyncProvider</code> objects bound to the JNDI
281 * context and its child nodes.
282 *
445 } else {
446 properties.put(ROWSET_SYNC_PROVIDER, providerImpls);
447 }
448 parseProperties(properties);
449 }
450 }
451 }
452
453 /**
454 * The internal debug switch.
455 */
456 private static boolean debug = false;
457 /**
458 * Internal registry count for the number of providers contained in the
459 * registry.
460 */
461 private static int providerImplIndex = 0;
462
463 /**
464 * Internal handler for all standard property parsing. Parses standard
465 * ROWSET properties and stores lazy references into the the internal registry.
466 */
467 private static void parseProperties(Properties p) {
468
469 ProviderImpl impl = null;
470 String key = null;
471 String[] propertyNames = null;
472
473 for (Enumeration<?> e = p.propertyNames(); e.hasMoreElements();) {
474
475 String str = (String) e.nextElement();
476
477 int w = str.length();
478
479 if (str.startsWith(SyncFactory.ROWSET_SYNC_PROVIDER)) {
480
481 impl = new ProviderImpl();
482 impl.setIndex(providerImplIndex++);
483
484 if (w == (SyncFactory.ROWSET_SYNC_PROVIDER).length()) {
485 // no property index has been set.
|
242 private static final SQLPermission SET_SYNCFACTORY_PERMISSION =
243 new SQLPermission("setSyncFactory");
244 /**
245 * The initial JNDI context where <code>SyncProvider</code> implementations can
246 * be stored and from which they can be invoked.
247 */
248 private static Context ic;
249 /**
250 * The <code>Logger</code> object to be used by the <code>SyncFactory</code>.
251 */
252 private static volatile Logger rsLogger;
253
254 /**
255 * The registry of available <code>SyncProvider</code> implementations.
256 * See section 2.0 of the class comment for <code>SyncFactory</code> for an
257 * explanation of how a provider can be added to this registry.
258 */
259 private static Hashtable<String, SyncProvider> implementations;
260
261 /**
262 * Adds the given synchronization provider to the factory register. Guidelines
263 * are provided in the <code>SyncProvider</code> specification for the
264 * required naming conventions for <code>SyncProvider</code>
265 * implementations.
266 * <p>
267 * Synchronization providers bound to a JNDI context can be
268 * registered by binding a SyncProvider instance to a JNDI namespace.
269 *
270 * <pre>
271 * {@code
272 * SyncProvider p = new MySyncProvider();
273 * InitialContext ic = new InitialContext();
274 * ic.bind ("jdbc/rowset/MySyncProvider", p);
275 * } </pre>
276 *
277 * Furthermore, an initial JNDI context should be set with the
278 * <code>SyncFactory</code> using the <code>setJNDIContext</code> method.
279 * The <code>SyncFactory</code> leverages this context to search for
280 * available <code>SyncProvider</code> objects bound to the JNDI
281 * context and its child nodes.
282 *
445 } else {
446 properties.put(ROWSET_SYNC_PROVIDER, providerImpls);
447 }
448 parseProperties(properties);
449 }
450 }
451 }
452
453 /**
454 * The internal debug switch.
455 */
456 private static boolean debug = false;
457 /**
458 * Internal registry count for the number of providers contained in the
459 * registry.
460 */
461 private static int providerImplIndex = 0;
462
463 /**
464 * Internal handler for all standard property parsing. Parses standard
465 * ROWSET properties and stores lazy references into the internal registry.
466 */
467 private static void parseProperties(Properties p) {
468
469 ProviderImpl impl = null;
470 String key = null;
471 String[] propertyNames = null;
472
473 for (Enumeration<?> e = p.propertyNames(); e.hasMoreElements();) {
474
475 String str = (String) e.nextElement();
476
477 int w = str.length();
478
479 if (str.startsWith(SyncFactory.ROWSET_SYNC_PROVIDER)) {
480
481 impl = new ProviderImpl();
482 impl.setIndex(providerImplIndex++);
483
484 if (w == (SyncFactory.ROWSET_SYNC_PROVIDER).length()) {
485 // no property index has been set.
|