01: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
02: * This code is licensed under the GPL 2.0 license, availible at the root
03: * application directory.
04: */
05: package org.geoserver.wfs;
06:
07: import net.opengis.wfs.NativeType;
08: import net.opengis.wfs.TransactionResponseType;
09: import net.opengis.wfs.TransactionType;
10: import org.eclipse.emf.ecore.EObject;
11: import java.util.Map;
12: import java.util.logging.Logger;
13: import javax.xml.namespace.QName;
14:
15: /**
16: * Processes native elements as unrecognized ones, and checks wheter they can be
17: * safely ignored on not.
18: *
19: * @author Andrea Aime - TOPP
20: */
21: public class NativeElementHandler implements TransactionElementHandler {
22: /**
23: * logger
24: */
25: static Logger LOGGER = org.geotools.util.logging.Logging
26: .getLogger("org.geoserver.wfs");
27:
28: /**
29: * Empty array of QNames
30: */
31: protected static final QName[] EMPTY_QNAMES = new QName[0];
32:
33: public void checkValidity(EObject element, Map featureTypeInfos)
34: throws WFSTransactionException {
35: NativeType nativ = (NativeType) element;
36:
37: if (!nativ.isSafeToIgnore()) {
38: throw new WFSTransactionException("Native element:"
39: + nativ.getVendorId()
40: + " unsupported but marked as"
41: + " unsafe to ignore", "InvalidParameterValue");
42: }
43: }
44:
45: public void execute(EObject element, TransactionType request,
46: Map featureSources, TransactionResponseType response,
47: TransactionListener listener)
48: throws WFSTransactionException {
49: // nothing to do, we just ignore if possible
50: }
51:
52: public Class getElementClass() {
53: return NativeType.class;
54: }
55:
56: public QName[] getTypeNames(EObject element)
57: throws WFSTransactionException {
58: // we don't handle this
59: return EMPTY_QNAMES;
60: }
61: }
|