|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T> org.springframework.batch.item.xml.StaxEventItemReader<T>
public class StaxEventItemReader<T>
Item reader for reading XML input based on StAX. It extracts fragments from the input XML document which correspond to records for processing. The fragments are wrapped with StartDocument and EndDocument events so that the fragments can be further processed like standalone XML documents. The implementation is *not* thread-safe.
Constructor Summary | |
---|---|
StaxEventItemReader()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Ensure that all required dependencies for the ItemReader to run are provided after all properties have been set. |
protected void |
doClose()
Close the resources opened in AbstractItemCountingItemStreamItemReader.doOpen() . |
protected void |
doOpen()
Open resources necessary to start reading input. |
protected T |
doRead()
Move to next fragment and map it to item. |
protected boolean |
moveCursorToNextFragment(javax.xml.stream.XMLEventReader reader)
Responsible for moving the cursor before the StartElement of the fragment root. |
void |
setFragmentRootElementName(String fragmentRootElementName)
|
void |
setResource(Resource resource)
|
void |
setStrict(boolean strict)
In strict mode the reader will throw an exception on AbstractItemCountingItemStreamItemReader.open(org.springframework.batch.item.ExecutionContext) if the
input resource does not exist. |
void |
setUnmarshaller(Unmarshaller unmarshaller)
|
Methods inherited from class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader |
---|
close, getCurrentItemCount, jumpToItem, open, read, setCurrentItemCount, setMaxItemCount, setName, setSaveState, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.batch.item.ItemStream |
---|
close, open, update |
Methods inherited from interface org.springframework.batch.item.ItemReader |
---|
read |
Constructor Detail |
---|
public StaxEventItemReader()
Method Detail |
---|
public void setStrict(boolean strict)
AbstractItemCountingItemStreamItemReader.open(org.springframework.batch.item.ExecutionContext)
if the
input resource does not exist.
strict
- false by defaultpublic void setResource(Resource resource)
setResource
in interface ResourceAwareItemReaderItemStream<T>
public void setUnmarshaller(Unmarshaller unmarshaller)
unmarshaller
- maps xml fragments corresponding to
records to objectspublic void setFragmentRootElementName(String fragmentRootElementName)
fragmentRootElementName
- name of the root element of the fragment
TODO String can be ambiguous due to namespaces, use QName?public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
IllegalArgumentException
- if the Resource, FragmentDeserializer or
FragmentRootElementName is null, or if the root element is empty.
IllegalStateException
- if the Resource does not exist.
Exception
InitializingBean.afterPropertiesSet()
protected boolean moveCursorToNextFragment(javax.xml.stream.XMLEventReader reader)
true
if next fragment was found,
false
otherwise.protected void doClose() throws Exception
AbstractItemCountingItemStreamItemReader
AbstractItemCountingItemStreamItemReader.doOpen()
.
doClose
in class AbstractItemCountingItemStreamItemReader<T>
Exception
protected void doOpen() throws Exception
AbstractItemCountingItemStreamItemReader
doOpen
in class AbstractItemCountingItemStreamItemReader<T>
Exception
protected T doRead() throws Exception
doRead
in class AbstractItemCountingItemStreamItemReader<T>
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |