/** * Registers a ResourceResolverSpi class at the beginning of the provider list. This method logs a * warning if the class cannot be registered. * * @param className the name of the ResourceResolverSpi class to be registered * @throws SecurityException if a security manager is installed and the caller does not have * permission to register a resource resolver */ @SuppressWarnings("unchecked") public static void registerAtStart(String className) { JavaUtils.checkRegisterPermission(); try { Class<ResourceResolverSpi> resourceResolverClass = (Class<ResourceResolverSpi>) Class.forName(className); register(resourceResolverClass, true); } catch (ClassNotFoundException e) { log.log( java.util.logging.Level.WARNING, "Error loading resolver " + className + " disabling it"); } }
/** * Registers a ResourceResolverSpi class. This method logs a warning if the class cannot be * registered. * * @param className * @param start * @throws SecurityException if a security manager is installed and the caller does not have * permission to register a resource resolver */ public static void register(Class<? extends ResourceResolverSpi> className, boolean start) { JavaUtils.checkRegisterPermission(); try { ResourceResolverSpi resourceResolverSpi = className.newInstance(); register(resourceResolverSpi, start); } catch (IllegalAccessException e) { log.log( java.util.logging.Level.WARNING, "Error loading resolver " + className + " disabling it"); } catch (InstantiationException e) { log.log( java.util.logging.Level.WARNING, "Error loading resolver " + className + " disabling it"); } }
/** * Method register * * @param algorithmURI * @param implementingClass * @throws AlgorithmAlreadyRegisteredException * @throws SecurityException if a security manager is installed and the caller does not have * permission to register the canonicalizer */ public static void register( String algorithmURI, Class<? extends CanonicalizerSpi> implementingClass) throws AlgorithmAlreadyRegisteredException, ClassNotFoundException { JavaUtils.checkRegisterPermission(); // check whether URI is already registered Class<? extends CanonicalizerSpi> registeredClass = canonicalizerHash.get(algorithmURI); if (registeredClass != null) { Object exArgs[] = {algorithmURI, registeredClass}; throw new AlgorithmAlreadyRegisteredException("algorithm.alreadyRegistered", exArgs); } canonicalizerHash.put(algorithmURI, implementingClass); }
/** * Registers a ResourceResolverSpi instance. This method logs a warning if the class cannot be * registered. * * @param resourceResolverSpi * @param start * @throws SecurityException if a security manager is installed and the caller does not have * permission to register a resource resolver */ public static void register(ResourceResolverSpi resourceResolverSpi, boolean start) { JavaUtils.checkRegisterPermission(); synchronized (resolverList) { if (start) { resolverList.add(0, new ResourceResolver(resourceResolverSpi)); } else { resolverList.add(new ResourceResolver(resourceResolverSpi)); } } if (log.isLoggable(java.util.logging.Level.FINE)) { log.log( java.util.logging.Level.FINE, "Registered resolver: " + resourceResolverSpi.toString()); } }