Skip to content

Commit

Permalink
Goodbye TransactionPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
aaime committed Jun 1, 2019
1 parent 76bbfa9 commit 5590a4f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 100 deletions.
4 changes: 1 addition & 3 deletions src/wfs/src/main/java/org/geoserver/wfs/GMLInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ public interface GMLInfo extends Serializable {
* <li>{@link #URN} : urn:x-ogc:def:crs:EPSG:XXXX
* </ul>
*
* <p>
*
* Use {@link SrsSyntax} whenever possible
* <p>Use {@link SrsSyntax} whenever possible
*/
public static enum SrsNameStyle {
NORMAL {
Expand Down
39 changes: 7 additions & 32 deletions src/wfs/src/main/java/org/geoserver/wfs/Transaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ public class Transaction {

protected List<TransactionElementHandler> transactionElementHandlers = new ArrayList<>();
protected List<TransactionListener> transactionListeners = new ArrayList<>();
protected List<TransactionPlugin> transactionPlugins = new ArrayList<>();
protected List<TransactionCallback> transactionPlugins2 = new ArrayList<>();
protected List<TransactionCallback> transactionCallbacks = new ArrayList<>();

public Transaction(WFSInfo wfs, Catalog catalog, ApplicationContext context) {
this.wfs = wfs;
Expand All @@ -73,15 +72,11 @@ public Transaction(WFSInfo wfs, Catalog catalog, ApplicationContext context) {
transactionElementHandlers.addAll(
GeoServerExtensions.extensions(TransactionElementHandler.class));
transactionListeners.addAll(GeoServerExtensions.extensions(TransactionListener.class));
transactionPlugins.addAll(GeoServerExtensions.extensions(TransactionPlugin.class));
transactionPlugins2.addAll(GeoServerExtensions.extensions(TransactionCallback.class));
transactionCallbacks.addAll(GeoServerExtensions.extensions(TransactionCallback.class));
// plugins are listeners too, but I want to make sure they are notified
// of
// changes in the same order as the other plugin callbacks
transactionListeners.removeAll(transactionPlugins);
transactionListeners.removeAll(transactionPlugins2);
// sort plugins according to priority
Collections.sort(transactionPlugins, new TransactionPluginComparator());
transactionListeners.removeAll(transactionCallbacks);
}

public void setFilterFactory(FilterFactory filterFactory) {
Expand Down Expand Up @@ -426,15 +421,7 @@ protected TransactionResponse execute(TransactionRequest request) throws Excepti

private TransactionRequest fireBeforeTransaction(TransactionRequest request) {
TransactionType tx = TransactionRequest.WFS11.unadapt(request);
if (tx != null) {
// TransactionPlugin cannot alter transactions since the advent of WFS 2.0, it's left
// like that and
// will be deprecated
for (TransactionPlugin tp : transactionPlugins) {
tp.beforeTransaction(tx);
}
}
for (TransactionCallback tp : transactionPlugins2) {
for (TransactionCallback tp : transactionCallbacks) {
request = tp.beforeTransaction(request);
}

Expand All @@ -445,25 +432,14 @@ private void fireAfterTransaction(
TransactionRequest request, TransactionResponse result, boolean committed) {
TransactionType tx = TransactionRequest.WFS11.unadapt(request);
TransactionResponseType tr = TransactionResponse.WFS11.unadapt(result);
if (tx != null && tr != null) {
for (TransactionPlugin tp : transactionPlugins) {
tp.afterTransaction(tx, tr, committed);
}
}
for (TransactionCallback tp : transactionPlugins2) {
for (TransactionCallback tp : transactionCallbacks) {
tp.afterTransaction(request, result, committed);
}
}

private void fireBeforeCommit(TransactionRequest request) {
// inform plugins we're about to commit
for (TransactionPlugin tp : transactionPlugins) {
TransactionType tx = TransactionRequest.WFS11.unadapt(request);
if (tx != null) {
tp.beforeCommit(tx);
}
}
for (TransactionCallback tp : transactionPlugins2) {
for (TransactionCallback tp : transactionCallbacks) {
tp.beforeCommit(request);
}
}
Expand Down Expand Up @@ -658,8 +634,7 @@ public void dataStoreChange(List listeners, TransactionEvent event) throws WFSEx
}

public void dataStoreChange(TransactionEvent event) throws WFSException {
dataStoreChange(transactionPlugins, event);
dataStoreChange(transactionPlugins2, event);
dataStoreChange(transactionCallbacks, event);
dataStoreChange(transactionListeners, event);
}
}
Expand Down
42 changes: 0 additions & 42 deletions src/wfs/src/main/java/org/geoserver/wfs/TransactionPlugin.java

This file was deleted.

This file was deleted.

0 comments on commit 5590a4f

Please sign in to comment.