/** * Registers implementing class of the Transform algorithm with algorithmURI * * @param algorithmURI algorithmURI URI representation of <code>Transform algorithm</code> * @param implementingClass <code>implementingClass</code> the implementing * class of {@link TransformSpi} * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI * is already registered * @throws SecurityException if a security manager is installed and the * caller does not have permission to register the transform */ public static void register(String algorithmURI, Class<? extends TransformSpi> implementingClass) throws AlgorithmAlreadyRegisteredException { JavaUtils.checkRegisterPermission(); // are we already registered? Class<? extends TransformSpi> transformSpi = transformSpiHash.get(algorithmURI); if (transformSpi != null) { Object exArgs[] = { algorithmURI, transformSpi }; throw new AlgorithmAlreadyRegisteredException("algorithm.alreadyRegistered", exArgs); } transformSpiHash.put(algorithmURI, implementingClass); }
/** * 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 implementing class of the SignatureAlgorithm with algorithmURI * * @param algorithmURI algorithmURI URI representation of <code>SignatureAlgorithm</code>. * @param implementingClass <code>implementingClass</code> the implementing class of * {@link SignatureAlgorithmSpi} * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI is already registered * @throws XMLSignatureException * @throws SecurityException if a security manager is installed and the * caller does not have permission to register the signature algorithm */ public static void register(String algorithmURI, Class<? extends SignatureAlgorithmSpi> implementingClass) throws AlgorithmAlreadyRegisteredException, ClassNotFoundException, XMLSignatureException { JavaUtils.checkRegisterPermission(); LOG.debug("Try to register {} {}", algorithmURI, implementingClass); // are we already registered? Class<? extends SignatureAlgorithmSpi> registeredClass = algorithmHash.get(algorithmURI); if (registeredClass != null) { Object exArgs[] = { algorithmURI, registeredClass }; throw new AlgorithmAlreadyRegisteredException( "algorithm.alreadyRegistered", exArgs ); } algorithmHash.put(algorithmURI, implementingClass); }
/** * 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 */ @SuppressWarnings("unchecked") public static void register(String algorithmURI, String 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, (Class<? extends CanonicalizerSpi>) ClassLoaderUtils.loadClass(implementingClass, Canonicalizer.class) ); }
/** * Registers implementing class of the Transform algorithm with algorithmURI * * @param algorithmURI algorithmURI URI representation of <code>Transform algorithm</code> * @param implementingClass <code>implementingClass</code> the implementing * class of {@link TransformSpi} * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI * is already registered * @throws SecurityException if a security manager is installed and the * caller does not have permission to register the transform */ @SuppressWarnings("unchecked") public static void register(String algorithmURI, String implementingClass) throws AlgorithmAlreadyRegisteredException, ClassNotFoundException, InvalidTransformException { JavaUtils.checkRegisterPermission(); // are we already registered? Class<? extends TransformSpi> transformSpi = transformSpiHash.get(algorithmURI); if (transformSpi != null) { Object exArgs[] = { algorithmURI, transformSpi }; throw new AlgorithmAlreadyRegisteredException("algorithm.alreadyRegistered", exArgs); } Class<? extends TransformSpi> transformSpiClass = (Class<? extends TransformSpi>) ClassLoaderUtils.loadClass(implementingClass, Transform.class); transformSpiHash.put(algorithmURI, transformSpiClass); }
if (registeredClass != null) { Object exArgs[] = { algorithmURI, registeredClass }; throw new AlgorithmAlreadyRegisteredException( "algorithm.alreadyRegistered", exArgs );