~ubuntu-branches/ubuntu/vivid/apgdiff/vivid

« back to all changes in this revision

Viewing changes to src/main/java/cz/startnet/utils/pgdiff/PgDiffArguments.java

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2010-10-02 19:35:17 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20101002193517-9wesve8sksxcktkc
Tags: 2.2-1
* New upstream version.
* Update homepage location.
* Finally enable test suite, yay!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * Copyright 2006 StartNet s.r.o.
 
3
 *
 
4
 * Distributed under MIT license
 
5
 */
1
6
package cz.startnet.utils.pgdiff;
2
7
 
3
8
import java.io.BufferedReader;
34
39
     */
35
40
    private boolean addDefaults;
36
41
    /**
37
 
     * Whether to enclose all commands in transaction.
 
42
     * Whether to enclose all statements in transaction.
38
43
     */
39
44
    private boolean addTransaction;
40
45
    /**
46
51
     */
47
52
    private boolean ignoreStartWith;
48
53
    /**
49
 
     * Whether to quote names when creating the diff SQL commands.
50
 
     */
51
 
    private boolean quoteNames;
52
 
    /**
53
54
     * Whether to display apgdiff version.
54
55
     */
55
56
    private boolean version;
 
57
    /**
 
58
     * Whether to output information about ignored statements.
 
59
     */
 
60
    private boolean outputIgnoredStatements;
56
61
 
57
62
    /**
58
63
     * Setter for {@link #addDefaults}.
164
169
    }
165
170
 
166
171
    /**
167
 
     * Setter for {@link #quoteNames}.
 
172
     * Getter for {@link #outputIgnoredStatements}.
168
173
     *
169
 
     * @param quoteNames {@link #quoteNames}
 
174
     * @return {@link #outputIgnoredStatements}
170
175
     */
171
 
    public void setQuoteNames(final boolean quoteNames) {
172
 
        this.quoteNames = quoteNames;
 
176
    public boolean isOutputIgnoredStatements() {
 
177
        return outputIgnoredStatements;
173
178
    }
174
179
 
175
180
    /**
176
 
     * Getter for {@link #quoteNames}.
 
181
     * Setter for {@link #outputIgnoredStatements}.
177
182
     *
178
 
     * @return {@link #quoteNames}
 
183
     * @param outputIgnoredStatements {@link #outputIgnoredStatements}
179
184
     */
180
 
    public boolean isQuoteNames() {
181
 
        return quoteNames;
 
185
    public void setOutputIgnoredStatements(
 
186
            final boolean outputIgnoredStatements) {
 
187
        this.outputIgnoredStatements = outputIgnoredStatements;
182
188
    }
183
189
 
184
190
    /**
233
239
            } else if ("--out-charset-name".equals(args[i])) {
234
240
                setOutCharsetName(args[i + 1]);
235
241
                i++;
236
 
            } else if ("--quote-names".equals(args[i])) {
237
 
                setQuoteNames(true);
 
242
            } else if ("--output-ignored-statements".equals(args[i])) {
 
243
                setOutputIgnoredStatements(true);
238
244
            } else if ("--version".equals(args[i])) {
239
245
                setVersion(true);
240
246
            } else {
263
269
     * Prints program usage.
264
270
     *
265
271
     * @param writer writer to print the usage to
266
 
     *
267
 
     * @throws RuntimeException Thrown if problem occured while reading usage
268
 
     *         info.
269
272
     */
270
273
    private void printUsage(final PrintWriter writer) {
271
 
        final BufferedReader reader =
272
 
                new BufferedReader(
273
 
                new InputStreamReader(
 
274
        final BufferedReader reader = new BufferedReader(new InputStreamReader(
274
275
                getClass().getResourceAsStream("usage.txt")));
275
276
 
276
277
        try {
282
283
            }
283
284
        } catch (final IOException ex) {
284
285
            throw new RuntimeException(
285
 
                    "Problem occured while reading usage file",
286
 
                    ex);
 
286
                    "Problem occured while reading usage file", ex);
287
287
        } finally {
288
288
            try {
289
289
                reader.close();
290
290
            } catch (final IOException ex) {
291
291
                throw new RuntimeException(
292
 
                        "Problem occured while closing reader",
293
 
                        ex);
 
292
                        "Problem occured while closing reader", ex);
294
293
            }
295
294
        }
296
295
    }
299
298
     * Prints program version.
300
299
     *
301
300
     * @param writer writer to print the usage to
302
 
     *
303
 
     * @throws RuntimeException Thrown if problem occured while reading program
304
 
     *         version.
305
301
     */
306
302
    private void printVersion(final PrintWriter writer) {
307
 
        final BufferedReader reader =
308
 
                new BufferedReader(
309
 
                new InputStreamReader(
 
303
        final BufferedReader reader = new BufferedReader(new InputStreamReader(
310
304
                getClass().getResourceAsStream("build_info")));
311
305
        writer.print("Version: ");
312
306
 
319
313
                reader.close();
320
314
            } catch (final IOException ex) {
321
315
                throw new RuntimeException(
322
 
                        "Problem occured while closing reader",
323
 
                        ex);
 
316
                        "Problem occured while closing reader", ex);
324
317
            }
325
318
        }
326
319
    }