Skip to content

Commit 50976e2

Browse files
authored
Add attribute to type definition to apply JRF, 11g only (#374)
* JIRA WDT-336 - Create minimal model context for summary logging after CLA exception * JIRA WDT-371 - Create flag in type definition to apply JRF explicitly * JIRA WDT-371 - Update readme to describe APPLY_JRF targeting; broke out type definition page * JIRA WDT-371 - Refinements to typedef readme
1 parent 862ba2c commit 50976e2

File tree

11 files changed

+328
-218
lines changed

11 files changed

+328
-218
lines changed

core/src/main/python/create.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,10 @@ def main(args):
404404
__logger.severe('WLSDPLY-20008', _program_name, ex.getLocalizedMessage(), error=ex,
405405
class_name=_class_name, method_name=_method_name)
406406
__clean_up_temp_files()
407-
tool_exit.end(None, exit_code)
407+
408+
# create a minimal model for summary logging
409+
model_context = ModelContext(_program_name, dict())
410+
tool_exit.end(model_context, exit_code)
408411

409412
model_file = model_context.get_model_file()
410413
try:

core/src/main/python/deploy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,10 @@ def main(args):
446446
__logger.severe('WLSDPLY-20008', _program_name, ex.getLocalizedMessage(), error=ex,
447447
class_name=_class_name, method_name=_method_name)
448448
__clean_up_temp_files()
449-
tool_exit.end(None, exit_code)
449+
450+
# create a minimal model for summary logging
451+
model_context = ModelContext(_program_name, dict())
452+
tool_exit.end(model_context, exit_code)
450453

451454
model_file = model_context.get_model_file()
452455
try:

core/src/main/python/discover.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,10 @@ def main(args):
489489
if exit_code != CommandLineArgUtil.HELP_EXIT_CODE:
490490
__logger.severe('WLSDPLY-20008', _program_name, ex.getLocalizedMessage(), error=ex,
491491
class_name=_class_name, method_name=_method_name)
492-
__log_and_exit(None, exit_code, _class_name, _method_name)
492+
493+
# create a minimal model for summary logging
494+
model_context = ModelContext(_program_name, dict())
495+
__log_and_exit(model_context, exit_code, _class_name, _method_name)
493496

494497
try:
495498
__clear_archive_file(model_context)

core/src/main/python/update.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,10 @@ def main(args):
465465
__logger.severe('WLSDPLY-20008', _program_name, ex.getLocalizedMessage(), error=ex,
466466
class_name=_class_name, method_name=_method_name)
467467
__clean_up_temp_files()
468-
tool_exit.end(None, exit_code)
468+
469+
# create a minimal model for summary logging
470+
model_context = ModelContext(_program_name, dict())
471+
tool_exit.end(model_context, exit_code)
469472

470473
model_file = model_context.get_model_file()
471474
try:

core/src/main/python/wlsdeploy/tool/create/domain_creator.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
from wlsdeploy.tool.util.archive_helper import ArchiveHelper
7777
from wlsdeploy.tool.util.library_helper import LibraryHelper
7878
from wlsdeploy.tool.util.target_helper import TargetHelper
79+
from wlsdeploy.tool.util.targeting_types import TargetingType
7980
from wlsdeploy.tool.util.topology_helper import TopologyHelper
8081
from wlsdeploy.util import dictionary_utils
8182
from wlsdeploy.util import model as model_helper
@@ -416,12 +417,18 @@ def __extend_domain(self, domain_home):
416417
self.__configure_fmw_infra_database()
417418

418419
if self.wls_helper.is_set_server_groups_supported():
420+
# 12c versions set server groups directly
419421
server_groups_to_target = self._domain_typedef.get_server_groups_to_target()
420422
self.target_helper.target_server_groups_to_servers(server_groups_to_target)
421423
self.wlst_helper.update_domain()
422-
elif self._domain_typedef.is_jrf_domain_type():
424+
425+
elif self._domain_typedef.is_jrf_domain_type() or \
426+
(self._domain_typedef.get_targeting() == TargetingType.APPLY_JRF):
427+
# for 11g, if template list includes JRF, or if specified in domain typedef, use applyJRF
423428
self.target_helper.target_jrf_groups_to_clusters_servers(domain_home)
429+
424430
else:
431+
# for 11g, if no targeting was needed, just update the domain
425432
self.wlst_helper.update_domain()
426433

427434
self.wlst_helper.close_domain()

core/src/main/python/wlsdeploy/tool/create/domain_typedef.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from wlsdeploy.exception import exception_helper
1313
from wlsdeploy.json.json_translator import JsonToPython
1414
from wlsdeploy.logging.platform_logger import PlatformLogger
15+
from wlsdeploy.tool.util.targeting_types import TargetingType
1516
from wlsdeploy.util.cla_utils import CommandLineArgUtil
1617
from wlsdeploy.util.weblogic_helper import WebLogicHelper
1718

@@ -70,6 +71,8 @@ def __init__(self, program_name, domain_type):
7071
self._model_context = None
7172
self._version_typedef_name = None
7273

74+
self._targeting_type = self._resolve_targeting_type()
75+
7376
if 'system-elements' in self._domain_typedefs_dict:
7477
self._system_elements = self._domain_typedefs_dict['system-elements']
7578
else:
@@ -185,6 +188,13 @@ def required_rcu(self):
185188
# resolution for create.py argument processing.
186189
return 'rcuSchemas' in self._domain_typedef and len(self._domain_typedef['rcuSchemas']) > 0
187190

191+
def get_targeting(self):
192+
"""
193+
Get the targeting type for the domain, or None if not specified.
194+
:return: the TargetingType enum value for the domain, or None
195+
"""
196+
return self._targeting_type
197+
188198
def is_system_app(self, name):
189199
"""
190200
Determine if the specified name matches a WLS system application.
@@ -409,3 +419,32 @@ def __match_version_typedef(self, versions_dict):
409419
raise ex
410420
self._logger.exiting(self.__class_name, _method_name, result)
411421
return result
422+
423+
def _resolve_targeting_type(self):
424+
"""
425+
Determine the targeting type based on the value in the definition.
426+
Check for problems or incompatibilities.
427+
:return: the matching TargetType enum value
428+
:raises: ClaException: if there are problems or incompatibilities
429+
"""
430+
_method_name = '_resolve_targeting_type'
431+
432+
if 'targeting' not in self._domain_typedef:
433+
return None
434+
435+
targeting_text = self._domain_typedef['targeting']
436+
437+
# there are no valid targeting types for version 12c and up
438+
if self.wls_helper.is_set_server_groups_supported():
439+
ex = exception_helper.create_cla_exception('WLSDPLY-12311', targeting_text, self._domain_typedef_filename,
440+
self.wls_helper.get_weblogic_version())
441+
self._logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
442+
raise ex
443+
444+
# if specified, targeting must be one of the known types
445+
if targeting_text not in TargetingType:
446+
ex = exception_helper.create_cla_exception('WLSDPLY-12312', targeting_text, self._domain_typedef_filename)
447+
self._logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
448+
raise ex
449+
450+
return TargetingType[targeting_text]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""
2+
Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3+
The Universal Permissive License (UPL), Version 1.0
4+
"""
5+
from wlsdeploy.util.enum import Enum
6+
7+
TargetingType = Enum([
8+
'APPLY_JRF'
9+
])

core/src/main/python/wlsdeploy/util/enum.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
The Universal Permissive License (UPL), Version 1.0
44
"""
55
from oracle.weblogic.deploy.exception import ExceptionHelper
@@ -30,6 +30,12 @@ def __str__(self):
3030
def __iter__(self):
3131
return self
3232

33+
def __contains__(self, name):
34+
return name in self.enum_list
35+
36+
def __getitem__(self, name):
37+
return self.enum_list.index(name)
38+
3339
def next(self):
3440
if self.current < len(self.enum_list):
3541
result = self.enum_list[self.current]

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,8 @@ WLSDPLY-12308=Domain type {0} type definition in file {1} contained version {2}
10681068
matches WebLogic version {3}
10691069
WLSDPLY-12309=Domain type {0} type definition in file {1} did not contain a version that matched WebLogic version {2}
10701070
WLSDPLY-12310=Version {0} returned from the domain home
1071+
WLSDPLY-12311=Targeting type "{0}" in type definition file {1} is not allowed for WebLogic version {2}
1072+
WLSDPLY-12312=Targeting type "{0}" in type definition file {1} is not valid
10711073

10721074
# create.py
10731075
WLSDPLY-12400={0} got the JAVA_HOME {1} from the environment variable but it was not a valid location: {2}

site/create.md

Lines changed: 1 addition & 212 deletions
Original file line numberDiff line numberDiff line change
@@ -21,217 +21,6 @@ To have the Create Domain Tool run RCU, simply add the `-run_rcu` argument to th
2121

2222
It is also possible to specify the connection information in the model instead of using the command-line arguments. This is especially easier for databases that require complex database connection string and extra parameters, such as RAC or Oracle Autonomous Transaction Processing Cloud Service database. For information on how to use it, refer to [Specifying RCU connection information in the model](rcuinfo.md)
2323

24-
The Create Domain Tool has an extensible domain type system. The three built-in domain types (`WLS`, `RestrictedJRF`, and `JRF`) are defined in JSON files of the same name in the `WLSDEPLOY_HOME/lib/typedefs` directory. For example, the `JRF` domain type is defined in the `WLSDEPLOY_HOME/lib/typedefs/JRF.json` file whose contents look like those shown below.
25-
26-
```json
27-
{
28-
"copyright": "Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.",
29-
"license": "The Universal Permissive License (UPL), Version 1.0",
30-
"name": "JRF",
31-
"description": "JRF type domain definitions",
32-
"versions": {
33-
"12.1.2": "JRF_1212",
34-
"12.1.3": "JRF_1213",
35-
"12.2.1": "JRF_12CR2",
36-
"12.2.1.3": "JRF_12213"
37-
},
38-
"definitions": {
39-
"JRF_1212" : {
40-
"baseTemplate": "@@WL_HOME@@/common/templates/wls/wls.jar",
41-
"extensionTemplates": [
42-
"@@ORACLE_HOME@@/oracle_common/common/templates/wls/oracle.jrf_template_12.1.2.jar",
43-
"@@ORACLE_HOME@@/oracle_common/common/templates/wls/oracle.jrf.ws.async_template_12.1.2.jar",
44-
"@@ORACLE_HOME@@/oracle_common/common/templates/wls/oracle.wsmpm_template_12.1.2.jar",
45-
"@@ORACLE_HOME@@/em/common/templates/wls/oracle.em_wls_template_12.1.2.jar"
46-
],
47-
"serverGroupsToTarget" : [ "JRF-MAN-SVR", "WSMPM-MAN-SVR" ],
48-
"rcuSchemas": [ "MDS", "IAU", "IAU_VIEWER", "IAU_APPEND", "OPSS" ]
49-
},
50-
"JRF_1213" : {
51-
"baseTemplate": "@@WL_HOME@@/common/templates/wls/wls.jar",
52-
"extensionTemplates": [
53-
"@@ORACLE_HOME@@/oracle_common/common/templates/wls/oracle.jrf_template_12.1.3.jar",
54-
"@@ORACLE_HOME@@/oracle_common/common/templates/wls/oracle.jrf.ws.async_template_12.1.3.jar",
55-
"@@ORACLE_HOME@@/oracle_common/common/templates/wls/oracle.wsmpm_template_12.1.3.jar",
56-
"@@ORACLE_HOME@@/em/common/templates/wls/oracle.em_wls_template_12.1.3.jar"
57-
],
58-
"serverGroupsToTarget" : [ "JRF-MAN-SVR", "WSMPM-MAN-SVR" ],
59-
"rcuSchemas": [ "MDS", "IAU", "IAU_VIEWER", "IAU_APPEND", "OPSS" ]
60-
},
61-
"JRF_12CR2": {
62-
"baseTemplate": "Basic WebLogic Server Domain",
63-
"extensionTemplates": [
64-
"Oracle JRF WebServices Asynchronous services",
65-
"Oracle WSM Policy Manager",
66-
"Oracle Enterprise Manager"
67-
],
68-
"serverGroupsToTarget": [ "JRF-MAN-SVR", "WSMPM-MAN-SVR" ],
69-
"rcuSchemas": [ "MDS", "IAU", "IAU_VIEWER", "IAU_APPEND", "OPSS" ]
70-
},
71-
"JRF_12213": {
72-
"baseTemplate": "Basic WebLogic Server Domain",
73-
"extensionTemplates": [
74-
"Oracle JRF WebServices Asynchronous services",
75-
"Oracle WSM Policy Manager",
76-
"Oracle Enterprise Manager"
77-
],
78-
"serverGroupsToTarget": [ "JRF-MAN-SVR", "WSMPM-MAN-SVR" ],
79-
"rcuSchemas": [ "WLS", "MDS", "IAU", "IAU_VIEWER", "IAU_APPEND", "OPSS" ]
80-
}
81-
}
82-
}
83-
```
84-
85-
This file tells the Create Domain Tool which templates to use to create the domain, which server groups to target, and even which RCU schemas to create, all based on the version of WebLogic Server installed. New domain types can be defined by creating a new JSON file with the same structure in the `WLSDEPLOY_HOME/lib/typedefs` directory. For example, to define a `SOA` domain type for 12.2.1.3, add the `WLSDEPLOY_HOME/lib/typedefs/SOA.json` file with contents like those shown below.
86-
87-
```json
88-
{
89-
"name": "SOA",
90-
"description": "SOA type domain definitions",
91-
"versions": {
92-
"12.2.1.3": "SOA_12213"
93-
},
94-
"definitions": {
95-
"SOA_12213": {
96-
"baseTemplate": "Basic WebLogic Server Domain",
97-
"extensionTemplates": [
98-
"Oracle SOA Suite"
99-
],
100-
"serverGroupsToTarget": [ "JRF-MAN-SVR", "WSMPM-MAN-SVR", "SOA-MGD-SVRS" ],
101-
"rcuSchemas": [ "STB", "WLS", "MDS", "IAU", "IAU_VIEWER", "IAU_APPEND", "OPSS", "UCSUMS", "SOAINFRA" ]
102-
}
103-
}
104-
}
105-
```
106-
107-
After the new domain `typedef` file exists, simply specify the new domain type name to the `createDomain` script, being sure to reference an Oracle Home with the required components installed. For pre-12.2.1 versions, the `-wlst_path` argument must be used to point to the product home where the appropriate WLST shell script exists; for example, for SOA 12.1.3, add `-wlst_path <ORACLE_HOME>/soa` so that the tool uses the WLST shell script with the proper environment for SOA domains. In 12.2.1 and later, this is no longer necessary because the WLST shell script in the standard `<ORACLE_HOME>oracle_common/common/bin` directory will automatically load all components in the Oracle Home. Using the new domain type, simply run the following command to run RCU and create the SOA domain with all of its resources and applications deployed.
108-
109-
weblogic-deploy\bin\createDomain.cmd -oracle_home d:\SOA12213 -domain_type SOA -domain_parent d:\demo\domains -model_file DemoDomain.yaml -archive_file DemoDomain.zip -variable_file DemoDomain.properties -run_rcu -rcu_db mydb.example.com:1539/PDBORCL -rcu_prefix DEMO
110-
111-
To create more complex domains with clusters of different types, it is necessary to control the targeting of server groups to managed servers. By default, all server groups in the domain type definition are targeted to all managed servers. To create a SOA domain with SOA and OSB clusters, simply add the OSB template and server group to the SOA domain definition, as shown below.
112-
113-
```json
114-
{
115-
"name": "SOA",
116-
"description": "SOA type domain definitions",
117-
"versions": {
118-
"12.2.1.3": "SOA_12213"
119-
},
120-
"definitions": {
121-
"SOA_12213": {
122-
"baseTemplate": "Basic WebLogic Server Domain",
123-
"extensionTemplates": [
124-
"Oracle SOA Suite",
125-
"Oracle Service Bus"
126-
],
127-
"serverGroupsToTarget": [ "JRF-MAN-SVR", "WSMPM-MAN-SVR", "SOA-MGD-SVRS", "OSB-MGD-SVRS-COMBINED" ],
128-
"rcuSchemas": [ "STB", "WLS", "MDS", "IAU", "IAU_VIEWER", "IAU_APPEND", "OPSS", "UCSUMS", "SOAINFRA" ]
129-
}
130-
}
131-
}
132-
```
133-
134-
Then, use the `ServerGroupTargetingLimits` map in the `domainInfo` section to limit the targeting of the Web Services Manager, SOA, and OSB server groups to the `soa_cluster` or `osb_cluster`, as appropriate. In the example below, notice that the `JRF-MAN-SVR` server group is not listed; therefore, it will use the default targeting and be targeted to all managed servers. The value of each element in this section is a logical list of server and/or cluster names. As shown in the example, the value for each server group can be specified as a list, a comma-separated string, or a single-valued string. There is no semantic difference between listing a cluster's member server names versus using the cluster name; the example uses these simply to show what is possible.
135-
136-
```yaml
137-
domainInfo:
138-
AdminUserName: weblogic
139-
AdminPassword: welcome1
140-
ServerStartMode: prod
141-
ServerGroupTargetingLimits:
142-
'WSMPM-MAN-SVR': soa_cluster
143-
'SOA-MGD-SVRS': 'soa_server1,soa_server2'
144-
'OSB-MGD-SVRS-COMBINED': [ osb_server1, osb_server2 ]
145-
146-
topology:
147-
Name: soa_domain
148-
AdminServerName: AdminServer
149-
Cluster:
150-
soa_cluster:
151-
osb_cluster:
152-
Server:
153-
AdminServer:
154-
ListenAddress: myadmin.example.com
155-
ListenPort: 7001
156-
Machine: machine1
157-
SSL:
158-
Enabled: true
159-
ListenPort: 7002
160-
soa_server1:
161-
ListenAddress: managed1.example.com
162-
ListenPort: 8001
163-
Cluster: soa_cluster
164-
Machine: machine2
165-
SSL:
166-
Enabled: true
167-
ListenPort: 8002
168-
soa_server2:
169-
ListenAddress: managed2.example.com
170-
ListenPort: 8001
171-
Cluster: soa_cluster
172-
Machine: machine3
173-
SSL:
174-
Enabled: true
175-
ListenPort: 8002
176-
osb_server1:
177-
ListenAddress: managed1.example.com
178-
ListenPort: 9001
179-
Cluster: osb_cluster
180-
Machine: machine2
181-
SSL:
182-
Enabled: true
183-
ListenPort: 9002
184-
osb_server2:
185-
ListenAddress: managed2.example.com
186-
ListenPort: 9001
187-
Cluster: osb_cluster
188-
Machine: machine3
189-
SSL:
190-
Enabled: true
191-
ListenPort: 9002
192-
UnixMachine:
193-
machine1:
194-
NodeManager:
195-
ListenAddress: myadmin.example.com
196-
ListenPort: 5556
197-
machine2:
198-
NodeManager:
199-
ListenAddress: managed1.example.com
200-
ListenPort: 5556
201-
machine3:
202-
NodeManager:
203-
ListenAddress: managed2.example.com
204-
ListenPort: 5556
205-
SecurityConfiguration:
206-
NodeManagerUsername: weblogic
207-
NodeManagerPasswordEncrypted: welcome1
208-
```
209-
210-
The `customExtensionTemplates` attribute can be used to specify custom extension templates to be applied to the domain. These should be specified as absolute file paths, and can use tokens.
211-
212-
```json
213-
{
214-
"name": "MyCustom",
215-
"description": "My custom type domain definitions",
216-
"versions": {
217-
"12.2.1.3": "My_12213"
218-
},
219-
"definitions": {
220-
"My_12213": {
221-
"baseTemplate": "Basic WebLogic Server Domain",
222-
"extensionTemplates": [ ],
223-
"customExtensionTemplates": [
224-
"/user/me/templates/my-template.jar",
225-
"@@ORACLE_HOME@@/user_templates/other-template.jar"
226-
],
227-
"serverGroupsToTarget": [ "MY-MAN-SVR" ],
228-
"rcuSchemas": [ ]
229-
}
230-
}
231-
}
232-
```
233-
234-
If there are any server groups in the custom template that should be targeted to managed servers, they should be specified in the `serverGroupsToTarget` attribute, similar to `MY_MAN_SVR` in the example above.
24+
To create more complex domains, it may be necessary to create a custom domain type. This is useful for cases where the domain has custom templates, or templates for other Oracle products. For more information, refer to [Domain Type Definitions](type_def.md).
23525

23626
One last note is that if the model or variables file contains encrypted passwords, add the `-use_encryption` flag to the command line to tell the Create Domain Tool that encryption is being used and to prompt for the encryption passphrase. As with the database passwords, the tool can also read the passphrase from standard input (for example, `stdin`) to allow the tool to run without any user input.
237-

0 commit comments

Comments
 (0)