use of org.jboss.as.ejb3.deployment.ModuleDeployment in project wildfly by wildfly.
the class LocalEjbReceiver method findBean.
private EjbDeploymentInformation findBean(final EJBLocator<?> locator) {
final String appName = locator.getAppName();
final String moduleName = locator.getModuleName();
final String distinctName = locator.getDistinctName();
final String beanName = locator.getBeanName();
final DeploymentModuleIdentifier moduleIdentifier = new DeploymentModuleIdentifier(appName, moduleName, distinctName);
final ModuleDeployment module = deploymentRepository.getValue().getModules().get(moduleIdentifier);
if (module == null) {
throw EjbLogger.ROOT_LOGGER.unknownDeployment(locator);
}
final EjbDeploymentInformation ejbInfo = module.getEjbs().get(beanName);
if (ejbInfo == null) {
throw EjbLogger.ROOT_LOGGER.ejbNotFoundInDeployment(locator);
}
return ejbInfo;
}
use of org.jboss.as.ejb3.deployment.ModuleDeployment in project wildfly by wildfly.
the class AssociationImpl method findEJB.
private EjbDeploymentInformation findEJB(final String appName, final String moduleName, final String distinctName, final String beanName) {
final DeploymentModuleIdentifier ejbModule = new DeploymentModuleIdentifier(appName, moduleName, distinctName);
final Map<DeploymentModuleIdentifier, ModuleDeployment> modules = this.deploymentRepository.getStartedModules();
if (modules == null || modules.isEmpty()) {
return null;
}
final ModuleDeployment moduleDeployment = modules.get(ejbModule);
if (moduleDeployment == null) {
return null;
}
return moduleDeployment.getEjbs().get(beanName);
}
use of org.jboss.as.ejb3.deployment.ModuleDeployment in project wildfly by wildfly.
the class CacheDependenciesProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext context) {
DeploymentUnit unit = context.getDeploymentUnit();
final ServiceName name = unit.getServiceName();
EEModuleDescription moduleDescription = unit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
if (moduleDescription == null) {
return;
}
final CapabilityServiceSupport support = unit.getAttachment(org.jboss.as.server.deployment.Attachments.CAPABILITY_SERVICE_SUPPORT);
final ServiceTarget target = context.getServiceTarget();
@SuppressWarnings("rawtypes") Collection<ValueDependency<CacheFactoryBuilder>> cacheDependencies = moduleDescription.getComponentDescriptions().stream().filter(StatefulComponentDescription.class::isInstance).map(description -> new InjectedValueDependency<>(getCacheFactoryBuilderServiceName((StatefulComponentDescription) description), CacheFactoryBuilder.class)).distinct().collect(Collectors.toList());
Service<Void> service = new AbstractService<Void>() {
@Override
public void start(StartContext context) {
// Install dependencies for each distinct cache factory builder referenced by the deployment
cacheDependencies.stream().map(Value::getValue).distinct().forEach(builder -> builder.installDeploymentUnitDependencies(support, target, name));
}
};
ServiceBuilder<Void> builder = target.addService(name.append("cache-dependencies-installer"), service);
cacheDependencies.forEach(dependency -> dependency.register(builder));
builder.install();
// Install versioned marshalling configuration
InjectedValue<ModuleDeployment> deployment = new InjectedValue<>();
Module module = unit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
target.addService(MarshallingConfigurationRepositoryValue.getServiceName(name), new ValueService<>(new MarshallingConfigurationRepositoryValue(deployment, new ImmediateValue<>(module)))).addDependency(name.append(ModuleDeployment.SERVICE_NAME), ModuleDeployment.class, deployment).setInitialMode(ServiceController.Mode.ON_DEMAND).install();
}
use of org.jboss.as.ejb3.deployment.ModuleDeployment in project wildfly by wildfly.
the class RemoteObjectSubstitutionService method serviceForLocator.
private EjbIIOPService serviceForLocator(final EJBLocator<?> locator, DeploymentRepository deploymentRepository) {
final ModuleDeployment module = deploymentRepository.getModules().get(new DeploymentModuleIdentifier(locator.getAppName(), locator.getModuleName(), locator.getDistinctName()));
if (module == null) {
EjbLogger.ROOT_LOGGER.couldNotFindEjbForLocatorIIOP(locator);
return null;
}
final EjbDeploymentInformation ejb = module.getEjbs().get(locator.getBeanName());
if (ejb == null) {
EjbLogger.ROOT_LOGGER.couldNotFindEjbForLocatorIIOP(locator);
return null;
}
final EjbIIOPService factory = ejb.getIorFactory();
if (factory == null) {
EjbLogger.ROOT_LOGGER.ejbNotExposedOverIIOP(locator);
return null;
}
return factory;
}
use of org.jboss.as.ejb3.deployment.ModuleDeployment in project wildfly by wildfly.
the class RegisterManagementEJBService method start.
@Override
public void start(StartContext context) throws StartException {
final DeploymentRepository repository = deploymentRepositoryValue.getValue();
moduleIdentifier = new DeploymentModuleIdentifier(APP_NAME, MODULE_NAME, DISTINCT_NAME);
final InjectedValue<ComponentView> injectedHomeView = new InjectedValue<ComponentView>();
injectedHomeView.setValue(new ImmediateValue<ComponentView>(new ManagementHomeEjbComponentView()));
final InjectedValue<ComponentView> injectedRemoteView = new InjectedValue<ComponentView>();
injectedRemoteView.setValue(new ImmediateValue<ComponentView>(new ManagementRemoteEjbComponentView(mbeanServerValue.getValue())));
Map<String, InjectedValue<ComponentView>> views = new HashMap<String, InjectedValue<ComponentView>>();
views.put(ManagementHome.class.getName(), injectedHomeView);
views.put(Management.class.getName(), injectedRemoteView);
final EjbDeploymentInformation ejb = new ManagementEjbDeploymentInformation(EJB_NAME, views, SecurityActions.getClassLoader(this.getClass()));
final ModuleDeployment deployment = new ModuleDeployment(moduleIdentifier, Collections.singletonMap(EJB_NAME, ejb));
repository.add(moduleIdentifier, deployment);
repository.startDeployment(moduleIdentifier);
doPrivileged((PrivilegedAction<Void>) () -> {
final ClassLoader classLoader = getClass().getClassLoader();
EJBClientContext.getContextManager().setClassLoaderDefault(classLoader, ejbClientContextValue.getValue().getClientContext());
Discovery.getContextManager().setClassLoaderDefault(classLoader, Discovery.create(associationServiceInjector.getValue().getLocalDiscoveryProvider()));
return null;
});
}
Aggregations