01: /*
02: * $Id: CreateCommand.java 674 2006-10-06 12:15:59Z hengels $
03: * (c) Copyright 2004 con:cern development team.
04: *
05: * This file is part of con:cern (http://concern.sf.net).
06: *
07: * con:cern is free software; you can redistribute it and/or modify
08: * it under the terms of the GNU Lesser General Public License
09: * as published by the Free Software Foundation; either version 2.1
10: * of the License, or (at your option) any later version.
11: *
12: * Please see COPYING for the complete licence.
13: */
14: package org.concern.client.commandline;
15:
16: /**
17: * <b>Example</b>: create a project with the id 99<br>
18: * <pre>
19: * concern.sh Project create 99
20: * </pre>
21: *
22: * @author hengels
23: */
24: public class CreateCommand extends Command {
25: private String[] subjects;
26:
27: public CreateCommand() {
28: usage = "SUBJECT...\n Create a new subject.";
29: }
30:
31: public String[] getSubjects() {
32: return subjects;
33: }
34:
35: public void setSubjects(String[] subjects) {
36: this .subjects = subjects;
37: }
38:
39: public void setArguments(String[] args) {
40: subjects = new String[args.length];
41: for (int i = 0; i < args.length; i++) {
42: String subject = args[i];
43: subjects[i] = subject;
44: }
45: }
46:
47: public void run() {
48: for (int i = 0; i < subjects.length; i++) {
49: String subject = subjects[i];
50: try {
51: controller.createSubject(subject);
52: System.out.println("create " + subject + ": OK");
53: } catch (Exception e) {
54: System.out.println("create " + subject + ": ERROR");
55: e.printStackTrace();
56: }
57: }
58: }
59: }
|