Skip to content

Commit

Permalink
[WFLY-10578] Removing DependencyType argument from ComponentDescripti…
Browse files Browse the repository at this point in the history
…on.addDependency() method and fixing usages accordingly.
  • Loading branch information
ropalka committed Jun 14, 2018
1 parent 7027657 commit 4070bbf
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 22 deletions.
Expand Up @@ -49,6 +49,7 @@
* A description of a generic Java EE component. The description is pre-classloading so it references everything by name.
*
* @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public class ComponentDescription implements ResourceInjectionTarget {

Expand Down Expand Up @@ -428,22 +429,13 @@ public EEModuleDescription getModuleDescription() {
* take effect.
*
* @param serviceName the service name of the dependency
* @param type the type of the dependency (required or optional)
*/
public void addDependency(ServiceName serviceName, ServiceBuilder.DependencyType type) {
public void addDependency(ServiceName serviceName) {
if (serviceName == null) {
throw EeLogger.ROOT_LOGGER.nullVar("serviceName", "component", componentName);
}
if (type == null) {
throw EeLogger.ROOT_LOGGER.nullVar("type", "component", componentName);
}
final Map<ServiceName, ServiceBuilder.DependencyType> dependencies = this.dependencies;
final ServiceBuilder.DependencyType dependencyType = dependencies.get(serviceName);
if (dependencyType == ServiceBuilder.DependencyType.REQUIRED) {
dependencies.put(serviceName, ServiceBuilder.DependencyType.REQUIRED);
} else {
dependencies.put(serviceName, type);
}
dependencies.put(serviceName, ServiceBuilder.DependencyType.REQUIRED);
}

/**
Expand Down
Expand Up @@ -311,7 +311,7 @@ public EJBComponentDescription(final String componentName, final String componen

//add a dependency on the module deployment service
//we need to make sure this is up before the EJB starts, so that remote invocations are available
addDependency(deploymentUnitServiceName.append(ModuleDeployment.SERVICE_NAME), ServiceBuilder.DependencyType.REQUIRED);
addDependency(deploymentUnitServiceName.append(ModuleDeployment.SERVICE_NAME));

getConfigurators().addFirst(EJBValidationConfigurator.INSTANCE);
getConfigurators().add(new ComponentConfigurator() {
Expand Down
Expand Up @@ -107,7 +107,7 @@ public MessageDrivenComponentDescription(final String componentName, final Strin
this.messageListenerInterfaceName = messageListenerInterfaceName;

// setup a dependency on the EJBUtilities service
this.addDependency(EJBUtilities.SERVICE_NAME, ServiceBuilder.DependencyType.REQUIRED);
this.addDependency(EJBUtilities.SERVICE_NAME);

registerView(getEJBClassName(), MethodIntf.MESSAGE_ENDPOINT);
// add the interceptor which will invoke the setMessageDrivenContext() method on a MDB which implements
Expand Down
Expand Up @@ -99,7 +99,7 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU
}
//we need to make sure all our components have a dependency on the EJB client context registration, which in turn implies a dependency on the context
for(final ComponentDescription component : moduleDescription.getComponentDescriptions()) {
component.addDependency(registrationServiceName, ServiceBuilder.DependencyType.REQUIRED);
component.addDependency(registrationServiceName);
}
}

Expand Down
Expand Up @@ -40,7 +40,6 @@
import org.jboss.as.server.deployment.module.ResourceRoot;
import org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex;
import org.jboss.metadata.ejb.spec.SessionBean31MetaData;
import org.jboss.msc.service.ServiceBuilder.DependencyType;

import static org.jboss.as.ejb3.logging.EjbLogger.ROOT_LOGGER;

Expand Down Expand Up @@ -101,7 +100,7 @@ private void setupDependencies(final EJBComponentDescription description, final
}
final ComponentDescription component = components.iterator().next();

description.addDependency(component.getStartServiceName(), DependencyType.REQUIRED);
description.addDependency(component.getStartServiceName());
if (description instanceof SingletonComponentDescription) {
((SingletonComponentDescription)description).getDependsOn().add(component.getStartServiceName());
if (ROOT_LOGGER.isDebugEnabled()) {
Expand Down
Expand Up @@ -46,7 +46,6 @@
import org.jboss.modules.Module;
import org.jboss.modules.ModuleIdentifier;
import org.jboss.modules.ModuleLoader;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceName;
import org.jipijapa.plugin.spi.PersistenceUnitMetadata;

Expand Down Expand Up @@ -157,7 +156,7 @@ private static void addPUServiceDependencyToComponents(final Collection<Componen
final ServiceName puServiceName = PersistenceUnitServiceImpl.getPUServiceName(pu);
for (final ComponentDescription component : components) {
ROOT_LOGGER.debugf("Adding dependency on PU service %s for component %s", puServiceName, component.getComponentClassName());
component.addDependency(puServiceName, ServiceBuilder.DependencyType.REQUIRED);
component.addDependency(puServiceName);
}
}
}
Expand Down
Expand Up @@ -46,7 +46,6 @@
import org.jboss.as.webservices.service.EndpointService;
import org.jboss.invocation.AccessCheckingInterceptor;
import org.jboss.jandex.ClassInfo;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceName;

/**
Expand Down Expand Up @@ -89,7 +88,7 @@ static ComponentDescription createComponentDescription(final DeploymentUnit unit
moduleDescription.addComponent(componentDescription);
// register WS dependency
final ServiceName endpointServiceName = EndpointService.getServiceName(unit, dependsOnEndpointClassName);
componentDescription.addDependency(endpointServiceName, ServiceBuilder.DependencyType.REQUIRED);
componentDescription.addDependency(endpointServiceName);

return componentDescription;
}
Expand Down
Expand Up @@ -52,7 +52,6 @@
import org.jboss.as.webservices.util.WSAttachmentKeys;
import org.jboss.jandex.ClassInfo;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceName;
import org.jboss.vfs.VirtualFile;
import org.jboss.wsf.spi.metadata.config.EndpointConfig;
Expand Down Expand Up @@ -153,7 +152,7 @@ private static void propagateNamingContext(final ComponentDescription jaxwsHandl
// configure JAXWS EJB3 handler to be able to see EJB3 environment
jaxwsHandlerDescription.setContextServiceName(ejbContextServiceName);
jaxwsHandlerDescription.setDeploymentDescriptorEnvironment(ejbEnv);
jaxwsHandlerDescription.addDependency(ejbContextServiceName, ServiceBuilder.DependencyType.REQUIRED);
jaxwsHandlerDescription.addDependency(ejbContextServiceName);
}

}

0 comments on commit 4070bbf

Please sign in to comment.