Update Tomas's name
[netconf.git] / protocol / netconf-server / src / main / java / org / opendaylight / netconf / server / api / operations / NetconfOperationChainedExecution.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.netconf.server.api.operations;
9
10 import org.opendaylight.netconf.api.DocumentedException;
11 import org.w3c.dom.Document;
12
13 /**
14  * Single link in netconf operation execution chain.
15  * Wraps the execution of a single netconf operation.
16  */
17 public interface NetconfOperationChainedExecution {
18
19     /**
20      * Check if this is termination point in operation execution.
21      *
22      * @return true if this is termination point in operation execution, false
23      *     if there is a subsequent operation present that needs to be
24      *     executed.
25      */
26     boolean isExecutionTermination();
27
28     /**
29      * Do not execute if this is termination point.
30      */
31     Document execute(Document requestMessage) throws DocumentedException;
32
33     NetconfOperationChainedExecution EXECUTION_TERMINATION_POINT = new NetconfOperationChainedExecution() {
34         @Override
35         public boolean isExecutionTermination() {
36             return true;
37         }
38
39         @Override
40         public Document execute(Document requestMessage) {
41             throw new IllegalStateException("This execution represents the termination point in operation execution "
42                     + "and cannot be executed itself");
43         }
44     };
45
46
47 }