Skip to content

Commit 6dd2995

Browse files
addressing WDT-709, WDT-710, and a ServerTemplate issue introduced by PR #1345 (#1348)
1 parent 4163587 commit 6dd2995

File tree

9 files changed

+173
-100
lines changed

9 files changed

+173
-100
lines changed

core/src/main/java/oracle/weblogic/deploy/util/WLSDeployArchive.java

Lines changed: 81 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,27 @@ public class WLSDeployArchive {
4444
// Deprecated top-level archive subdirectory where the opss wallet is stored.
4545
public static final String OLD_ARCHIVE_OPSS_WALLET_PATH = "opsswallet";
4646

47+
/**
48+
* The archive subdirectory name where all database wallets are stored.
49+
*/
50+
public static final String DB_WALLETS_DIR_NAME = "dbWallets";
51+
52+
/**
53+
* The archive subdirectory name used by default for the database wallet for the RCU database.
54+
*/
55+
public static final String DEFAULT_RCU_WALLET_NAME = "rcu";
56+
57+
/**
58+
* Top-level archive subdirectory where all database wallets are stored in subdirectories.
59+
*/
60+
public static final String ARCHIVE_DB_WALLETS_DIR =
61+
String.format("%s/%s/", WLSDPLY_ARCHIVE_BINARY_DIR, DB_WALLETS_DIR_NAME);
62+
63+
/**
64+
* Default, top-level archive subdirectory where the database wallet for the RCU database is stored.
65+
*/
66+
public static final String DEFAULT_RCU_WALLET_PATH = ARCHIVE_DB_WALLETS_DIR + DEFAULT_RCU_WALLET_NAME;
67+
4768
/**
4869
* Top-level archive subdirectory where the atp wallet is stored.
4970
*/
@@ -514,6 +535,14 @@ public String addApplication(String appPath) throws WLSDeployArchiveIOException
514535
return newName;
515536
}
516537

538+
/**
539+
* Replace an existing application in the archive file.
540+
*
541+
* @param appPath the path within the archive of the app to remove
542+
* @param tempFile the file system location of the new app to replace the existing one
543+
* @return the archive path of the new application
544+
* @throws WLSDeployArchiveIOException if an IOException occurred while reading or writing changes
545+
*/
517546
public String replaceApplication(String appPath, String tempFile) throws WLSDeployArchiveIOException {
518547
final String METHOD = "replaceApplication";
519548
LOGGER.entering(CLASS, METHOD, appPath);
@@ -567,33 +596,29 @@ public List<String> listApplications() throws WLSDeployArchiveIOException {
567596
}
568597

569598
/**
570-
* Extract the ATP wallet in the archive.
599+
* Extract the named database wallet.
571600
*
572601
* @param domainHome the domain home directory
602+
* @param walletName the name of the database wallet to extract (e.g., rcu)
573603
* @return the full path to the directory containing the extracted wallet files or null, if no wallet was found.
574604
* @throws WLSDeployArchiveIOException if an error occurs while reading or extracting the archive files.
575605
*/
576-
public String extractATPWallet(File domainHome) throws WLSDeployArchiveIOException {
577-
final String METHOD = "extractATPWallet";
606+
public String extractDatabaseWallet(File domainHome, String walletName) throws WLSDeployArchiveIOException {
607+
final String METHOD = "extractDatabaseWallet";
578608

579-
LOGGER.entering(CLASS, METHOD, domainHome);
580-
validateExistingDirectory(domainHome, "domainHome", getArchiveFileName(), METHOD);
609+
LOGGER.entering(CLASS, METHOD, domainHome, walletName);
581610

582-
// Look in the updated location first
583611
String extractPath = null;
584-
List<String> zipEntries = getZipFile().listZipEntries(ARCHIVE_ATP_WALLET_PATH + ZIP_SEP);
585-
zipEntries.remove(ARCHIVE_ATP_WALLET_PATH + ZIP_SEP);
586-
if (!zipEntries.isEmpty()) {
587-
extractPath = ARCHIVE_ATP_WALLET_PATH + ZIP_SEP;
588-
extractWallet(domainHome, extractPath, zipEntries, null);
589-
extractPath = new File(domainHome, extractPath).getAbsolutePath();
612+
if (DEFAULT_RCU_WALLET_NAME.equals(walletName)) {
613+
// handle archive files with deprecated path, as needed
614+
extractPath = extractRCUWallet(domainHome);
590615
} else {
591-
// Look in the deprecated location.
592-
zipEntries = getZipFile().listZipEntries(OLD_ARCHIVE_ATP_WALLET_PATH + ZIP_SEP);
593-
zipEntries.remove(OLD_ARCHIVE_ATP_WALLET_PATH + ZIP_SEP);
616+
validateExistingDirectory(domainHome, "domainHome", getArchiveFileName(), METHOD);
617+
List<String> zipEntries = getZipFile().listZipEntries(ARCHIVE_DB_WALLETS_DIR + walletName + ZIP_SEP);
618+
zipEntries.remove(ARCHIVE_DB_WALLETS_DIR + walletName + ZIP_SEP);
594619
if (!zipEntries.isEmpty()) {
595-
extractPath = ARCHIVE_ATP_WALLET_PATH + ZIP_SEP;
596-
extractWallet(domainHome, extractPath, zipEntries, "WLSDPLY-01427");
620+
extractPath = ARCHIVE_DB_WALLETS_DIR + walletName + ZIP_SEP;
621+
extractWallet(domainHome, extractPath, zipEntries, null, null, null);
597622
extractPath = new File(domainHome, extractPath).getAbsolutePath();
598623
}
599624
}
@@ -621,15 +646,15 @@ public String extractOPSSWallet(File domainHome) throws WLSDeployArchiveIOExcept
621646
zipEntries.remove(ARCHIVE_OPSS_WALLET_PATH + ZIP_SEP);
622647
if (!zipEntries.isEmpty()) {
623648
extractPath = ARCHIVE_OPSS_WALLET_PATH + ZIP_SEP;
624-
extractWallet(domainHome, extractPath, zipEntries, null);
649+
extractWallet(domainHome, extractPath, zipEntries, null, null, null);
625650
extractPath = new File(domainHome, extractPath).getAbsolutePath();
626651
} else {
627652
// Look in the deprecated location.
628653
zipEntries = getZipFile().listZipEntries(OLD_ARCHIVE_OPSS_WALLET_PATH + ZIP_SEP);
629654
zipEntries.remove(OLD_ARCHIVE_OPSS_WALLET_PATH + ZIP_SEP);
630655
if (!zipEntries.isEmpty()) {
631656
extractPath = OLD_ARCHIVE_OPSS_WALLET_PATH + ZIP_SEP;
632-
extractWallet(domainHome, extractPath, zipEntries, "WLSDPLY-01433");
657+
extractWallet(domainHome, extractPath, zipEntries, "WLSDPLY-01433",null, null);
633658
extractPath = new File(domainHome, extractPath).getAbsolutePath();
634659
}
635660
}
@@ -1556,8 +1581,8 @@ protected String addUrlToZip(String zipPathPrefix, URL url, String extension, bo
15561581
return newName;
15571582
}
15581583

1559-
protected void extractWallet(File domainHome, String extractPath, List<String> zipEntries, String deprecationKey)
1560-
throws WLSDeployArchiveIOException {
1584+
protected void extractWallet(File domainHome, String extractPath, List<String> zipEntries, String deprecationKey,
1585+
String fromDir, String toDir) throws WLSDeployArchiveIOException {
15611586
final String METHOD = "extractWallet";
15621587
LOGGER.entering(CLASS, METHOD, domainHome, extractPath, zipEntries, deprecationKey);
15631588

@@ -1586,7 +1611,11 @@ protected void extractWallet(File domainHome, String extractPath, List<String> z
15861611
extractToLocation = new File(domainHome, WLSDPLY_ARCHIVE_BINARY_DIR);
15871612
LOGGER.warning(deprecationKey, getArchiveFileName(), zipEntry, extractPath);
15881613
}
1589-
extractFileFromZip(zipEntry, extractToLocation);
1614+
if (StringUtils.isEmpty(fromDir) && StringUtils.isEmpty(toDir)) {
1615+
extractFileFromZip(zipEntry, extractToLocation);
1616+
} else {
1617+
extractFileFromZip(zipEntry, fromDir, toDir, extractToLocation);
1618+
}
15901619
}
15911620
}
15921621
}
@@ -1765,6 +1794,36 @@ protected void extractFileFromZip(String itemToExtract, String fromDir, String t
17651794
LOGGER.exiting(CLASS, METHOD);
17661795
}
17671796

1797+
protected String extractRCUWallet(File domainHome) throws WLSDeployArchiveIOException {
1798+
final String METHOD = "extractRCUWallet";
1799+
1800+
LOGGER.entering(CLASS, METHOD, domainHome);
1801+
validateExistingDirectory(domainHome, "domainHome", getArchiveFileName(), METHOD);
1802+
1803+
// Look in the updated location first
1804+
String extractPath = null;
1805+
List<String> zipEntries = getZipFile().listZipEntries(DEFAULT_RCU_WALLET_PATH + ZIP_SEP);
1806+
zipEntries.remove(DEFAULT_RCU_WALLET_PATH + ZIP_SEP);
1807+
if (!zipEntries.isEmpty()) {
1808+
extractPath = DEFAULT_RCU_WALLET_PATH + ZIP_SEP;
1809+
extractWallet(domainHome, extractPath, zipEntries, null, null, null);
1810+
extractPath = new File(domainHome, extractPath).getAbsolutePath();
1811+
} else {
1812+
// Look in the deprecated location.
1813+
zipEntries = getZipFile().listZipEntries(OLD_ARCHIVE_ATP_WALLET_PATH + ZIP_SEP);
1814+
zipEntries.remove(OLD_ARCHIVE_ATP_WALLET_PATH + ZIP_SEP);
1815+
if (!zipEntries.isEmpty()) {
1816+
extractPath = DEFAULT_RCU_WALLET_PATH + ZIP_SEP;
1817+
extractWallet(domainHome, extractPath, zipEntries, "WLSDPLY-01427",
1818+
OLD_ARCHIVE_ATP_WALLET_PATH, DB_WALLETS_DIR_NAME + ZIP_SEP + DEFAULT_RCU_WALLET_NAME);
1819+
extractPath = new File(domainHome, extractPath).getAbsolutePath();
1820+
}
1821+
}
1822+
1823+
LOGGER.exiting(CLASS, METHOD, extractPath);
1824+
return extractPath;
1825+
}
1826+
17681827
///////////////////////////////////////////////////////////////////////////
17691828
// Private Helper methods used by the protected methods above... //
17701829
///////////////////////////////////////////////////////////////////////////

core/src/main/python/create.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def _validate_atp_wallet_in_archive(archive_helper, is_regular_db, has_tns_admin
264264
# 2. If it is plain old regular oracle db, do nothing
265265
# 3. If it deos not have tns_admin in the model, then the wallet must be in the archive
266266
if not has_tns_admin:
267-
wallet_path = archive_helper.extract_atp_wallet()
267+
wallet_path = archive_helper.extract_database_wallet()
268268
if wallet_path:
269269
# update the model to add the tns_admin
270270
model[model_constants.DOMAIN_INFO][model_constants.RCU_DB_INFO][
@@ -323,7 +323,7 @@ def main(model_context):
323323
# check if there is an atpwallet and extract in the domain dir
324324
# it is to support non JRF domain but user wants to use ATP database
325325
if has_atp and archive_helper:
326-
archive_helper.extract_atp_wallet()
326+
archive_helper.extract_database_wallet()
327327

328328
creator = DomainCreator(model_dictionary, model_context, aliases)
329329
creator.create()

core/src/main/python/wlsdeploy/tool/util/archive_helper.py

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -349,23 +349,30 @@ def get_archive_entries(self):
349349
self.__logger.exiting(class_name=self.__class_name, method_name=_method_name, result=all_entries)
350350
return all_entries
351351

352-
def extract_atp_wallet(self):
352+
def extract_database_wallet(self, wallet_name=WLSDeployArchive.DEFAULT_RCU_WALLET_NAME):
353353
"""
354-
Extract the and unzip the ATP wallet, if present, and return the path to the wallet directory.
354+
Extract the and unzip the named database wallet, if present, and return the path to
355+
the wallet directory.
355356
:return: the path to the extracted wallet, or None if no wallet was found
356357
:raises: BundleAwareException of the appropriate type: if an error occurs
357358
"""
358-
_method_name = 'extract_atp_wallet'
359+
_method_name = 'extract_database_wallet'
359360
self.__logger.entering(class_name=self.__class_name, method_name=_method_name)
360361

361-
wallet_path = None
362+
resulting_wallet_path = None
362363
for archive_file in self.__archive_files[::-1]:
363-
wallet_path = archive_file.extractATPWallet(self.__domain_home)
364+
wallet_path = archive_file.extractDatabaseWallet(self.__domain_home, wallet_name)
365+
# Allow iteration to continue through all archive files but
366+
# make sure to store off the path for a wallet that was extracted.
367+
#
364368
if wallet_path is not None:
365-
break
369+
# If multiple archives contain the same named wallet, they
370+
# will all have the same path.
371+
#
372+
resulting_wallet_path = wallet_path
366373

367-
self.__logger.exiting(class_name=self.__class_name, method_name=_method_name, result=wallet_path)
368-
return wallet_path
374+
self.__logger.exiting(class_name=self.__class_name, method_name=_method_name, result=resulting_wallet_path)
375+
return resulting_wallet_path
369376

370377
def extract_opss_wallet(self):
371378
"""
@@ -376,14 +383,20 @@ def extract_opss_wallet(self):
376383
_method_name = 'extract_opss_wallet'
377384
self.__logger.entering(class_name=self.__class_name, method_name=_method_name)
378385

379-
wallet_path = None
386+
resulting_wallet_path = None
380387
for archive_file in self.__archive_files[::-1]:
381388
wallet_path = archive_file.extractOPSSWallet(self.__domain_home)
389+
# Allow iteration to continue through all archive files but
390+
# make sure to store off the path for a wallet that was extracted.
391+
#
382392
if wallet_path is not None:
383-
break
393+
# If multiple archives contain the same named wallet, they
394+
# will all have the same path.
395+
#
396+
resulting_wallet_path = wallet_path
384397

385-
self.__logger.exiting(class_name=self.__class_name, method_name=_method_name, result=wallet_path)
386-
return wallet_path
398+
self.__logger.exiting(class_name=self.__class_name, method_name=_method_name, result=resulting_wallet_path)
399+
return resulting_wallet_path
387400

388401
def get_manifest(self, source_path):
389402
"""

core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ServerTemplate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,7 @@
15331533
],
15341534
"CleanupOrphanedSessionsEnabled": [ {"version": "[12.2.1.4,)", "wlst_mode": "both", "wlst_name": "CleanupOrphanedSessionsEnabled", "wlst_path": "WP001", "default_value": "false", "wlst_type": "boolean" } ],
15351535
"ClientCertProxyEnabled": [ {"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "ClientCertProxyEnabled", "wlst_path": "WP001", "default_value": "false", "wlst_type": "boolean" } ],
1536-
"Cluster": [ {"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "Cluster", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "get_method": "LSA", "set_method": "${MBEAN.set_server_cluster_mbean:MBEAN.set_cluster_mbean}", "set_mbean_type": "${:weblogic.management.configuration.ClusterMBean}" } ],
1536+
"Cluster": [ {"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "Cluster", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "get_method": "LSA", "set_method": "${:MBEAN.set_cluster_mbean}", "set_mbean_type": "${:weblogic.management.configuration.ClusterMBean}" } ],
15371537
"ClusterWeight": [ {"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "ClusterWeight", "wlst_path": "WP001", "default_value": 100, "wlst_type": "integer" } ],
15381538
"CoherenceClusterSystemResource": [ {"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "CoherenceClusterSystemResource", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "get_method": "LSA", "set_method": "${:MBEAN.set_coherence_cluster_mbean}", "set_mbean_type": "${:weblogic.management.configuration.CoherenceClusterSystemResourceMBean}" } ],
15391539
"CompleteCOMMessageTimeout": [ {"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "CompleteCOMMessageTimeout", "wlst_path": "WP001", "default_value": -1, "wlst_type": "integer" } ],

0 commit comments

Comments
 (0)