Skip to content

Commit 6af10a0

Browse files
authored
Merge pull request #174 from oracle/Issue#152-alias-definition-fixes
Issue#152 alias definition fixes
2 parents e2fb1cf + 382139f commit 6af10a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3728
-2858
lines changed

core/src/main/python/wlsdeploy/aliases/alias_entries.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class AliasEntries(object):
8686
'JTA': 'JTA',
8787
'Library': 'Library',
8888
'Log': 'Log',
89+
'LogFilter': 'LogFilter',
8990
'Machine': 'Machine',
9091
'MailSession': 'MailSession',
9192
'MessagingBridge': 'MessagingBridge',
@@ -110,14 +111,18 @@ class AliasEntries(object):
110111
'UnixMachine': 'UnixMachine',
111112
'VirtualHost': 'VirtualHost',
112113
'VirtualTarget': 'VirtualTarget',
113-
'WLDFSystemResource': 'WLDFSystemResource'
114+
'WLDFSystemResource': 'WLDFSystemResource',
115+
'WSReliableDeliveryPolicy': 'WSReliableDeliveryPolicy',
116+
'XMLEntityCache': 'XMLEntityCache',
117+
'XMLRegistry': 'XMLRegistry'
114118
}
115119

116120
__topology_top_level_folders = [
117121
'Cluster',
118122
'JMX',
119123
'JTA',
120124
'Log',
125+
'LogFilter',
121126
'Machine',
122127
'MigratableTarget',
123128
'NMProperties',
@@ -128,7 +133,10 @@ class AliasEntries(object):
128133
'ServerTemplate',
129134
'UnixMachine',
130135
'VirtualHost',
131-
'VirtualTarget'
136+
'VirtualTarget',
137+
'WSReliableDeliveryPolicy',
138+
'XMLEntityCache',
139+
'XMLRegistry'
132140
]
133141

134142
__resources_top_level_folders = [

core/src/main/python/wlsdeploy/aliases/aliases.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,14 +423,15 @@ def get_wlst_attribute_name_and_value(self, location, model_attribute_name, mode
423423

424424
return wlst_attribute_name, wlst_attribute_value
425425

426-
def get_wlst_attribute_name(self, location, model_attribute_name):
426+
def get_wlst_attribute_name(self, location, model_attribute_name, check_read_only=True):
427427
"""
428428
Returns the WLST attribute name and value for the specified model attribute name and value.
429429
430430
wlst_attribute_value should return the correct type and value, even if the value
431431
is the default value for model_attribute_name.
432432
:param location:
433433
:param model_attribute_name:
434+
:param check_read_only: Defaults to True. If false, return name even if alias definition is read only
434435
:return: the WLST attribute name or None, if it is not relevant
435436
:raises: AliasException: if an error occurs due to a bad location or bad alias data
436437
"""
@@ -440,7 +441,8 @@ def get_wlst_attribute_name(self, location, model_attribute_name):
440441
class_name=self._class_name, method_name=_method_name)
441442
wlst_attribute_name = None
442443
alias_attr_dict = self._alias_entries.get_alias_attribute_entry_by_model_name(location, model_attribute_name)
443-
if alias_attr_dict is not None and not self.__is_model_attribute_read_only(location, alias_attr_dict):
444+
if alias_attr_dict is not None and (not check_read_only or not
445+
self.__is_model_attribute_read_only(location, alias_attr_dict)):
444446
if WLST_NAME in alias_attr_dict:
445447
wlst_attribute_name = alias_attr_dict[WLST_NAME]
446448
else:
@@ -908,13 +910,14 @@ def get_model_attribute_name_and_value(self, location, wlst_attribute_name, wlst
908910
result={model_attribute_name: model_attribute_value})
909911
return model_attribute_name, model_attribute_value
910912

911-
def get_model_attribute_name(self, location, wlst_attribute_name):
913+
def get_model_attribute_name(self, location, wlst_attribute_name, check_read_only=True):
912914
"""
913915
Returns the model attribute name for the specified WLST attribute name and value. If the model attribute name
914916
is not valid for the version or the attribute is marked as read-only, return None
915917
916918
:param location: the location
917919
:param wlst_attribute_name: the WLST attribute name
920+
:param check_read_only: Defaults to True. If False, return the WLST attribute name even if read only
918921
:return: matching model attribute name
919922
:raises: AliasException: if an error occurs
920923
"""
@@ -925,7 +928,8 @@ def get_model_attribute_name(self, location, wlst_attribute_name):
925928
model_attribute_name = None
926929

927930
attribute_info = self._alias_entries.get_alias_attribute_entry_by_wlst_name(location, wlst_attribute_name)
928-
if attribute_info is not None and not self.__is_model_attribute_read_only(location, attribute_info):
931+
if attribute_info is not None and \
932+
(not check_read_only or not self.__is_model_attribute_read_only(location, attribute_info)):
929933
model_attribute_name = attribute_info[MODEL_NAME]
930934

931935
self._logger.exiting(class_name=self._class_name, method_name=_method_name,

core/src/main/python/wlsdeploy/aliases/model_constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
LIBRARY = 'Library'
133133
LOAD_BALANCING_PARAMS = 'LoadBalancingParams'
134134
LOG = 'Log'
135+
LOG_FILTER = 'LogFilter'
135136
LOG_ACTION = 'LogAction'
136137
MACHINE = 'Machine'
137138
MAIL_SESSION = 'MailSession'
@@ -251,8 +252,11 @@
251252
WLDF_INSTRUMENTATION_MONITOR = "WLDFInstrumentationMonitor"
252253
WLDF_RESOURCE = "WLDFResource"
253254
WLDF_SYSTEM_RESOURCE = "WLDFSystemResource"
255+
WS_RELIABLE_DELIVERY_POLICY = 'WSReliableDeliveryPolicy'
254256
XACML_AUTHORIZER = 'XACMLAuthorizer'
255257
XACML_ROLE_MAPPER = 'XACMLRoleMapper'
258+
XML_ENTITY_CACHE = 'XMLEntityCache'
259+
XML_REGISTRY = 'XMLRegistry'
256260

257261
# names of attributes, alphabetically
258262

core/src/main/python/wlsdeploy/tool/create/domain_creator.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from wlsdeploy.aliases.model_constants import JDBC_DRIVER_PARAMS_PROPERTIES
2222
from wlsdeploy.aliases.model_constants import JDBC_RESOURCE
2323
from wlsdeploy.aliases.model_constants import JDBC_SYSTEM_RESOURCE
24+
from wlsdeploy.aliases.model_constants import LOG_FILTER
2425
from wlsdeploy.aliases.model_constants import MACHINE
2526
from wlsdeploy.aliases.model_constants import MIGRATABLE_TARGET
2627
from wlsdeploy.aliases.model_constants import NAME
@@ -42,6 +43,9 @@
4243
from wlsdeploy.aliases.model_constants import URL
4344
from wlsdeploy.aliases.model_constants import USER
4445
from wlsdeploy.aliases.model_constants import VIRTUAL_TARGET
46+
from wlsdeploy.aliases.model_constants import WS_RELIABLE_DELIVERY_POLICY
47+
from wlsdeploy.aliases.model_constants import XML_ENTITY_CACHE
48+
from wlsdeploy.aliases.model_constants import XML_REGISTRY
4549
from wlsdeploy.exception import exception_helper
4650
from wlsdeploy.exception.expection_types import ExceptionType
4751
from wlsdeploy.tool.create.creator import Creator
@@ -382,6 +386,8 @@ def __apply_base_domain_config(self, topology_folder_list):
382386
self.security_provider_creator.create_security_configuration(security_config_location)
383387
topology_folder_list.remove(SECURITY_CONFIGURATION)
384388

389+
self.__create_mbeans_used_by_topology_mbeans(location, topology_folder_list)
390+
385391
self.__create_machines(location)
386392
topology_folder_list.remove(MACHINE)
387393
topology_folder_list.remove(UNIX_MACHINE)
@@ -423,6 +429,21 @@ def __set_core_domain_params(self):
423429
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
424430
return
425431

432+
def __create_mbeans_used_by_topology_mbeans(self, location, topology_folder_list):
433+
"""
434+
Create the entities that are referenced by domain, machine, server and server template attributes.
435+
:param location: current location
436+
:raises: CreateException: if an error occurs
437+
"""
438+
self.__create_log_filters(location)
439+
topology_folder_list.remove(LOG_FILTER)
440+
self.__create_reliable_delivery_policy(location)
441+
topology_folder_list.remove(WS_RELIABLE_DELIVERY_POLICY)
442+
self.__create_xml_entity_cache(location)
443+
topology_folder_list.remove(XML_ENTITY_CACHE)
444+
self.__create_xml_registry(location)
445+
topology_folder_list.remove(XML_REGISTRY)
446+
426447
def __create_security_folder(self, location):
427448
"""
428449
Create the /Security folder objects, if any.
@@ -438,6 +459,70 @@ def __create_security_folder(self, location):
438459
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
439460
return
440461

462+
def __create_log_filters(self, location):
463+
"""
464+
Create the /LogFilter objects if any for use in the logs of the base components like domain and server
465+
:param location: the location to use
466+
:raises: CreateException: if an error occurs
467+
"""
468+
_method_name = '__create_log_filters'
469+
470+
self.logger.entering(str(location), class_name=self.__class_name, method_name=_method_name)
471+
log_filter_nodes = dictionary_utils.get_dictionary_element(self._topology, LOG_FILTER)
472+
473+
if len(log_filter_nodes) > 0:
474+
self._create_named_mbeans(LOG_FILTER, log_filter_nodes, location, log_created=True)
475+
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
476+
return
477+
478+
def __create_reliable_delivery_policy(self, location):
479+
"""
480+
Create the /WSReliableDeliverPolicy objects if any for use by the server and server templates.
481+
:param location: the location to use
482+
:raises: CreateException: if an error occurs
483+
"""
484+
_method_name = '__create_reliable_delivery_policy'
485+
486+
self.logger.entering(str(location), class_name=self.__class_name, method_name=_method_name)
487+
policy_nodes = dictionary_utils.get_dictionary_element(self._topology, WS_RELIABLE_DELIVERY_POLICY)
488+
489+
if len(policy_nodes) > 0:
490+
self._create_named_mbeans(WS_RELIABLE_DELIVERY_POLICY, policy_nodes, location, log_created=True)
491+
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
492+
return
493+
494+
def __create_xml_entity_cache(self, location):
495+
"""
496+
Create the /XMLEntityCache objects if any for use by the server and server templates.
497+
:param location: the location to use
498+
:raises: CreateException: if an error occurs
499+
"""
500+
_method_name = '__create_xml_entity_cache'
501+
502+
self.logger.entering(str(location), class_name=self.__class_name, method_name=_method_name)
503+
cache_nodes = dictionary_utils.get_dictionary_element(self._topology, XML_ENTITY_CACHE)
504+
505+
if len(cache_nodes) > 0:
506+
self._create_named_mbeans(XML_ENTITY_CACHE, cache_nodes, location, log_created=True)
507+
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
508+
return
509+
510+
def __create_xml_registry(self, location):
511+
"""
512+
Create the /XMLRegistry objects if any for use by the server and server templates.
513+
:param location: the location to use
514+
:raises: CreateException: if an error occurs
515+
"""
516+
_method_name = '__create_xml_registry'
517+
518+
self.logger.entering(str(location), class_name=self.__class_name, method_name=_method_name)
519+
registry_nodes = dictionary_utils.get_dictionary_element(self._topology, XML_REGISTRY)
520+
521+
if len(registry_nodes) > 0:
522+
self._create_named_mbeans(XML_REGISTRY, registry_nodes, location, log_created=True)
523+
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
524+
return
525+
441526
def __create_machines(self, location):
442527
"""
443528
Create the /Machine and /UnixMachine folder objects, if any.

core/src/main/python/wlsdeploy/tool/discover/discoverer.py

Lines changed: 97 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def _populate_model_parameters(self, dictionary, location):
9999
wlst_param,
100100
wlst_value)
101101
except AliasException, de:
102-
_logger.warning('WLSDPLY-06106', wlst_param, wlst_path, de.getLocalizedMessage(),
102+
_logger.info('WLSDPLY-06106', wlst_param, wlst_path, de.getLocalizedMessage(),
103103
class_name=_class_name, method_name=_method_name)
104104
continue
105105

@@ -139,24 +139,28 @@ def _get_attributes_for_current_location_offline(self, location):
139139

140140
def _get_attributes_for_current_location_online(self, location):
141141
_method_name = '_get_attributes_for_current_location_online'
142-
attributes = dict()
142+
lsa_attributes = dict()
143143
path = self._alias_helper.get_wlst_attributes_path(location)
144-
added = False
145144
try:
146-
attributes = wlst_helper.lsa(path)
147-
mbean_attributes = wlst_helper.get_mbi().getAttributes()
148-
if mbean_attributes:
149-
alias_attributes = self._get_wlst_attributes(location)
150-
for mbean_attribute in mbean_attributes:
151-
name = mbean_attribute.getName()
152-
if name not in attributes and name in alias_attributes:
153-
attributes[name] = wlst_helper.get(name)
154-
added = True
145+
lsa_attributes = wlst_helper.lsa(path)
146+
mbi_attributes = _get_mbi_attribute_list()
147+
if mbi_attributes:
148+
for lsa_attribute_name in lsa_attributes:
149+
if lsa_attribute_name in lsa_attributes and lsa_attribute_name not in mbi_attributes:
150+
_logger.finer('WLSDPLY-06142', lsa_attribute_name)
151+
del lsa_attributes[lsa_attribute_name]
152+
for mbi_attribute_name in mbi_attributes:
153+
if mbi_attribute_name not in lsa_attributes and mbi_attribute_name in mbi_attributes:
154+
# don't count on the item in the get required list in caller, just get the value
155+
# and add it to our lsa list
156+
_logger.finer('WLSDPLY-06141', mbi_attribute_name, class_name=_class_name,
157+
method_name=_method_name)
158+
lsa_attributes[mbi_attribute_name] = wlst_helper.get(mbi_attribute_name)
155159
except PyWLSTException, pe:
156160
name = location.get_model_folders()[-1]
157161
_logger.fine('WLSDPLY-06109', name, str(location), pe.getLocalizedMessage(), class_name=_class_name,
158162
method_name=_method_name)
159-
return attributes
163+
return lsa_attributes
160164

161165
def _is_defined_attribute(self, location, wlst_name):
162166
attribute = False
@@ -260,6 +264,11 @@ def _find_singleton_name_in_folder(self, location):
260264
return name
261265

262266
def _find_subfolders(self, location):
267+
if self._wlst_mode == WlstModes.OFFLINE:
268+
return self._find_subfolders_offline(location)
269+
else:
270+
return self._find_subfolders_online(location)
271+
def _find_subfolders_offline(self, location):
263272
"""
264273
Find the subfolders of the current location.
265274
:param location: context containing current location information
@@ -278,6 +287,20 @@ def _find_subfolders(self, location):
278287
wlst_subfolders = new_subfolders
279288
return wlst_subfolders
280289

290+
def _find_subfolders_online(self, location):
291+
wlst_path = self._alias_helper.get_wlst_subfolders_path(location)
292+
wlst_subfolders = []
293+
if self.wlst_cd(wlst_path, location):
294+
wlst_subfolders = _massage_online_folders(self._wlst_helper.lsc())
295+
if wlst_subfolders:
296+
new_subfolders = []
297+
for wlst_subfolder in wlst_subfolders:
298+
model_subfolder_name = self._get_model_name(location, wlst_subfolder)
299+
if model_subfolder_name:
300+
new_subfolders.append(wlst_subfolder)
301+
wlst_subfolders = new_subfolders
302+
return wlst_subfolders
303+
281304
def _discover_subfolder_singleton(self, model_subfolder_name, location):
282305
"""
283306
Discover the subfolder from the wlst subfolder name. populate the attributes in the folder.
@@ -586,7 +609,7 @@ def _get_wlst_attributes(self, location):
586609
wlst_attribute = self._aliases.get_wlst_attribute_name(location, model_attribute)
587610
if wlst_attribute:
588611
wlst_attributes.append(wlst_attribute)
589-
except AliasException, ae:
612+
except AliasException:
590613
continue
591614
return wlst_attributes
592615

@@ -636,6 +659,66 @@ def convert_to_absolute_path(relative_to, file_name):
636659
return file_name
637660

638661

662+
def _get_mbi_attribute_list():
663+
attribute_list = []
664+
for mbean_attribute_info in wlst_helper.get_mbi().getAttributes():
665+
if _is_attribute(mbean_attribute_info):
666+
attribute_list.append(mbean_attribute_info.getName())
667+
return attribute_list
668+
669+
670+
def _is_attribute(attributes_info):
671+
return _is_attribute_type(attributes_info) or _is_valid_reference(attributes_info)
672+
673+
674+
def _is_valid_reference(attribute_info):
675+
# check again after all done to see whether need to use get deprecated
676+
return _is_reference(attribute_info) and (
677+
attribute_info.isWritable() or not _is_deprecated(attribute_info))
678+
679+
680+
def _is_reference(mbean_attribute_info):
681+
return mbean_attribute_info.getDescriptor().getFieldValue('com.bea.relationship') == 'reference'
682+
683+
684+
def _is_deprecated(mbean_attribute_info):
685+
deprecated_version = mbean_attribute_info.getDescriptor().getFieldValue('deprecated')
686+
return deprecated_version is not None and deprecated_version != 'null' and len(deprecated_version) > 1
687+
688+
689+
def _is_containment(mbean_attribute_info):
690+
return mbean_attribute_info.getDescriptor().getFieldValue('com.bea.relationship') == 'containment'
691+
692+
693+
def _is_attribute_type(attribute_info):
694+
_method_name = '_is_attribute_type'
695+
if not attribute_info.isWritable() and _is_deprecated(attribute_info):
696+
_logger.finer('WLSDPLY-06143', attribute_info.getName(), wlst_helper.get_pwd(),
697+
class_name=_class_name, method_name=_method_name)
698+
return attribute_info.getDescriptor().getFieldValue(
699+
'descriptorType') == 'Attribute' and attribute_info.getDescriptor().getFieldValue(
700+
'com.bea.relationship') is None and (attribute_info.isWritable() or not _is_deprecated(attribute_info))
701+
702+
703+
def _massage_online_folders(lsc_folders):
704+
_method_name = '_massage_online_folders'
705+
location = wlst_helper.get_pwd()
706+
folder_list = []
707+
mbi_folder_list = []
708+
for mbean_attribute_info in wlst_helper.get_mbi().getAttributes():
709+
if _is_containment(mbean_attribute_info):
710+
mbi_folder_list.append(mbean_attribute_info.getName())
711+
for lsc_folder in lsc_folders:
712+
if lsc_folder in mbi_folder_list:
713+
folder_list.append(lsc_folder)
714+
else:
715+
_logger.finer('WLSDPLY-06144', lsc_folder, location, class_name=_class_name, method_name=_method_name)
716+
if len(folder_list) != len(mbi_folder_list):
717+
_logger.fine('WLSDPLY-06145', folder_list, location, mbi_folder_list, class_name=_class_name,
718+
method_name=_method_name)
719+
return folder_list
720+
721+
639722
def get_discover_logger_name():
640723
"""
641724
Return the common logger used for all discover logging.

0 commit comments

Comments
 (0)