org.milyn.payload.JavaSource Maven / Gradle / Ivy
The newest version!
/*
Milyn - Copyright (C) 2006 - 2010
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License (version 2.1) as published by the Free Software
Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details:
http://www.gnu.org/licenses/lgpl.txt
*/
package org.milyn.payload;
import org.milyn.assertion.AssertArgument;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Java Filtration/Transformation {@link javax.xml.transform.Source}.
*
* Controlling Event Stream Generation
* The Java Objects used to create this source can be used to generate a stream of SAX
* events, which can then be analysed by Smooks in the normal manner. Generation of the
* SAX event stream can also be turned off via the {@link #setEventStreamRequired(boolean)}
* method, or by configuring the 'http://www.smooks.org/sax/features/generate-java-event-stream'
* feature on the reader in the Smoooks configuration as follows:
*
*
* <reader>
* <features>
* <setOff feature="http://www.smooks.org/sax/features/generate-java-event-stream" />
* </features>
* </reader>
*
*
* Turning off event stream generation can make sense in many situations. In some use cases event stream
* generation may add no value and may just reduces performance e.g. where you simply wish to apply a
* template to the supplied Java Object(s).
*
* Smooks must generate at least 1 event to which configured resources can be targeted (e.g. a templating
* resource). When event stream generation is turned off, Smooks simply generates what we call a "Null Source"
* document event. In XML, it could be represented as "<nullsource-document/>". So when event stream
* generation is turned off, simply target resources at "nullsource-document" or "#document".
*
* @author [email protected]
*/
public class JavaSource extends FilterSource {
/**
*
*/
public static final String FEATURE_GENERATE_EVENT_STREAM = "http://www.smooks.org/sax/features/generate-java-event-stream";
private List