use of org.jboss.as.ejb3.deployment.DeploymentModuleIdentifier in project wildfly by wildfly.
the class AssociationImpl method registerModuleAvailabilityListener.
@Override
public ListenerHandle registerModuleAvailabilityListener(@NotNull final ModuleAvailabilityListener moduleAvailabilityListener) {
final DeploymentRepositoryListener listener = new DeploymentRepositoryListener() {
public void listenerAdded(final DeploymentRepository repository) {
List<ModuleAvailabilityListener.ModuleIdentifier> identifierList = new ArrayList<>();
for (DeploymentModuleIdentifier identifier : repository.getModules().keySet()) {
final ModuleAvailabilityListener.ModuleIdentifier moduleIdentifier = toModuleIdentifier(identifier);
identifierList.add(moduleIdentifier);
}
moduleAvailabilityListener.moduleAvailable(identifierList);
}
private ModuleAvailabilityListener.ModuleIdentifier toModuleIdentifier(final DeploymentModuleIdentifier identifier) {
return new ModuleAvailabilityListener.ModuleIdentifier(identifier.getApplicationName(), identifier.getModuleName(), identifier.getDistinctName());
}
public void deploymentAvailable(final DeploymentModuleIdentifier deployment, final ModuleDeployment moduleDeployment) {
moduleAvailabilityListener.moduleAvailable(Collections.singletonList(toModuleIdentifier(deployment)));
}
public void deploymentStarted(final DeploymentModuleIdentifier deployment, final ModuleDeployment moduleDeployment) {
}
public void deploymentRemoved(final DeploymentModuleIdentifier deployment) {
moduleAvailabilityListener.moduleUnavailable(Collections.singletonList(toModuleIdentifier(deployment)));
}
@Override
public void deploymentSuspended(DeploymentModuleIdentifier deployment) {
moduleAvailabilityListener.moduleUnavailable(Collections.singletonList(toModuleIdentifier(deployment)));
}
@Override
public void deploymentResumed(DeploymentModuleIdentifier deployment) {
moduleAvailabilityListener.moduleAvailable(Collections.singletonList(toModuleIdentifier(deployment)));
}
};
deploymentRepository.addListener(listener);
return () -> deploymentRepository.removeListener(listener);
}
Aggregations