forked from adallolio/neptus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
overview-and-developers-guide.html
291 lines (272 loc) · 13 KB
/
overview-and-developers-guide.html
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Neptus Overview and Developers Guide</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<style type="text/css">
pre.fragment {
border: 1px solid #C4CFE5;
background-color: #FBFCFD;
padding: 4px 6px;
margin: 4px 8px 4px 2px;
overflow: auto;
word-wrap: break-word;
font-size: 9pt;
line-height: 125%;
}
body {
font-family: Tahoma,Arial,Helvetica,sans-serif;
background-color: black;
background-attachment: fixed;
background-repeat: repeat-x;
background-image: -webkit-gradient(linear, left top, left 150, color-stop(0, #2bb6e3), color-stop(1, #000000));
background-image: -webkit-linear-gradient(top, #2bb6e3, #000000 150px);
background-image: -moz-linear-gradient(top, #2bb6e3 0%, #000000 150px);
background-image: -o-linear-gradient(top, #2bb6e3, #000000 150px);
background-image: -ms-linear-gradient(top, #2bb6e3, #000000 150px);
background-image: linear-gradient(top, #2bb6e3 0%, #000000 150px);
}
div.document {
margin: 0 auto;
padding: 1px 5px;
color: #303030;
max-width: 1100px;
min-width: 950px;
background-color: white;
text-align: left;
}
a {
color: #2bb6e3;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #2bb6e3;
}
h3,
h4,
h5,
h6 {
border-bottom: none;
}
.htmladdlogo:before {
content: url('neptus_logo_font_500x193.png');
display: block;
}
.htmlhide {
display: none !important;
}
.htmladdcopy:after {
content: '© 2004-2016 Universidade do Porto - Faculdade de Engenharia';
display: block;
}
</style>
<body>
<div class="document">
<p class="htmladdlogo"></p>
<p class="htmlhide"><a href="#overview">Overview</a></p>
<p class="htmlhide"><a href="#dev-guide">Developers Guide</a></p>
<p class="htmlhide">View the unit tests <a href="../junit/html/index.html" target="_top">here</a>.</p>
<h1 id="overview">Overview</h1>
<p>
This software is provided using a dual license. One commercial and for that contact
[email protected], and another using "European Union Public Licence - EUPL v.1.1 Usage"
(see <a href="https://www.lsts.pt/neptus/licence">here</a> to check the license or
check the included LICENSE.md file).
</p>
<p>
For more information check <a href="http://www.lsts.pt/neptus/">Neptus web site</a>.
</p>
<h1 id="dev-guide">Developers Guide</h1>
<h2>Source Code Management</h2>
<p>Neptus is hosted using Git. You should learn to use the Git client (or any other available front-end),
studying the advantages and limitations of the system before compromising any part of the repository. A
good Git guide is available at <a href="http://git-scm.com/">http://git-scm.com/</a> or
<a href="https://help.github.com/">https://help.github.com/</a>.</p>
<p>
Neptus' Git repository is accessible at <a href="https://github.com/LSTS/neptus">https://github.com/LSTS/neptus/</a>.
</p>
<p>Take the following point into consideration:</p>
<div>
<ul>
<li>Commit only the files that you have changed. Resist the temptation of committing an entire directory, hoping for the best to happen;</li>
<li>Commit changes with caution and conscience. Furthermore do not make any commits that you know will render the project in an uncompilable state;</li>
<li>Never keep files checked out for long periods;</li>
<li>Document every commit meaningfully;</li>
<li>Always update your working copy before starting work.</li>
<li>Don't just test it inside Eclipse, compile it using ant and test it.</li>
</ul>
</div>
<h2><a class="anchor" id="JavaCode"></a>Java Code</h2>
<p>
The language of choice for writing code and documentation is English and you should not use other languages.
The prefer encoding to use is UTF-8.
</p>
<p>
Do not use "underhanded names" (ones that begin with an underscore). Also the use of underscore is must only be used for constants.
</p>
<p>
Class and enum names should be nouns, in mixed case with the first letter of each internal word capitalized
(in case of enums they should end with the word "Enum", e.g., "StatusEnum").
Try to keep your class names simple and descriptive. Use whole words. Avoid acronyms and abbreviations, unless the abbreviation is much more widely used than the long form, such as UDP or TCP. (e.g. UDPSocket or UdpSocket).
</p>
<p>
Methods names should be verbs, in mixed case with the first letter lowercase and the first letter of each internal word capitalized. (e.g. dumpRegisters).
</p>
<p>
Variable names should be short yet meaningful, in mixed case with the first letter lowercase and the first letter of each internal word capitalized. In the case of constants All characters should be uppercase with underscores separating words (e.g. ICON_START). The choice of a variable name should be mnemonic, that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary "throwaway" variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters.
</p>
<p>
Each source file must start with the following preamble (by using Eclipse this will be added for you).
The blank line after the comment box should be the package declaration.
</p>
<div class="fragment"><pre class="fragment">
<span class="comment">/*</span>
<span class="comment"> * Copyright (c) 2004-2016 Universidade do Porto - Faculdade de Engenharia</span>
<span class="comment"> * Laboratório de Sistemas e Tecnologia Subaquática (LSTS)</span>
<span class="comment"> * All rights reserved.</span>
<span class="comment"> * Rua Dr. Roberto Frias s/n, sala I203, 4200-465 Porto, Portugal</span>
<span class="comment"> *</span>
<span class="comment"> * This file is part of Neptus, Command and Control Framework.</span>
<span class="comment"> *</span>
<span class="comment"> * Commercial Licence Usage</span>
<span class="comment"> * Licencees holding valid commercial Neptus licences may use this file</span>
<span class="comment"> * in accordance with the commercial licence agreement provided with the</span>
<span class="comment"> * Software or, alternatively, in accordance with the terms contained in a</span>
<span class="comment"> * written agreement between you and Universidade do Porto. For licensing</span>
<span class="comment"> * terms, conditions, and further information contact [email protected].</span>
<span class="comment"> *</span>
<span class="comment"> * European Union Public Licence - EUPL v.1.1 Usage</span>
<span class="comment"> * Alternatively, this file may be used under the terms of the EUPL,</span>
<span class="comment"> * Version 1.1 only (the "Licence"), appearing in the file LICENCE.md</span>
<span class="comment"> * included in the packaging of this file. You may not use this work</span>
<span class="comment"> * except in compliance with the Licence. Unless required by applicable</span>
<span class="comment"> * law or agreed to in writing, software distributed under the Licence is</span>
<span class="comment"> * distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF</span>
<span class="comment"> * ANY KIND, either express or implied. See the Licence for the specific</span>
<span class="comment"> * language governing permissions and limitations at</span>
<span class="comment"> * https://www.lsts.pt/neptus/licence.</span>
<span class="comment"> *</span>
<span class="comment"> * For more information please see <http://www.lsts.pt/neptus>.</span>
<span class="comment"> * </span>
<span class="comment"> * Author: Paulo Dias</span>
<span class="comment"> * 2010/05/19</span>
<span class="comment"> */</span>
<span class="comment">package pt.lsts.neptus.util;</span>
<span class="comment"></span>
</pre></div>
<p>
You must document the class with author tag and with one author per line and an optional sentence describing his/her work in the file
</p>
<p>
In terms of methods order, the constructors must be the first ones, and a <code>main</code> if existence must be the last method.
</p>
<p>
The declaration of variables must be on top just before the constructors. If you have <code>final</code> variables (constants) these
should be put on top of the other ones, and if they are <code>static</code> they should precede the others.
</p>
<p>
It is encourage if you use images for icons, to declare them as <code>static final</code>.
</p>
<h3><a class="anchor" id="JavaCodeFormat"></a>Formatting Source Code</h3>
<p>
Eclipse project has the Neptus Code Style and you can format your code by <code>Ctrl+Shift+F</code> on your class code.
</p>
<p>
You must use Neptus Code Style which is based on the Java Conventions for code formating with the following
exceptions/enforcements.
</p>
<p>
Indentation should be spaces only with a tab size of 4 spaces.
</p>
<p>Single line if statement (use it only if the next statement is onle line lenght): </p>
<div class="fragment"><pre class="fragment">
<span class="keywordflow">if</span> (<span class="keywordflow">if</span>-condition)
<span class="keywordflow">if</span>-line;
<span class="keywordflow">else</span> <span class="keywordflow">if</span> (<span class="keywordflow">else</span>-<span class="keywordflow">if</span>-condition)
<span class="keywordflow">else</span>-<span class="keywordflow">if</span>-line;
<span class="keywordflow">else</span>
<span class="keywordflow">else</span>-line;
</pre></div>
<p>Multiline if statement: </p>
<div class="fragment"><pre class="fragment"> <span class="keywordflow">if</span> (condition) {
<span class="keywordflow">if</span>-block;
}
<span class="keywordflow">else</span> {
<span class="keywordflow">else</span>-block;
}
</pre></div>
<p>Single line while statement (use it only if the next statement is onle line lenght): </p>
<div class="fragment"><pre class="fragment"> <span class="keywordflow">while</span> (condition)
<span class="keywordflow">while</span>-line;
</pre></div>
<p>Multiline while statement: </p>
<div class="fragment"><pre class="fragment"> <span class="keywordflow">while</span> (condition) {
<span class="keywordflow">while</span>-block;
}
</pre></div>
<p>Single line for statement (use it only if the next statement is onle line lenght): </p>
<div class="fragment"><pre class="fragment"> <span class="keywordflow">for</span> (initialization; stop-condition; increment)
<span class="keywordflow">for</span>-line;
</pre></div>
<p>Multiline for statement: </p>
<div class="fragment"><pre class="fragment"> <span class="keywordflow">for</span> (initialization; stop-condition; increment) {
<span class="keywordflow">for</span>-block;
}
</pre></div>
<p>Single and multiline line do while statement: </p>
<div class="fragment"><pre class="fragment"> <span class="keywordflow">do</span> {
<span class="keywordflow">do</span>-<span class="keywordflow">while</span>-line;
} <span class="keywordflow">while</span> (condition);
</pre></div>
<p>Try/catch statement: </p>
<div class="fragment"><pre class="fragment"> <span class="keywordflow">try</span> {
<span class="keywordflow">try</span>-block;
}
<span class="keywordflow">catch</span> (variable) {
<span class="keywordflow">catch</span>-block;
}
<span class="keywordflow">finally</span> {
<span class="keywordflow">finally</span>-block;
}
</pre></div>
<p>Switch statement: </p>
<div class="fragment"><pre class="fragment"> <span class="keywordflow">switch</span> (variable) {
<span class="keywordflow">case</span> A:
a-statement;
<span class="keywordflow">break</span>;
<span class="keywordflow">case</span> B:
b-statement;
<span class="keywordflow">break</span>;
<span class="keywordflow">default</span>:
<span class="keywordflow">default</span>-statement;
<span class="keywordflow">break</span>;
}
</pre></div>
<h2><a class="anchor" id="BuildInstructions"></a>
Build Instructions</h2>
<p>Required Software:</p>
<ul>
<li>Oracle Java JDK 1.8</li>
<li><a href="http://ant.apache.org">Apache Ant version 1.8+</a></li>
<li>Eclipse Java Development Environment</li>
</ul>
<p>Optional Software:</p>
<ul>
<li>xgettext - used to re-generate I18n translation files. </li>
<li>NSIS - used to generate Windows installers. </li>
</ul>
<h3><a class="anchor" id="Instructions"></a>Instructions</h3>
<p>Neptus uses Apache Ant as its building system.</p>
<p>Check the targets for ant:</p>
<div class="fragment"><pre class="fragment"><span class="keywordflow">ant -p</span></pre></div>
<p>Default command to use to prepare the necessary files to run Neptus:</p>
<div class="fragment"><pre class="fragment"><span class="keywordflow">ant</span></pre></div>
<p class="htmladdcopy"></p>
</div>
</body>
</html>