My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package edu.sdsc.cleos;

/*!
* @author Lawrence J. Miller <ljmiller@sdsc.edu>
* @author Cyberinfrastructure Laboratory for Environmental Observing Systems (CLEOS)
* @author San Diego Supercomputer Center (SDSC)
* @since $LastChangedDate$
* $LastChangedRevision$
* @author $LastChangedBy$
* $HeadURL$
*/

/*! @class a classs that will add channels required by the RBNB KML plugin to a specified
* RBNB Source and channel name */

import com.rbnb.sapi.ChannelMap;
import com.rbnb.sapi.Source;
import java.util.HashMap;
import java.util.logging.Logger;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;

public class GPSCoordinateSource extends RBNBBase {

protected String DEFAULT_TARGET_RBNB_SOURCE_NAME = "coordinateTarget";
protected HashMap<String, String> coordinateValueHash;
public HashMap getCoordinateHash() {return this.coordinateValueHash;}
protected static String[] coordinateChannelNames =
{"Alt", "Lat", "Lon", "TrackID", "Type", "Classification", "Speed", "Heading"};
private static Logger logger = Logger.getLogger(GPSCoordinateSource.class.getName());

/*! constructor */
public GPSCoordinateSource() {
super();
coordinateValueHash = new HashMap();
}

public void putToHash(String hashKey, String hashValue) throws IllegalArgumentException {
// validate the key
for(int i=0; i<coordinateChannelNames.length; i++) {
if(hashKey.compareTo(coordinateChannelNames[i]) == 0) { // then the key is valid
break;
} else if(i==coordinateChannelNames.length - 1) { // then key is not valid (not in the list)
throw new IllegalArgumentException("Invalid coordinate key");
}
} // for

coordinateValueHash.put(hashKey, hashValue);

} // putToHash()

/** @note required by interface RBNBBase */
protected String getCVSVersionString() {
return getSVNVersionString();
}

/** @note svn keywords */
protected String getSVNVersionString() {
return (
"$LastChangedDate$\n" +
"$LastChangedRevision$\n" +
"$LastChangedBy$\n" +
"$HeadURL$"
);
}

/**
* @param args
*/
public static void main(String[] args) {
GPSCoordinateSource coordinateSource = new GPSCoordinateSource();
if (coordinateSource.parseArgs(args)) {
// do some stuff
} else System.exit(0);
} // main()

/** @note required by interface RBNBBase */
protected Options setOptions() {
Options opt = setBaseOptions(new Options()); // uses h, v, s, p

opt.addOption("t", true, " target RBNB source name *" + DEFAULT_TARGET_RBNB_SOURCE_NAME);
opt.addOption("c", true, " target channel name in source");

opt.addOption("a", true, " alt");
opt.addOption("l", true, " lat");
opt.addOption("L", true, " long");
opt.addOption("i", true, " track ID");
opt.addOption("T", true, " type");
opt.addOption("C", true, " classification");
opt.addOption("S", true, " speed");
opt.addOption("H", true, " heading");

return opt;
} // setOptions()

/** @note required by interface RBNBBase */
protected boolean setArgs(CommandLine cmd) {
if (!setBaseArgs(cmd)) return false;

if (cmd.hasOption('t')) { // target source name
String v = cmd.getOptionValue("t");
logger.info("t=" + v);
}
if (cmd.hasOption('c')) { // target channel name
String v = cmd.getOptionValue("c");
logger.info("c=" + v);
}
if (cmd.hasOption('a')) { // alt
String v = cmd.getOptionValue("a");
logger.info("a=" + v);
}
if (cmd.hasOption('l')) { // lat
String v = cmd.getOptionValue("l");
logger.info("l=" + v);
}
if (cmd.hasOption('L')) { // long
String v = cmd.getOptionValue("L");
logger.info("L=" + v);
}
if (cmd.hasOption('i')) { // track ID
String v = cmd.getOptionValue("i");
logger.info("i=" + v);
}
if (cmd.hasOption('T')) { // type
String v = cmd.getOptionValue("T");
logger.info("T=" + v);
}
if (cmd.hasOption('C')) { // classification
String v = cmd.getOptionValue("C");
logger.info("C=" + v);
}
if (cmd.hasOption('S')) { // speed
String v = cmd.getOptionValue("S");
logger.info("S=" + v);
}
if (cmd.hasOption('H')) { // heading
String v = cmd.getOptionValue("H");
logger.info("H=" + v);
}

return true;
} // setArgs()
} // class

Change log

r36 by ljmiller.ucsd on Apr 15, 2008   Diff
keywords
start osdt refactor - still won't build
Go to: 
Project members, sign in to write a code review

Older revisions

r1 by phubbard on Mar 10, 2008   Diff
Initial import of reorganized and
cleaned up codebase.

All revisions of this file

File info

Size: 4273 bytes, 143 lines

File properties

svn:keywords
LastChangedRevision LastChangedDate H...gedBy Id
Powered by Google Project Hosting