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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 005d2a08bb09c491286ff70df7be2131d534ece7
4
- data.tar.gz: dde860334b09dfb5ef56c2c6a968806159eb61e3
3
+ metadata.gz: e3a9bc73a1f67dcc850a1564ca93a999eb383c2d
4
+ data.tar.gz: 10e86578e295468d0441f0baaad13997c1f9595c
5
5
  SHA512:
6
- metadata.gz: 672273adc0a488d82fa9680a87406a3a3c32d721a7c66a5c983e801fbb6c31f76a44122fcab5c031a22de5bc4d9597dfc885f62a170e0aa9128fc4e5b02d2c20
7
- data.tar.gz: 0981bb0bd9ba73e382204a7afb2c221f7859c098d4ffd7acbca2041b87919fd68acaebdc537e7f7891a64371c027b8f861934e8859dda44ec66771de0cd49f0d
6
+ metadata.gz: 360559b2014d06a68429f0bbb7e0d1bb9de6f66422d8e2da912a9b85688bd092d8e331185251bd4ec5931995e5e57408b9c77e2a2c9a5bbb95e94d6609cfcd41
7
+ data.tar.gz: f4ee47a1acf642ebcd14102e028e4107dcdb45e869b2572307fe3e863f6c49b3ab76fd399a7ff81a40a2c99b09bd63949d53f752b8a8d82be0aaedc755b3c435
@@ -1,3 +1,9 @@
1
+ # 0.3.1 (2017-08-26)
2
+
3
+ Enhancements:
4
+
5
+ * Use old, but non-deprecated TimestampFormatter API to support embulk < 0.8.29
6
+
1
7
  # 0.3.0 (2017-08-23)
2
8
 
3
9
  Changes:
@@ -13,14 +13,14 @@ configurations {
13
13
  provided
14
14
  }
15
15
 
16
- version = "0.3.0"
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.29+"
23
- provided "org.embulk:embulk-core:0.8.29+"
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
- new TimestampFormatter(task.getTimestampFormat(), timezone);
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.0
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-23 00:00:00.000000000 Z
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.0.jar
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