Search in sources :

Example 1 with ModuleDeployment

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;
}
Also used : ModuleDeployment(org.jboss.as.ejb3.deployment.ModuleDeployment) EjbDeploymentInformation(org.jboss.as.ejb3.deployment.EjbDeploymentInformation) DeploymentModuleIdentifier(org.jboss.as.ejb3.deployment.DeploymentModuleIdentifier)

Example 2 with ModuleDeployment

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);
}
Also used : ModuleDeployment(org.jboss.as.ejb3.deployment.ModuleDeployment) DeploymentModuleIdentifier(org.jboss.as.ejb3.deployment.DeploymentModuleIdentifier)

Example 3 with ModuleDeployment

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();
}
Also used : InjectedValue(org.jboss.msc.value.InjectedValue) ServiceTarget(org.jboss.msc.service.ServiceTarget) MarshallingConfigurationRepositoryValue(org.jboss.as.ejb3.component.stateful.MarshallingConfigurationRepositoryValue) AbstractService(org.jboss.msc.service.AbstractService) ValueDependency(org.wildfly.clustering.service.ValueDependency) InjectedValueDependency(org.wildfly.clustering.service.InjectedValueDependency) ValueService(org.jboss.msc.service.ValueService) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport) CacheFactoryBuilder(org.jboss.as.ejb3.cache.CacheFactoryBuilder) ImmediateValue(org.jboss.msc.value.ImmediateValue) ModuleDeployment(org.jboss.as.ejb3.deployment.ModuleDeployment) StartContext(org.jboss.msc.service.StartContext) EEModuleDescription(org.jboss.as.ee.component.EEModuleDescription) ServiceName(org.jboss.msc.service.ServiceName) Value(org.jboss.msc.value.Value) ImmediateValue(org.jboss.msc.value.ImmediateValue) MarshallingConfigurationRepositoryValue(org.jboss.as.ejb3.component.stateful.MarshallingConfigurationRepositoryValue) InjectedValue(org.jboss.msc.value.InjectedValue) Module(org.jboss.modules.Module) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 4 with ModuleDeployment

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;
}
Also used : ModuleDeployment(org.jboss.as.ejb3.deployment.ModuleDeployment) EjbDeploymentInformation(org.jboss.as.ejb3.deployment.EjbDeploymentInformation) DeploymentModuleIdentifier(org.jboss.as.ejb3.deployment.DeploymentModuleIdentifier)

Example 5 with ModuleDeployment

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;
    });
}
Also used : InjectedValue(org.jboss.msc.value.InjectedValue) ManagementEjbDeploymentInformation(org.jboss.as.jsr77.ejb.ManagementEjbDeploymentInformation) EjbDeploymentInformation(org.jboss.as.ejb3.deployment.EjbDeploymentInformation) HashMap(java.util.HashMap) Management(javax.management.j2ee.Management) ManagementHomeEjbComponentView(org.jboss.as.jsr77.ejb.ManagementHomeEjbComponentView) ManagementEjbDeploymentInformation(org.jboss.as.jsr77.ejb.ManagementEjbDeploymentInformation) ManagementRemoteEjbComponentView(org.jboss.as.jsr77.ejb.ManagementRemoteEjbComponentView) ManagementHome(javax.management.j2ee.ManagementHome) ModuleDeployment(org.jboss.as.ejb3.deployment.ModuleDeployment) ManagementHomeEjbComponentView(org.jboss.as.jsr77.ejb.ManagementHomeEjbComponentView) ManagementRemoteEjbComponentView(org.jboss.as.jsr77.ejb.ManagementRemoteEjbComponentView) ComponentView(org.jboss.as.ee.component.ComponentView) DeploymentModuleIdentifier(org.jboss.as.ejb3.deployment.DeploymentModuleIdentifier) DeploymentRepository(org.jboss.as.ejb3.deployment.DeploymentRepository)

Aggregations

ModuleDeployment (org.jboss.as.ejb3.deployment.ModuleDeployment)7 DeploymentModuleIdentifier (org.jboss.as.ejb3.deployment.DeploymentModuleIdentifier)6 EjbDeploymentInformation (org.jboss.as.ejb3.deployment.EjbDeploymentInformation)4 InjectedValue (org.jboss.msc.value.InjectedValue)3 HashMap (java.util.HashMap)2 ComponentView (org.jboss.as.ee.component.ComponentView)2 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)2 DeploymentRepository (org.jboss.as.ejb3.deployment.DeploymentRepository)2 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)2 Module (org.jboss.modules.Module)2 ServiceName (org.jboss.msc.service.ServiceName)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Management (javax.management.j2ee.Management)1 ManagementHome (javax.management.j2ee.ManagementHome)1 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)1 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)1 ViewDescription (org.jboss.as.ee.component.ViewDescription)1 StartupCountdown (org.jboss.as.ee.component.deployers.StartupCountdown)1