embulk-formatter-single_value 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/build.gradle +3 -3
- data/src/main/java/org/embulk/formatter/single_value/SingleValueFormatterPlugin.java +66 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3a9bc73a1f67dcc850a1564ca93a999eb383c2d
|
4
|
+
data.tar.gz: 10e86578e295468d0441f0baaad13997c1f9595c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 360559b2014d06a68429f0bbb7e0d1bb9de6f66422d8e2da912a9b85688bd092d8e331185251bd4ec5931995e5e57408b9c77e2a2c9a5bbb95e94d6609cfcd41
|
7
|
+
data.tar.gz: f4ee47a1acf642ebcd14102e028e4107dcdb45e869b2572307fe3e863f6c49b3ab76fd399a7ff81a40a2c99b09bd63949d53f752b8a8d82be0aaedc755b3c435
|
data/CHANGELOG.md
CHANGED
data/build.gradle
CHANGED
@@ -13,14 +13,14 @@ configurations {
|
|
13
13
|
provided
|
14
14
|
}
|
15
15
|
|
16
|
-
version = "0.3.
|
16
|
+
version = "0.3.1"
|
17
17
|
|
18
18
|
sourceCompatibility = 1.7
|
19
19
|
targetCompatibility = 1.7
|
20
20
|
|
21
21
|
dependencies {
|
22
|
-
compile "org.embulk:embulk-core:0.8
|
23
|
-
provided "org.embulk:embulk-core:0.8
|
22
|
+
compile "org.embulk:embulk-core:0.8.+"
|
23
|
+
provided "org.embulk:embulk-core:0.8.+"
|
24
24
|
// compile "YOUR_JAR_DEPENDENCY_GROUP:YOUR_JAR_DEPENDENCY_MODULE:YOUR_JAR_DEPENDENCY_VERSION"
|
25
25
|
testCompile "junit:junit:4.+"
|
26
26
|
}
|
@@ -23,6 +23,7 @@ import org.embulk.spi.time.TimestampFormatter;
|
|
23
23
|
import org.embulk.spi.util.LineEncoder;
|
24
24
|
|
25
25
|
import org.joda.time.DateTimeZone;
|
26
|
+
import org.jruby.embed.ScriptingContainer;
|
26
27
|
import org.msgpack.value.Value;
|
27
28
|
|
28
29
|
public class SingleValueFormatterPlugin
|
@@ -85,7 +86,7 @@ public class SingleValueFormatterPlugin
|
|
85
86
|
final Schema outputSchema = getOutputSchema(inputColumnIndex, inputSchema);
|
86
87
|
final DateTimeZone timezone = DateTimeZone.forID(task.getTimezone());
|
87
88
|
final TimestampFormatter timestampFormatter =
|
88
|
-
|
89
|
+
getTimestampFormatter(task.getTimestampFormat(), timezone);
|
89
90
|
|
90
91
|
// create a file
|
91
92
|
encoder.nextFile();
|
@@ -185,4 +186,68 @@ public class SingleValueFormatterPlugin
|
|
185
186
|
}
|
186
187
|
};
|
187
188
|
}
|
189
|
+
|
190
|
+
|
191
|
+
private class TimestampFormatterTaskImpl implements TimestampFormatter.Task
|
192
|
+
{
|
193
|
+
private final DateTimeZone defaultTimeZone;
|
194
|
+
private final String defaultTimestampFormat;
|
195
|
+
public TimestampFormatterTaskImpl(
|
196
|
+
DateTimeZone defaultTimeZone,
|
197
|
+
String defaultTimestampFormat)
|
198
|
+
{
|
199
|
+
this.defaultTimeZone = defaultTimeZone;
|
200
|
+
this.defaultTimestampFormat = defaultTimestampFormat;
|
201
|
+
}
|
202
|
+
@Override
|
203
|
+
public DateTimeZone getDefaultTimeZone()
|
204
|
+
{
|
205
|
+
return this.defaultTimeZone;
|
206
|
+
}
|
207
|
+
@Override
|
208
|
+
public String getDefaultTimestampFormat()
|
209
|
+
{
|
210
|
+
return this.defaultTimestampFormat;
|
211
|
+
}
|
212
|
+
@Override
|
213
|
+
public ScriptingContainer getJRuby()
|
214
|
+
{
|
215
|
+
return null;
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
private class TimestampFormatterColumnOptionImpl implements TimestampFormatter.TimestampColumnOption
|
220
|
+
{
|
221
|
+
private final Optional<DateTimeZone> timeZone;
|
222
|
+
private final Optional<String> format;
|
223
|
+
public TimestampFormatterColumnOptionImpl(
|
224
|
+
Optional<DateTimeZone> timeZone,
|
225
|
+
Optional<String> format)
|
226
|
+
{
|
227
|
+
this.timeZone = timeZone;
|
228
|
+
this.format = format;
|
229
|
+
}
|
230
|
+
@Override
|
231
|
+
public Optional<DateTimeZone> getTimeZone()
|
232
|
+
{
|
233
|
+
return this.timeZone;
|
234
|
+
}
|
235
|
+
@Override
|
236
|
+
public Optional<String> getFormat()
|
237
|
+
{
|
238
|
+
return this.format;
|
239
|
+
}
|
240
|
+
}
|
241
|
+
|
242
|
+
private TimestampFormatter getTimestampFormatter(String format, DateTimeZone timezone)
|
243
|
+
{
|
244
|
+
// ToDo: Use following codes after deciding to drop supporting embulk < 0.8.29.
|
245
|
+
//
|
246
|
+
// return new TimestampFormatter(format, timezone);
|
247
|
+
TimestampFormatterTaskImpl task = new TimestampFormatterTaskImpl(
|
248
|
+
timezone, format);
|
249
|
+
TimestampFormatterColumnOptionImpl columnOption = new TimestampFormatterColumnOptionImpl(
|
250
|
+
Optional.of(timezone), Optional.of(format));
|
251
|
+
return new TimestampFormatter(task, Optional.of(columnOption));
|
252
|
+
}
|
188
253
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-formatter-single_value
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -67,7 +67,7 @@ files:
|
|
67
67
|
- settings.gradle
|
68
68
|
- src/main/java/org/embulk/formatter/single_value/SingleValueFormatterPlugin.java
|
69
69
|
- src/test/java/org/embulk/formatter/single_value/TestSingleValueFormatterPlugin.java
|
70
|
-
- classpath/embulk-formatter-single_value-0.3.
|
70
|
+
- classpath/embulk-formatter-single_value-0.3.1.jar
|
71
71
|
homepage: https://github.com/sonots/embulk-formatter-single_value
|
72
72
|
licenses:
|
73
73
|
- MIT
|