Skip to content

Commit 239b86b

Browse files
CLOUDSTACK-8562: Deprecate commands.properties
- Removes commands.properties file - Fixes apidocs and marvin to be independent of commands.properties usage - Removes bundling of commands.properties in deb/rpm packaging - Removes file references across codebase Signed-off-by: Rohit Yadav <[email protected]>
1 parent 95e0b8d commit 239b86b

13 files changed

+73
-1371
lines changed

client/tomcatconf/commands.properties.in

-801
This file was deleted.

debian/cloudstack-management.install

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
/etc/cloudstack/management/catalina.policy
1919
/etc/cloudstack/management/catalina.properties
2020
/etc/cloudstack/management/logging.properties
21-
/etc/cloudstack/management/commands.properties
2221
/etc/cloudstack/management/ehcache.xml
2322
/etc/cloudstack/management/server-ssl.xml
2423
/etc/cloudstack/management/server-nonssl.xml

scripts/installer/windows/client.wxs

-3
Original file line numberDiff line numberDiff line change
@@ -595,9 +595,6 @@
595595
<Component Id="cmp71D36BFB6B214FAAD323C31A1CE3BC19" Guid="{EF4C61E1-F77E-4E4D-80EA-131511E0804E}">
596596
<File Id="fil44B623C422B90349A635A113C5F4D417" KeyPath="yes" Source="!(wix.SourceClient)\WEB-INF\classes\cloudmanagementserver.keystore" />
597597
</Component>
598-
<Component Id="cmp19EB0E73466EB36D5AA02AB4CE8164B0" Guid="{D3EDCF5B-8A0F-444B-AE64-6C3EEE5F25F0}">
599-
<File Id="filAB20DD6954DD207821DD0311C1F48FAA" KeyPath="yes" Source="!(wix.SourceClient)\WEB-INF\classes\commands.properties" />
600-
</Component>
601598
<Component Id="cmp68E096BB729948107692341D8202CC5A" Guid="{0D5D3AF3-0BC0-48EE-ABA3-AF07535169BF}">
602599
<File Id="fil3E9BCB1A8CB8F8415FE3E71B65A94878" KeyPath="yes" Source="!(wix.SourceClient)\WEB-INF\classes\context.xml" />
603600
</Component>

server/src/com/cloud/api/doc/ApiXmlDocWriter.java

+9-111
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141

4242
import java.io.File;
4343
import java.io.FileInputStream;
44-
import java.io.FileNotFoundException;
4544
import java.io.FileOutputStream;
4645
import java.io.FileWriter;
4746
import java.io.IOException;
@@ -67,16 +66,10 @@
6766
public class ApiXmlDocWriter {
6867
public static final Logger s_logger = Logger.getLogger(ApiXmlDocWriter.class.getName());
6968

70-
private static final short DOMAIN_ADMIN_COMMAND = 4;
71-
private static final short USER_COMMAND = 8;
69+
private static String s_dirName = "";
7270
private static Map<String, Class<?>> s_apiNameCmdClassMap = new HashMap<String, Class<?>>();
7371
private static LinkedHashMap<Object, String> s_allApiCommands = new LinkedHashMap<Object, String>();
74-
private static LinkedHashMap<Object, String> s_domainAdminApiCommands = new LinkedHashMap<Object, String>();
75-
private static LinkedHashMap<Object, String> s_regularUserApiCommands = new LinkedHashMap<Object, String>();
7672
private static TreeMap<Object, String> s_allApiCommandsSorted = new TreeMap<Object, String>();
77-
private static TreeMap<Object, String> s_domainAdminApiCommandsSorted = new TreeMap<Object, String>();
78-
private static TreeMap<Object, String> s_regularUserApiCommandsSorted = new TreeMap<Object, String>();
79-
private static String s_dirName = "";
8073
private static final List<String> AsyncResponses = setAsyncResponses();
8174

8275
private static List<String> setAsyncResponses() {
@@ -123,155 +116,61 @@ public static void main(String[] args) {
123116
s_apiNameCmdClassMap.put(apiName, cmdClass);
124117
}
125118
}
126-
127-
LinkedProperties preProcessedCommands = new LinkedProperties();
128-
String[] fileNames = null;
129-
119+
System.out.printf("Scanned and found %d APIs\n", s_apiNameCmdClassMap.size());
130120
List<String> argsList = Arrays.asList(args);
131121
Iterator<String> iter = argsList.iterator();
132122
while (iter.hasNext()) {
133123
String arg = iter.next();
134-
// populate the file names
135-
if (arg.equals("-f")) {
136-
fileNames = iter.next().split(",");
137-
}
138124
if (arg.equals("-d")) {
139125
s_dirName = iter.next();
140126
}
141127
}
142128

143-
if ((fileNames == null) || (fileNames.length == 0)) {
144-
System.out.println("Please specify input file(s) separated by coma using -f option");
145-
System.exit(2);
146-
}
147-
148-
for (String fileName : fileNames) {
149-
try(FileInputStream in = new FileInputStream(fileName);) {
150-
preProcessedCommands.load(in);
151-
} catch (FileNotFoundException ex) {
152-
System.out.println("Can't find file " + fileName);
153-
System.exit(2);
154-
} catch (IOException ex1) {
155-
System.out.println("Error reading from file " + ex1);
156-
System.exit(2);
157-
}
158-
}
159-
160-
Iterator<?> propertiesIterator = preProcessedCommands.keys.iterator();
161-
// Get command classes and response object classes
162-
while (propertiesIterator.hasNext()) {
163-
String key = (String)propertiesIterator.next();
164-
String preProcessedCommand = preProcessedCommands.getProperty(key);
165-
int splitIndex = preProcessedCommand.lastIndexOf(";");
166-
String commandRoleMask = preProcessedCommand.substring(splitIndex + 1);
167-
Class<?> cmdClass = s_apiNameCmdClassMap.get(key);
168-
if (cmdClass == null) {
169-
System.out.println("Check, is this api part of another build profile? Null value for key: " + key + " preProcessedCommand=" + preProcessedCommand);
170-
continue;
171-
}
172-
String commandName = cmdClass.getName();
173-
s_allApiCommands.put(key, commandName);
174-
175-
short cmdPermissions = 1;
176-
if (commandRoleMask != null) {
177-
cmdPermissions = Short.parseShort(commandRoleMask);
178-
}
179-
180-
if ((cmdPermissions & DOMAIN_ADMIN_COMMAND) != 0) {
181-
s_domainAdminApiCommands.put(key, commandName);
182-
}
183-
if ((cmdPermissions & USER_COMMAND) != 0) {
184-
s_regularUserApiCommands.put(key, commandName);
185-
}
129+
for (Map.Entry<String, Class<?>> entry: s_apiNameCmdClassMap.entrySet()) {
130+
Class<?> cls = entry.getValue();
131+
s_allApiCommands.put(entry.getKey(), cls.getName());
186132
}
187133

188134
s_allApiCommandsSorted.putAll(s_allApiCommands);
189-
s_domainAdminApiCommandsSorted.putAll(s_domainAdminApiCommands);
190-
s_regularUserApiCommandsSorted.putAll(s_regularUserApiCommands);
191135

192136
try {
193137
// Create object writer
194138
XStream xs = new XStream();
195139
xs.alias("command", Command.class);
196140
xs.alias("arg", Argument.class);
197141
String xmlDocDir = s_dirName + "/xmldoc";
198-
String rootAdminDirName = xmlDocDir + "/root_admin";
199-
String domainAdminDirName = xmlDocDir + "/domain_admin";
200-
String regularUserDirName = xmlDocDir + "/regular_user";
142+
String rootAdminDirName = xmlDocDir + "/apis";
201143
(new File(rootAdminDirName)).mkdirs();
202-
(new File(domainAdminDirName)).mkdirs();
203-
(new File(regularUserDirName)).mkdirs();
204144

205145
ObjectOutputStream out = xs.createObjectOutputStream(new FileWriter(s_dirName + "/commands.xml"), "commands");
206-
ObjectOutputStream rootAdmin = xs.createObjectOutputStream(new FileWriter(rootAdminDirName + "/" + "rootAdminSummary.xml"), "commands");
207-
ObjectOutputStream rootAdminSorted = xs.createObjectOutputStream(new FileWriter(rootAdminDirName + "/" + "rootAdminSummarySorted.xml"), "commands");
208-
ObjectOutputStream domainAdmin = xs.createObjectOutputStream(new FileWriter(domainAdminDirName + "/" + "domainAdminSummary.xml"), "commands");
209-
ObjectOutputStream outDomainAdminSorted = xs.createObjectOutputStream(new FileWriter(domainAdminDirName + "/" + "domainAdminSummarySorted.xml"), "commands");
210-
ObjectOutputStream regularUser = xs.createObjectOutputStream(new FileWriter(regularUserDirName + "/regularUserSummary.xml"), "commands");
211-
ObjectOutputStream regularUserSorted = xs.createObjectOutputStream(new FileWriter(regularUserDirName + "/regularUserSummarySorted.xml"), "commands");
212-
213-
// Write commands in the order they are represented in commands.properties.in file
146+
ObjectOutputStream rootAdmin = xs.createObjectOutputStream(new FileWriter(rootAdminDirName + "/" + "apiSummary.xml"), "commands");
147+
ObjectOutputStream rootAdminSorted = xs.createObjectOutputStream(new FileWriter(rootAdminDirName + "/" + "apiSummarySorted.xml"), "commands");
148+
214149
Iterator<?> it = s_allApiCommands.keySet().iterator();
215150
while (it.hasNext()) {
216151
String key = (String)it.next();
217-
218152
// Write admin commands
219153
writeCommand(out, key);
220154
writeCommand(rootAdmin, key);
221-
222155
// Write single commands to separate xml files
223156
ObjectOutputStream singleRootAdminCommandOs = xs.createObjectOutputStream(new FileWriter(rootAdminDirName + "/" + key + ".xml"), "command");
224157
writeCommand(singleRootAdminCommandOs, key);
225158
singleRootAdminCommandOs.close();
226-
227-
if (s_domainAdminApiCommands.containsKey(key)) {
228-
writeCommand(domainAdmin, key);
229-
ObjectOutputStream singleDomainAdminCommandOs = xs.createObjectOutputStream(new FileWriter(domainAdminDirName + "/" + key + ".xml"), "command");
230-
writeCommand(singleDomainAdminCommandOs, key);
231-
singleDomainAdminCommandOs.close();
232-
}
233-
234-
if (s_regularUserApiCommands.containsKey(key)) {
235-
writeCommand(regularUser, key);
236-
ObjectOutputStream singleRegularUserCommandOs = xs.createObjectOutputStream(new FileWriter(regularUserDirName + "/" + key + ".xml"), "command");
237-
writeCommand(singleRegularUserCommandOs, key);
238-
singleRegularUserCommandOs.close();
239-
}
240159
}
241160

242161
// Write sorted commands
243162
it = s_allApiCommandsSorted.keySet().iterator();
244163
while (it.hasNext()) {
245164
String key = (String)it.next();
246-
247165
writeCommand(rootAdminSorted, key);
248-
249-
if (s_domainAdminApiCommands.containsKey(key)) {
250-
writeCommand(outDomainAdminSorted, key);
251-
}
252-
253-
if (s_regularUserApiCommands.containsKey(key)) {
254-
writeCommand(regularUserSorted, key);
255-
}
256166
}
257167

258168
out.close();
259169
rootAdmin.close();
260170
rootAdminSorted.close();
261-
domainAdmin.close();
262-
outDomainAdminSorted.close();
263-
regularUser.close();
264-
regularUserSorted.close();
265171

266172
// write alerttypes to xml
267173
writeAlertTypes(xmlDocDir);
268-
269-
// gzip directory with xml doc
270-
// zipDir(dirName + "xmldoc.zip", xmlDocDir);
271-
272-
// Delete directory
273-
// deleteDir(new File(xmlDocDir));
274-
275174
} catch (Exception ex) {
276175
ex.printStackTrace();
277176
System.exit(2);
@@ -537,5 +436,4 @@ public Object put(Object key, Object value) {
537436
return super.put(key, value);
538437
}
539438
}
540-
541439
}

tools/apidoc/XmlToHtmlConverter.java

+8-56
Original file line numberDiff line numberDiff line change
@@ -23,87 +23,39 @@ public class XmlToHtmlConverter extends XmlToHtmlConverterData {
2323
// To turn off generation of API docs for certain roles, comment out
2424
public static void main(String[] args) {
2525
XmlToHtmlConverter x = new XmlToHtmlConverter();
26-
x.populateForRootAdmin();
27-
x.populateForDomainAdmin();
28-
x.populateForUser();
26+
x.populateForApi();
2927
x.generateToc();
3028
x.generateIndividualCommandPages();
3129
}
3230

3331
public void generateToc() {
3432
try {
3533
TransformerFactory tFactory = TransformerFactory.newInstance();
36-
// Generate the TOC for the API reference for User role
37-
Transformer transformer = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generatetocforuser.xsl"));
38-
// Modify this path to match your own setup.
39-
transformer.transform(new javax.xml.transform.stream.StreamSource("regular_user/regularUserSummary.xml"), new javax.xml.transform.stream.StreamResult(
40-
new FileOutputStream("html/TOC_User.html")));
4134
// Generate the TOC for root administrator role
42-
Transformer transformer1 = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generatetocforadmin.xsl"));
43-
// Modify this path to match your own setup.
44-
transformer1.transform(new javax.xml.transform.stream.StreamSource("root_admin/rootAdminSummary.xml"),
45-
// Modify this path to your own desired output location.
46-
new javax.xml.transform.stream.StreamResult(new FileOutputStream("html/TOC_Root_Admin.html")));
47-
// Generate the TOC for domain admin role
48-
Transformer transformer2 = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generatetocfordomainadmin.xsl"));
49-
50-
// The XML to be transformed must be at the location below.
35+
Transformer transformer1 = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generatetoc.xsl"));
5136
// Modify this path to match your own setup.
52-
transformer2.transform(new javax.xml.transform.stream.StreamSource("domain_admin/domainAdminSummary.xml"),
37+
transformer1.transform(new javax.xml.transform.stream.StreamSource("apis/apiSummarySorted.xml"),
5338
// Modify this path to your own desired output location.
54-
new javax.xml.transform.stream.StreamResult(new FileOutputStream("html/TOC_Domain_Admin.html")));
55-
39+
new javax.xml.transform.stream.StreamResult(new FileOutputStream("html/index.html")));
5640
} catch (Exception e) {
5741
e.printStackTrace();
5842
}
5943
}
6044

6145
// Create man pages
6246
public void generateIndividualCommandPages() {
63-
for (String commandName : rootAdminCommandNames) {
47+
for (String commandName : allCommandNames) {
6448

6549
try {
6650

6751
TransformerFactory tFactory = TransformerFactory.newInstance();
68-
Transformer transformer = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generateadmincommands.xsl"));
52+
Transformer transformer = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generatecommands.xsl"));
6953

7054
transformer.transform
7155
// Modify this path to the location of the input files on your system.
72-
(new javax.xml.transform.stream.StreamSource("root_admin/" + commandName + ".xml"),
56+
(new javax.xml.transform.stream.StreamSource("apis/" + commandName + ".xml"),
7357
// Modify this path with the desired output location.
74-
new javax.xml.transform.stream.StreamResult(new FileOutputStream("html/root_admin/" + commandName + ".html")));
75-
} catch (Exception e) {
76-
e.printStackTrace();
77-
}
78-
}
79-
80-
for (String commandName : domainAdminCommandNames) {
81-
82-
try {
83-
84-
TransformerFactory tFactory = TransformerFactory.newInstance();
85-
Transformer transformer = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generatedomainadmincommands.xsl"));
86-
87-
transformer.transform
88-
// Modify this path with the location of the input files on your system.
89-
(new javax.xml.transform.stream.StreamSource("domain_admin/" + commandName + ".xml"),
90-
// Modify this path to the desired output location.
91-
new javax.xml.transform.stream.StreamResult(new FileOutputStream("html/domain_admin/" + commandName + ".html")));
92-
} catch (Exception e) {
93-
e.printStackTrace();
94-
}
95-
}
96-
97-
for (String commandName : userCommandNames) {
98-
99-
try {
100-
101-
TransformerFactory tFactory = TransformerFactory.newInstance();
102-
103-
Transformer transformer = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource("generateusercommands.xsl"));
104-
105-
transformer.transform(new javax.xml.transform.stream.StreamSource("regular_user/" + commandName + ".xml"), new javax.xml.transform.stream.StreamResult(
106-
new FileOutputStream("html/user/" + commandName + ".html")));
58+
new javax.xml.transform.stream.StreamResult(new FileOutputStream("html/apis/" + commandName + ".html")));
10759
} catch (Exception e) {
10860
e.printStackTrace();
10961
}

tools/apidoc/build-apidoc.sh

+4-11
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ set -e
5858
(cd "$DISTDIR/xmldoc"
5959
cp "$thisdir"/*.java .
6060
cp "$thisdir"/*.xsl .
61-
sed -e 's,%API_HEADER%,User API,g' "$thisdir/generatetoc_header.xsl" >generatetocforuser.xsl
62-
sed -e 's,%API_HEADER%,Root Admin API,g' "$thisdir/generatetoc_header.xsl" >generatetocforadmin.xsl
63-
sed -e 's,%API_HEADER%,Domain Admin API,g' "$thisdir/generatetoc_header.xsl" >generatetocfordomainadmin.xsl
61+
sed -e 's,%API_HEADER%,All APIs,g' "$thisdir/generatetoc_header.xsl" >generatetoc.xsl
6462

6563
PLATFORM=`uname -s`
6664
if [[ "$PLATFORM" =~ .*WIN.* ]]
@@ -74,15 +72,10 @@ set -e
7472
python "$thisdir/gen_toc.py" $(find . -type f)
7573
fi
7674

77-
cat generatetocforuser_include.xsl >>generatetocforuser.xsl
78-
cat generatetocforadmin_include.xsl >>generatetocforadmin.xsl
79-
cat generatetocfordomainadmin_include.xsl >>generatetocfordomainadmin.xsl
75+
cat generatetoc_include.xsl >> generatetoc.xsl
76+
cat "$thisdir/generatetoc_footer.xsl" >>generatetoc.xsl
8077

81-
cat "$thisdir/generatetoc_footer.xsl" >>generatetocforuser.xsl
82-
cat "$thisdir/generatetoc_footer.xsl" >>generatetocforadmin.xsl
83-
cat "$thisdir/generatetoc_footer.xsl" >>generatetocfordomainadmin.xsl
84-
85-
mkdir -p html/user html/domain_admin html/root_admin
78+
mkdir -p html/apis
8679
cp -r "$thisdir/includes" html
8780
cp -r "$thisdir/images" html
8881

0 commit comments

Comments
 (0)