]>
git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.support.gis/src/main/java/org/argeo/slc/gpsbabel/GpsBabelCall.java
1 package org
.argeo
.slc
.gpsbabel
;
3 import java
.util
.ArrayList
;
6 import org
.argeo
.slc
.SlcException
;
7 import org
.argeo
.slc
.core
.execution
.tasks
.SystemCall
;
8 import org
.springframework
.beans
.factory
.InitializingBean
;
10 public class GpsBabelCall
extends SystemCall
implements InitializingBean
{
11 private String executable
= "/usr/bin/gpsbabel";
12 private String inputFormat
;
13 private String inputFile
;
14 private String outputFormat
;
15 private String outputFile
;
17 public GpsBabelCall() {
21 public GpsBabelCall(String inputFormat
, String inputFile
,
22 String outputFormat
, String outputFile
) {
24 this.inputFormat
= inputFormat
;
25 this.inputFile
= inputFile
;
26 this.outputFormat
= outputFormat
;
27 this.outputFile
= outputFile
;
30 } catch (Exception e
) {
31 throw new SlcException("Cannot configure gpsbabel call", e
);
35 public void afterPropertiesSet() throws Exception
{
36 List
<Object
> command
= new ArrayList
<Object
>();
37 command
.add(executable
);
39 command
.add(inputFormat
);
41 command
.add(inputFile
);
43 command
.add(outputFormat
);
45 command
.add(outputFile
);
48 setStdOutLogLevel(LOG_STDOUT
);
51 public final static void main(String
[] args
) {
52 String output
= new GpsBabelCall("garmin,get_posn", "usb:", "csv", "-")
54 System
.out
.println("output='" + output
+ "'");