All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.as.ee.security.AbstractSecurityDeployer Maven / Gradle / Ivy

There is a newer version: 35.0.0.Beta1
Show newest version
/*
 * Copyright The WildFly Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package org.jboss.as.ee.security;

import org.jboss.as.server.deployment.AttachmentKey;
import org.jboss.as.server.deployment.DeploymentUnit;

/**
 * A helper class for security deployment processors
 *
 * @author Marcus Moyses
 * @author Anil Saldhana
 */
public abstract class AbstractSecurityDeployer {

    public JaccService deploy(DeploymentUnit deploymentUnit) {
        // build the Jakarta Authorization context id.
        String contextId = deploymentUnit.getName();
        if (deploymentUnit.getParent() != null) {
            contextId = deploymentUnit.getParent().getName() + "!" + contextId;
        }
        return deploy(deploymentUnit, contextId);
    }

    public JaccService deploy(DeploymentUnit deploymentUnit, String jaccContextId) {
        T metaData = deploymentUnit.getAttachment(getMetaDataType());
        Boolean standalone = Boolean.FALSE;
        // check if it is top level
        if (deploymentUnit.getParent() == null) {
            standalone = Boolean.TRUE;
        }
        return createService(jaccContextId, metaData, standalone);
    }

    public void undeploy(DeploymentUnit deploymentUnit) {

    }

    /**
     * Creates the appropriate service for metaData T
     * @param contextId
     * @param metaData
     * @param standalone
     * @return
     */
    protected abstract JaccService createService(String contextId, T metaData, Boolean standalone);

    /**
     * Return the type of metadata
     *
     * @return
     */
    protected abstract AttachmentKey getMetaDataType();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy