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

org.wildfly.swarm.arquillian.adapter.DependencyDeclarationFactory Maven / Gradle / Ivy

There is a newer version: 2.7.0.Final
Show newest version
package org.wildfly.swarm.arquillian.adapter;

import org.wildfly.swarm.arquillian.resolver.ShrinkwrapArtifactResolvingHelper;
import org.wildfly.swarm.internal.FileSystemLayout;
import org.wildfly.swarm.tools.DeclaredDependencies;

import java.util.ServiceLoader;

/**
 * @author Heiko Braun
 * @since 26/10/2016
 */
public interface DependencyDeclarationFactory {

    DeclaredDependencies create(FileSystemLayout fsLayout, ShrinkwrapArtifactResolvingHelper resolvingHelper);

    boolean acceptsFsLayout(FileSystemLayout fsLayout);

    static DependencyDeclarationFactory newInstance(FileSystemLayout fsLayout) {
        ServiceLoader factoryIterable = ServiceLoader.load(DependencyDeclarationFactory.class);
        for (DependencyDeclarationFactory factory : factoryIterable) {
            if (factory.acceptsFsLayout(fsLayout)) {
                return factory;
            }
        }

        throw new IllegalArgumentException("Unsupported FileSystemLayout: " + fsLayout);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy