public InputStreamGenerator(InputStream inputStream) { super(); if (inputStream == null) { throw new SetupException("An input stream has to be passed."); } this.inputStream = inputStream; }
public SAXBufferGenerator(SAXBuffer saxBuffer) { super(); if (saxBuffer == null) { throw new SetupException("A SAXBuffer has to be passed."); } this.saxBuffer = saxBuffer; }
public NodeGenerator(Node document) { if (document == null) { throw new SetupException("A DOM document has to be passed."); } this.node = document; }
public XMLSerializer(Properties format) { super(); if (format == null) { throw new SetupException("No format properites passed as argument."); } this.format = format; }
public ByteArrayGenerator(byte[] bytes, String encoding) { if (bytes == null) { throw new SetupException("A byte array has to be passed."); } this.bytes = bytes; this.encoding = encoding; }
public FileGenerator(File file) { if (file == null) { throw new SetupException("A file has to be passed."); } this.file = file; }
public StringGenerator(String xmlString) { super(); if (xmlString == null) { throw new SetupException("An XML string has to be passed."); } this.xmlString = xmlString; }
public XMLSerializer setDoctypePublic(String doctypePublic) { if (doctypePublic == null || EMPTY.equals(doctypePublic)) { throw new SetupException("A doctype-public has to be passed as argument."); } this.format.put(OutputKeys.DOCTYPE_PUBLIC, doctypePublic); return this; }
public XMLSerializer setEncoding(String encoding) { if (encoding == null || EMPTY.equals(encoding)) { throw new SetupException("A encoding has to be passed as argument."); } this.format.put(OutputKeys.ENCODING, encoding); return this; }
public XMLSerializer setMethod(String method) { if (method == null || EMPTY.equals(method)) { throw new SetupException("A method has to be passed as argument."); } this.format.put(OutputKeys.METHOD, method); return this; }
public XMLSerializer setMediaType(String mediaType) { if (mediaType == null || EMPTY.equals(mediaType)) { throw new SetupException("A media-type has to be passed as argument."); } this.format.put(OutputKeys.MEDIA_TYPE, mediaType); return this; }
public XMLSerializer setCDataSectionElements(String cdataSectionElements) { if (cdataSectionElements == null || EMPTY.equals(cdataSectionElements)) { throw new SetupException("A ... has to be passed as argument."); } this.format.put(OutputKeys.CDATA_SECTION_ELEMENTS, cdataSectionElements); return this; }
public XMLSerializer setDoctypeSystem(String doctypeSystem) { if (doctypeSystem == null || EMPTY.equals(doctypeSystem)) { throw new SetupException("A doctype-system has to be passed as argument."); } this.format.put(OutputKeys.DOCTYPE_SYSTEM, doctypeSystem); return this; }
public XMLSerializer setVersion(String version) { if (version == null || EMPTY.equals(version)) { throw new SetupException("A version has to be passed as argument."); } this.format.put(OutputKeys.VERSION, version); return this; }
@Override public void setConfiguration(Map<String, ? extends Object> configuration) { try { this.service = new URL((String) configuration.get("service")); } catch (MalformedURLException e) { throw new SetupException(("Can't create an URL for " + configuration.get("service") + "."), e); } }
/** * {@inheritDoc} * * @see org.apache.cocoon.pipeline.component.Producer#setConsumer(org.apache.cocoon.pipeline.component.Consumer) */ public final void setConsumer(Consumer consumer) { if (!(consumer instanceof SAXConsumer)) { throw new SetupException("SAXProducer requires a SAXConsumer."); } this.setSAXConsumer((SAXConsumer) consumer); }
@Override public void setOutputStream(OutputStream outputStream) { try { super.setOutputStream(outputStream); } catch (IOException e) { throw new SetupException(e); } }
/** * {@inheritDoc} * * @see org.apache.cocoon.pipeline.Pipeline#setup(java.io.OutputStream, * java.util.Map) */ public void setup(OutputStream outputStream, Map<String, Object> parameters) { if (outputStream == null) { throw new SetupException("An output stream must be passed."); } this.setupComponents(outputStream, parameters); this.setupDone = true; }
/** * {@inheritDoc} * * @see org.apache.cocoon.pipeline.component.Producer#setConsumer(org.apache.cocoon.pipeline.component.Consumer) */ public void setConsumer(Consumer consumer) { if (consumer instanceof StAXConsumer) { this.consumer = (StAXConsumer) consumer; this.consumer.setParent(this); } else { throw new SetupException("StAXProducer requires an StAXConsumer."); } }
public void execute() { if (XMLGenerator.this.logger.isDebugEnabled()) { XMLGenerator.this.logger.debug("Using a DOM node to produce SAX events."); } DOMStreamer streamer = new DOMStreamer(XMLGenerator.this.getSAXConsumer()); try { streamer.stream(this.node); } catch (SAXException e) { throw new SetupException("Can't stream DOM node + " + this.node); } }