17
17
from wlsdeploy .aliases .model_constants import DRIVER_NAME
18
18
from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_PROPERTY_VALUE
19
19
from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_USER_PROPERTY
20
+
21
+ from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_TRUSTSTORE_PROPERTY
22
+ from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_kEYSTORE_PROPERTY
23
+ from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_TRUSTSTORETYPE_PROPERTY
24
+ from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_KEYSTORETYPE_PROPERTY
25
+ from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_TRUSTSTOREPWD_PROPERTY
26
+ from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_KEYSTOREPWD_PROPERTY
27
+ from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_NET_SERVER_DN_MATCH_PROPERTY
28
+ from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_NET_SSL_VERSION
29
+ from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_NET_TNS_ADMIN
30
+ from wlsdeploy .aliases .model_constants import DRIVER_PARAMS_NET_FAN_ENABLED
31
+
20
32
from wlsdeploy .aliases .model_constants import JDBC_DRIVER_PARAMS
21
33
from wlsdeploy .aliases .model_constants import JDBC_DRIVER_PARAMS_PROPERTIES
22
34
from wlsdeploy .aliases .model_constants import JDBC_RESOURCE
46
58
from wlsdeploy .aliases .model_constants import WS_RELIABLE_DELIVERY_POLICY
47
59
from wlsdeploy .aliases .model_constants import XML_ENTITY_CACHE
48
60
from wlsdeploy .aliases .model_constants import XML_REGISTRY
61
+ from wlsdeploy .util import variables
49
62
from wlsdeploy .exception import exception_helper
50
63
from wlsdeploy .exception .expection_types import ExceptionType
51
64
from wlsdeploy .tool .create .creator import Creator
58
71
from wlsdeploy .tool .util .topology_helper import TopologyHelper
59
72
from wlsdeploy .util import dictionary_utils
60
73
from wlsdeploy .util import model as model_helper
74
+ from oracle .weblogic .deploy .util import VariableException
61
75
62
76
63
77
class DomainCreator (Creator ):
@@ -195,6 +209,7 @@ def __run_rcu(self):
195
209
rcu_sys_pass = self .model_context .get_rcu_sys_pass ()
196
210
rcu_schema_pass = self .model_context .get_rcu_schema_pass ()
197
211
212
+
198
213
runner = RCURunner (domain_type , oracle_home , java_home , rcu_db , rcu_prefix , rcu_schemas )
199
214
runner .runRcu (rcu_sys_pass , rcu_schema_pass )
200
215
@@ -642,6 +657,20 @@ def __create_other_domain_artifacts(self, location, mbean_type_list):
642
657
self .logger .exiting (class_name = self .__class_name , method_name = _method_name )
643
658
return
644
659
660
+ def __set_atp_connection_property (self , root_location , propery_name , property_value ):
661
+ token_name = self .alias_helper .get_name_token (root_location )
662
+ if token_name is not None :
663
+ root_location .add_name_token (token_name , propery_name )
664
+
665
+ wlst_name , wlst_value = \
666
+ self .alias_helper .get_wlst_attribute_name_and_value (root_location , DRIVER_PARAMS_PROPERTY_VALUE ,
667
+ property_value )
668
+ self .wlst_helper .set_if_needed (wlst_name , wlst_value ,
669
+ JDBC_DRIVER_PARAMS_PROPERTIES , propery_name )
670
+
671
+ root_location .remove_name_token (propery_name )
672
+
673
+
645
674
def __configure_fmw_infra_database (self ):
646
675
"""
647
676
Configure the FMW Infrastructure DataSources.
@@ -650,61 +679,167 @@ def __configure_fmw_infra_database(self):
650
679
_method_name = '__configure_fmw_infra_database'
651
680
652
681
self .logger .entering (class_name = self .__class_name , method_name = _method_name )
653
- rcu_database = self .model_context .get_rcu_database ()
654
- if rcu_database is None :
655
- return
656
682
657
- # No need to validate since these were validated at the entry point...
658
- rcu_prefix = self .model_context .get_rcu_prefix ()
659
- rcu_schema_pwd = self .model_context .get_rcu_schema_pass ()
683
+ # For ATP databases : we need to set all the property for each datasource
684
+ # load atp connection properties from properties file
685
+ #
686
+ props_file = self .model_context .get_rcu_properties_file ()
687
+ if props_file :
688
+ try :
689
+ rcu_properties_map = variables .load_variables (props_file )
690
+
691
+ print rcu_properties_map
692
+ print '------'
693
+
694
+ # parse the tnsnames.ora file and retrieve the connection string
695
+ tns_admin = rcu_properties_map [DRIVER_PARAMS_NET_TNS_ADMIN ]
696
+ tns_names = variables .load_variables ( tns_admin + os .sep +
697
+ 'tnsnames.ora' )
698
+
699
+ rcu_database = tns_names [rcu_properties_map ['tns.entry' ]]
700
+
701
+ rcu_prefix = rcu_properties_map ['rcu_prefix' ]
702
+ rcu_schema_pwd = rcu_properties_map ['rcu_schema_password' ]
703
+
704
+ keystore_pwd = rcu_properties_map [DRIVER_PARAMS_KEYSTOREPWD_PROPERTY ]
705
+ truststore_pwd = rcu_properties_map [DRIVER_PARAMS_TRUSTSTOREPWD_PROPERTY ]
706
+
707
+ # Need to set for the connection proeprty for each datasource
708
+
709
+ print 'conn ' + str (rcu_database )
710
+ print 'prefix ' + str (rcu_prefix )
711
+ print 'pawws ' + str (rcu_schema_pwd )
712
+ fmw_database = self .wls_helper .get_jdbc_url_from_rcu_connect_string (rcu_database )
713
+
714
+ location = LocationContext ()
715
+ location .append_location (JDBC_SYSTEM_RESOURCE )
716
+ token_name = self .alias_helper .get_name_token (location )
717
+
718
+ folder_path = self .alias_helper .get_wlst_list_path (location )
719
+ self .wlst_helper .cd (folder_path )
720
+ ds_names = self .wlst_helper .lsc ()
721
+ print ds_names
722
+
723
+ for ds_name in ds_names :
724
+ location = LocationContext ()
725
+ location .append_location (JDBC_SYSTEM_RESOURCE )
726
+ token_name = self .alias_helper .get_name_token (location )
727
+ location .add_name_token (token_name , ds_name )
728
+
729
+
730
+ location .append_location (JDBC_RESOURCE )
731
+ location .append_location (JDBC_DRIVER_PARAMS )
732
+ wlst_path = self .alias_helper .get_wlst_attributes_path (location )
733
+ self .wlst_helper .cd (wlst_path )
734
+
735
+ wlst_name , wlst_value = \
736
+ self .alias_helper .get_wlst_attribute_name_and_value (location , URL , fmw_database )
737
+ self .wlst_helper .set_if_needed (wlst_name , wlst_value , JDBC_DRIVER_PARAMS , ds_name )
738
+
739
+ wlst_name , wlst_value = \
740
+ self .alias_helper .get_wlst_attribute_name_and_value (location , PASSWORD_ENCRYPTED ,
741
+ rcu_schema_pwd , masked = True )
742
+
743
+ self .wlst_helper .set_if_needed (wlst_name , wlst_value , JDBC_DRIVER_PARAMS , ds_name , masked = True )
744
+
745
+
746
+ location .append_location (JDBC_DRIVER_PARAMS_PROPERTIES )
747
+ token_name = self .alias_helper .get_name_token (location )
748
+ if token_name is not None :
749
+ location .add_name_token (token_name , DRIVER_PARAMS_USER_PROPERTY )
750
+
751
+ wlst_path = self .alias_helper .get_wlst_attributes_path (location )
752
+ self .wlst_helper .cd (wlst_path )
753
+ orig_user = self .wlst_helper .get ('Value' )
754
+ stb_user = orig_user .replace ('DEV' , rcu_prefix )
755
+ wlst_name , wlst_value = \
756
+ self .alias_helper .get_wlst_attribute_name_and_value (location , DRIVER_PARAMS_PROPERTY_VALUE , stb_user )
757
+ self .wlst_helper .set_if_needed (wlst_name , wlst_value ,
758
+ JDBC_DRIVER_PARAMS_PROPERTIES , DRIVER_PARAMS_USER_PROPERTY )
759
+
760
+ # need to set other properties
761
+
762
+ location .remove_name_token (DRIVER_PARAMS_USER_PROPERTY )
763
+
764
+ self .__set_atp_connection_property (location , DRIVER_PARAMS_kEYSTORE_PROPERTY , tns_admin + os .sep
765
+ + 'keystore.jks' )
766
+ self .__set_atp_connection_property (location , DRIVER_PARAMS_KEYSTORETYPE_PROPERTY ,
767
+ 'JKS' )
768
+ self .__set_atp_connection_property (location , DRIVER_PARAMS_KEYSTOREPWD_PROPERTY , keystore_pwd )
769
+ self .__set_atp_connection_property (location , DRIVER_PARAMS_TRUSTSTORE_PROPERTY , tns_admin + os .sep
770
+ + 'truststore.jks' )
771
+ self .__set_atp_connection_property (location , DRIVER_PARAMS_TRUSTSTORETYPE_PROPERTY ,
772
+ 'JKS' )
773
+ self .__set_atp_connection_property (location , DRIVER_PARAMS_TRUSTSTOREPWD_PROPERTY , truststore_pwd )
774
+
775
+ self .__set_atp_connection_property (location , DRIVER_PARAMS_NET_SSL_VERSION , '1.2' )
776
+ self .__set_atp_connection_property (location , DRIVER_PARAMS_NET_SERVER_DN_MATCH_PROPERTY , 'true' )
777
+ self .__set_atp_connection_property (location , DRIVER_PARAMS_NET_TNS_ADMIN , tns_admin )
778
+ self .__set_atp_connection_property (location , DRIVER_PARAMS_NET_FAN_ENABLED , 'false' )
779
+ print 'UPDATED ALL PROPERTIES '
780
+
781
+ except VariableException , ex :
782
+ self .logger .severe ('WLSDPLY-20004' , _program_name , ex .getLocalizedMessage (), error = ex ,
783
+ class_name = _class_name , method_name = _method_name )
784
+ self .logger .throwing (ex , class_name = self .__class_name , method_name = _method_name )
785
+ raise ex
660
786
661
- fmw_database = self .wls_helper .get_jdbc_url_from_rcu_connect_string (rcu_database )
662
- self .logger .fine ('WLSDPLY-12221' , fmw_database , class_name = self .__class_name , method_name = _method_name )
787
+ else :
788
+ rcu_database = self .model_context .get_rcu_database ()
789
+ if rcu_database is None :
790
+ return
663
791
664
- location = LocationContext ()
665
- location .append_location (JDBC_SYSTEM_RESOURCE )
666
- token_name = self .alias_helper .get_name_token (location )
667
- svc_table_ds_name = self .wls_helper .get_jrf_service_table_datasource_name ()
668
- if token_name is not None :
669
- location .add_name_token (token_name , svc_table_ds_name )
792
+ rcu_prefix = self .model_context .get_rcu_prefix ()
793
+ rcu_schema_pwd = self .model_context .get_rcu_schema_pass ()
670
794
671
- location .append_location (JDBC_RESOURCE )
672
- location .append_location (JDBC_DRIVER_PARAMS )
673
- wlst_path = self .alias_helper .get_wlst_attributes_path (location )
674
- self .wlst_helper .cd (wlst_path )
795
+ fmw_database = self .wls_helper .get_jdbc_url_from_rcu_connect_string (rcu_database )
796
+ self .logger .fine ('WLSDPLY-12221' , fmw_database , class_name = self .__class_name , method_name = _method_name )
675
797
676
- svc_table_driver_name = self .wls_helper .get_stb_data_source_jdbc_driver_name ()
677
- wlst_name , wlst_value = \
678
- self .alias_helper .get_wlst_attribute_name_and_value (location , DRIVER_NAME , svc_table_driver_name )
679
- self .wlst_helper .set_if_needed (wlst_name , wlst_value , JDBC_DRIVER_PARAMS , svc_table_ds_name )
798
+ location = LocationContext ()
799
+ location .append_location (JDBC_SYSTEM_RESOURCE )
800
+ token_name = self .alias_helper .get_name_token (location )
801
+ svc_table_ds_name = self .wls_helper .get_jrf_service_table_datasource_name ()
802
+ if token_name is not None :
803
+ location .add_name_token (token_name , svc_table_ds_name )
680
804
681
- wlst_name , wlst_value = \
682
- self .alias_helper .get_wlst_attribute_name_and_value (location , URL , fmw_database )
683
- self .wlst_helper .set_if_needed (wlst_name , wlst_value , JDBC_DRIVER_PARAMS , svc_table_ds_name )
805
+ location .append_location (JDBC_RESOURCE )
806
+ location .append_location (JDBC_DRIVER_PARAMS )
807
+ wlst_path = self .alias_helper .get_wlst_attributes_path (location )
808
+ self .wlst_helper .cd (wlst_path )
684
809
685
- wlst_name , wlst_value = \
686
- self . alias_helper . get_wlst_attribute_name_and_value ( location , PASSWORD_ENCRYPTED ,
687
- rcu_schema_pwd , masked = True )
688
- self .wlst_helper .set_if_needed (wlst_name , wlst_value , JDBC_DRIVER_PARAMS , svc_table_ds_name , masked = True )
810
+ svc_table_driver_name = self . wls_helper . get_stb_data_source_jdbc_driver_name ()
811
+ wlst_name , wlst_value = \
812
+ self . alias_helper . get_wlst_attribute_name_and_value ( location , DRIVER_NAME , svc_table_driver_name )
813
+ self .wlst_helper .set_if_needed (wlst_name , wlst_value , JDBC_DRIVER_PARAMS , svc_table_ds_name )
689
814
690
- location .append_location (JDBC_DRIVER_PARAMS_PROPERTIES )
691
- token_name = self .alias_helper .get_name_token (location )
815
+ wlst_name , wlst_value = \
816
+ self .alias_helper .get_wlst_attribute_name_and_value (location , URL , fmw_database )
817
+ self .wlst_helper .set_if_needed (wlst_name , wlst_value , JDBC_DRIVER_PARAMS , svc_table_ds_name )
692
818
693
- if token_name is not None :
694
- location .add_name_token (token_name , DRIVER_PARAMS_USER_PROPERTY )
819
+ wlst_name , wlst_value = \
820
+ self .alias_helper .get_wlst_attribute_name_and_value (location , PASSWORD_ENCRYPTED ,
821
+ rcu_schema_pwd , masked = True )
822
+ self .wlst_helper .set_if_needed (wlst_name , wlst_value , JDBC_DRIVER_PARAMS , svc_table_ds_name , masked = True )
695
823
696
- stb_user = self .wls_helper .get_stb_user_name (rcu_prefix )
697
- self .logger .fine ('WLSDPLY-12222' , stb_user , class_name = self .__class_name , method_name = _method_name )
698
- wlst_path = self .alias_helper .get_wlst_attributes_path (location )
699
- self .wlst_helper .cd (wlst_path )
700
- wlst_name , wlst_value = \
701
- self .alias_helper .get_wlst_attribute_name_and_value (location , DRIVER_PARAMS_PROPERTY_VALUE , stb_user )
702
- self .wlst_helper .set_if_needed (wlst_name , wlst_value ,
703
- JDBC_DRIVER_PARAMS_PROPERTIES , DRIVER_PARAMS_USER_PROPERTY )
824
+ location .append_location (JDBC_DRIVER_PARAMS_PROPERTIES )
825
+ token_name = self .alias_helper .get_name_token (location )
826
+
827
+ if token_name is not None :
828
+ location .add_name_token (token_name , DRIVER_PARAMS_USER_PROPERTY )
829
+
830
+ stb_user = self .wls_helper .get_stb_user_name (rcu_prefix )
831
+ self .logger .fine ('WLSDPLY-12222' , stb_user , class_name = self .__class_name , method_name = _method_name )
832
+ wlst_path = self .alias_helper .get_wlst_attributes_path (location )
833
+ self .wlst_helper .cd (wlst_path )
834
+ wlst_name , wlst_value = \
835
+ self .alias_helper .get_wlst_attribute_name_and_value (location , DRIVER_PARAMS_PROPERTY_VALUE , stb_user )
836
+ self .wlst_helper .set_if_needed (wlst_name , wlst_value ,
837
+ JDBC_DRIVER_PARAMS_PROPERTIES , DRIVER_PARAMS_USER_PROPERTY )
838
+
839
+ self .logger .info ('WLSDPLY-12223' , class_name = self .__class_name , method_name = _method_name )
840
+ if self .wls_helper .is_database_defaults_supported ():
841
+ self .wlst_helper .get_database_defaults ()
704
842
705
- self .logger .info ('WLSDPLY-12223' , class_name = self .__class_name , method_name = _method_name )
706
- if self .wls_helper .is_database_defaults_supported ():
707
- self .wlst_helper .get_database_defaults ()
708
843
709
844
self .logger .exiting (class_name = self .__class_name , method_name = _method_name )
710
845
return
0 commit comments