Skip to content

Commit

Permalink
WFCORE-6806 Add method to combine multiple DeploymentServiceInstaller
Browse files Browse the repository at this point in the history
  • Loading branch information
pferraro committed Apr 25, 2024
1 parent a65325c commit 9182b8f
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
*/
package org.wildfly.subsystem.service;

import java.util.Collection;
import java.util.List;

import org.jboss.as.server.deployment.DeploymentPhaseContext;

/**
Expand All @@ -16,4 +19,29 @@ public interface DeploymentServiceInstaller {
* @param context a deployment phase context
*/
void install(DeploymentPhaseContext context);

/**
* Returns a composite {@link DeploymentServiceInstaller} that installs the specified installers.
* @param installers a variable number of installers
* @return a composite installer
*/
static DeploymentServiceInstaller combine(DeploymentServiceInstaller... installers) {
return combine(List.of(installers));
}

/**
* Returns a composite {@link DeploymentServiceInstaller} that installs the specified installers.
* @param installers a collection of installers
* @return a composite installer
*/
static DeploymentServiceInstaller combine(Collection<? extends DeploymentServiceInstaller> installers) {
return new DeploymentServiceInstaller() {
@Override
public void install(DeploymentPhaseContext context) {
for (DeploymentServiceInstaller installer : installers) {
installer.install(context);
}
}
};
}
}

0 comments on commit 9182b8f

Please sign in to comment.