@@ -44,6 +44,27 @@ public class WLSDeployArchive {
44
44
// Deprecated top-level archive subdirectory where the opss wallet is stored.
45
45
public static final String OLD_ARCHIVE_OPSS_WALLET_PATH = "opsswallet" ;
46
46
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
+
47
68
/**
48
69
* Top-level archive subdirectory where the atp wallet is stored.
49
70
*/
@@ -514,6 +535,14 @@ public String addApplication(String appPath) throws WLSDeployArchiveIOException
514
535
return newName ;
515
536
}
516
537
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
+ */
517
546
public String replaceApplication (String appPath , String tempFile ) throws WLSDeployArchiveIOException {
518
547
final String METHOD = "replaceApplication" ;
519
548
LOGGER .entering (CLASS , METHOD , appPath );
@@ -567,33 +596,29 @@ public List<String> listApplications() throws WLSDeployArchiveIOException {
567
596
}
568
597
569
598
/**
570
- * Extract the ATP wallet in the archive .
599
+ * Extract the named database wallet .
571
600
*
572
601
* @param domainHome the domain home directory
602
+ * @param walletName the name of the database wallet to extract (e.g., rcu)
573
603
* @return the full path to the directory containing the extracted wallet files or null, if no wallet was found.
574
604
* @throws WLSDeployArchiveIOException if an error occurs while reading or extracting the archive files.
575
605
*/
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 " ;
578
608
579
- LOGGER .entering (CLASS , METHOD , domainHome );
580
- validateExistingDirectory (domainHome , "domainHome" , getArchiveFileName (), METHOD );
609
+ LOGGER .entering (CLASS , METHOD , domainHome , walletName );
581
610
582
- // Look in the updated location first
583
611
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 );
590
615
} 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 );
594
619
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 );
597
622
extractPath = new File (domainHome , extractPath ).getAbsolutePath ();
598
623
}
599
624
}
@@ -621,15 +646,15 @@ public String extractOPSSWallet(File domainHome) throws WLSDeployArchiveIOExcept
621
646
zipEntries .remove (ARCHIVE_OPSS_WALLET_PATH + ZIP_SEP );
622
647
if (!zipEntries .isEmpty ()) {
623
648
extractPath = ARCHIVE_OPSS_WALLET_PATH + ZIP_SEP ;
624
- extractWallet (domainHome , extractPath , zipEntries , null );
649
+ extractWallet (domainHome , extractPath , zipEntries , null , null , null );
625
650
extractPath = new File (domainHome , extractPath ).getAbsolutePath ();
626
651
} else {
627
652
// Look in the deprecated location.
628
653
zipEntries = getZipFile ().listZipEntries (OLD_ARCHIVE_OPSS_WALLET_PATH + ZIP_SEP );
629
654
zipEntries .remove (OLD_ARCHIVE_OPSS_WALLET_PATH + ZIP_SEP );
630
655
if (!zipEntries .isEmpty ()) {
631
656
extractPath = OLD_ARCHIVE_OPSS_WALLET_PATH + ZIP_SEP ;
632
- extractWallet (domainHome , extractPath , zipEntries , "WLSDPLY-01433" );
657
+ extractWallet (domainHome , extractPath , zipEntries , "WLSDPLY-01433" , null , null );
633
658
extractPath = new File (domainHome , extractPath ).getAbsolutePath ();
634
659
}
635
660
}
@@ -1556,8 +1581,8 @@ protected String addUrlToZip(String zipPathPrefix, URL url, String extension, bo
1556
1581
return newName ;
1557
1582
}
1558
1583
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 {
1561
1586
final String METHOD = "extractWallet" ;
1562
1587
LOGGER .entering (CLASS , METHOD , domainHome , extractPath , zipEntries , deprecationKey );
1563
1588
@@ -1586,7 +1611,11 @@ protected void extractWallet(File domainHome, String extractPath, List<String> z
1586
1611
extractToLocation = new File (domainHome , WLSDPLY_ARCHIVE_BINARY_DIR );
1587
1612
LOGGER .warning (deprecationKey , getArchiveFileName (), zipEntry , extractPath );
1588
1613
}
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
+ }
1590
1619
}
1591
1620
}
1592
1621
}
@@ -1765,6 +1794,36 @@ protected void extractFileFromZip(String itemToExtract, String fromDir, String t
1765
1794
LOGGER .exiting (CLASS , METHOD );
1766
1795
}
1767
1796
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
+
1768
1827
///////////////////////////////////////////////////////////////////////////
1769
1828
// Private Helper methods used by the protected methods above... //
1770
1829
///////////////////////////////////////////////////////////////////////////
0 commit comments