3434
3535import io .wcm .tooling .commons .packmgr .PackageManagerProperties ;
3636import io .wcm .tooling .commons .packmgr .install .VendorInstallerFactory ;
37+ import io .wcm .tooling .commons .packmgr .install .VendorInstallerFactory .Service ;
3738
3839/**
3940 * Common functionality for all mojos.
@@ -120,14 +121,14 @@ abstract class AbstractContentPackageMojo extends AbstractMojo {
120121 * before it is tried to upload and install a new package and after each upload.
121122 * </p>
122123 * <p>
123- * If not all packages are installed the upload is delayed up to 10 minutes, every 5 seconds the
124- * activation status is checked anew.
124+ * If not all bundles are activated the upload is delayed up to {@link #bundleStatusWaitLimit} seconds,
125+ * every 5 seconds the activation status is checked anew.
125126 * </p>
126127 * <p>
127128 * Expected is an URL like: http://localhost:4502/system/console/bundles/.json
128129 * </p>
129130 * <p>
130- * If the URL is not set it is derived from serviceURL. Set to "-" to explicitly disable the status check.
131+ * If the URL is not set it is derived from serviceURL. If set to "-" the status check is disabled .
131132 * </p>
132133 */
133134 @ Parameter (property = "vault.bundleStatusURL" , required = false )
@@ -140,6 +141,33 @@ abstract class AbstractContentPackageMojo extends AbstractMojo {
140141 @ Parameter (property = "vault.bundleStatusWaitLimit" , defaultValue = "360" )
141142 private int bundleStatusWaitLimit ;
142143
144+ /**
145+ * <p>
146+ * Package Manager install status JSON URL. If an URL is configured the installation status of packages and
147+ * embedded packages is checked before it is tried to upload and install a new package and after each upload.
148+ * </p>
149+ * <p>
150+ * If not all packages are installed the upload is delayed up to {@link #packageManagerInstallStatusWaitLimit}
151+ * seconds, every 5 seconds the installation status is checked anew.
152+ * </p>
153+ * <p>
154+ * Expected is an URL like: http://localhost:4502/crx/packmgr/installstatus.jsp
155+ * </p>
156+ * <p>
157+ * If the URL is not set it is derived from serviceURL. If set to "-" the status check is disabled.
158+ * </p>
159+ */
160+ @ Parameter (property = "vault.packageManagerInstallStatusURL" , required = false )
161+ private String packageManagerInstallStatusURL ;
162+
163+ /**
164+ * Number of seconds to wait as maximum for a positive package manager install status check.
165+ * If this limit is reached and the package manager status is still not positive the install of the package proceeds
166+ * anyway.
167+ */
168+ @ Parameter (property = "vault.packageManagerInstallStatusWaitLimit" , defaultValue = "360" )
169+ private int packageManagerInstallStatusWaitLimit ;
170+
143171 /**
144172 * Patterns for symbolic names of bundles that are expected to be not present in bundle list.
145173 * If any of these bundles are found in the bundle list, this system is assumed as not ready for installing further
@@ -211,6 +239,8 @@ protected PackageManagerProperties getPackageManagerProperties() throws MojoExec
211239 props .setBundleStatusWaitLimitSec (this .bundleStatusWaitLimit );
212240 props .setBundleStatusBlacklistBundleNames (ImmutableList .copyOf (this .bundleStatusBlacklistBundleNames ));
213241 props .setBundleStatusWhitelistBundleNames (ImmutableList .copyOf (this .bundleStatusWhitelistBundleNames ));
242+ props .setPackageManagerInstallStatusURL (buildPackageManagerInstallStatusUrl ());
243+ props .setPackageManagerInstallStatusWaitLimitSec (this .packageManagerInstallStatusWaitLimit );
214244 props .setRelaxedSSLCheck (this .relaxedSSLCheck );
215245 props .setHttpConnectTimeoutSec (this .httpConnectTimeoutSec );
216246 props .setHttpSocketTimeoutSec (this .httpSocketTimeout );
@@ -230,7 +260,7 @@ private String buildPackageManagerUrl() throws MojoExecutionException {
230260 serviceUrl = VendorInstallerFactory .getBaseUrl (serviceUrl ) + COMPOSUM_URL ;
231261 break ;
232262 default :
233- throw new MojoExecutionException ("Unsupporte service URL: " + serviceUrl );
263+ throw new MojoExecutionException ("Unsupported service URL: " + serviceUrl );
234264 }
235265 return serviceUrl ;
236266 }
@@ -247,6 +277,19 @@ private String buildBundleStatusUrl() throws MojoExecutionException {
247277 return baseUrl + "/system/console/bundles/.json" ;
248278 }
249279
280+ private String buildPackageManagerInstallStatusUrl () throws MojoExecutionException {
281+ if (StringUtils .equals (this .packageManagerInstallStatusURL , "-" )
282+ || VendorInstallerFactory .identify (this .serviceURL ) != Service .CRX ) {
283+ return null ;
284+ }
285+ if (this .packageManagerInstallStatusURL != null ) {
286+ return this .packageManagerInstallStatusURL ;
287+ }
288+ // if not set use hostname from serviceURL and add default path to bundle status
289+ String baseUrl = VendorInstallerFactory .getBaseUrl (buildPackageManagerUrl ());
290+ return baseUrl + "/crx/packmgr/installstatus.jsp" ;
291+ }
292+
250293 protected String buildConsoleUrl () {
251294 return VendorInstallerFactory .getBaseUrl (this .serviceURL ) + CONSOLE_URL ;
252295 }
0 commit comments