14
14
from java .lang import IllegalStateException
15
15
from java .lang import String
16
16
from java .io import File
17
+ from java .nio .file import Files
17
18
from java .io import FileInputStream
18
19
from java .io import FileOutputStream
19
20
from java .util .zip import ZipInputStream
20
21
import jarray
21
22
22
-
23
-
24
23
from oracle .weblogic .deploy .create import CreateException
25
24
from oracle .weblogic .deploy .deploy import DeployException
26
25
from oracle .weblogic .deploy .util import CLAException
@@ -283,15 +282,15 @@ def __process_rcu_args(optional_arg_map, domain_type, domain_typedef):
283
282
ex .setExitCode (CommandLineArgUtil .USAGE_ERROR_EXIT_CODE )
284
283
__logger .throwing (ex , class_name = _class_name , method_name = _method_name )
285
284
raise ex
286
- elif CommandLineArgUtil .ATP_PROPERTIES_FILE_SWITCH in optional_arg_map :
287
- pass
288
- else :
289
- ex = exception_helper .create_cla_exception ('WLSDPLY-12408' , domain_type , rcu_schema_count ,
290
- CommandLineArgUtil .RCU_DB_SWITCH ,
291
- CommandLineArgUtil .RCU_PREFIX_SWITCH )
292
- ex .setExitCode (CommandLineArgUtil .USAGE_ERROR_EXIT_CODE )
293
- __logger .throwing (ex , class_name = _class_name , method_name = _method_name )
294
- raise ex
285
+ # elif CommandLineArgUtil.ATP_PROPERTIES_FILE_SWITCH in optional_arg_map:
286
+ # pass
287
+ # else:
288
+ # ex = exception_helper.create_cla_exception('WLSDPLY-12408', domain_type, rcu_schema_count,
289
+ # CommandLineArgUtil.RCU_DB_SWITCH,
290
+ # CommandLineArgUtil.RCU_PREFIX_SWITCH)
291
+ # ex.setExitCode(CommandLineArgUtil.USAGE_ERROR_EXIT_CODE)
292
+ # __logger.throwing(ex, class_name=_class_name, method_name=_method_name)
293
+ # raise ex
295
294
return
296
295
297
296
@@ -419,6 +418,51 @@ def unzip_atp_wallet(wallet_file, location):
419
418
fis .close ()
420
419
421
420
421
+ def validateRCUArgsAndModel (model_context , model ):
422
+ has_atp = 0
423
+ if model_constants .RCU_DB_INFO in model [model_constants .DOMAIN_INFO ]:
424
+ # extract the wallet first
425
+ has_atp = 1
426
+ has_tns_admin = model_constants .DRIVER_PARAMS_NET_TNS_ADMIN in model [model_constants .DOMAIN_INFO ][
427
+ model_constants .RCU_DB_INFO ]
428
+ if model_context .get_archive_file_name ():
429
+ # if it does not have the oracle.net.tns_admin specified, then extract to
430
+ if not has_tns_admin :
431
+ archive_file = WLSDeployArchive (model_context .get_archive_file_name ())
432
+ atp_path = archive_file .getATPWallet ()
433
+ if atp_path and model [model_constants .TOPOLOGY ]['Name' ]:
434
+ domain_path = model_context .get_domain_parent_dir () + os .sep + model [model_constants .TOPOLOGY ][
435
+ 'Name' ]
436
+ extract_path = domain_path + os .sep + 'atpwallet'
437
+ extract_dir = File (extract_path )
438
+ extract_dir .mkdirs ()
439
+ wallet_zip = archive_file .extractFile (atp_path , File (domain_path ))
440
+ unzip_atp_wallet (wallet_zip , extract_path )
441
+ os .remove (wallet_zip )
442
+ # update the model to add the tns_admin
443
+ model [model_constants .DOMAIN_INFO ][model_constants .RCU_DB_INFO ][
444
+ model_constants .DRIVER_PARAMS_NET_TNS_ADMIN ] = extract_path
445
+ else :
446
+ __logger .severe ('WLSDPLY-12411' , error = None ,
447
+ class_name = _class_name , method_name = "validateRCUArgsAndModel" )
448
+ __clean_up_temp_files ()
449
+ tool_exit .end (model_context , CommandLineArgUtil .PROG_ERROR_EXIT_CODE )
450
+ elif not has_tns_admin :
451
+ __logger .severe ('WLSDPLY-12411' , error = None ,
452
+ class_name = _class_name , method_name = "validateRCUArgsAndModel" )
453
+ __clean_up_temp_files ()
454
+ tool_exit .end (model_context , CommandLineArgUtil .PROG_ERROR_EXIT_CODE )
455
+
456
+ if not has_atp and model_context .get_domain_type () not in ['WLS' , 'RestrictedJRF' ]:
457
+ if not model_context .get_rcu_database () or not model_context .get_rcu_prefix ():
458
+ __logger .severe ('WLSDPLY-12408' , model_context .get_domain_type (), CommandLineArgUtil .RCU_DB_SWITCH ,
459
+ CommandLineArgUtil .RCU_PREFIX_SWITCH )
460
+ __clean_up_temp_files ()
461
+ tool_exit .end (model_context , CommandLineArgUtil .PROG_ERROR_EXIT_CODE )
462
+
463
+ return has_atp
464
+
465
+
422
466
def main (args ):
423
467
"""
424
468
The entry point for the create domain tool.
@@ -447,10 +491,8 @@ def main(args):
447
491
model_file = model_context .get_model_file ()
448
492
try :
449
493
model = FileToPython (model_file , True ).parse ()
450
- if model_context .get_atp_properties_file ():
451
- os .environ ['oracle.net.fanEnabled' ] = 'false'
452
- unzip_atp_wallet (model_context .get_atp_properties_file (), model [model_constants .DOMAIN_INFO ][
453
- model_constants .ATP_DB_INFO ][model_constants .DRIVER_PARAMS_NET_TNS_ADMIN ])
494
+ # if model_context.get_archive_file():
495
+ # os.environ['oracle.net.fanEnabled'] = 'false'
454
496
except TranslateException , te :
455
497
__logger .severe ('WLSDPLY-20009' , _program_name , model_file , te .getLocalizedMessage (), error = te ,
456
498
class_name = _class_name , method_name = _method_name )
@@ -476,17 +518,19 @@ def main(args):
476
518
validate_model (model , model_context , aliases )
477
519
478
520
try :
521
+
522
+ has_atp = validateRCUArgsAndModel (model_context , model )
479
523
creator = DomainCreator (model , model_context , aliases )
480
524
creator .create ()
481
525
482
- if model_context . get_atp_properties_file () :
526
+ if has_atp :
483
527
#print model[model_constants.DOMAIN_INFO][model_constants.ATP_DB_INFO]
484
- tns_admin = model [model_constants .DOMAIN_INFO ][model_constants .ATP_DB_INFO ][
528
+ tns_admin = model [model_constants .DOMAIN_INFO ][model_constants .RCU_DB_INFO ][
485
529
model_constants .DRIVER_PARAMS_NET_TNS_ADMIN ]
486
- keystore_password = model [model_constants .DOMAIN_INFO ][model_constants .ATP_DB_INFO ][
530
+ keystore_password = model [model_constants .DOMAIN_INFO ][model_constants .RCU_DB_INFO ][
487
531
model_constants .DRIVER_PARAMS_KEYSTOREPWD_PROPERTY ]
488
532
489
- truststore_password = model [model_constants .DOMAIN_INFO ][model_constants .ATP_DB_INFO ][
533
+ truststore_password = model [model_constants .DOMAIN_INFO ][model_constants .RCU_DB_INFO ][
490
534
model_constants .DRIVER_PARAMS_TRUSTSTOREPWD_PROPERTY ]
491
535
492
536
jsp_config = model_context .get_domain_home () + '/config/fmwconfig/jps-config.xml'
0 commit comments