1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.jgit.internal.storage.dfs;
12
13 import java.io.File;
14 import java.io.IOException;
15
16 import org.eclipse.jgit.internal.JGitText;
17 import org.eclipse.jgit.lib.BaseRepositoryBuilder;
18
19
20
21
22
23
24
25
26
27 public abstract class DfsRepositoryBuilder<B extends DfsRepositoryBuilder, R extends DfsRepository>
28 extends BaseRepositoryBuilder<B, R> {
29 private DfsReaderOptions readerOptions;
30
31 private DfsRepositoryDescription repoDesc;
32
33
34
35
36
37
38 public DfsReaderOptions getReaderOptions() {
39 return readerOptions;
40 }
41
42
43
44
45
46
47
48
49 public B setReaderOptions(DfsReaderOptions opt) {
50 readerOptions = opt;
51 return self();
52 }
53
54
55
56
57
58
59 public DfsRepositoryDescription getRepositoryDescription() {
60 return repoDesc;
61 }
62
63
64
65
66
67
68
69
70 public B setRepositoryDescription(DfsRepositoryDescription desc) {
71 repoDesc = desc;
72 return self();
73 }
74
75
76 @Override
77 public B setup() throws IllegalArgumentException, IOException {
78 super.setup();
79 if (getReaderOptions() == null)
80 setReaderOptions(new DfsReaderOptions());
81 if (getRepositoryDescription() == null)
82 setRepositoryDescription(new DfsRepositoryDescription());
83 return self();
84 }
85
86
87
88
89
90
91
92
93
94
95 @Override
96 public abstract R build() throws IOException;
97
98
99
100
101 @Override
102 public B setGitDir(File gitDir) {
103 if (gitDir != null)
104 throw new IllegalArgumentException();
105 return self();
106 }
107
108
109 @Override
110 public B setObjectDirectory(File objectDirectory) {
111 if (objectDirectory != null)
112 throw new IllegalArgumentException();
113 return self();
114 }
115
116
117 @Override
118 public B addAlternateObjectDirectory(File other) {
119 throw new UnsupportedOperationException(
120 JGitText.get().unsupportedAlternates);
121 }
122
123
124 @Override
125 public B setWorkTree(File workTree) {
126 if (workTree != null)
127 throw new IllegalArgumentException();
128 return self();
129 }
130
131
132 @Override
133 public B setIndexFile(File indexFile) {
134 if (indexFile != null)
135 throw new IllegalArgumentException();
136 return self();
137 }
138 }