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

org.jboss.as.ee.naming.JavaNamespaceSetup 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.naming;

import org.jboss.as.naming.WritableServiceBasedNamingStore;
import org.jboss.as.naming.context.NamespaceContextSelector;
import org.jboss.as.server.deployment.SetupAction;
import org.jboss.msc.service.ServiceName;

import java.util.Collections;
import java.util.Map;
import java.util.Set;

/**
 * Sets and restores the java: contexts
 *
 * @author Stuart Douglas
 *
 */
public class JavaNamespaceSetup implements SetupAction {

    private final NamespaceContextSelector namespaceSelector;
    private final ServiceName deploymentUnitServiceName;

    public JavaNamespaceSetup(final NamespaceContextSelector namespaceSelector, final ServiceName deploymentUnitServiceName) {
        this.namespaceSelector = namespaceSelector;
        this.deploymentUnitServiceName = deploymentUnitServiceName;
    }

    @Override
    public int priority() {
        return 1000;
    }

    @Override
    public Set dependencies() {
        return Collections.emptySet();
    }

    @Override
    public void setup(Map properties) {
        NamespaceContextSelector.pushCurrentSelector(namespaceSelector);
        WritableServiceBasedNamingStore.pushOwner(deploymentUnitServiceName);
    }

    @Override
    public void teardown(Map properties) {
        NamespaceContextSelector.popCurrentSelector();
        WritableServiceBasedNamingStore.popOwner();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy