jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/Init.java
author ctornqvi
Wed, 18 Feb 2015 19:28:08 -0800
changeset 29105 3927f8f0bf4b
parent 27081 1ceee8d3844d
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * reserved comment block
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 */
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
     5
/**
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
     6
 * Licensed to the Apache Software Foundation (ASF) under one
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
     7
 * or more contributor license agreements. See the NOTICE file
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
     8
 * distributed with this work for additional information
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
     9
 * regarding copyright ownership. The ASF licenses this file
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    10
 * to you under the Apache License, Version 2.0 (the
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    11
 * "License"); you may not use this file except in compliance
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    12
 * with the License. You may obtain a copy of the License at
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 *
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    14
 * http://www.apache.org/licenses/LICENSE-2.0
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 *
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    16
 * Unless required by applicable law or agreed to in writing,
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    17
 * software distributed under the License is distributed on an
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    18
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    19
 * KIND, either express or implied. See the License for the
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    20
 * specific language governing permissions and limitations
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    21
 * under the License.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
package com.sun.org.apache.xml.internal.security;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
import java.io.InputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
import java.security.AccessController;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.security.PrivilegedAction;
27081
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
    28
import java.security.PrivilegedActionException;
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
    29
import java.security.PrivilegedExceptionAction;
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    30
import java.util.ArrayList;
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    31
import java.util.List;
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    32
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    33
import javax.xml.XMLConstants;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.xml.parsers.DocumentBuilder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.xml.parsers.DocumentBuilderFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import com.sun.org.apache.xml.internal.security.algorithms.JCEMapper;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import com.sun.org.apache.xml.internal.security.algorithms.SignatureAlgorithm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import com.sun.org.apache.xml.internal.security.c14n.Canonicalizer;
27081
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
    40
import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import com.sun.org.apache.xml.internal.security.keys.keyresolver.KeyResolver;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import com.sun.org.apache.xml.internal.security.transforms.Transform;
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    43
import com.sun.org.apache.xml.internal.security.utils.ElementProxy;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import com.sun.org.apache.xml.internal.security.utils.I18n;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolver;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
import org.w3c.dom.Attr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
import org.w3c.dom.Document;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
import org.w3c.dom.Element;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
import org.w3c.dom.Node;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * This class does the configuration of the library. This includes creating
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * the mapping of Canonicalization and Transform algorithms. Initialization is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * done by calling {@link Init#init} which should be done in any static block
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * of the files of this library. We ensure that this call is only executed once.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 */
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    59
public class Init {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    61
    /** The namespace for CONF file **/
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    62
    public static final String CONF_NS = "http://www.xmlsecurity.org/NS/#configuration";
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    63
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    64
    /** {@link org.apache.commons.logging} logging facility */
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    65
    private static java.util.logging.Logger log =
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        java.util.logging.Logger.getLogger(Init.class.getName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    68
    /** Field alreadyInitialized */
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    69
    private static boolean alreadyInitialized = false;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    71
    /**
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    72
     * Method isInitialized
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    73
     * @return true if the library is already initialized.
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    74
     */
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    75
    public static synchronized final boolean isInitialized() {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    76
        return Init.alreadyInitialized;
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    77
    }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    78
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    79
    /**
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    80
     * Method init
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    81
     *
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    82
     */
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    83
    public static synchronized void init() {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    84
        if (alreadyInitialized) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    85
            return;
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    86
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    88
        InputStream is =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    89
            AccessController.doPrivileged(
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    90
                new PrivilegedAction<InputStream>() {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    91
                    public InputStream run() {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    92
                        String cfile =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    93
                            System.getProperty("com.sun.org.apache.xml.internal.security.resource.config");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    94
                        if (cfile == null) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    95
                            return null;
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    96
                        }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    97
                        return getClass().getResourceAsStream(cfile);
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    98
                    }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
    99
                });
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   100
        if (is == null) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   101
            dynamicInit();
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   102
        } else {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   103
            fileInit(is);
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   104
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   106
        alreadyInitialized = true;
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   107
    }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   108
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   109
    /**
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   110
     * Dynamically initialise the library by registering the default algorithms/implementations
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   111
     */
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   112
    private static void dynamicInit() {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   113
        //
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   114
        // Load the Resource Bundle - the default is the English resource bundle.
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   115
        // To load another resource bundle, call I18n.init(...) before calling this
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   116
        // method.
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   117
        //
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   118
        I18n.init("en", "US");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   120
        if (log.isLoggable(java.util.logging.Level.FINE)) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   121
            log.log(java.util.logging.Level.FINE, "Registering default algorithms");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   122
        }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   123
        try {
27081
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   124
            AccessController.doPrivileged(new PrivilegedExceptionAction<Void>(){
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   125
                @Override public Void run() throws XMLSecurityException {
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   126
                    //
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   127
                    // Bind the default prefixes
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   128
                    //
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   129
                    ElementProxy.registerDefaultPrefixes();
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   130
27081
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   131
                    //
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   132
                    // Set the default Transforms
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   133
                    //
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   134
                    Transform.registerDefaultAlgorithms();
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   135
27081
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   136
                    //
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   137
                    // Set the default signature algorithms
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   138
                    //
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   139
                    SignatureAlgorithm.registerDefaultAlgorithms();
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   140
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   141
                    //
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   142
                    // Set the default JCE algorithms
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   143
                    //
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   144
                    JCEMapper.registerDefaultAlgorithms();
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   145
27081
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   146
                    //
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   147
                    // Set the default c14n algorithms
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   148
                    //
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   149
                    Canonicalizer.registerDefaultAlgorithms();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
27081
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   151
                    //
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   152
                    // Register the default resolvers
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   153
                    //
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   154
                    ResourceResolver.registerDefaultResolvers();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
27081
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   156
                    //
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   157
                    // Register the default key resolvers
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   158
                    //
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   159
                    KeyResolver.registerDefaultResolvers();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
27081
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   161
                    return null;
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   162
                }
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   163
           });
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   164
        } catch (PrivilegedActionException ex) {
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   165
            XMLSecurityException xse = (XMLSecurityException)ex.getException();
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   166
            log.log(java.util.logging.Level.SEVERE, xse.getMessage(), xse);
1ceee8d3844d 8038913: Bolster XML support
mullan
parents: 25859
diff changeset
   167
            xse.printStackTrace();
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   168
        }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   169
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   171
    /**
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   172
     * Initialise the library from a configuration file
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   173
     */
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   174
    private static void fileInit(InputStream is) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   175
        try {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            /* read library configuration file */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   178
            dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            dbf.setNamespaceAware(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            dbf.setValidating(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            DocumentBuilder db = dbf.newDocumentBuilder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
            Document doc = db.parse(is);
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   185
            Node config = doc.getFirstChild();
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   186
            for (; config != null; config = config.getNextSibling()) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                if ("Configuration".equals(config.getLocalName())) {
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   188
                    break;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            }
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   191
            if (config == null) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   192
                log.log(java.util.logging.Level.SEVERE, "Error in reading configuration file - Configuration element not found");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   193
                return;
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   194
            }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   195
            for (Node el = config.getFirstChild(); el != null; el = el.getNextSibling()) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   196
                if (Node.ELEMENT_NODE != el.getNodeType()) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   197
                    continue;
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   198
                }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   199
                String tag = el.getLocalName();
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   200
                if (tag.equals("ResourceBundles")) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   201
                    Element resource = (Element)el;
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   202
                    /* configure internationalization */
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   203
                    Attr langAttr = resource.getAttributeNode("defaultLanguageCode");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   204
                    Attr countryAttr = resource.getAttributeNode("defaultCountryCode");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   205
                    String languageCode =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   206
                        (langAttr == null) ? null : langAttr.getNodeValue();
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   207
                    String countryCode =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   208
                        (countryAttr == null) ? null : countryAttr.getNodeValue();
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   209
                    I18n.init(languageCode, countryCode);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                }
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   211
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   212
                if (tag.equals("CanonicalizationMethods")) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   213
                    Element[] list =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   214
                        XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "CanonicalizationMethod");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   215
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   216
                    for (int i = 0; i < list.length; i++) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   217
                        String uri = list[i].getAttributeNS(null, "URI");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   218
                        String javaClass =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   219
                            list[i].getAttributeNS(null, "JAVACLASS");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   220
                        try {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   221
                            Canonicalizer.register(uri, javaClass);
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   222
                            if (log.isLoggable(java.util.logging.Level.FINE)) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   223
                                log.log(java.util.logging.Level.FINE, "Canonicalizer.register(" + uri + ", " + javaClass + ")");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   224
                            }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   225
                        } catch (ClassNotFoundException e) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   226
                            Object exArgs[] = { uri, javaClass };
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   227
                            log.log(java.util.logging.Level.SEVERE, I18n.translate("algorithm.classDoesNotExist", exArgs));
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   228
                        }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   229
                    }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   230
                }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   231
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   232
                if (tag.equals("TransformAlgorithms")) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   233
                    Element[] tranElem =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   234
                        XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "TransformAlgorithm");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   236
                    for (int i = 0; i < tranElem.length; i++) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   237
                        String uri = tranElem[i].getAttributeNS(null, "URI");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   238
                        String javaClass =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   239
                            tranElem[i].getAttributeNS(null, "JAVACLASS");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   240
                        try {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   241
                            Transform.register(uri, javaClass);
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   242
                            if (log.isLoggable(java.util.logging.Level.FINE)) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   243
                                log.log(java.util.logging.Level.FINE, "Transform.register(" + uri + ", " + javaClass + ")");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   244
                            }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   245
                        } catch (ClassNotFoundException e) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   246
                            Object exArgs[] = { uri, javaClass };
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   248
                            log.log(java.util.logging.Level.SEVERE, I18n.translate("algorithm.classDoesNotExist", exArgs));
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   249
                        } catch (NoClassDefFoundError ex) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   250
                            log.log(java.util.logging.Level.WARNING, "Not able to found dependencies for algorithm, I'll keep working.");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   251
                        }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   252
                    }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   253
                }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   255
                if ("JCEAlgorithmMappings".equals(tag)) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   256
                    Node algorithmsNode = ((Element)el).getElementsByTagName("Algorithms").item(0);
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   257
                    if (algorithmsNode != null) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   258
                        Element[] algorithms =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   259
                            XMLUtils.selectNodes(algorithmsNode.getFirstChild(), CONF_NS, "Algorithm");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   260
                        for (int i = 0; i < algorithms.length; i++) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   261
                            Element element = algorithms[i];
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   262
                            String id = element.getAttribute("URI");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   263
                            JCEMapper.register(id, new JCEMapper.Algorithm(element));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
                        }
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   265
                    }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   266
                }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   267
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   268
                if (tag.equals("SignatureAlgorithms")) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   269
                    Element[] sigElems =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   270
                        XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "SignatureAlgorithm");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   271
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   272
                    for (int i = 0; i < sigElems.length; i++) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   273
                        String uri = sigElems[i].getAttributeNS(null, "URI");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   274
                        String javaClass =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   275
                            sigElems[i].getAttributeNS(null, "JAVACLASS");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   276
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   277
                        /** $todo$ handle registering */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   279
                        try {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   280
                            SignatureAlgorithm.register(uri, javaClass);
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   281
                            if (log.isLoggable(java.util.logging.Level.FINE)) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   282
                                log.log(java.util.logging.Level.FINE, "SignatureAlgorithm.register(" + uri + ", "
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   283
                                          + javaClass + ")");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   284
                            }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   285
                        } catch (ClassNotFoundException e) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   286
                            Object exArgs[] = { uri, javaClass };
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   288
                            log.log(java.util.logging.Level.SEVERE, I18n.translate("algorithm.classDoesNotExist", exArgs));
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   289
                        }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   290
                    }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   291
                }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   293
                if (tag.equals("ResourceResolvers")) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   294
                    Element[]resolverElem =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   295
                        XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "Resolver");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   296
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   297
                    for (int i = 0; i < resolverElem.length; i++) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   298
                        String javaClass =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   299
                            resolverElem[i].getAttributeNS(null, "JAVACLASS");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   300
                        String description =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   301
                            resolverElem[i].getAttributeNS(null, "DESCRIPTION");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   303
                        if ((description != null) && (description.length() > 0)) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   304
                            if (log.isLoggable(java.util.logging.Level.FINE)) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   305
                                log.log(java.util.logging.Level.FINE, "Register Resolver: " + javaClass + ": "
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   306
                                          + description);
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   307
                            }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   308
                        } else {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   309
                            if (log.isLoggable(java.util.logging.Level.FINE)) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   310
                                log.log(java.util.logging.Level.FINE, "Register Resolver: " + javaClass
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   311
                                          + ": For unknown purposes");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   312
                            }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   313
                        }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   314
                        try {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   315
                            ResourceResolver.register(javaClass);
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   316
                        } catch (Throwable e) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   317
                            log.log(java.util.logging.Level.WARNING,
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   318
                                 "Cannot register:" + javaClass
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   319
                                 + " perhaps some needed jars are not installed",
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   320
                                 e
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   321
                             );
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   322
                        }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   323
                    }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   324
                }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   326
                if (tag.equals("KeyResolver")){
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   327
                    Element[] resolverElem =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   328
                        XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "Resolver");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   329
                    List<String> classNames = new ArrayList<String>(resolverElem.length);
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   330
                    for (int i = 0; i < resolverElem.length; i++) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   331
                        String javaClass =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   332
                            resolverElem[i].getAttributeNS(null, "JAVACLASS");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   333
                        String description =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   334
                            resolverElem[i].getAttributeNS(null, "DESCRIPTION");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   336
                        if ((description != null) && (description.length() > 0)) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   337
                            if (log.isLoggable(java.util.logging.Level.FINE)) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   338
                                log.log(java.util.logging.Level.FINE, "Register Resolver: " + javaClass + ": "
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   339
                                          + description);
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   340
                            }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   341
                        } else {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   342
                            if (log.isLoggable(java.util.logging.Level.FINE)) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   343
                                log.log(java.util.logging.Level.FINE, "Register Resolver: " + javaClass
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   344
                                          + ": For unknown purposes");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   345
                            }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   346
                        }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   347
                        classNames.add(javaClass);
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   348
                    }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   349
                    KeyResolver.registerClassNames(classNames);
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   350
                }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   353
                if (tag.equals("PrefixMappings")){
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   354
                    if (log.isLoggable(java.util.logging.Level.FINE)) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   355
                        log.log(java.util.logging.Level.FINE, "Now I try to bind prefixes:");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   356
                    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   358
                    Element[] nl =
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   359
                        XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "PrefixMapping");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   361
                    for (int i = 0; i < nl.length; i++) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   362
                        String namespace = nl[i].getAttributeNS(null, "namespace");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   363
                        String prefix = nl[i].getAttributeNS(null, "prefix");
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   364
                        if (log.isLoggable(java.util.logging.Level.FINE)) {
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   365
                            log.log(java.util.logging.Level.FINE, "Now I try to bind " + prefix + " to " + namespace);
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   366
                        }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   367
                        ElementProxy.setDefaultPrefix(namespace, prefix);
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   368
                    }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   369
                }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
            }
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   371
        } catch (Exception e) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
            log.log(java.util.logging.Level.SEVERE, "Bad: ", e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
            e.printStackTrace();
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   374
        }
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   375
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
}
18240
cda839ac048f 6741606: Integrate Apache Santuario
mullan
parents: 13791
diff changeset
   378