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

org.jboss.modules.Linkage Maven / Gradle / Ivy

There is a newer version: 2.1.6.Final
Show newest version
/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2014 Red Hat, Inc., and individual contributors
 * as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jboss.modules;

import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * The linkage state of a module.
 *
 * @author David M. Lloyd
 */
final class Linkage {

    private static final Dependency[] NO_DEPENDENCIES = new Dependency[0];
    private static final DependencySpec[] NO_DEPENDENCY_SPECS = new DependencySpec[0];

    enum State {
        NEW,
        UNLINKED,
        LINKING,
        LINKED,
        ;
    }

    private final DependencySpec[] dependencySpecs;
    private final Dependency[] dependencies;

    private final State state;
    private final Map> allPaths;

    Linkage(final State state) {
        this(NO_DEPENDENCY_SPECS, NO_DEPENDENCIES, state, Collections.>emptyMap());
    }

    Linkage(final DependencySpec[] dependencySpecs, final Dependency[] dependencies, final State state) {
        this(dependencySpecs, dependencies, state, Collections.>emptyMap());
    }

    Linkage(final DependencySpec[] dependencySpecs, final Dependency[] dependencies, final State state, final Map> allPaths) {
        this.dependencySpecs = dependencySpecs;
        this.dependencies = dependencies;
        this.state = state;
        this.allPaths = allPaths;
    }

    Map> getPaths() {
        return allPaths;
    }

    State getState() {
        return state;
    }

    Dependency[] getDependencies() {
        return dependencies;
    }

    DependencySpec[] getDependencySpecs() {
        return dependencySpecs;
    }

    static final Linkage NONE = new Linkage(State.NEW);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy