Hi,
I was looking at making WFS transaction element handling extensible,
since in WFSV in need to handle another element, the rollback one (and
in the future, when handling branches, I'll need to handle the merge
one).
The transaction processing is a big bad method, doing the following:
1) create gt2 transaction
2) for each element, perform basic validity checks
3) for each element, gather the name and
namespace of involved feature types so that we can gather the
feature type infos involved
4) build maps from feature type names to feature sources
5) check lock id, and add authorization
6) build transaction result, by looping over elements and make
them execute their part
7) release locks
8) "complete" the result to handle issues with the spec (insert)
It seems to me it's possible to make element handling extensible
by adding a new interface, TransactionElementHandler, with the
following definition:
interface TransactionElementHandler {
/**
* Returns the element class this handler can proces
*/
Class getElementClass();
/**
* Checks the element content is valid, throws an exception
* otherwise
*/
void checkValidity(Element e) throws WFSTransactionException;
/**
* Returns a list of feature type names needed to handle this element
*/
QName getTypeNames(Element e) throws WFSTransactionException;
/**
* Executes the element against the provided feature sources
*/
void execute(Element e, Map featureSources,
TransactionResponseType response)
throws WFSTransactionException;
}
We could register these handlers in the spring context or, to make
things simpler, have just a factory method that builds them
in the Transaction class, so that subclasses can handle more.
What do you think? Suggestions? I'm not stuck because of this today,
but I'll probably be tomorrow, so please be quick
Cheers
Andrea