jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/CachedXPathFuncHereAPI.java
author mullan
Mon, 22 Sep 2008 10:43:17 -0400
changeset 1337 e8d6cef36199
parent 2 90ce3da70b43
child 10694 cf59e2badd14
permissions -rw-r--r--
6469266: Integrate Apache XMLSec 1.4.2 into JDK 7 Reviewed-by: valeriep
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
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * Copyright  1999-2004 The Apache Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *  Licensed under the Apache License, Version 2.0 (the "License");
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 *  you may not use this file except in compliance with the License.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *  You may obtain a copy of the License at
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 *      http://www.apache.org/licenses/LICENSE-2.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *  Unless required by applicable law or agreed to in writing, software
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 *  distributed under the License is distributed on an "AS IS" BASIS,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 *  See the License for the specific language governing permissions and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *  limitations under the License.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
package com.sun.org.apache.xml.internal.security.utils;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
import com.sun.org.apache.xml.internal.dtm.DTMManager;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
import com.sun.org.apache.xml.internal.security.transforms.implementations.FuncHere;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import com.sun.org.apache.xml.internal.security.transforms.implementations.FuncHereContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import com.sun.org.apache.xml.internal.utils.PrefixResolver;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import com.sun.org.apache.xml.internal.utils.PrefixResolverDefault;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import com.sun.org.apache.xpath.internal.CachedXPathAPI;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import com.sun.org.apache.xpath.internal.Expression;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import com.sun.org.apache.xpath.internal.XPath;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import com.sun.org.apache.xpath.internal.XPathContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import com.sun.org.apache.xpath.internal.compiler.FunctionTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import com.sun.org.apache.xpath.internal.objects.XObject;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import org.w3c.dom.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import org.w3c.dom.traversal.NodeIterator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import javax.xml.transform.ErrorListener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import javax.xml.transform.SourceLocator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import javax.xml.transform.TransformerException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import java.lang.reflect.Constructor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import java.lang.reflect.Method;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import java.lang.reflect.Modifier;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
1337
e8d6cef36199 6469266: Integrate Apache XMLSec 1.4.2 into JDK 7
mullan
parents: 2
diff changeset
    48
 * @author $Author: mullan $
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
public class CachedXPathFuncHereAPI {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    static java.util.logging.Logger log =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
           java.util.logging.Logger.getLogger(CachedXPathFuncHereAPI.class.getName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    * XPathContext, and thus DTMManager and DTMs, persists through multiple
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    *   calls to this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
   FuncHereContext _funcHereContext = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
   /** Field _dtmManager */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
   DTMManager _dtmManager = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
   XPathContext _context = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
   String xpathStr=null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
   XPath xpath=null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
   static FunctionTable _funcTable = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        fixupFunctionTable();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    * Method getFuncHereContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    * @return the context for this object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
   public FuncHereContext getFuncHereContext() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
      return this._funcHereContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    * Constructor CachedXPathFuncHereAPI
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
   private CachedXPathFuncHereAPI() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    * Constructor CachedXPathFuncHereAPI
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    * @param existingXPathContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
   public CachedXPathFuncHereAPI(XPathContext existingXPathContext) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
      this._dtmManager = existingXPathContext.getDTMManager();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
      this._context=existingXPathContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    * Constructor CachedXPathFuncHereAPI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    * @param previouslyUsed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
   public CachedXPathFuncHereAPI(CachedXPathAPI previouslyUsed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
      this._dtmManager = previouslyUsed.getXPathContext().getDTMManager();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
      this._context=previouslyUsed.getXPathContext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    * Use an XPath string to select a single node. XPath namespace
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    * prefixes are resolved from the context node, which may not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    * be what you want (see the next method).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    * @param contextNode The node to start searching from.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    * @param xpathnode A Node containing a valid XPath string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    * @return The first node found that matches the XPath, or null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    * @throws TransformerException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
   public Node selectSingleNode(Node contextNode, Node xpathnode)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
           throws TransformerException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
      return selectSingleNode(contextNode, xpathnode, contextNode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    * Use an XPath string to select a single node.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    * XPath namespace prefixes are resolved from the namespaceNode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    * @param contextNode The node to start searching from.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    * @param xpathnode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    * @return The first node found that matches the XPath, or null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    * @throws TransformerException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
   public Node selectSingleNode(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
           Node contextNode, Node xpathnode, Node namespaceNode)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
              throws TransformerException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
      // Have the XObject return its result as a NodeSetDTM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
      NodeIterator nl = selectNodeIterator(contextNode, xpathnode,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                                           namespaceNode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
      // Return the first node, or null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
      return nl.nextNode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    *   Use an XPath string to select a nodelist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    *   XPath namespace prefixes are resolved from the contextNode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    *   @param contextNode The node to start searching from.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    *   @param xpathnode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    *   @return A NodeIterator, should never be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    *  @throws TransformerException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
   public NodeIterator selectNodeIterator(Node contextNode, Node xpathnode)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
           throws TransformerException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
      return selectNodeIterator(contextNode, xpathnode, contextNode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    *  Use an XPath string to select a nodelist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    *  XPath namespace prefixes are resolved from the namespaceNode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    *  @param contextNode The node to start searching from.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    * @param xpathnode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    *  @return A NodeIterator, should never be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    * @throws TransformerException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    * @deprecated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
   public NodeIterator selectNodeIterator(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
           Node contextNode, Node xpathnode, Node namespaceNode)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
              throws TransformerException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
      // Execute the XPath, and have it return the result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
      XObject list = eval(contextNode, xpathnode, getStrFromNode(xpathnode), namespaceNode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
      // Have the XObject return its result as a NodeSetDTM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
      return list.nodeset();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    *  Use an XPath string to select a nodelist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    *  XPath namespace prefixes are resolved from the contextNode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    *  @param contextNode The node to start searching from.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    * @param xpathnode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    *  @return A NodeIterator, should never be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    * @throws TransformerException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    * @deprecated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
   public NodeList selectNodeList(Node contextNode, Node xpathnode)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
           throws TransformerException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
      return selectNodeList(contextNode, xpathnode, getStrFromNode(xpathnode), contextNode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    *  Use an XPath string to select a nodelist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    *  XPath namespace prefixes are resolved from the namespaceNode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    *  @param contextNode The node to start searching from.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    * @param xpathnode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    * @param str
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    *  @return A NodeIterator, should never be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    * @throws TransformerException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
   public NodeList selectNodeList(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
           Node contextNode, Node xpathnode, String str, Node namespaceNode)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
              throws TransformerException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
      // Execute the XPath, and have it return the result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
      XObject list = eval(contextNode, xpathnode, str, namespaceNode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
      // Return a NodeList.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
      return list.nodelist();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    *  Evaluate XPath string to an XObject.  Using this method,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    *  XPath namespace prefixes will be resolved from the namespaceNode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    *  @param contextNode The node to start searching from.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    * @param xpathnode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    *  @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    *  @see com.sun.org.apache.xpath.internal.objects.XObject
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    *  @see com.sun.org.apache.xpath.internal.objects.XNull
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    *  @see com.sun.org.apache.xpath.internal.objects.XBoolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    *  @see com.sun.org.apache.xpath.internal.objects.XNumber
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    *  @see com.sun.org.apache.xpath.internal.objects.XString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    *  @see com.sun.org.apache.xpath.internal.objects.XRTreeFrag
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    * @throws TransformerException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    * @deprecated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
   public XObject eval(Node contextNode, Node xpathnode)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
           throws TransformerException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
      return eval(contextNode, xpathnode, getStrFromNode(xpathnode),contextNode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    *  Evaluate XPath string to an XObject.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    *  XPath namespace prefixes are resolved from the namespaceNode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    *  The implementation of this is a little slow, since it creates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    *  a number of objects each time it is called.  This could be optimized
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    *  to keep the same objects around, but then thread-safety issues would arise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    *  @param contextNode The node to start searching from.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    * @param xpathnode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    * @param str
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    *  @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    *  @see com.sun.org.apache.xpath.internal.objects.XObject
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    *  @see com.sun.org.apache.xpath.internal.objects.XNull
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    *  @see com.sun.org.apache.xpath.internal.objects.XBoolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    *  @see com.sun.org.apache.xpath.internal.objects.XNumber
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    *  @see com.sun.org.apache.xpath.internal.objects.XString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    *  @see com.sun.org.apache.xpath.internal.objects.XRTreeFrag
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    * @throws TransformerException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
   public XObject eval(Node contextNode, Node xpathnode, String str, Node namespaceNode)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
           throws TransformerException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
      //  Create the XPath object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
      //String str = CachedXPathFuncHereAPI.getStrFromNode(xpathnode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
      // Since we don't have a XML Parser involved here, install some default support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
      // for things like namespaces, etc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
      // (Changed from: XPathContext xpathSupport = new XPathContext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
      //    because XPathContext is weak in a number of areas... perhaps
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
      //    XPathContext should be done away with.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
      if (this._funcHereContext == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
         this._funcHereContext = new FuncHereContext(xpathnode,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
                                                     this._dtmManager);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
      // Create an object to resolve namespace prefixes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
      // XPath namespaces are resolved from the input context node's document element
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
      // if it is a root node, or else the current context node (for lack of a better
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
      // resolution space, given the simplicity of this sample code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
      PrefixResolverDefault prefixResolver =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
         new PrefixResolverDefault((namespaceNode.getNodeType()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
                                    == Node.DOCUMENT_NODE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
                                   ? ((Document) namespaceNode)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
                                      .getDocumentElement()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
                                   : namespaceNode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
1337
e8d6cef36199 6469266: Integrate Apache XMLSec 1.4.2 into JDK 7
mullan
parents: 2
diff changeset
   294
      // only check if string points to different object (for performance)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
      if (str!=xpathStr) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        if (str.indexOf("here()")>0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
            _context.reset();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
            _dtmManager=_context.getDTMManager();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        xpath = createXPath(str, prefixResolver);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
        xpathStr=str;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
      // Execute the XPath, and have it return the result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
      // return xpath.execute(xpathSupport, contextNode, prefixResolver);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
      int ctxtNode = this._funcHereContext.getDTMHandleFromNode(contextNode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
      return xpath.execute(this._funcHereContext, ctxtNode, prefixResolver);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    *   Evaluate XPath string to an XObject.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    *   XPath namespace prefixes are resolved from the namespaceNode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    *   The implementation of this is a little slow, since it creates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    *   a number of objects each time it is called.  This could be optimized
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
    *   to keep the same objects around, but then thread-safety issues would arise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    *   @param contextNode The node to start searching from.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    * @param xpathnode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    * @param str
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    *   @param prefixResolver Will be called if the parser encounters namespace
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    *                         prefixes, to resolve the prefixes to URLs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    *   @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    *   @see com.sun.org.apache.xpath.internal.objects.XObject
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    *   @see com.sun.org.apache.xpath.internal.objects.XNull
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    *   @see com.sun.org.apache.xpath.internal.objects.XBoolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    *   @see com.sun.org.apache.xpath.internal.objects.XNumber
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    *   @see com.sun.org.apache.xpath.internal.objects.XString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    *   @see com.sun.org.apache.xpath.internal.objects.XRTreeFrag
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    * @throws TransformerException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
   public XObject eval(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
           Node contextNode, Node xpathnode, String str, PrefixResolver prefixResolver)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
              throws TransformerException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
      // Since we don't have a XML Parser involved here, install some default support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
      // for things like namespaces, etc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
      // (Changed from: XPathContext xpathSupport = new XPathContext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
      //    because XPathContext is weak in a number of areas... perhaps
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
      //    XPathContext should be done away with.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
      // Create the XPath object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
      //String str = CachedXPathFuncHereAPI.getStrFromNode(xpathnode);
1337
e8d6cef36199 6469266: Integrate Apache XMLSec 1.4.2 into JDK 7
mullan
parents: 2
diff changeset
   344
    // only check if string points to different object (for performance)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    if (str!=xpathStr) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
        if (str.indexOf("here()")>0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
            _context.reset();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
            _dtmManager=_context.getDTMManager();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
            xpath = createXPath(str, prefixResolver);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        } catch (TransformerException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
            //Try to see if it is a problem with the classloader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
            Throwable th= ex.getCause();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
            if (th instanceof ClassNotFoundException) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
                 if (th.getMessage().indexOf("FuncHere")>0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
                     throw new RuntimeException(I18n.translate("endorsed.jdk1.4.0")/*,*/+ex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
                 }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
              }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
              throw ex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        xpathStr=str;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
      // Execute the XPath, and have it return the result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
      if (this._funcHereContext == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
         this._funcHereContext = new FuncHereContext(xpathnode,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
                                                     this._dtmManager);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
      int ctxtNode = this._funcHereContext.getDTMHandleFromNode(contextNode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
      return xpath.execute(this._funcHereContext, ctxtNode, prefixResolver);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    private XPath createXPath(String str, PrefixResolver prefixResolver) throws TransformerException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        XPath xpath = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
        Class[] classes = new Class[]{String.class, SourceLocator.class, PrefixResolver.class, int.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
                ErrorListener.class, FunctionTable.class};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        Object[] objects = new Object[]{str, null, prefixResolver, new Integer(XPath.SELECT), null, _funcTable};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
            Constructor constructor = XPath.class.getConstructor(classes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
            xpath = (XPath) constructor.newInstance(objects);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        } catch (Throwable t) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        if (xpath == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
            xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        return xpath;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * Method getStrFromNode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * @param xpathnode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * @return the string for the node.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
    public static String getStrFromNode(Node xpathnode) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
       if (xpathnode.getNodeType() == Node.TEXT_NODE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
          // we iterate over all siblings of the context node because eventually,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
          // the text is "polluted" with pi's or comments
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
          StringBuffer sb = new StringBuffer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
          for (Node currentSibling = xpathnode.getParentNode().getFirstChild();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
               currentSibling != null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
               currentSibling = currentSibling.getNextSibling()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
             if (currentSibling.getNodeType() == Node.TEXT_NODE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
                sb.append(((Text) currentSibling).getData());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
             }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
          return sb.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
       } else if (xpathnode.getNodeType() == Node.ATTRIBUTE_NODE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
          return ((Attr) xpathnode).getNodeValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
       } else if (xpathnode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
          return ((ProcessingInstruction) xpathnode).getNodeValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
       return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    private static void fixupFunctionTable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        boolean installed = false;
1337
e8d6cef36199 6469266: Integrate Apache XMLSec 1.4.2 into JDK 7
mullan
parents: 2
diff changeset
   426
        log.log(java.util.logging.Level.INFO, "Registering Here function");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
         * Try to register our here() implementation as internal function.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
            Class []args = {String.class, Expression.class};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
            Method installFunction = FunctionTable.class.getMethod("installFunction", args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
            if ((installFunction.getModifiers() & Modifier.STATIC) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
                Object []params = {"here", new FuncHere()};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
                installFunction.invoke(null, params);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
                installed = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        } catch (Throwable t) {
1337
e8d6cef36199 6469266: Integrate Apache XMLSec 1.4.2 into JDK 7
mullan
parents: 2
diff changeset
   439
            log.log(java.util.logging.Level.FINE, "Error installing function using the static installFunction method", t);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        if(!installed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
                _funcTable = new FunctionTable();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
                Class []args = {String.class, Class.class};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
                Method installFunction = FunctionTable.class.getMethod("installFunction", args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
                Object []params = {"here", FuncHere.class};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
                installFunction.invoke(_funcTable, params);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
                installed = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
            } catch (Throwable t) {
1337
e8d6cef36199 6469266: Integrate Apache XMLSec 1.4.2 into JDK 7
mullan
parents: 2
diff changeset
   450
                log.log(java.util.logging.Level.FINE, "Error installing function using the static installFunction method", t);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        }
1337
e8d6cef36199 6469266: Integrate Apache XMLSec 1.4.2 into JDK 7
mullan
parents: 2
diff changeset
   453
        if (log.isLoggable(java.util.logging.Level.FINE)) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
            if (installed) {
1337
e8d6cef36199 6469266: Integrate Apache XMLSec 1.4.2 into JDK 7
mullan
parents: 2
diff changeset
   455
                log.log(java.util.logging.Level.FINE, "Registered class " + FuncHere.class.getName()
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
                        + " for XPath function 'here()' function in internal table");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            } else {
1337
e8d6cef36199 6469266: Integrate Apache XMLSec 1.4.2 into JDK 7
mullan
parents: 2
diff changeset
   458
                log.log(java.util.logging.Level.FINE, "Unable to register class " + FuncHere.class.getName()
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
                        + " for XPath function 'here()' function in internal table");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
}