Search in sources :

Example 1 with EjbSecurityDeployer

use of org.jboss.as.ejb3.deployment.EjbSecurityDeployer in project wildfly by wildfly.

the class JaccEjbDeploymentProcessor method undeploy.

@Override
public void undeploy(DeploymentUnit deploymentUnit) {
    AbstractSecurityDeployer<?> deployer = null;
    deployer = new EjbSecurityDeployer();
    deployer.undeploy(deploymentUnit);
    // Jakarta Enterprise Beans maybe included directly in war deployment
    ServiceName jaccServiceName = getJaccServiceName(deploymentUnit);
    ServiceRegistry registry = deploymentUnit.getServiceRegistry();
    if (registry != null) {
        ServiceController<?> serviceController = registry.getService(jaccServiceName);
        if (serviceController != null) {
            serviceController.setMode(ServiceController.Mode.REMOVE);
        }
    }
}
Also used : EjbSecurityDeployer(org.jboss.as.ejb3.deployment.EjbSecurityDeployer) ServiceName(org.jboss.msc.service.ServiceName) ServiceRegistry(org.jboss.msc.service.ServiceRegistry)

Example 2 with EjbSecurityDeployer

use of org.jboss.as.ejb3.deployment.EjbSecurityDeployer in project wildfly by wildfly.

the class JaccEjbDeploymentProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    if (deploymentContainsEjbs(deploymentUnit) == false) {
        return;
    }
    AbstractSecurityDeployer<?> deployer = null;
    deployer = new EjbSecurityDeployer();
    JaccService<?> service = deployer.deploy(deploymentUnit);
    if (service != null) {
        final DeploymentUnit parentDU = deploymentUnit.getParent();
        // Jakarta Enterprise Beans maybe included directly in war deployment
        ServiceName jaccServiceName = getJaccServiceName(deploymentUnit);
        final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
        ServiceBuilder<?> builder = serviceTarget.addService(jaccServiceName, service);
        if (parentDU != null) {
            // add dependency to parent policy
            builder.addDependency(parentDU.getServiceName().append(JaccService.SERVICE_NAME), PolicyConfiguration.class, service.getParentPolicyInjector());
        }
        CapabilityServiceSupport capabilitySupport = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT);
        builder.addDependencies(capabilitySupport.getCapabilityServiceName(jaccCapabilityName));
        builder.setInitialMode(Mode.ACTIVE).install();
    }
}
Also used : EjbSecurityDeployer(org.jboss.as.ejb3.deployment.EjbSecurityDeployer) ServiceName(org.jboss.msc.service.ServiceName) ServiceTarget(org.jboss.msc.service.ServiceTarget) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Aggregations

EjbSecurityDeployer (org.jboss.as.ejb3.deployment.EjbSecurityDeployer)2 ServiceName (org.jboss.msc.service.ServiceName)2 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)1 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1 ServiceRegistry (org.jboss.msc.service.ServiceRegistry)1 ServiceTarget (org.jboss.msc.service.ServiceTarget)1