1
1
"""
2
- Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates. All rights reserved.
2
+ Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates.
3
3
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4
4
"""
5
+
6
+ import copy
5
7
import os
6
8
import tempfile
7
9
@@ -88,6 +90,17 @@ def __init__(self, program_name, arg_map):
88
90
89
91
self ._trailing_args = []
90
92
93
+ if self ._wl_version is None :
94
+ self ._wl_version = self ._wls_helper .get_actual_weblogic_version ()
95
+
96
+ if self ._wlst_mode is None :
97
+ self ._wlst_mode = WlstModes .OFFLINE
98
+
99
+ self .__copy_from_args (arg_map )
100
+
101
+ return
102
+
103
+ def __copy_from_args (self , arg_map ):
91
104
if CommandLineArgUtil .ORACLE_HOME_SWITCH in arg_map :
92
105
self ._oracle_home = arg_map [CommandLineArgUtil .ORACLE_HOME_SWITCH ]
93
106
self ._wl_home = self ._wls_helper .get_weblogic_home (self ._oracle_home )
@@ -200,10 +213,13 @@ def __init__(self, program_name, arg_map):
200
213
201
214
if CommandLineArgUtil .TARGET_MODE_SWITCH in arg_map :
202
215
wlst_mode_string = arg_map [CommandLineArgUtil .TARGET_MODE_SWITCH ]
203
- if wlst_mode_string . lower ( ) == 'online' :
204
- self ._wlst_mode = WlstModes . ONLINE
216
+ if type ( wlst_mode_string ) == int :
217
+ self ._wlst_mode = wlst_mode_string
205
218
else :
206
- self ._wlst_mode = WlstModes .OFFLINE
219
+ if wlst_mode_string .lower () == 'online' :
220
+ self ._wlst_mode = WlstModes .ONLINE
221
+ else :
222
+ self ._wlst_mode = WlstModes .OFFLINE
207
223
208
224
if CommandLineArgUtil .OUTPUT_DIR_SWITCH in arg_map :
209
225
self ._output_dir = arg_map [CommandLineArgUtil .OUTPUT_DIR_SWITCH ]
@@ -217,13 +233,91 @@ def __init__(self, program_name, arg_map):
217
233
if CommandLineArgUtil .VARIABLE_PROPERTIES_FILE_SWITCH in arg_map :
218
234
self ._variable_properties_file = arg_map [CommandLineArgUtil .VARIABLE_PROPERTIES_FILE_SWITCH ]
219
235
220
- if self ._wl_version is None :
221
- self ._wl_version = self ._wls_helper .get_actual_weblogic_version ()
222
-
223
- if self ._wlst_mode is None :
224
- self ._wlst_mode = WlstModes .OFFLINE
225
-
226
- return
236
+ def __copy__ (self ):
237
+ arg_map = dict ()
238
+ if self ._oracle_home is not None :
239
+ arg_map [CommandLineArgUtil .ORACLE_HOME_SWITCH ] = self ._oracle_home
240
+ if self ._java_home is not None :
241
+ arg_map [CommandLineArgUtil .JAVA_HOME_SWITCH ] = self ._java_home
242
+ if self ._domain_home is not None :
243
+ arg_map [CommandLineArgUtil .DOMAIN_HOME_SWITCH ] = self ._domain_home
244
+ if self ._domain_parent_dir is not None :
245
+ arg_map [CommandLineArgUtil .DOMAIN_PARENT_SWITCH ] = self ._domain_parent_dir
246
+ if self ._domain_type is not None :
247
+ arg_map [CommandLineArgUtil .DOMAIN_TYPE_SWITCH ] = self ._domain_type
248
+ if self ._admin_url is not None :
249
+ arg_map [CommandLineArgUtil .ADMIN_URL_SWITCH ] = self ._admin_url
250
+ if self ._admin_user is not None :
251
+ arg_map [CommandLineArgUtil .ADMIN_USER_SWITCH ] = self ._admin_user
252
+ if self ._admin_password is not None :
253
+ arg_map [CommandLineArgUtil .ADMIN_PASS_SWITCH ] = self ._admin_password
254
+ if self ._archive_file_name is not None :
255
+ arg_map [CommandLineArgUtil .ARCHIVE_FILE_SWITCH ] = self ._archive_file_name
256
+ if self ._model_file is not None :
257
+ arg_map [CommandLineArgUtil .MODEL_FILE_SWITCH ] = self ._model_file
258
+ if self ._previous_model_file is not None :
259
+ arg_map [CommandLineArgUtil .PREVIOUS_MODEL_FILE_SWITCH ] = self ._previous_model_file
260
+ if self ._attributes_only is not None :
261
+ arg_map [CommandLineArgUtil .ATTRIBUTES_ONLY_SWITCH ] = self ._attributes_only
262
+ if self ._folders_only is not None :
263
+ arg_map [CommandLineArgUtil .FOLDERS_ONLY_SWITCH ] = self ._folders_only
264
+ if self ._recursive is not None :
265
+ arg_map [CommandLineArgUtil .RECURSIVE_SWITCH ] = self ._recursive
266
+ if self ._variable_file_name is not None :
267
+ arg_map [CommandLineArgUtil .VARIABLE_FILE_SWITCH ] = self ._variable_file_name
268
+ if self ._run_rcu is not None :
269
+ arg_map [CommandLineArgUtil .RUN_RCU_SWITCH ]= self ._run_rcu
270
+ if self ._rcu_database is not None :
271
+ arg_map [CommandLineArgUtil .RCU_DB_SWITCH ] = self ._rcu_database
272
+ if self ._rcu_prefix is not None :
273
+ arg_map [CommandLineArgUtil .RCU_PREFIX_SWITCH ] = self ._rcu_prefix
274
+ if self ._rcu_sys_pass is not None :
275
+ arg_map [CommandLineArgUtil .RCU_SYS_PASS_SWITCH ] = self ._rcu_sys_pass
276
+ if self ._rcu_db_user is not None :
277
+ arg_map [CommandLineArgUtil .RCU_DB_USER_SWITCH ] = self ._rcu_db_user
278
+ if self ._rcu_schema_pass is not None :
279
+ arg_map [CommandLineArgUtil .RCU_SCHEMA_PASS_SWITCH ] = self ._rcu_schema_pass
280
+ if self ._domain_typedef is not None :
281
+ arg_map [CommandLineArgUtil .DOMAIN_TYPEDEF ] = self ._domain_typedef
282
+ if self ._encryption_passphrase is not None :
283
+ arg_map [CommandLineArgUtil .PASSPHRASE_SWITCH ] = self ._encryption_passphrase
284
+ if self ._encrypt_manual is not None :
285
+ arg_map [CommandLineArgUtil .ENCRYPT_MANUAL_SWITCH ] = self ._encrypt_manual
286
+ if self ._encrypt_one_pass is not None :
287
+ arg_map [CommandLineArgUtil .ONE_PASS_SWITCH ] = self ._encrypt_one_pass
288
+ if self ._rollback_if_restart_required is not None :
289
+ arg_map [CommandLineArgUtil .ROLLBACK_IF_RESTART_REQ_SWITCH ] = self ._rollback_if_restart_required
290
+ if self ._use_encryption is not None :
291
+ arg_map [CommandLineArgUtil .USE_ENCRYPTION_SWITCH ] = self ._use_encryption
292
+ if self ._archive_file is not None :
293
+ arg_map [CommandLineArgUtil .ARCHIVE_FILE ] = self ._archive_file
294
+ if self ._opss_wallet_passphrase is not None :
295
+ arg_map [CommandLineArgUtil .OPSS_WALLET_PASSPHRASE ] = self ._opss_wallet_passphrase
296
+ if self ._opss_wallet is not None :
297
+ arg_map [CommandLineArgUtil .OPSS_WALLET_SWITCH ] = self ._opss_wallet
298
+ if self ._update_rcu_schema_pass is not None :
299
+ arg_map [CommandLineArgUtil .UPDATE_RCU_SCHEMA_PASS_SWITCH ] = self ._update_rcu_schema_pass
300
+ if self ._validation_method is not None :
301
+ arg_map [CommandLineArgUtil .VALIDATION_METHOD ] = self ._validation_method
302
+ if self ._wl_version is not None :
303
+ arg_map [CommandLineArgUtil .TARGET_VERSION_SWITCH ] = self ._wl_version
304
+ if self ._domain_resource_file is not None :
305
+ arg_map [CommandLineArgUtil .DOMAIN_RESOURCE_FILE_SWITCH ] = self ._domain_resource_file
306
+ if self ._trailing_args is not None :
307
+ arg_map [CommandLineArgUtil .TRAILING_ARGS_SWITCH ] = self ._trailing_args
308
+ if self ._target is not None :
309
+ arg_map [CommandLineArgUtil .TARGET_SWITCH ] = self ._target
310
+ if self ._wlst_mode is not None :
311
+ arg_map [CommandLineArgUtil .TARGET_MODE_SWITCH ] = self ._wlst_mode
312
+ if self ._output_dir is not None :
313
+ arg_map [CommandLineArgUtil .OUTPUT_DIR_SWITCH ] = self ._output_dir
314
+ if self ._variable_injector_file is not None :
315
+ arg_map [CommandLineArgUtil .VARIABLE_INJECTOR_FILE_SWITCH ] = self ._variable_injector_file
316
+ if self ._variable_keywords_file is not None :
317
+ arg_map [CommandLineArgUtil .VARIABLE_KEYWORDS_FILE_SWITCH ] = self ._variable_keywords_file
318
+ if self ._variable_properties_file is not None :
319
+ arg_map [CommandLineArgUtil .VARIABLE_PROPERTIES_FILE_SWITCH ] = self ._variable_properties_file
320
+ return ModelContext (self ._program_name , arg_map )
227
321
228
322
def get_program_name (self ):
229
323
"""
@@ -761,6 +855,11 @@ def tokenize_classpath(self, classpath):
761
855
762
856
return separator .join (cp_elements )
763
857
858
+ def copy (self , arg_map ):
859
+ model_context_copy = copy .copy (self )
860
+ model_context_copy .__copy_from_args (arg_map )
861
+ return model_context_copy
862
+
764
863
# private methods
765
864
766
865
@@ -778,3 +877,4 @@ def _replace(string_value, token, replace_token_string):
778
877
else :
779
878
result = string_value .replace (token , replace_token_string )
780
879
return result
880
+
0 commit comments