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
@@ -278,15 +277,15 @@ def __process_rcu_args(optional_arg_map, domain_type, domain_typedef):
278
277
ex .setExitCode (CommandLineArgUtil .USAGE_ERROR_EXIT_CODE )
279
278
__logger .throwing (ex , class_name = _class_name , method_name = _method_name )
280
279
raise ex
281
- elif CommandLineArgUtil .ATP_PROPERTIES_FILE_SWITCH in optional_arg_map :
282
- pass
283
- else :
284
- ex = exception_helper .create_cla_exception ('WLSDPLY-12408' , domain_type , rcu_schema_count ,
285
- CommandLineArgUtil .RCU_DB_SWITCH ,
286
- CommandLineArgUtil .RCU_PREFIX_SWITCH )
287
- ex .setExitCode (CommandLineArgUtil .USAGE_ERROR_EXIT_CODE )
288
- __logger .throwing (ex , class_name = _class_name , method_name = _method_name )
289
- raise ex
280
+ # elif CommandLineArgUtil.ATP_PROPERTIES_FILE_SWITCH in optional_arg_map:
281
+ # pass
282
+ # else:
283
+ # ex = exception_helper.create_cla_exception('WLSDPLY-12408', domain_type, rcu_schema_count,
284
+ # CommandLineArgUtil.RCU_DB_SWITCH,
285
+ # CommandLineArgUtil.RCU_PREFIX_SWITCH)
286
+ # ex.setExitCode(CommandLineArgUtil.USAGE_ERROR_EXIT_CODE)
287
+ # __logger.throwing(ex, class_name=_class_name, method_name=_method_name)
288
+ # raise ex
290
289
return
291
290
292
291
@@ -414,6 +413,51 @@ def unzip_atp_wallet(wallet_file, location):
414
413
fis .close ()
415
414
416
415
416
+ def validateRCUArgsAndModel (model_context , model ):
417
+ has_atp = 0
418
+ if model_constants .RCU_DB_INFO in model [model_constants .DOMAIN_INFO ]:
419
+ # extract the wallet first
420
+ has_atp = 1
421
+ has_tns_admin = model_constants .DRIVER_PARAMS_NET_TNS_ADMIN in model [model_constants .DOMAIN_INFO ][
422
+ model_constants .RCU_DB_INFO ]
423
+ if model_context .get_archive_file_name ():
424
+ # if it does not have the oracle.net.tns_admin specified, then extract to
425
+ if not has_tns_admin :
426
+ archive_file = WLSDeployArchive (model_context .get_archive_file_name ())
427
+ atp_path = archive_file .getATPWallet ()
428
+ if atp_path and model [model_constants .TOPOLOGY ]['Name' ]:
429
+ domain_path = model_context .get_domain_parent_dir () + os .sep + model [model_constants .TOPOLOGY ][
430
+ 'Name' ]
431
+ extract_path = domain_path + os .sep + 'atpwallet'
432
+ extract_dir = File (extract_path )
433
+ extract_dir .mkdirs ()
434
+ wallet_zip = archive_file .extractFile (atp_path , File (domain_path ))
435
+ unzip_atp_wallet (wallet_zip , extract_path )
436
+ os .remove (wallet_zip )
437
+ # update the model to add the tns_admin
438
+ model [model_constants .DOMAIN_INFO ][model_constants .RCU_DB_INFO ][
439
+ model_constants .DRIVER_PARAMS_NET_TNS_ADMIN ] = extract_path
440
+ else :
441
+ __logger .severe ('WLSDPLY-12411' , error = None ,
442
+ class_name = _class_name , method_name = "validateRCUArgsAndModel" )
443
+ __clean_up_temp_files ()
444
+ tool_exit .end (model_context , CommandLineArgUtil .PROG_ERROR_EXIT_CODE )
445
+ elif not has_tns_admin :
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
+
451
+ if not has_atp and model_context .get_domain_type () not in ['WLS' , 'RestrictedJRF' ]:
452
+ if not model_context .get_rcu_database () or not model_context .get_rcu_prefix ():
453
+ __logger .severe ('WLSDPLY-12408' , model_context .get_domain_type (), CommandLineArgUtil .RCU_DB_SWITCH ,
454
+ CommandLineArgUtil .RCU_PREFIX_SWITCH )
455
+ __clean_up_temp_files ()
456
+ tool_exit .end (model_context , CommandLineArgUtil .PROG_ERROR_EXIT_CODE )
457
+
458
+ return has_atp
459
+
460
+
417
461
def main (args ):
418
462
"""
419
463
The entry point for the create domain tool.
@@ -442,10 +486,8 @@ def main(args):
442
486
model_file = model_context .get_model_file ()
443
487
try :
444
488
model = FileToPython (model_file , True ).parse ()
445
- if model_context .get_atp_properties_file ():
446
- os .environ ['oracle.net.fanEnabled' ] = 'false'
447
- unzip_atp_wallet (model_context .get_atp_properties_file (), model [model_constants .DOMAIN_INFO ][
448
- model_constants .ATP_DB_INFO ][model_constants .DRIVER_PARAMS_NET_TNS_ADMIN ])
489
+ # if model_context.get_archive_file():
490
+ # os.environ['oracle.net.fanEnabled'] = 'false'
449
491
except TranslateException , te :
450
492
__logger .severe ('WLSDPLY-20009' , _program_name , model_file , te .getLocalizedMessage (), error = te ,
451
493
class_name = _class_name , method_name = _method_name )
@@ -471,17 +513,19 @@ def main(args):
471
513
validate_model (model , model_context , aliases )
472
514
473
515
try :
516
+
517
+ has_atp = validateRCUArgsAndModel (model_context , model )
474
518
creator = DomainCreator (model , model_context , aliases )
475
519
creator .create ()
476
520
477
- if model_context . get_atp_properties_file () :
521
+ if has_atp :
478
522
#print model[model_constants.DOMAIN_INFO][model_constants.ATP_DB_INFO]
479
- tns_admin = model [model_constants .DOMAIN_INFO ][model_constants .ATP_DB_INFO ][
523
+ tns_admin = model [model_constants .DOMAIN_INFO ][model_constants .RCU_DB_INFO ][
480
524
model_constants .DRIVER_PARAMS_NET_TNS_ADMIN ]
481
- keystore_password = model [model_constants .DOMAIN_INFO ][model_constants .ATP_DB_INFO ][
525
+ keystore_password = model [model_constants .DOMAIN_INFO ][model_constants .RCU_DB_INFO ][
482
526
model_constants .DRIVER_PARAMS_KEYSTOREPWD_PROPERTY ]
483
527
484
- truststore_password = model [model_constants .DOMAIN_INFO ][model_constants .ATP_DB_INFO ][
528
+ truststore_password = model [model_constants .DOMAIN_INFO ][model_constants .RCU_DB_INFO ][
485
529
model_constants .DRIVER_PARAMS_TRUSTSTOREPWD_PROPERTY ]
486
530
487
531
jsp_config = model_context .get_domain_home () + '/config/fmwconfig/jps-config.xml'
0 commit comments