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 openr66.context.filesystem;
22
23 import goldengate.common.command.exception.CommandAbstractException;
24 import goldengate.common.command.exception.Reply502Exception;
25 import goldengate.common.file.filesystembased.FilesystemBasedRestartImpl;
26 import openr66.context.R66Session;
27
28 /**
29 * Restart implementation
30 *
31 * @author frederic bregier
32 *
33 */
34 public class R66Restart extends FilesystemBasedRestartImpl {
35
36 /**
37 * @param session
38 */
39 public R66Restart(R66Session session) {
40 super(session);
41 }
42
43 /*
44 * (non-Javadoc)
45 *
46 * @see goldengate.common.file.Restart#restartMarker(java.lang.String)
47 */
48 @Override
49 public boolean restartMarker(String marker) throws CommandAbstractException {
50 long newposition = 0;
51 try {
52 newposition = Long.parseLong(marker);
53 } catch (NumberFormatException e) {
54 throw new Reply502Exception(
55 "Marker must be length in byte as a position");
56 }
57 return restartMarker(newposition);
58 }
59
60 /**
61 * Same as restartMarker with String
62 *
63 * @param newposition
64 * @return True if OK
65 */
66 public boolean restartMarker(long newposition) {
67 position = newposition;
68 setSet(true);
69 return true;
70 }
71 }