Skip to content

Commit 1d1a252

Browse files
committed
add singleton service support
1 parent 32baa34 commit 1d1a252

File tree

6 files changed

+64
-2
lines changed

6 files changed

+64
-2
lines changed

core/src/main/python/wlsdeploy/aliases/alias_entries.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ class AliasEntries(object):
108108
'Server': 'Server',
109109
'ServerTemplate': 'ServerTemplate',
110110
'ShutdownClass': 'ShutdownClass',
111+
'SingletonService' : 'SingletonService',
111112
'StartupClass': 'StartupClass',
112113
'UnixMachine': 'UnixMachine',
113114
'VirtualHost': 'VirtualHost',
@@ -161,6 +162,7 @@ class AliasEntries(object):
161162
'SAFAgent',
162163
'SelfTuning',
163164
'ShutdownClass',
165+
'SingletonService',
164166
'StartupClass',
165167
'WebAppContainer',
166168
'WLDFSystemResource'

core/src/main/python/wlsdeploy/aliases/model_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@
222222
SERVER_START_MODE = 'ServerStartMode'
223223
SERVER_TEMPLATE = 'ServerTemplate'
224224
SHUTDOWN_CLASS = 'ShutdownClass'
225+
SINGLETON_SERVICE= 'SingletonService'
225226
SMTP_NOTIFICATION = 'SMTPNotification'
226227
SNMP_NOTIFICATION = 'SNMPNotification'
227228
SOURCE_DESTINATION = 'SourceDestination'

core/src/main/python/wlsdeploy/tool/deploy/common_resources_deployer.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from wlsdeploy.aliases.model_constants import SELF_TUNING
1717
from wlsdeploy.aliases.model_constants import WORK_MANAGER
1818
from wlsdeploy.aliases.model_constants import WEBAPP_CONTAINER
19+
from wlsdeploy.aliases.model_constants import SINGLETON_SERVICE
1920
from wlsdeploy.aliases.model_constants import MIME_MAPPING_FILE
2021
from wlsdeploy.aliases.wlst_modes import WlstModes
2122
from wlsdeploy.tool.deploy.deployer import Deployer
@@ -184,3 +185,14 @@ def add_webapp_container(self, parent_dict, location):
184185
self.archive_helper.extract_file(file_path)
185186

186187
return
188+
189+
def add_singleton_service(self, parent_dict, location):
190+
"""
191+
Deploy the singleton service in the dictionary at the specified location.
192+
:param parent_dict: the dictionary possibly containing singleton service elements
193+
:param location: the location to deploy the elements
194+
"""
195+
singleton_services = dictionary_utils.get_dictionary_element(parent_dict, SINGLETON_SERVICE)
196+
self._add_named_elements(SINGLETON_SERVICE, singleton_services, location)
197+
198+
return

core/src/main/python/wlsdeploy/tool/deploy/resources_deployer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def _add_resources(self, location):
7272

7373
common_deployer.add_coherence_clusters(self._resources, location)
7474
common_deployer.add_webapp_container(self._resources, location)
75+
common_deployer.add_singleton_service(self._resources, location)
7576
return
7677

7778
def _add_startup_classes(self, location):

core/src/main/python/wlsdeploy/tool/discover/global_resources_discoverer.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ def discover(self):
4747
discoverer.add_to_model_if_not_empty(self._dictionary, model_top_folder_name, startups)
4848
model_top_folder_name, shutdowns = self.get_shutdown_classes()
4949
discoverer.add_to_model_if_not_empty(self._dictionary, model_top_folder_name, shutdowns)
50-
model_top_folder_name, shutdowns = self.get_webapp_container()
51-
discoverer.add_to_model_if_not_empty(self._dictionary, model_top_folder_name, shutdowns)
50+
model_top_folder_name, web_app_container = self.get_webapp_container()
51+
discoverer.add_to_model_if_not_empty(self._dictionary, model_top_folder_name, web_app_container)
52+
model_top_folder_name, singleton_services = self.get_singleton_service()
53+
discoverer.add_to_model_if_not_empty(self._dictionary, model_top_folder_name, singleton_services)
5254

5355
_logger.exiting(class_name=_class_name, method_name=_method_name)
5456
return self._dictionary
@@ -176,4 +178,27 @@ def _add_mimemapping_file_to_archive(self, web_app_container):
176178
_logger.exiting(class_name=_class_name, method_name=_method_name, result=new_name)
177179
return new_name
178180

181+
def get_singleton_service(self):
182+
"""
183+
Discover the SingletonService global resource settings
184+
:return: model name for the folder: dictionary containing the discovered SingletonService
185+
"""
186+
_method_name = 'get_singleton_service'
187+
_logger.entering(class_name=_class_name, method_name=_method_name)
188+
model_top_folder_name = model_constants.SINGLETON_SERVICE
189+
result = OrderedDict()
190+
location = LocationContext(self._base_location)
191+
location.append_location(model_top_folder_name)
192+
singleton_services = self._find_names_in_folder(location)
193+
if singleton_services is not None:
194+
_logger.info('WLSDPLY-06445', len(singleton_services), class_name=_class_name, method_name=_method_name)
195+
name_token = self._alias_helper.get_name_token(location)
196+
for singleton_service in singleton_services:
197+
_logger.info('WLSDPLY-06446', singleton_service, class_name=_class_name, method_name=_method_name)
198+
result[singleton_service] = OrderedDict()
199+
location.add_name_token(name_token, singleton_service)
200+
self._populate_model_parameters(result[singleton_service], location)
201+
location.remove_name_token(name_token)
179202

203+
_logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
204+
return model_top_folder_name, result
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"copyright": "Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.",
3+
"license": "The Universal Permissive License (UPL), Version 1.0",
4+
"wlst_type": "SingletonService${:s}",
5+
"child_folders_type": "multiple",
6+
"folders": {},
7+
"attributes": {
8+
"AdditionalMigrationAttempts": [ {"version": "[12,)", "wlst_mode": "both", "wlst_name": "AdditionalMigrationAttempts", "wlst_path": "WP001", "value": {"default": 2 }, "wlst_type": "integer" } ],
9+
"ClassName": [ {"version": "[12,)", "wlst_mode": "both", "wlst_name": "ClassName", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
10+
"Cluster": [ {"version": "[12,)", "wlst_mode": "both", "wlst_name": "Cluster", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
11+
"ConstrainedCandidateServer": [ {"version": "[12,)", "wlst_mode": "both", "wlst_name": "ConstrainedCandidateServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
12+
"HostingServer": [ {"version": "[12,)", "wlst_mode": "both", "wlst_name": "HostingServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
13+
"MillisToSleepBetweenAttempts": [ {"version": "[12,)", "wlst_mode": "both", "wlst_name": "MillisToSleepBetweenAttempts", "wlst_path": "WP001", "value": {"default": 30000 }, "wlst_type": "long" } ],
14+
"UserPreferredServer": [ {"version": "[12,)", "wlst_mode": "both", "wlst_name": "UserPreferredServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
15+
"Notes": [ {"version": "[12,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ]
16+
},
17+
"wlst_attributes_path": "WP001",
18+
"wlst_paths": {
19+
"WP001": "/SingletonService${:s}/%SINGLETONSERVICE%"
20+
}
21+
}

0 commit comments

Comments
 (0)