View Javadoc

1   /**
2      This file is part of GoldenGate Project (named also GoldenGate or GG).
3   
4      Copyright 2009, Frederic Bregier, and individual contributors by the @author
5      tags. See the COPYRIGHT.txt in the distribution for a full listing of
6      individual contributors.
7   
8      All GoldenGate Project is free software: you can redistribute it and/or 
9      modify it under the terms of the GNU General Public License as published 
10     by the Free Software Foundation, either version 3 of the License, or
11     (at your option) any later version.
12  
13     GoldenGate is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU General Public License for more details.
17  
18     You should have received a copy of the GNU General Public License
19     along with GoldenGate .  If not, see <http://www.gnu.org/licenses/>.
20   */
21  package goldengate.common.file;
22  
23  import goldengate.common.command.exception.CommandAbstractException;
24  import goldengate.common.exception.NoRestartException;
25  
26  /**
27   * Restart object that implements the REST command.<br>
28   * Note that if necessary, according to the implementation of
29   * {@link DirInterface} and {@link FileInterface}, one could want to implement a
30   * way to store or retrieve Marker from/to the client specification.
31   *
32   * @author Frederic Bregier
33   *
34   */
35  public abstract class Restart {
36      /**
37       * SessionInterface
38       */
39      private final SessionInterface session;
40  
41      /**
42       * Is the current Restart object in context set
43       */
44      private boolean isSet = false;
45  
46      /**
47       * Default constructor
48       *
49       * @param session
50       */
51      protected Restart(SessionInterface session) {
52          isSet = false;
53          this.session = session;
54      }
55  
56      /**
57       * @return the isSet
58       */
59      protected boolean isSet() {
60          return isSet;
61      }
62  
63      /**
64       * @param isSet
65       *            the isSet to set
66       */
67      public void setSet(boolean isSet) {
68          this.isSet = isSet;
69      }
70  
71      /**
72       * @return the session
73       */
74      protected SessionInterface getSession() {
75          return session;
76      }
77  
78      /**
79       * Restart from a Marker for the next FileInterface
80       *
81       * @param marker
82       * @return True if the Marker is OK
83       * @exception CommandAbstractException
84       */
85      public abstract boolean restartMarker(String marker)
86              throws CommandAbstractException;
87  
88      /**
89       *
90       * @return the position from a previous REST command
91       * @throws NoRestartException
92       *             if no REST command was issued before
93       */
94      public abstract long getPosition() throws NoRestartException;
95      // FIXME Additionally the implementation should implement a way to get the
96      // values
97  }