< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java

Print this page




 157          *
 158          * <p>See {@link javax.xml.xpath.XPathFactory} for full documentation
 159          * of specific features.</p>
 160          *
 161          * @param name Feature name.
 162          * @param value Is feature state <code>true</code> or <code>false</code>.
 163          *
 164          * @throws XPathFactoryConfigurationException if this
 165          * <code>XPathFactory</code> or the <code>XPath</code>s
 166          *   it creates cannot support this feature.
 167          * @throws NullPointerException if <code>name</code> is
 168          * <code>null</code>.
 169          */
 170         public void setFeature(String name, boolean value)
 171                 throws XPathFactoryConfigurationException {
 172 
 173             // feature name cannot be null
 174             if (name == null) {
 175                 String fmsg = XSLMessages.createXPATHMessage(
 176                         XPATHErrorResources.ER_FEATURE_NAME_NULL,
 177                         new Object[] { CLASS_NAME, new Boolean( value) } );
 178                 throw new NullPointerException( fmsg );
 179              }
 180 
 181             // secure processing?
 182             if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
 183                 if ((_isSecureMode) && (!value)) {
 184                     String fmsg = XSLMessages.createXPATHMessage(
 185                             XPATHErrorResources.ER_SECUREPROCESSING_FEATURE,
 186                             new Object[] { name, CLASS_NAME, new Boolean(value) } );
 187                     throw new XPathFactoryConfigurationException( fmsg );
 188                 }
 189 
 190                 _isNotSecureProcessing = !value;
 191                 if (value && _featureManager != null) {
 192                     _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
 193                             FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
 194                 }
 195 
 196                 // all done processing feature
 197                 return;
 198             }
 199             if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
 200                 //in secure mode, let _useServicesMechanism be determined by the constructor
 201                 if (!_isSecureMode)
 202                     _useServicesMechanism = value;
 203                 return;
 204             }
 205 
 206             if (_featureManager != null &&
 207                     _featureManager.setValue(name, FeaturePropertyBase.State.APIPROPERTY, value)) {
 208                 return;
 209             }
 210 
 211             // unknown feature
 212             String fmsg = XSLMessages.createXPATHMessage(
 213                     XPATHErrorResources.ER_FEATURE_UNKNOWN,
 214                     new Object[] { name, CLASS_NAME, new Boolean(value) } );
 215             throw new XPathFactoryConfigurationException( fmsg );
 216         }
 217 
 218         /**
 219          * <p>Get the state of the named feature.</p>
 220          *
 221          * <p>
 222          * Feature names are fully qualified {@link java.net.URI}s.
 223          * Implementations may define their own features.
 224          * An {@link XPathFactoryConfigurationException} is thrown if this
 225          * <code>XPathFactory</code> or the <code>XPath</code>s
 226          * it creates cannot support the feature.
 227          * It is possible for an <code>XPathFactory</code> to expose a feature
 228          * value but be unable to change its state.
 229          * </p>
 230          *
 231          * @param name Feature name.
 232          *
 233          * @return State of the named feature.
 234          *




 157          *
 158          * <p>See {@link javax.xml.xpath.XPathFactory} for full documentation
 159          * of specific features.</p>
 160          *
 161          * @param name Feature name.
 162          * @param value Is feature state <code>true</code> or <code>false</code>.
 163          *
 164          * @throws XPathFactoryConfigurationException if this
 165          * <code>XPathFactory</code> or the <code>XPath</code>s
 166          *   it creates cannot support this feature.
 167          * @throws NullPointerException if <code>name</code> is
 168          * <code>null</code>.
 169          */
 170         public void setFeature(String name, boolean value)
 171                 throws XPathFactoryConfigurationException {
 172 
 173             // feature name cannot be null
 174             if (name == null) {
 175                 String fmsg = XSLMessages.createXPATHMessage(
 176                         XPATHErrorResources.ER_FEATURE_NAME_NULL,
 177                         new Object[] { CLASS_NAME, value } );
 178                 throw new NullPointerException( fmsg );
 179              }
 180 
 181             // secure processing?
 182             if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
 183                 if ((_isSecureMode) && (!value)) {
 184                     String fmsg = XSLMessages.createXPATHMessage(
 185                             XPATHErrorResources.ER_SECUREPROCESSING_FEATURE,
 186                             new Object[] { name, CLASS_NAME, value } );
 187                     throw new XPathFactoryConfigurationException( fmsg );
 188                 }
 189 
 190                 _isNotSecureProcessing = !value;
 191                 if (value && _featureManager != null) {
 192                     _featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
 193                             FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
 194                 }
 195 
 196                 // all done processing feature
 197                 return;
 198             }
 199             if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
 200                 //in secure mode, let _useServicesMechanism be determined by the constructor
 201                 if (!_isSecureMode)
 202                     _useServicesMechanism = value;
 203                 return;
 204             }
 205 
 206             if (_featureManager != null &&
 207                     _featureManager.setValue(name, FeaturePropertyBase.State.APIPROPERTY, value)) {
 208                 return;
 209             }
 210 
 211             // unknown feature
 212             String fmsg = XSLMessages.createXPATHMessage(
 213                     XPATHErrorResources.ER_FEATURE_UNKNOWN,
 214                     new Object[] { name, CLASS_NAME, value } );
 215             throw new XPathFactoryConfigurationException( fmsg );
 216         }
 217 
 218         /**
 219          * <p>Get the state of the named feature.</p>
 220          *
 221          * <p>
 222          * Feature names are fully qualified {@link java.net.URI}s.
 223          * Implementations may define their own features.
 224          * An {@link XPathFactoryConfigurationException} is thrown if this
 225          * <code>XPathFactory</code> or the <code>XPath</code>s
 226          * it creates cannot support the feature.
 227          * It is possible for an <code>XPathFactory</code> to expose a feature
 228          * value but be unable to change its state.
 229          * </p>
 230          *
 231          * @param name Feature name.
 232          *
 233          * @return State of the named feature.
 234          *


< prev index next >