/** Register classes authorized to replaceStateManager. The caller of * this method must be authorized for JDOPermission("setStateManager"). * During replaceStateManager, a persistence-capable class will call * the corresponding checkAuthorizedStateManager and the class of the * instance of the parameter must have been registered. * @param smClasses a Collection of Classes that are authorized for * JDOPermission("setStateManager"). * @throws SecurityException if the caller is not authorized for * JDOPermission("setStateManager"). * @since 1.0.1 */ public static void registerAuthorizedStateManagerClasses ( Collection smClasses) throws SecurityException { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(JDOPermission.SET_STATE_MANAGER); synchronized (authorizedStateManagerClasses) { for (Iterator it = smClasses.iterator(); it.hasNext();) { Object smClass = it.next(); if (!(smClass instanceof Class)) { throw new ClassCastException( msg.msg("ERR_StateManagerClassCast", //NOI18N smClass.getClass().getName())); } registerAuthorizedStateManagerClass((Class)it.next()); } } } }
/** Register classes authorized to replaceStateManager. The caller of * this method must be authorized for JDOPermission("setStateManager"). * During replaceStateManager, a persistence-capable class will call * the corresponding checkAuthorizedStateManager and the class of the * instance of the parameter must have been registered. * @param smClasses a Collection of Classes that are authorized for * JDOPermission("setStateManager"). * @throws SecurityException if the caller is not authorized for * JDOPermission("setStateManager"). * @since 1.0.1 */ public static void registerAuthorizedStateManagerClasses ( Collection smClasses) throws SecurityException { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(JDOPermission.SET_STATE_MANAGER); synchronized (authorizedStateManagerClasses) { for (Iterator it = smClasses.iterator(); it.hasNext();) { Object smClass = it.next(); if (!(smClass instanceof Class)) { throw new ClassCastException( msg.msg("ERR_StateManagerClassCast", //NOI18N smClass.getClass().getName())); } registerAuthorizedStateManagerClass((Class)it.next()); } } } }