< prev index next >

src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java

Print this page


   1 /*
   2  * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 121 
 122     /**
 123      * Returns a <code>TransformService</code> that supports the specified
 124      * algorithm URI (ex: {@link Transform#XPATH2}) and mechanism type
 125      * (ex: DOM).
 126      *
 127      * <p>This method uses the standard JCA provider lookup mechanism to
 128      * locate and instantiate a <code>TransformService</code> implementation
 129      * of the desired algorithm and <code>MechanismType</code> service
 130      * attribute. It traverses the list of registered security
 131      * <code>Provider</code>s, starting with the most preferred
 132      * <code>Provider</code>. A new <code>TransformService</code> object
 133      * from the first <code>Provider</code> that supports the specified
 134      * algorithm and mechanism type is returned.
 135      *
 136      * <p> Note that the list of registered providers may be retrieved via
 137      * the {@link Security#getProviders() Security.getProviders()} method.
 138      *
 139      * @implNote
 140      * The JDK Reference Implementation additionally uses the
 141      * {@code jdk.security.provider.preferred} property to determine

 142      * the preferred provider order for the specified algorithm. This
 143      * may be different than the order of providers returned by
 144      * {@link Security#getProviders() Security.getProviders()}.
 145      *
 146      * @param algorithm the URI of the algorithm
 147      * @param mechanismType the type of the XML processing mechanism and
 148      *   representation
 149      * @return a new <code>TransformService</code>
 150      * @throws NullPointerException if <code>algorithm</code> or
 151      *   <code>mechanismType</code> is  <code>null</code>
 152      * @throws NoSuchAlgorithmException if no <code>Provider</code> supports a
 153      *   <code>TransformService</code> implementation for the specified
 154      *   algorithm and mechanism type
 155      * @see Provider
 156      */
 157     public static TransformService getInstance
 158         (String algorithm, String mechanismType)
 159         throws NoSuchAlgorithmException {
 160         if (mechanismType == null || algorithm == null) {
 161             throw new NullPointerException();


   1 /*
   2  * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 121 
 122     /**
 123      * Returns a <code>TransformService</code> that supports the specified
 124      * algorithm URI (ex: {@link Transform#XPATH2}) and mechanism type
 125      * (ex: DOM).
 126      *
 127      * <p>This method uses the standard JCA provider lookup mechanism to
 128      * locate and instantiate a <code>TransformService</code> implementation
 129      * of the desired algorithm and <code>MechanismType</code> service
 130      * attribute. It traverses the list of registered security
 131      * <code>Provider</code>s, starting with the most preferred
 132      * <code>Provider</code>. A new <code>TransformService</code> object
 133      * from the first <code>Provider</code> that supports the specified
 134      * algorithm and mechanism type is returned.
 135      *
 136      * <p> Note that the list of registered providers may be retrieved via
 137      * the {@link Security#getProviders() Security.getProviders()} method.
 138      *
 139      * @implNote
 140      * The JDK Reference Implementation additionally uses the
 141      * {@code jdk.security.provider.preferred}
 142      * {@link Security#getProperty(String) Security} property to determine
 143      * the preferred provider order for the specified algorithm. This
 144      * may be different than the order of providers returned by
 145      * {@link Security#getProviders() Security.getProviders()}.
 146      *
 147      * @param algorithm the URI of the algorithm
 148      * @param mechanismType the type of the XML processing mechanism and
 149      *   representation
 150      * @return a new <code>TransformService</code>
 151      * @throws NullPointerException if <code>algorithm</code> or
 152      *   <code>mechanismType</code> is  <code>null</code>
 153      * @throws NoSuchAlgorithmException if no <code>Provider</code> supports a
 154      *   <code>TransformService</code> implementation for the specified
 155      *   algorithm and mechanism type
 156      * @see Provider
 157      */
 158     public static TransformService getInstance
 159         (String algorithm, String mechanismType)
 160         throws NoSuchAlgorithmException {
 161         if (mechanismType == null || algorithm == null) {
 162             throw new NullPointerException();


< prev index next >