1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.tools;
21
22
23 import java.io.File;
24
25 import org.apache.commons.cli.CommandLine;
26 import org.apache.commons.cli.Options;
27 import org.apache.directory.daemon.InstallationLayout;
28 import org.apache.directory.server.configuration.ApacheDS;
29
30
31
32
33
34
35
36
37 public abstract class ToolCommand
38 {
39 private final String name;
40 private boolean debugEnabled = false;
41 private boolean verboseEnabled = false;
42 private boolean quietEnabled = false;
43 private String version;
44 private InstallationLayout layout;
45 private ApacheDS apacheDS;
46
47
48 protected ToolCommand( String name )
49 {
50 this.name = name;
51 }
52
53
54 public abstract void execute( CommandLine cmd ) throws Exception;
55
56
57 public abstract Options getOptions();
58
59
60 public String getName()
61 {
62 return this.name;
63 }
64
65
66 public void setLayout( File installationDirectory )
67 {
68 this.layout = new InstallationLayout( installationDirectory );
69 }
70
71
72 public void setLayout( String installationPath )
73 {
74 this.layout = new InstallationLayout( installationPath );
75 }
76
77
78 public void setLayout( InstallationLayout layout )
79 {
80 this.layout = layout;
81 }
82
83
84 public InstallationLayout getLayout()
85 {
86 return layout;
87 }
88
89
90 public void setApacheDS( ApacheDS apacheDS )
91 {
92 this.apacheDS = apacheDS;
93 }
94
95
96 public ApacheDS getApacheDS()
97 {
98 return apacheDS;
99 }
100
101
102 public void setVersion( String version )
103 {
104 this.version = version;
105 }
106
107
108 public String getVersion()
109 {
110 return version;
111 }
112
113
114 public String toString()
115 {
116 return getName();
117 }
118
119
120 public void setDebugEnabled( boolean debugEnabled )
121 {
122 this.debugEnabled = debugEnabled;
123 }
124
125
126 public boolean isDebugEnabled()
127 {
128 return debugEnabled;
129 }
130
131
132 public void setVerboseEnabled( boolean verboseEnabled )
133 {
134 this.verboseEnabled = verboseEnabled;
135 }
136
137
138 public boolean isVerboseEnabled()
139 {
140 return verboseEnabled;
141 }
142
143
144 public void setQuietEnabled( boolean quietEnabled )
145 {
146 this.quietEnabled = quietEnabled;
147 }
148
149
150 public boolean isQuietEnabled()
151 {
152 return quietEnabled;
153 }
154 }