@@ -71,6 +71,10 @@ public class WLSDeployArchive {
71
71
*/
72
72
public static final String ARCHIVE_CPLIB_TARGET_DIR = WLSDPLY_ARCHIVE_BINARY_DIR + "/classpathLibraries" ;
73
73
74
+ /**
75
+ * Top-level archive subdirectory where the $DOMAIN_HOME/bin scripts are stored.
76
+ */
77
+ public static final String ARCHIVE_DOM_BIN_TARGET_DIR = WLSDPLY_ARCHIVE_BINARY_DIR + "/domainBin" ;
74
78
/**
75
79
* Top-level archive subdirectory where the FileStore directories are stored and the subdirectory
76
80
* to which they will be extracted.
@@ -714,6 +718,62 @@ public void extractDomainLibLibrary(String archivePath, File extractToLocation)
714
718
LOGGER .exiting (CLASS , METHOD );
715
719
}
716
720
721
+ /**
722
+ * Adds a $DOMAIN_HOME/bin script to the archive. If a script with the same name already exists, this method
723
+ * assumes that the new one also needs to be added so it changes the name to prevent conflicts by adding a
724
+ * numeric value onto the file's basename (e.g., myscript(1).cmd, myscript(2).cmd).
725
+ *
726
+ * @param domainBinPath - File representing the actual path of the script file in the file system
727
+ * @return the relative path where the script is stored within the archive
728
+ * @throws WLSDeployArchiveIOException if an IOException occurred while reading or writing changes
729
+ * @throws IllegalArgumentException if the file or directory passed in does not exist
730
+ */
731
+ public String addDomainBinScript (File domainBinPath ) throws WLSDeployArchiveIOException {
732
+ final String METHOD = "addDomainBinScript" ;
733
+
734
+ LOGGER .entering (CLASS , METHOD , domainBinPath );
735
+ validateExistingFile (domainBinPath , "domainBinPath" , getArchiveFileName (), METHOD );
736
+
737
+ String newName = addItemToZip (ARCHIVE_DOM_BIN_TARGET_DIR , domainBinPath );
738
+ LOGGER .exiting (CLASS , METHOD , newName );
739
+ return newName ;
740
+ }
741
+
742
+ /**
743
+ * Get the list of $DOMAIN_HOME/bin script names in the archive.
744
+ *
745
+ * @return the list of $DOMAIN_HOME/bin script names
746
+ * @throws WLSDeployArchiveIOException if an error occurs reading the archive
747
+ */
748
+ public List <String > listDomainBinScripts () throws WLSDeployArchiveIOException {
749
+ final String METHOD = "listDomainBinScripts" ;
750
+
751
+ LOGGER .entering (CLASS , METHOD );
752
+ List <String > result = getZipFile ().listZipEntries (ARCHIVE_DOM_BIN_TARGET_DIR + ZIP_SEP );
753
+ // Remove the top-level directory entry from the list...
754
+ result .remove (ARCHIVE_DOM_BIN_TARGET_DIR + ZIP_SEP );
755
+ LOGGER .exiting (CLASS , METHOD , result );
756
+ return result ;
757
+ }
758
+
759
+ /**
760
+ * Extract the specified domain bin user script to the specified location (e.g., $DOMAIN_HOME/bin).
761
+ *
762
+ * @param archivePath the path of the script within the archive
763
+ * @param extractToLocation the location to write the file
764
+ * @throws WLSDeployArchiveIOException if an IOException occurred while extracting or writing the file
765
+ * @throws IllegalArgumentException if the file or directory passed in does not exist
766
+ */
767
+ public void extractDomainBinScript (String archivePath , File extractToLocation ) throws WLSDeployArchiveIOException {
768
+ final String METHOD = "extractDomainBinScript" ;
769
+
770
+ LOGGER .entering (CLASS , METHOD , archivePath , extractToLocation );
771
+ validateNonEmptyString (archivePath , "archivePath" , METHOD );
772
+ validateExistingDirectory (extractToLocation , "extractToLocation" , getArchiveFileName (), METHOD );
773
+
774
+ extractFileFromZip (archivePath , ARCHIVE_DOM_BIN_TARGET_DIR , "" , extractToLocation );
775
+ LOGGER .exiting (CLASS , METHOD );
776
+ }
717
777
/**
718
778
* This method adds a classpath library to the archive. If a library with the same name already exists, this
719
779
* method assumes that the new one also needs to be added so it changes the name to prevent conflicts by adding
0 commit comments