Skip to content

Commit 53f1f8a

Browse files
llingllinggit
authored andcommitted
Change parameter inputName to SplitFilename. Also change getInputName() and setInputName() to getSplitFilename() and setSplitFilename(). #1237
1 parent 699655f commit 53f1f8a

File tree

14 files changed

+85
-85
lines changed

14 files changed

+85
-85
lines changed

marklogic-client-api/src/main/java/com/marklogic/client/datamovement/JSONSplitter.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static public JSONSplitter<StringHandle> makeArraySplitter() {
5858

5959
private JSONSplitter.Visitor<T> visitor;
6060
private ThreadLocal<Long> count = new ThreadLocal<>();
61-
private String inputName;
61+
private String splitFilename;
6262

6363
/**
6464
* Construct a JSONSplitter which splits the JSON file according to the visitor.
@@ -123,19 +123,19 @@ public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input) th
123123
* Takes an InputStream of a JSON file and file name and split it into a steam of DocumentWriteOperation
124124
* to write to database.
125125
* @param input is the incoming input stream of a JSON file
126-
* @param inputName is the name of input file, including name and extension. It is used to generate URLs for split
127-
* files.The inputName could either be provided here or in user-defined UriMaker.
126+
* @param splitFilename is the name of input file, including name and extension. It is used to generate URLs for split
127+
* files.The splitFilename could either be provided here or in user-defined UriMaker.
128128
* @return a stream of DocumentWriteOperation to write to database
129129
* @throws Exception if the input cannot be split
130130
*/
131131
@Override
132-
public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input, String inputName) throws Exception {
132+
public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input, String splitFilename) throws Exception {
133133
if (input == null) {
134134
throw new IllegalArgumentException("Input cannot be null");
135135
}
136136

137137
JsonParser jsonParser = new JsonFactory().createParser(input);
138-
return splitWriteOperations(jsonParser, inputName);
138+
return splitWriteOperations(jsonParser, splitFilename);
139139
}
140140

141141
/**
@@ -159,7 +159,7 @@ public Stream<T> split(JsonParser input) throws IOException {
159159
* to write to database.
160160
* @param input JsonParser created from the JSON file
161161
* @param splitFilename is the name of input file, including name and extension. It is used to generate URLs for split
162-
* files.The inputName could either be provided here or in user-defined UriMaker.
162+
* files.The splitFilename could either be provided here or in user-defined UriMaker.
163163
* @return a stream of DocumentWriteOperation to write to database
164164
*/
165165
public Stream<DocumentWriteOperation> splitWriteOperations(JsonParser input, String splitFilename) {
@@ -168,7 +168,7 @@ public Stream<DocumentWriteOperation> splitWriteOperations(JsonParser input, Str
168168
}
169169
count.set(0L);
170170

171-
this.inputName = splitFilename;
171+
this.splitFilename = splitFilename;
172172
JSONSplitter.DocumentWriteOperationSpliterator spliterator =
173173
new JSONSplitter.DocumentWriteOperationSpliterator<>(this, input);
174174
return StreamSupport.stream(spliterator, true);
@@ -502,12 +502,12 @@ public boolean tryAdvance(Consumer<? super DocumentWriteOperation> action) {
502502
JSONSplitter splitter = getSplitter();
503503
if (splitter.getUriMaker() == null) {
504504
JSONSplitter.UriMakerImpl uriMaker = new JSONSplitter.UriMakerImpl();
505-
uriMaker.setInputName(splitter.inputName);
505+
uriMaker.setSplitFilename(splitter.splitFilename);
506506
uriMaker.setExtension("json");
507507
splitter.setUriMaker(uriMaker);
508508
} else {
509-
if (splitter.inputName != null) {
510-
splitter.getUriMaker().setInputName(splitter.inputName);
509+
if (splitter.splitFilename != null) {
510+
splitter.getUriMaker().setSplitFilename(splitter.splitFilename);
511511
}
512512
}
513513

marklogic-client-api/src/main/java/com/marklogic/client/datamovement/JacksonCSVSplitter.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input) th
146146
* Takes the input stream and the input name, then converts the input into a stream of DocumentWriteOperation
147147
* by setting the schema and wrapping the JsonNode into DocumentWriteOperation.
148148
* @param input is the incoming input stream.
149-
* @param inputName the name of the input stream, including name and extension. It is used to generate URLs for
150-
* split files.The inputName could either be provided here or in user-defined UriMaker.
149+
* @param splitFilename the name of the input stream, including name and extension. It is used to generate URLs for
150+
* split files.The splitFilename could either be provided here or in user-defined UriMaker.
151151
* @return a stream of DocumentWriteOperation.
152152
* @throws Exception if the input cannot be split
153153
*/
154154
@Override
155-
public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input, String inputName) throws Exception {
155+
public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input, String splitFilename) throws Exception {
156156
if (input == null) {
157157
throw new IllegalArgumentException("Input cannot be null");
158158
}
@@ -162,8 +162,8 @@ public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input, St
162162
setUriMaker(uriMaker);
163163
}
164164

165-
if (inputName != null) {
166-
getUriMaker().setInputName(inputName);
165+
if (splitFilename != null) {
166+
getUriMaker().setSplitFilename(splitFilename);
167167
}
168168

169169
Iterator<JsonNode> nodeItr = configureObjReader().readValues(input);
@@ -186,7 +186,7 @@ public Stream<DocumentWriteOperation> splitWriteOperations(Reader input) throws
186186
* by setting the schema and wrapping the JsonNode into DocumentWriteOperation.
187187
* @param input is the incoming input Reader.
188188
* @param splitFilename the name of the input Reader, including name and extension. It is used to generate URLs for
189-
* split files.The inputName could either be provided here or in user-defined UriMaker.
189+
* split files.The splitFilename could either be provided here or in user-defined UriMaker.
190190
* @return a stream of DocumentWriteOperation.
191191
* @throws Exception if the input cannot be split
192192
*/
@@ -201,7 +201,7 @@ public Stream<DocumentWriteOperation> splitWriteOperations(Reader input, String
201201
}
202202

203203
if (splitFilename != null) {
204-
getUriMaker().setInputName(splitFilename);
204+
getUriMaker().setSplitFilename(splitFilename);
205205
}
206206

207207
//for case file.csv, to generate uris with extension "json"
@@ -334,7 +334,7 @@ public String makeUri(long num, JacksonHandle handle) {
334334
uri.append(getInputAfter());
335335
}
336336

337-
if (getInputName() != null && getInputName().length() != 0) {
337+
if (getSplitFilename() != null && getSplitFilename().length() != 0) {
338338
uri.append(getName());
339339
}
340340

marklogic-client-api/src/main/java/com/marklogic/client/datamovement/LineSplitter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input) th
9595
* Provide GZIPInputStream to the splitter when splitting gzip files.
9696
* @param input is the incoming input stream.
9797
* @param splitFilename is the name of the input file, including name and extension. It is used to generate URLs for
98-
* split files. The inputName could either be provided here or in user-defined UriMaker.
98+
* split files. The splitFilename could either be provided here or in user-defined UriMaker.
9999
* @return a stream of DocumentWriteOperation.
100100
* @throws Exception if the input cannot be split
101101
*/
@@ -109,12 +109,12 @@ public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input, St
109109
String extension = getFormat().getDefaultExtension();
110110
if (getUriMaker() == null) {
111111
LineSplitter.UriMakerImpl uriMaker = new LineSplitter.UriMakerImpl();
112-
uriMaker.setInputName(splitFilename);
112+
uriMaker.setSplitFilename(splitFilename);
113113
uriMaker.setExtension(extension);
114114
setUriMaker(uriMaker);
115115
} else {
116116
if (splitFilename != null) {
117-
getUriMaker().setInputName(splitFilename);
117+
getUriMaker().setSplitFilename(splitFilename);
118118
}
119119
if (getUriMaker() instanceof LineSplitter.UriMakerImpl) {
120120
((LineSplitter.UriMakerImpl)getUriMaker()).setExtension(extension);

marklogic-client-api/src/main/java/com/marklogic/client/datamovement/Splitter.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ interface UriMaker {
6969
void setInputAfter(String base);
7070

7171
/**
72-
* Get inputName of the UriMaker, which should include name and extension.
73-
* @return inputName of the UriMaker
72+
* Get splitFilename of the UriMaker, which should include name and extension.
73+
* @return splitFilename of the UriMaker
7474
*/
75-
String getInputName();
75+
String getSplitFilename();
7676

7777
/**
78-
* Set inputName to the UriMaker
79-
* @param name inputName of UriMaker, which should include both name and extension.
78+
* Set splitFilename to the UriMaker
79+
* @param name splitFilename of UriMaker, which should include both name and extension.
8080
*/
81-
void setInputName(String name);
81+
void setSplitFilename(String name);
8282
}
8383

8484
/**

marklogic-client-api/src/main/java/com/marklogic/client/datamovement/UnarySplitter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input) th
8282
* Takes a input stream and the name of a file, then convert the entire file to a stream of DocumentWriteOperation
8383
* @param input is the incoming input stream.
8484
* @param splitFilename is the file name, including name and extension. It is used to generate URLs for split files.
85-
* The inputName could either be provided here or in user-defined UriMaker.
85+
* The splitFilename could either be provided here or in user-defined UriMaker.
8686
* @return a stream of DocumentWriteOperation
8787
* @throws Exception if input cannot be split
8888
*/
@@ -99,7 +99,7 @@ public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input, St
9999
}
100100

101101
if (splitFilename != null) {
102-
uriMaker.setInputName(splitFilename);
102+
uriMaker.setSplitFilename(splitFilename);
103103
}
104104

105105
String uri = uriMaker.makeUri(handle);
@@ -146,7 +146,7 @@ public String makeUri(InputStreamHandle handle) {
146146
uri.append(getInputAfter());
147147
}
148148

149-
if (getInputName() != null && getInputName().length() != 0) {
149+
if (getSplitFilename() != null && getSplitFilename().length() != 0) {
150150
uri.append(getName());
151151
}
152152

marklogic-client-api/src/main/java/com/marklogic/client/datamovement/XMLSplitter.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static public XMLSplitter<StringHandle> makeSplitter(String nsUri, String localN
6464

6565
private XMLSplitter.Visitor<T> visitor;
6666
private ThreadLocal<Long> count = new ThreadLocal<>();
67-
private String inputName;
67+
private String splitFilename;
6868

6969
/**
7070
* Construct an XMLSplitter which split the XML file according to the visitor.
@@ -124,19 +124,19 @@ public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input) th
124124
/**
125125
* Takes an input stream of an XML file and input file name, split it into a steam of DocumentWriteOperation.
126126
* @param input is the incoming input stream.
127-
* @param inputName is the name of input file, including name and extension. It is used to generate URLs for split
128-
* files.The inputName could either be provided here or in user-defined UriMaker.
127+
* @param splitFilename is the name of input file, including name and extension. It is used to generate URLs for split
128+
* files.The splitFilename could either be provided here or in user-defined UriMaker.
129129
* @return a stream of DocumentWriteOperation to write to database
130130
* @throws Exception if the input cannot be split
131131
*/
132132
@Override
133-
public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input, String inputName) throws Exception {
133+
public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input, String splitFilename) throws Exception {
134134
if (input == null) {
135135
throw new IllegalArgumentException("Input cannot be null");
136136
}
137137

138138
XMLStreamReader reader = XMLInputFactory.newFactory().createXMLStreamReader(input);
139-
return splitWriteOperations(reader, inputName);
139+
return splitWriteOperations(reader, splitFilename);
140140
}
141141

142142
@Override
@@ -167,7 +167,7 @@ public Stream<T> split(XMLStreamReader input) throws IOException {
167167
* to write to database.
168168
* @param input an XMLStreamReader of the XML file
169169
* @param splitFilename is the name of the input file, including name and extension. It is used to generate URLs for
170-
* split files.The inputName could either be provided here or in user-defined UriMaker.
170+
* split files.The splitFilename could either be provided here or in user-defined UriMaker.
171171
* @return a stream of DocumentWriteOperation to write to database
172172
*/
173173
public Stream<DocumentWriteOperation> splitWriteOperations(XMLStreamReader input, String splitFilename) {
@@ -177,7 +177,7 @@ public Stream<DocumentWriteOperation> splitWriteOperations(XMLStreamReader input
177177
}
178178
count.set(0L);
179179

180-
this.inputName = splitFilename;
180+
this.splitFilename = splitFilename;
181181
XMLSplitter.DocumentWriteOperationSpliterator<T> documentWriteOperationSpliterator =
182182
new XMLSplitter.DocumentWriteOperationSpliterator<>(this, input);
183183

@@ -501,12 +501,12 @@ public boolean tryAdvance(Consumer<? super DocumentWriteOperation> action) {
501501
XMLSplitter splitter = getSplitter();
502502
if (splitter.getUriMaker() == null) {
503503
XMLSplitter.UriMakerImpl uriMaker = new XMLSplitter.UriMakerImpl();
504-
uriMaker.setInputName(splitter.inputName);
504+
uriMaker.setSplitFilename(splitter.splitFilename);
505505
uriMaker.setExtension("xml");
506506
splitter.setUriMaker(uriMaker);
507507
} else {
508-
if (splitter.inputName != null) {
509-
splitter.getUriMaker().setInputName(splitter.inputName);
508+
if (splitter.splitFilename != null) {
509+
splitter.getUriMaker().setSplitFilename(splitter.splitFilename);
510510
}
511511
}
512512

marklogic-client-api/src/main/java/com/marklogic/client/datamovement/ZipSplitter.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class ZipSplitter implements Splitter<BytesHandle> {
4343
private Map<String, Format> extensionFormats;
4444
private Predicate<ZipEntry> entryFilter;
4545
private Function<String, String> uriTransformer;
46-
private String inputName;
46+
private String splitFilename;
4747
private static ThreadLocal<Long> count = new ThreadLocal<>();
4848
private static Pattern extensionRegex = Pattern.compile("^(.+)\\.([^.]+)$");
4949

@@ -171,13 +171,13 @@ public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input) th
171171
* The input stream must be a ZipInputStream, otherwise it will throw an exception.
172172
* The ZIP file could contain XML, JSON, TXT and BINARY files.
173173
* @param input is the incoming input stream.
174-
* @param inputName is the input file name, including name and extension. It is used to generate URLs for split
175-
* files.The inputName could either be provided here or in user-defined UriMaker.
174+
* @param splitFilename is the input file name, including name and extension. It is used to generate URLs for split
175+
* files.The splitFilename could either be provided here or in user-defined UriMaker.
176176
* @return a stream of DocumentWriteOperation
177177
* @throws Exception if the input cannot be split
178178
*/
179179
@Override
180-
public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input, String inputName) throws Exception {
180+
public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input, String splitFilename) throws Exception {
181181
if (input == null) {
182182
throw new IllegalArgumentException("Input cannot be null");
183183
}
@@ -186,7 +186,7 @@ public Stream<DocumentWriteOperation> splitWriteOperations(InputStream input, St
186186
throw new IllegalArgumentException("Input should be an instance of ZipInputStream");
187187
}
188188

189-
return splitWriteOperations((ZipInputStream) input, inputName);
189+
return splitWriteOperations((ZipInputStream) input, splitFilename);
190190
}
191191

192192

@@ -206,7 +206,7 @@ public Stream<DocumentWriteOperation> splitWriteOperations(ZipInputStream input)
206206
* The ZIP file could contain XML, JSON, TXT and BINARY files.
207207
* @param input is a ZipInputStream of a zip file
208208
* @param splitFilename is the file name of input file, including name and extension. It is used to generate URLs for
209-
* split files.The inputName could either be provided here or in user-defined UriMaker.
209+
* split files.The splitFilename could either be provided here or in user-defined UriMaker.
210210
* @return a stream of DocumentWriteOperation
211211
* @throws IOException if input cannot be split
212212
*/
@@ -221,7 +221,7 @@ public Stream<DocumentWriteOperation> splitWriteOperations(ZipInputStream input,
221221
documentWriteOperationSpliterator.setZipStream(input);
222222
documentWriteOperationSpliterator.setEntryFilter(this.entryFilter);
223223
documentWriteOperationSpliterator.setExtensionFormats(this.extensionFormats);
224-
this.inputName = splitFilename;
224+
this.splitFilename = splitFilename;
225225

226226
return StreamSupport.stream(documentWriteOperationSpliterator, true);
227227
}
@@ -401,13 +401,13 @@ public boolean tryAdvance(Consumer<? super DocumentWriteOperation> action) {
401401

402402
if (splitter.getUriTransformer() == null && splitter.getUriMaker() == null) {
403403
ZipSplitter.UriMakerImpl uriMaker = new ZipSplitter.UriMakerImpl();
404-
uriMaker.setInputName(splitter.inputName);
404+
uriMaker.setSplitFilename(splitter.splitFilename);
405405
splitter.setUriMaker(uriMaker);
406406
}
407407

408408
if (splitter.getUriMaker() != null) {
409-
if (splitter.inputName != null) {
410-
splitter.getUriMaker().setInputName(splitter.inputName);
409+
if (splitter.splitFilename != null) {
410+
splitter.getUriMaker().setSplitFilename(splitter.splitFilename);
411411
}
412412
uri = splitter.getUriMaker().makeUri(splitter.count.get(), name, nextBytesHandle);
413413
} else {
@@ -482,7 +482,7 @@ public String makeUri(long num, String entryName, BytesHandle handle) {
482482
uri.append(getInputAfter());
483483
}
484484

485-
if (getInputName() != null && getInputName().length() != 0) {
485+
if (getSplitFilename() != null && getSplitFilename().length() != 0) {
486486
uri.append(getName());
487487
}
488488

0 commit comments

Comments
 (0)