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