Skip to content

Commit 66fbd66

Browse files
authored
JIRA WDT-320 Display section title when no attributes are present; flag folders with multiple children (#621)
1 parent 9f05639 commit 66fbd66

File tree

2 files changed

+40
-16
lines changed

2 files changed

+40
-16
lines changed

core/src/main/python/wlsdeploy/tool/modelhelp/model_help_printer.py

+32-12
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,6 @@ def _print_model_folder_help(self, model_path_tokens, valid_section_folder_keys,
221221
self._logger.throwing(ex, class_name=_class_name, method_name=_method_name)
222222
raise ex
223223

224-
folder_path = '/'.join(model_path_tokens[1:])
225-
model_path = _format_message('WLSDPLY-10105', '%s:/%s' % (section_name, folder_path))
226-
227-
# Print 'Path: <model_section>' header
228-
print
229-
_print_indent(model_path, 0)
230-
231224
# Populate the location context using model_path_tokens[1:]
232225
model_location = LocationContext()
233226
for folder_key in model_path_tokens[1:]:
@@ -239,6 +232,16 @@ def _print_model_folder_help(self, model_path_tokens, valid_section_folder_keys,
239232
self._logger.finest('2 model_location={0}', model_location, class_name=_class_name,
240233
method_name=_method_name)
241234

235+
folder_path = '/'.join(model_path_tokens[1:])
236+
model_path = _format_message('WLSDPLY-10105', '%s:/%s' % (section_name, folder_path))
237+
type_name = self._get_folder_type_name(model_location)
238+
if type_name is not None:
239+
model_path += " (" + type_name + ")"
240+
241+
# Print 'Path: <model_section>' header
242+
print
243+
_print_indent(model_path, 0)
244+
242245
if self._show_attributes(control_option):
243246
# Print the attributes associated with location context
244247
self._print_attributes_help(model_location, 1)
@@ -279,7 +282,12 @@ def _print_subfolders_help(self, model_location, control_option, indent_level):
279282
self._logger.finest('3 model_location={0}', model_location, class_name=_class_name,
280283
method_name=_method_name)
281284

282-
_print_indent(key, indent_level + 1)
285+
text = key
286+
type_name = self._get_folder_type_name(model_location)
287+
if type_name is not None:
288+
text += " (" + type_name + ")"
289+
290+
_print_indent(text, indent_level + 1)
283291

284292
if control_option == self.ControlOptions.RECURSIVE:
285293
# Call this method recursively
@@ -299,11 +307,11 @@ def _print_attributes_help(self, model_location, indent_level):
299307
self._logger.finer('WLSDPLY-05012', str(model_location), str(attr_infos),
300308
class_name=_class_name, method_name=_method_name)
301309

302-
if attr_infos:
303-
# Print 'Valid Attributes are :-' area label
304-
print
305-
_print_indent(_format_message('WLSDPLY-10111'), indent_level)
310+
# Print 'Valid Attributes:' area label
311+
print
312+
_print_indent(_format_message('WLSDPLY-10111'), indent_level)
306313

314+
if attr_infos:
307315
maxlen = 0
308316
for key in attr_infos:
309317
if len(key) > maxlen:
@@ -332,6 +340,18 @@ def _show_folders(self, control_option):
332340
"""
333341
return control_option != self.ControlOptions.ATTRIBUTES_ONLY
334342

343+
def _get_folder_type_name(self, location):
344+
"""
345+
Return text indicating the type of a folder, such as "multiple".
346+
:param location: the location to be checked
347+
:return: name of the folder type to be displayed, or None
348+
"""
349+
if self._alias_helper.is_artificial_type_folder(location):
350+
return None
351+
if self._alias_helper.supports_multiple_mbean_instances(location):
352+
return "multiple"
353+
return None
354+
335355

336356
def _format_message(key, *args):
337357
"""

site/model_help.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Path: resources:/JDBCSystemResource
2424

2525
Valid Folders:
2626
JdbcResource
27-
SubDeployment
27+
SubDeployment (multiple)
2828
```
2929
This result lists the attributes and folders available for the `JDBCSystemResource` folder in the `resources` section of the model. You can use this information to construct this model section:
3030
```yaml
@@ -36,8 +36,12 @@ resources:
3636
JdbcSystemResource:
3737
# JdbcSystemResource attributes and folders
3838
SubDeployment:
39-
# SubDeployment attributes and folders
39+
deployment1:
40+
# SubDeployment attributes and folders
41+
deployment2:
42+
# SubDeployment attributes and folders
4043
```
44+
The `(multiple)` notation on the `SubDeployment` folder indicates that it should have one or more named sub-folders containing its attributes and sub-folders.
4145

4246
### Path Patterns
4347
There are a number of ways to specify model location in the path argument. Here are some examples:
@@ -92,8 +96,8 @@ Path: resources:/JDBCSystemResource
9296
JDBCConnectionPoolParams
9397
JDBCDataSourceParams
9498
JDBCDriverParams
95-
Properties
99+
Properties (multiple)
96100
JDBCOracleParams
97101
JDBCXAParams
98-
SubDeployment
102+
SubDeployment (multiple)
99103
```

0 commit comments

Comments
 (0)