Search in sources :

Example 1 with Registration

use of org.jboss.as.ejb3.subsystem.ApplicationSecurityDomainService.Registration in project wildfly by wildfly.

the class EjbClientContextSetupProcessor method deploy.

@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
    if (module == null) {
        return;
    }
    RegistrationService registrationService = new RegistrationService(module);
    ServiceName registrationServiceName = deploymentUnit.getServiceName().append("ejb3", "client-context", "registration-service");
    final ServiceName profileServiceName = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_REMOTING_PROFILE_SERVICE_NAME);
    final ServiceBuilder<Void> builder = phaseContext.getServiceTarget().addService(registrationServiceName, registrationService).addDependency(getEJBClientContextServiceName(phaseContext), EJBClientContextService.class, registrationService.ejbClientContextInjectedValue).addDependency(getDiscoveryServiceName(phaseContext), Discovery.class, registrationService.discoveryInjector);
    if (profileServiceName != null) {
        builder.addDependency(profileServiceName, RemotingProfileService.class, registrationService.profileServiceInjectedValue);
    }
    builder.install();
    final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
    if (moduleDescription == null) {
        return;
    }
    //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);
    }
}
Also used : ComponentDescription(org.jboss.as.ee.component.ComponentDescription) EEModuleDescription(org.jboss.as.ee.component.EEModuleDescription) ServiceName(org.jboss.msc.service.ServiceName) EJBClientContextService(org.jboss.as.ejb3.remote.EJBClientContextService) Module(org.jboss.modules.Module) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 2 with Registration

use of org.jboss.as.ejb3.subsystem.ApplicationSecurityDomainService.Registration in project wildfly by wildfly.

the class EJBSecurityDomainService method start.

@Override
public synchronized void start(StartContext context) throws StartException {
    ApplicationSecurityDomain applicationSecurityDomain = getApplicationSecurityDomain();
    BiFunction<String, ClassLoader, Registration> securityFunction = applicationSecurityDomain != null ? applicationSecurityDomain.getSecurityFunction() : null;
    if (securityFunction != null) {
        final String deploymentName = deploymentUnit.getParent() == null ? deploymentUnit.getName() : deploymentUnit.getParent().getName() + "." + deploymentUnit.getName();
        final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
        final ClassLoader classLoader = module.getClassLoader();
        registration = securityFunction.apply(deploymentName, classLoader);
    }
}
Also used : Registration(org.jboss.as.ejb3.subsystem.ApplicationSecurityDomainService.Registration) Module(org.jboss.modules.Module) ApplicationSecurityDomain(org.jboss.as.ejb3.subsystem.ApplicationSecurityDomainService.ApplicationSecurityDomain)

Aggregations

Module (org.jboss.modules.Module)2 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)1 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)1 EJBClientContextService (org.jboss.as.ejb3.remote.EJBClientContextService)1 ApplicationSecurityDomain (org.jboss.as.ejb3.subsystem.ApplicationSecurityDomainService.ApplicationSecurityDomain)1 Registration (org.jboss.as.ejb3.subsystem.ApplicationSecurityDomainService.Registration)1 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1 ServiceName (org.jboss.msc.service.ServiceName)1