11"""
2- Copyright (c) 2017, 2022 , Oracle Corporation and/or its affiliates. All rights reserved .
2+ Copyright (c) 2017, 2023 , Oracle Corporation and/or its affiliates.
33Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44"""
55import os
1919from wlsdeploy .util .weblogic_helper import WebLogicHelper
2020
2121CREATE_DOMAIN = 'createDomain'
22- UPDATE_DOMAIN = 'updateDomain '
22+ DISCOVER_DOMAIN = 'discoverDomain '
2323NOT_SUPPORTED = 'NOT_SUPPORTED'
2424
25+ def _get_logger_name (program_name ):
26+ logger_name = 'wlsdeploy.create'
27+ if program_name == DISCOVER_DOMAIN :
28+ logger_name = 'wlsdeploy.discover'
29+ return logger_name
30+
2531
2632class DomainTypedef (object ):
2733 """
@@ -35,6 +41,19 @@ class DomainTypedef(object):
3541 RESTRICTED_JRF_TEMPLATE_REGEX = "^(Oracle Restricted JRF)$"
3642 JRF_SERVER_GROUP = 'JRF-MAN-SVR'
3743
44+ __key_mapping_table = {
45+ 'apps' : '/Application' ,
46+ 'coherence-clusters' : '/CoherenceClusterSystemResource' ,
47+ 'datasources' : '/JDBCSystemResource' ,
48+ 'file-stores' : '/FileStore' ,
49+ 'jms' : '/JMSSystemResource' ,
50+ 'jms-server' : '/JMSServer' ,
51+ 'shared-libraries' : '/Library' ,
52+ 'shutdown-classes' : '/ShutdownClass' ,
53+ 'startup-classes' : '/StartupClass' ,
54+ 'wldf' : '/WLDFSystemResource'
55+ }
56+
3857 def __init__ (self , program_name , domain_type ):
3958 """
4059 The DomainTypedef constructor.
@@ -43,7 +62,7 @@ def __init__(self, program_name, domain_type):
4362 """
4463 _method_name = '__init__'
4564
46- self ._logger = PlatformLogger ('wlsdeploy.create' )
65+ self ._logger = PlatformLogger (_get_logger_name ( program_name ) )
4766 self ._program_name = program_name
4867 self ._domain_type = domain_type
4968 self .wls_helper = WebLogicHelper (self ._logger )
@@ -77,10 +96,15 @@ def __init__(self, program_name, domain_type):
7796
7897 self ._targeting_type = self ._resolve_targeting_type ()
7998
80- if 'system-elements' in self ._domain_typedefs_dict :
81- self ._system_elements = self ._domain_typedefs_dict ['system-elements' ]
99+ if 'discover-filters' in self ._domain_typedefs_dict :
100+ if 'system-elements' in self ._domain_typedefs_dict :
101+ self ._logger .notification ('WLSDPLY-12317' , self ._domain_typedef_filename )
102+ self ._discover_filters = self ._domain_typedefs_dict ['discover-filters' ]
103+ elif 'system-elements' in self ._domain_typedefs_dict :
104+ self ._logger .deprecation ('WLSDPLY-12318' , self ._domain_typedef_filename )
105+ self ._discover_filters = self ._translate_system_elements (self ._domain_typedefs_dict ['system-elements' ])
82106 else :
83- self ._system_elements = {}
107+ self ._discover_filters = {}
84108
85109 self ._topology_profile = self ._resolve_topology_profile ()
86110
@@ -108,13 +132,6 @@ def get_topology_profile(self):
108132 """
109133 return self ._topology_profile
110134
111- def has_jrf_resources (self ):
112- """
113- Determine if the domain type has domain resources from either the JRF or Restricted JRF templates.
114- :return: True if the domain type has resources from one of the JRF type
115- """
116- return self .is_jrf_domain_type () or self .is_restricted_jrf_domain_type ()
117-
118135 def is_jrf_domain_type (self ):
119136 """
120137 Determine if this is a JRF domain type by checking for the JRF extension template or
@@ -220,111 +237,54 @@ def get_targeting(self):
220237 """
221238 return self ._targeting_type
222239
223- def is_system_app (self , name ):
224- """
225- Determine if the specified name matches a WLS system application.
226- :param name: the name to be checked
227- :return: True if the name matches a system application, False otherwise
228- """
229- return self ._is_system_name (name , 'apps' )
230-
231- def is_system_coherence_cluster (self , name ):
232- """
233- Determine if the specified name matches a WLS system Coherence cluster.
234- :param name: the name to be checked
235- :return: True if the name matches a system Coherence cluster, False otherwise
236- """
237- return self ._is_system_name (name , 'coherence-clusters' )
238-
239- def is_system_datasource (self , name ):
240- """
241- Determine if the specified name matches a WLS system datasource.
242- :param name: the name to be checked
243- :return: True if the name matches a system datasource, False otherwise
244- """
245- return self ._is_system_name (name , 'datasources' )
246-
247- def is_system_file_store (self , name ):
248- """
249- Determine if the specified name matches a WLS system file store.
250- :param name: the name to be checked
251- :return: True if the name matches a system file store, False otherwise
252- """
253- return self ._is_system_name (name , 'file-stores' )
254-
255- def is_system_jms (self , name ):
256- """
257- Determine if the specified name matches a WLS system JMS resource.
258- :param name: the name to be checked
259- :return: True if the name matches a system JMS resource, False otherwise
260- """
261- return self ._is_system_name (name , 'jms' )
262-
263- def is_system_jms_server (self , name ):
264- """
265- Determine if the specified name matches a WLS system JMS server.
266- :param name: the name to be checked
267- :return: True if the name matches a system JMS server, False otherwise
240+ def is_filtered (self , location , name = None ):
268241 """
269- return self . _is_system_name ( name , 'jms-servers' )
242+ Determine if the named object at the specified location is filtered.
270243
271- def is_system_shared_library (self , name ):
244+ :param location: the alias location object
245+ :param name: the name of the object
246+ :return: true, if the object should be filtered; false otherwise
272247 """
273- Determine if the specified name matches a WLS system shared library.
274- :param name: the name to be checked
275- :return: True if the name matches a system shared library, False otherwise
276- """
277- return self ._is_system_name (name , 'shared-libraries' )
278-
279- def is_system_shutdown_class (self , name ):
280- """
281- Determine if the specified name matches a WLS system shutdown class.
282- :param name: the name to be checked
283- :return: True if the name matches a system shutdown class, False otherwise
284- """
285- return self ._is_system_name (name , 'shutdown-classes' )
286-
287- def is_system_startup_class (self , name ):
288- """
289- Determine if the specified name matches a WLS system startup class.
290- :param name: the name to be checked
291- :return: True if the name matches a system startup class, False otherwise
292- """
293- return self ._is_system_name (name , 'startup-classes' )
248+ key = location .get_folder_path ()
249+ if key in self ._discover_filters :
250+ # Global filter to remove the entire section
251+ if name is None :
252+ return True
294253
295- def is_system_wldf (self , name ):
296- """
297- Determine if the specified name matches a WLS system WLDF resource.
298- :param name: the name to be checked
299- :return: True if the name matches a system WLDF resource, False otherwise
300- """
301- return self ._is_system_name (name , 'wldf' )
254+ discover_filters = self ._discover_filters [key ]
255+ for discover_filter in discover_filters :
256+ matched = re .match (discover_filter , name )
257+ if matched is not None :
258+ return True
259+ return False
302260
303- def is_security_configuration_supported (self ):
261+ def _translate_system_elements (self , system_elements_dict ):
304262 """
305- Determine if the security configuration can be configured. Currently, update domain does not
306- support configuration of the SecurityConfiguration, and 11g create domain does not support
307- configuration of the SecurityConfiguration
263+ Convert the old system-elements format to the new discover-filters format.
308264
309- :return: True if the security realm can be configured
265+ :param system_elements_dict: the system-elements dictionary
266+ :return:
310267 """
311- return self ._program_name != UPDATE_DOMAIN
268+ discover_filters_dict = dict ()
269+ for key , value in system_elements_dict .iteritems ():
270+ new_key = self ._convert_system_elements_key_name (key )
271+ discover_filters_dict [new_key ] = value
272+ return discover_filters_dict
312273
313- def _is_system_name (self , name , key ):
274+ def _convert_system_elements_key_name (self , key ):
314275 """
315- Determine if the specified name matches a WLS name of the specified type key.
316- :param name: the name to be checked
317- :param key: the key of the type to be checked against
318- :return: True if the name matches a system name, False otherwise
276+ Convert the old system-elements key names to the new discover-filters key names.
277+ :param key: the system-elements key
278+ :return: the equivalent discover-filters key
319279 """
320- if key in self ._system_elements :
321- system_names = self ._system_elements [key ]
322- for system_name in system_names :
323- matched = re . match ( system_name , name )
324- if matched is not None :
325- return True
326-
327- return False
280+ if key in self .__key_mapping_table :
281+ return self .__key_mapping_table [key ]
282+ else :
283+ if self . _program_name == DISCOVER_DOMAIN :
284+ ex = exception_helper . create_discover_exception ( 'WLSDPLY-12316' , key , self . _domain_typedef_filename )
285+ else :
286+ ex = exception_helper . create_create_exception ( 'WLSDPLY-12316' , key , self . _domain_typedef_filename )
287+ raise ex
328288
329289 def __resolve_paths (self ):
330290 """
0 commit comments