List of usage examples for org.xml.sax SAXNotSupportedException SAXNotSupportedException
public SAXNotSupportedException(String message)
From source file:com.jkoolcloud.tnt4j.streams.configure.sax.ConfigParserHandler.java
/** * Processes a {@code <stream>} element. * * @param attrs/*from w w w . j a v a 2 s . c om*/ * List of element attributes * * @throws SAXException * if error occurs parsing element */ private void processStream(Attributes attrs) throws SAXException { if (currStream != null) { throw new SAXParseException(StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.malformed.configuration", STREAM_ELMT), currParseLocation); } String name = null; String className = null; for (int i = 0; i < attrs.getLength(); i++) { String attName = attrs.getQName(i); String attValue = attrs.getValue(i); if (NAME_ATTR.equals(attName)) { name = attValue; } else if (CLASS_ATTR.equals(attName)) { className = attValue; } } notEmpty(name, STREAM_ELMT, NAME_ATTR); notEmpty(className, STREAM_ELMT, CLASS_ATTR); if (streamsConfigData.getStream(name) != null) { throw new SAXParseException(StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.duplicate", STREAM_ELMT, name), currParseLocation); } try { Object newStream = Utils.createInstance(className); if (!(newStream instanceof TNTInputStream)) { throw new SAXNotSupportedException(StreamsResources.getStringFormatted( StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.not.extend.class", STREAM_ELMT, CLASS_ATTR, className, TNTInputStream.class.getName(), getLocationInfo())); } currStream = (TNTInputStream<?, ?>) newStream; } catch (Exception exc) { throw new SAXException(StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.failed.to.load", STREAM_ELMT, CLASS_ATTR, className, getLocationInfo()), exc); } currStream.setName(name); streamsConfigData.addStream(currStream); currStream.ensureOutputSet(); }
From source file:com.jkoolcloud.tnt4j.streams.configure.sax.ConfigParserHandler.java
@SuppressWarnings("unchecked") private void handleFieldTransform(FieldTransformData currTransformData) throws SAXException { String eDataVal = getElementData(); if (eDataVal != null) { if (StringUtils.isNotEmpty(currTransformData.beanRef) && eDataVal.length() > 0) { throw new SAXException(StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.element.has.both3", FIELD_TRANSFORM_ELMT, BEAN_REF_ATTR, getLocationInfo())); } else if (currTransformData.scriptCode == null) { currTransformData.scriptCode = eDataVal; }/* w w w . j a va 2s . co m*/ } if (StringUtils.isEmpty(currTransformData.beanRef) && StringUtils.isEmpty(currTransformData.scriptCode)) { throw new SAXParseException( StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.must.contain", FIELD_TRANSFORM_ELMT, BEAN_REF_ATTR, CDATA), currParseLocation); } ValueTransformation<Object, Object> transform; if (StringUtils.isNotEmpty(currTransformData.beanRef)) { Object tObj = javaObjectsMap.get(currTransformData.beanRef); if (tObj == null) { throw new SAXParseException(StreamsResources.getStringFormatted( StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.undefined.reference", FIELD_TRANSFORM_ELMT, currTransformData.beanRef), currParseLocation); } if (tObj instanceof ValueTransformation) { transform = (ValueTransformation<Object, Object>) tObj; } else { throw new SAXNotSupportedException( StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.not.extend.class", FIELD_TRANSFORM_ELMT, BEAN_REF_ATTR, tObj.getClass().getName(), ValueTransformation.class.getName(), getLocationInfo())); } } else { transform = AbstractScriptTransformation.createScriptTransformation(currTransformData.name, currTransformData.scriptLang, currTransformData.scriptCode); } if (currLocatorData != null) { currLocatorData.valueTransforms.add(transform); } else { currField.addTransformation(transform); } }
From source file:nl.nn.adapterframework.align.XmlAligner.java
@Override public void setFeature(String feature, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (feature.equals(FEATURE_NAMESPACES)) { if (!value) { throw new SAXNotSupportedException("Cannot set feature [" + feature + "] to [" + value + "]"); }/*from ww w . ja va 2s. c o m*/ return; } if (feature.equals(FEATURE_NAMESPACE_PREFIXES)) { if (value) { throw new SAXNotSupportedException("Cannot set feature [" + feature + "] to [" + value + "]"); } return; } log.debug("setting feature [" + feature + "] to [" + value + "]"); super.setFeature(feature, value); }
From source file:nl.nn.adapterframework.validation.xerces_2_11.XMLSchemaFactory.java
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException(JAXPValidationMessageFormatter .formatMessage(fXMLSchemaLoader.getLocale(), "FeatureNameNull", null)); }// w w w.j a va2 s.c om if (name.startsWith(JAXP_SOURCE_FEATURE_PREFIX)) { // Indicates to the caller that this SchemaFactory supports a specific JAXP Source. if (name.equals(StreamSource.FEATURE) || name.equals(SAXSource.FEATURE) || name.equals(DOMSource.FEATURE) || name.equals(StAXSource.FEATURE)) { return true; } } if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { return (fSecurityManager != null); } else if (name.equals(USE_GRAMMAR_POOL_ONLY)) { return fUseGrammarPoolOnly; } try { return fXMLSchemaLoader.getFeature(name); } catch (XMLConfigurationException e) { String identifier = e.getIdentifier(); if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) { throw new SAXNotRecognizedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "feature-not-recognized", new Object[] { identifier })); } else { throw new SAXNotSupportedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "feature-not-supported", new Object[] { identifier })); } } }
From source file:nl.nn.adapterframework.validation.xerces_2_11.XMLSchemaFactory.java
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException(JAXPValidationMessageFormatter .formatMessage(fXMLSchemaLoader.getLocale(), "ProperyNameNull", null)); }/* w w w. ja va 2s .com*/ if (name.equals(SECURITY_MANAGER)) { return fSecurityManager; } else if (name.equals(XMLGRAMMAR_POOL)) { throw new SAXNotSupportedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "property-not-supported", new Object[] { name })); } try { return fXMLSchemaLoader.getProperty(name); } catch (XMLConfigurationException e) { String identifier = e.getIdentifier(); if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) { throw new SAXNotRecognizedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "property-not-recognized", new Object[] { identifier })); } else { throw new SAXNotSupportedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "property-not-supported", new Object[] { identifier })); } } }
From source file:nl.nn.adapterframework.validation.xerces_2_11.XMLSchemaFactory.java
public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException(JAXPValidationMessageFormatter .formatMessage(fXMLSchemaLoader.getLocale(), "FeatureNameNull", null)); }// ww w . j a v a2 s. c om if (name.startsWith(JAXP_SOURCE_FEATURE_PREFIX)) { if (name.equals(StreamSource.FEATURE) || name.equals(SAXSource.FEATURE) || name.equals(DOMSource.FEATURE) || name.equals(StAXSource.FEATURE)) { throw new SAXNotSupportedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "feature-read-only", new Object[] { name })); } } if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { fSecurityManager = value ? new SecurityManager() : null; fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager); return; } else if (name.equals(USE_GRAMMAR_POOL_ONLY)) { fUseGrammarPoolOnly = value; return; } try { fXMLSchemaLoader.setFeature(name, value); } catch (XMLConfigurationException e) { String identifier = e.getIdentifier(); if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) { throw new SAXNotRecognizedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "feature-not-recognized", new Object[] { identifier })); } else { throw new SAXNotSupportedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "feature-not-supported", new Object[] { identifier })); } } }
From source file:nl.nn.adapterframework.validation.xerces_2_11.XMLSchemaFactory.java
public void setProperty(String name, Object object) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException(JAXPValidationMessageFormatter .formatMessage(fXMLSchemaLoader.getLocale(), "ProperyNameNull", null)); }//from ww w . j a va 2 s . c om if (name.equals(SECURITY_MANAGER)) { fSecurityManager = (SecurityManager) object; fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager); return; } else if (name.equals(XMLGRAMMAR_POOL)) { throw new SAXNotSupportedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "property-not-supported", new Object[] { name })); } try { fXMLSchemaLoader.setProperty(name, object); } catch (XMLConfigurationException e) { String identifier = e.getIdentifier(); if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) { throw new SAXNotRecognizedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "property-not-recognized", new Object[] { identifier })); } else { throw new SAXNotSupportedException(SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "property-not-supported", new Object[] { identifier })); } } }