4
4
5
5
The main module for the WLSDeploy tool to create empty domains.
6
6
"""
7
+ import exceptions
7
8
import os
8
9
import sys
9
- import exceptions
10
10
11
- from java .lang import Exception as JException
12
11
from java .io import IOException
12
+ from java .lang import Class as JClass
13
+ from java .lang import Exception as JException
13
14
from java .lang import IllegalArgumentException
14
15
from java .lang import String
15
- from java .lang import System
16
- import java .sql .DriverManager as DriverManager
17
- import java .util .Properties as Properties
18
-
16
+ from java .sql import DriverManager
17
+ from java .util import Properties
19
18
from oracle .weblogic .deploy .create import CreateException
20
19
from oracle .weblogic .deploy .deploy import DeployException
21
- from oracle .weblogic .deploy .validate import ValidateException
22
20
from oracle .weblogic .deploy .util import FileUtils
23
21
from oracle .weblogic .deploy .util import WLSDeployArchiveIOException
22
+ from oracle .weblogic .deploy .validate import ValidateException
24
23
25
24
sys .path .insert (0 , os .path .dirname (os .path .realpath (sys .argv [0 ])))
26
25
27
26
# imports from local packages start here
28
27
from wlsdeploy .aliases .aliases import Aliases
29
- from wlsdeploy .aliases import model_constants
30
- from wlsdeploy .aliases .model_constants import DEFAULT_WLS_DOMAIN_NAME , PATH_TO_RCU_ADMIN_PASSWORD , \
31
- PATH_TO_RCU_SCHEMA_PASSWORD
28
+ from wlsdeploy .aliases .model_constants import DEFAULT_WLS_DOMAIN_NAME
32
29
from wlsdeploy .aliases .model_constants import DOMAIN_NAME
33
- from wlsdeploy .aliases .model_constants import PATH_TO_RCU_DB_CONN
34
- from wlsdeploy .aliases .model_constants import PATH_TO_RCU_PREFIX
35
30
from wlsdeploy .aliases .model_constants import TOPOLOGY
36
31
from wlsdeploy .aliases .wlst_modes import WlstModes
37
32
from wlsdeploy .exception import exception_helper
38
33
from wlsdeploy .exception .exception_types import ExceptionType
39
34
from wlsdeploy .logging .platform_logger import PlatformLogger
40
- from wlsdeploy .tool .create .rcudbinfo_helper import RcuDbInfo
35
+ from wlsdeploy .tool .create import rcudbinfo_helper
36
+ from wlsdeploy .tool .create .jps_config_helper import JpsConfigHelper
41
37
from wlsdeploy .tool .create .domain_creator import DomainCreator
42
38
from wlsdeploy .tool .util import model_context_helper
43
39
from wlsdeploy .tool .util .archive_helper import ArchiveList
44
40
from wlsdeploy .tool .util .wlst_helper import WlstHelper
45
41
from wlsdeploy .tool .util import wlst_helper
46
- from wlsdeploy .tool .validate .content_validator import CreateDomainContentValidator
42
+ from wlsdeploy .tool .validate .create_content_validator import CreateDomainContentValidator
47
43
from wlsdeploy .util import cla_helper
48
- from wlsdeploy .util import dictionary_utils
49
44
from wlsdeploy .util import env_helper
50
45
from wlsdeploy .util import getcreds
51
46
from wlsdeploy .util import string_utils
52
47
from wlsdeploy .util import tool_main
53
48
from wlsdeploy .util .cla_utils import CommandLineArgUtil
54
49
from wlsdeploy .util .cla_utils import TOOL_TYPE_CREATE
55
50
from wlsdeploy .util .exit_code import ExitCode
56
- from wlsdeploy .tool .create import atp_helper
57
- from wlsdeploy .tool .create import ssl_helper
58
- import wlsdeploy .tool .create .rcudbinfo_helper as rcudbinfo_helper
59
51
60
52
wlst_helper .wlst_functions = globals ()
61
53
@@ -198,77 +190,6 @@ def __process_opss_args(optional_arg_map):
198
190
optional_arg_map [CommandLineArgUtil .OPSS_WALLET_PASSPHRASE ] = str (String (passphrase ))
199
191
200
192
201
- def validate_rcu_args_and_model (model_context , model , archive_helper , aliases ):
202
- _method_name = 'validate_rcu_args_and_model'
203
-
204
- has_atpdbinfo = 0
205
- has_ssldbinfo = 0
206
-
207
- domain_info = dictionary_utils .get_dictionary_element (model , model_constants .DOMAIN_INFO )
208
-
209
- if model_context .get_domain_typedef ().requires_rcu ():
210
- if model_constants .RCU_DB_INFO in domain_info :
211
- rcu_info = domain_info [model_constants .RCU_DB_INFO ]
212
- rcu_db_info = RcuDbInfo (model_context , aliases , rcu_info )
213
-
214
- if string_utils .is_empty (rcu_db_info .get_rcu_prefix ()):
215
- ex = exception_helper .create_validate_exception ('WLSDPLY-12414' , model_context .get_domain_type (),
216
- PATH_TO_RCU_PREFIX )
217
- __logger .throwing (ex , class_name = _class_name , method_name = _method_name )
218
- raise ex
219
- #
220
- # Skip validating rcu_db_conn since is there is a tnsnames.ora file,
221
- # the connection string is picked up from there.
222
- #
223
- if string_utils .is_empty (rcu_db_info .get_rcu_schema_password ()):
224
- ex = exception_helper .create_validate_exception ('WLSDPLY-12414' , model_context .get_domain_type (),
225
- PATH_TO_RCU_SCHEMA_PASSWORD )
226
- __logger .throwing (ex , class_name = _class_name , method_name = _method_name )
227
- raise ex
228
-
229
- if model_context .is_run_rcu () and string_utils .is_empty (rcu_db_info .get_rcu_admin_password ()):
230
- ex = exception_helper .create_validate_exception ('WLSDPLY-12415' , model_context .get_domain_type (),
231
- CommandLineArgUtil .RUN_RCU_SWITCH , PATH_TO_RCU_ADMIN_PASSWORD )
232
- __logger .throwing (ex , class_name = _class_name , method_name = _method_name )
233
- raise ex
234
-
235
- has_tns_admin = rcu_db_info .has_tns_admin ()
236
- is_regular_db = rcu_db_info .is_regular_db ()
237
- has_atpdbinfo = rcu_db_info .has_atpdbinfo ()
238
- has_ssldbinfo = rcu_db_info .has_ssldbinfo ()
239
-
240
- _validate_atp_wallet_in_archive (archive_helper , is_regular_db , has_tns_admin , model )
241
- else :
242
- ex = exception_helper .create_validate_exception ('WLSDPLY-12408' , model_context .get_domain_type (),
243
- PATH_TO_RCU_DB_CONN , PATH_TO_RCU_PREFIX ,
244
- PATH_TO_RCU_ADMIN_PASSWORD , PATH_TO_RCU_SCHEMA_PASSWORD )
245
- __logger .throwing (ex , class_name = _class_name , method_name = _method_name )
246
- raise ex
247
-
248
- return has_atpdbinfo , has_ssldbinfo
249
-
250
-
251
- def _validate_atp_wallet_in_archive (archive_helper , is_regular_db , has_tns_admin , model ):
252
- _method_name = '_validate_atp_wallet_in_archive'
253
- if archive_helper and not is_regular_db :
254
- # 1. If it does not have the oracle.net.tns_admin specified, then see if it was extracted
255
- # 2. If it is plain old regular oracle db, do nothing
256
- # 3. If it does not have tns_admin in the model, then the wallet must be in the archive
257
- if not has_tns_admin :
258
- wallet_path = archive_helper .check_rcu_wallet_path ()
259
- if wallet_path :
260
- # update the model to add the tns_admin
261
- model [model_constants .DOMAIN_INFO ][model_constants .RCU_DB_INFO ][
262
- model_constants .DRIVER_PARAMS_NET_TNS_ADMIN ] = wallet_path
263
- else :
264
- ex = exception_helper .create_validate_exception ('WLSDPLY-12411' )
265
- __logger .throwing (ex , class_name = _class_name , method_name = _method_name )
266
- raise ex
267
-
268
- if not is_regular_db :
269
- System .setProperty ('oracle.jdbc.fanEnabled' , 'false' )
270
-
271
-
272
193
def _get_domain_path (model_context , model ):
273
194
"""
274
195
Returns the domain home path.
@@ -286,26 +207,31 @@ def _get_domain_path(model_context, model):
286
207
287
208
288
209
def _precheck_rcu_connectivity (model_context , creator , rcu_db_info ):
289
-
290
210
_method_name = '_precheck_rcu_connectivity'
211
+ __logger .entering (class_name = _class_name , method_name = _method_name )
212
+
291
213
domain_typename = model_context .get_domain_typedef ().get_domain_type ()
214
+ if model_context .get_domain_typedef ().requires_rcu () and not model_context .is_run_rcu ():
215
+ rcu_prefix = rcu_db_info .get_rcu_prefix ()
216
+ schema_name = None
217
+ if not string_utils .is_empty (rcu_prefix ):
218
+ user_name = model_context .get_weblogic_helper ().get_stb_user_name (rcu_prefix )
219
+ schema_name = user_name [len (rcu_prefix ) + 1 :]
220
+
221
+ if schema_name is None or schema_name not in model_context .get_domain_typedef ().get_rcu_schemas ():
222
+ __logger .exiting (class_name = _class_name , method_name = _method_name )
223
+ return
292
224
293
- if model_context .get_domain_typedef ().requires_rcu () and not model_context .is_run_rcu () and 'STB' in \
294
- model_context .get_domain_typedef ().get_rcu_schemas ():
295
- # how to create rcu_db_info ?
296
225
db_conn_props = None
297
- fmw_database , is_atp_ds , is_ssl_ds , keystore , keystore_pwd , keystore_type , rcu_prefix , rcu_schema_pwd , \
298
- tns_admin , truststore , truststore_pwd , \
299
- truststore_type = creator .get_rcu_basic_connection_info (rcu_db_info )
300
-
301
- if is_atp_ds :
302
- db_conn_props = creator .get_atp_standard_conn_properties (tns_admin , truststore , truststore_pwd ,
303
- truststore_type , keystore_pwd , keystore_type ,
304
- keystore )
305
- elif is_ssl_ds :
306
- db_conn_props = creator .get_ssl_standard_conn_properties (tns_admin , truststore , truststore_pwd ,
307
- truststore_type , keystore_pwd , keystore_type ,
308
- keystore )
226
+
227
+ rcu_database_type = rcu_db_info .get_rcu_database_type ()
228
+ tns_admin , rcu_prefix , jdbc_conn_string , rcu_schema_pwd = \
229
+ creator .get_rcu_datasource_basic_connection_info (rcu_db_info )
230
+
231
+ if rcu_db_info .is_use_atp () or rcu_db_info .is_use_ssl ():
232
+ db_conn_props = creator .get_jdbc_ssl_connection_properties (tns_admin , rcu_db_info .is_use_atp (), rcu_db_info )
233
+
234
+ jdbc_driver_name = creator .get_jdbc_driver_class_name (rcu_database_type )
309
235
310
236
try :
311
237
props = Properties ()
@@ -314,24 +240,29 @@ def _precheck_rcu_connectivity(model_context, creator, rcu_db_info):
314
240
for key in item .keys ():
315
241
props .put (key , item [key ])
316
242
317
- __logger .info ('WLSDPLY_12575' , 'test datasource' , fmw_database , rcu_prefix + "_STB" , props ,
318
- class_name = _class_name , method_name = _method_name )
243
+ __logger .info ('WLSDPLY_12575' , 'test datasource' , jdbc_conn_string , schema_name , props ,
244
+ class_name = _class_name , method_name = _method_name )
319
245
320
- props .put ('user' , rcu_prefix + "_STB" )
246
+ props .put ('user' , user_name )
321
247
props .put ('password' , rcu_schema_pwd )
322
248
323
- DriverManager .getConnection (fmw_database , props )
249
+ # Force the driver to be loaded and registered...
250
+ JClass .forName (jdbc_driver_name )
251
+ DriverManager .getConnection (jdbc_conn_string , props )
324
252
325
253
except (exceptions .Exception , JException ), e :
326
- ex = exception_helper .create_create_exception ('WLSDPLY-12505' , domain_typename , e . getClass (). getName (),
327
- e .getLocalizedMessage (), error = e )
254
+ ex = exception_helper .create_create_exception ('WLSDPLY-12505' , domain_typename ,
255
+ e .getClass (). getName (), e . getLocalizedMessage (), error = e )
328
256
__logger .throwing (ex , class_name = _class_name , method_name = _method_name )
329
257
raise ex
330
258
except ee :
331
259
ex = exception_helper .create_create_exception ('WLSDPLY-12506' , domain_typename , error = ee )
332
260
__logger .throwing (ex , class_name = _class_name , method_name = _method_name )
333
261
raise ex
334
262
263
+ __logger .exiting (class_name = _class_name , method_name = _method_name )
264
+
265
+
335
266
def main (model_context ):
336
267
"""
337
268
The entry point for the createDomain tool.
@@ -353,24 +284,23 @@ def main(model_context):
353
284
# set domain home result in model context, for use by deployers and helpers
354
285
model_context .set_domain_home (_get_domain_path (model_context , model_dictionary ))
355
286
356
- # check for any content problems in the merged, substituted model
357
- content_validator = CreateDomainContentValidator (model_context , aliases )
358
- content_validator .validate_model (model_dictionary )
359
-
360
287
archive_helper = None
361
288
archive_file_name = model_context .get_archive_file_name ()
362
289
if archive_file_name :
363
- domain_path = _get_domain_path (model_context , model_dictionary )
364
290
archive_helper = ArchiveList (archive_file_name , model_context , ExceptionType .CREATE )
365
- if archive_helper :
366
- if not os .path .exists (os .path .abspath (domain_path )):
367
- os .mkdir (os .path .abspath (domain_path ))
368
291
369
- archive_helper .extract_all_database_wallets ()
370
- archive_helper .extract_custom_directory ()
371
- archive_helper .extract_weblogic_remote_console_extension ()
292
+ # check for any content problems in the merged, substituted model
293
+ content_validator = CreateDomainContentValidator (model_context , archive_helper , aliases )
294
+ content_validator .validate_model (model_dictionary )
295
+
296
+ if archive_helper :
297
+ domain_path = _get_domain_path (model_context , model_dictionary )
298
+ if not os .path .exists (os .path .abspath (domain_path )):
299
+ os .mkdir (os .path .abspath (domain_path ))
372
300
373
- has_atp , has_ssl = validate_rcu_args_and_model (model_context , model_dictionary , archive_helper , aliases )
301
+ archive_helper .extract_all_database_wallets ()
302
+ archive_helper .extract_custom_directory ()
303
+ archive_helper .extract_weblogic_remote_console_extension ()
374
304
375
305
creator = DomainCreator (model_dictionary , model_context , aliases )
376
306
@@ -382,10 +312,8 @@ def main(model_context):
382
312
creator .create ()
383
313
384
314
if model_context .get_domain_typedef ().requires_rcu ():
385
- if has_atp :
386
- atp_helper .fix_jps_config (rcu_db_info , model_context )
387
- elif has_ssl :
388
- ssl_helper .fix_jps_config (rcu_db_info , model_context )
315
+ jps_config_helper = JpsConfigHelper (model_context , rcu_db_info )
316
+ jps_config_helper .fix_jps_config ()
389
317
390
318
except WLSDeployArchiveIOException , ex :
391
319
_exit_code = ExitCode .ERROR
0 commit comments