1 /*
2 * Copyright (C) 2003-2009 eXo Platform SAS.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Affero General Public License
6 * as published by the Free Software Foundation; either version 3
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see<http://www.gnu.org/licenses/>.
16 */
17 package org.exoplatform.services.cms.link;
18
19 import javax.jcr.RangeIterator;
20
21 /**
22 * Created by The eXo Platform SAS
23 * Author : eXoPlatform
24 * nicolas.filotto@exoplatform.com
25 * 1 avr. 2009
26 */
27 public abstract class RangeIteratorLinkAware implements RangeIterator {
28
29 protected final String originalWorkspace;
30 protected final String virtualPath;
31 protected final RangeIterator iterator;
32
33 public RangeIteratorLinkAware(String originalWorkspace, String virtualPath, RangeIterator iterator) {
34 this.iterator = iterator;
35 this.originalWorkspace = originalWorkspace;
36 if (!virtualPath.startsWith("/")) {
37 throw new IllegalArgumentException("The path '" + virtualPath + "' must be an absolute path");
38 }
39 this.virtualPath = virtualPath;
40 }
41
42 /**
43 * {@inheritDoc}
44 */
45 public long getPosition() {
46 return iterator.getPosition();
47 }
48
49 /**
50 * {@inheritDoc}
51 */
52 public long getSize() {
53 return iterator.getSize();
54 }
55
56 /**
57 * {@inheritDoc}
58 */
59 public void skip(long skipNum) {
60 iterator.skip(skipNum);
61 }
62
63 /**
64 * {@inheritDoc}
65 */
66 public boolean hasNext() {
67 return iterator.hasNext();
68 }
69
70 /**
71 * {@inheritDoc}
72 */
73 public void remove() {
74 iterator.remove();
75 }
76 }