This repository was archived by the owner on Jul 20, 2024. It is now read-only.
forked from splunk/splunk-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.java
More file actions
221 lines (198 loc) · 6.2 KB
/
Application.java
File metadata and controls
221 lines (198 loc) · 6.2 KB
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
/*
* Copyright 2012 Splunk, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"): you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.splunk;
/**
* The {@code Application} class represents a locally-installed Splunk app.
*/
public class Application extends Entity {
/**
* Class constructor.
*
* @param service The connected {@code Service} instance.
* @param path The application endpoint.
*/
Application(Service service, String path) {
super(service, path);
}
/**
* Returns the name of the app's author. For Splunkbase
* apps, this value is the username of the Splunk.com account. For internal
* apps, this value is the full name.
*
* @return The author name, or {@code null} if not specified.
*/
public String getAuthor() {
return getString("author", null);
}
/**
* Indicates whether Splunk checks Splunkbase for updates.
*
* @return {@code true} if Splunk checks Splunkbase for app updates,
* {@code false} if not.
*/
public boolean getCheckForUpdates() {
return getBoolean("check_for_updates", false);
}
/**
* Returns a short description of the app.
*
* @return The description, or {@code null} if not specified.
*/
public String getDescription() {
return getString("description", null);
}
/**
* Returns the app's label (its name).
*
* @return The label, or {@code null} if not specified.
*/
public String getLabel() {
return getString("label", null);
}
/**
* Indicates whether to reload objects contained in the locally-installed
* app.
*
* @return {@code true} if objects are reloaded, {@code false} if not.
*/
public boolean getRefresh() {
return getBoolean("refresh", false);
}
/**
* Returns the version of the app.
*
* @return The version, or {@code null} if not specified.
*/
public String getVersion() {
return getString("version", null);
}
/**
* Indicates whether the app's custom setup has been
* performed. This field is available in Splunk version 4.2.4 and later.
*
* @return {@code true} if custom setup has been performed, {@code false}
* if not.
*/
public boolean isConfigured() {
return getBoolean("configured", false);
}
/**
* Indicates whether the app is visible and navigable from Splunk Web.
*
* @return {@code true} if the app is visible and navigable from Splunk
* Web, {@code false} if not.
*/
public boolean isVisible() {
return getBoolean("visible", false);
}
/**
* Indicates whether a state change requires the app to be restarted.
*
* @return {@code true} if state changes require the app to be restarted,
* {@code false} if not.
*/
public boolean stateChangeRequiresRestart() {
return getBoolean("state_change_requires_restart", false);
}
/***
* Sets the name of the app's author. For Splunkbase apps, this value is
* the username of the Splunk.com account. For internal apps, this value is
* the full name.
*
* @param author The author name.
*/
public void setAuthor(String author) {
setCacheValue("author", author);
}
/**
* Sets whether Splunk checks Splunkbase for updates to the app.
*
* @param value {@code true} if Splunk checks Splunkbase for app updates,
* {@code false} if not.
*/
public void setCheckForUpdates(boolean value) {
setCacheValue("check_for_updates", value);
}
/**
* Sets whether the app's custom setup has been performed. This field
* is available in Splunk 4.2.4 and later.
*
* @param value {@code true} if the app has run its custom setup,
* {@code false} if not.
*/
public void setConfigured(boolean value) {
setCacheValue("configured", value);
}
/**
* Sets a short description of the application, which is displayed below
* the app's title on the Splunk Home tab in Splunk Web.
*
* @param description The short description of the app.
*/
public void setDescription(String description) {
setCacheValue("description", description);
}
/**
* Sets the app's name, which is displayed in Splunk Web. The name should be
* between 5-80 characters and should not include the prefix "Splunk For".
*
* @param label The label (name) of the app.
*/
public void setLabel(String label) {
setCacheValue("label", label);
}
/**
* Sets the version of the app.
*
* @param version The app's version.
*/
public void setVersion(String version) {
setCacheValue("version", version);
}
/**
* Sets whether the app is visible and navigable from Splunk Web.
*
* @param visible {@code true} if the app can be visible and navigable
* from Splunk Web, {@code false} if not.
*/
public void setVisible(boolean visible) {
setCacheValue("visible", visible);
}
/**
* Archives the app on the server file system.
*
* @return The location of the archived app, as {app_name}.spl.
*/
public ApplicationArchive archive() {
return new ApplicationArchive(service, path);
}
/**
* Returns the app's setup information.
*
* @return The app's setup information.
*/
public ApplicationSetup setup() {
return new ApplicationSetup(service, path);
}
/**
* Returns any update information that is available for the app.
*
* @return Update information for the app.
*/
public ApplicationUpdate getUpdate() {
return new ApplicationUpdate(service, path);
}
}