1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.esigate.extension.parallelesi;
16
17 import java.io.IOException;
18 import java.util.concurrent.Future;
19
20 import org.esigate.HttpErrorPage;
21 import org.esigate.parser.future.FutureElement;
22 import org.esigate.parser.future.FutureParserContext;
23
24 abstract class BaseElement implements FutureElement {
25 private FutureElement parent = null;
26
27 protected BaseElement() {
28 }
29
30
31
32
33
34
35
36
37 protected boolean parseTag(Tag tag, FutureParserContext ctx) throws HttpErrorPage, IOException {
38
39 return true;
40 }
41
42 @Override
43 public boolean onTagStart(String tag, FutureParserContext ctx) throws IOException, HttpErrorPage {
44 Tag tagObj = Tag.create(tag);
45 this.parent = ctx.getCurrent();
46 return parseTag(tagObj, ctx);
47 }
48
49 @Override
50 public boolean onError(Exception e, FutureParserContext ctx) {
51 return false;
52 }
53
54 @Override
55 public void characters(Future<CharSequence> csq) throws IOException {
56 this.parent.characters(csq);
57 }
58
59 @Override
60 public FutureElement getParent() {
61 return this.parent;
62 }
63
64 }