class DefaultArtifactRepositoryFactory implements ArtifactRepositoryFactory {
    // TODO use settings?
    private String globalUpdatePolicy;

    private String globalChecksumPolicy;

    @Inject
    private Map<String, ArtifactRepositoryLayout> repositoryLayouts;

    public ArtifactRepositoryLayout getLayout(String layoutId) throws UnknownRepositoryLayoutException {
        return repositoryLayouts.get(layoutId);
    }

    public ArtifactRepository createDeploymentArtifactRepository(
            String id, String url, String layoutId, boolean uniqueVersion) throws UnknownRepositoryLayoutException {
        ArtifactRepositoryLayout layout = repositoryLayouts.get(layoutId);

        checkLayout(id, layoutId, layout);

        return createDeploymentArtifactRepository(id, url, layout, uniqueVersion);
    }

    private void checkLayout(String repositoryId, String layoutId, ArtifactRepositoryLayout layout)
            throws UnknownRepositoryLayoutException {
        if (layout == null) {
            throw new UnknownRepositoryLayoutException(repositoryId, layoutId);
        }
    }

    public ArtifactRepository createDeploymentArtifactRepository(
            String id, String url, ArtifactRepositoryLayout repositoryLayout, boolean uniqueVersion) {
        return createArtifactRepository(id, url, repositoryLayout, null, null);
    }

    public ArtifactRepository createArtifactRepository(
            String id,
            String url,
            String layoutId,
            ArtifactRepositoryPolicy snapshots,
            ArtifactRepositoryPolicy releases)
            throws UnknownRepositoryLayoutException {
        ArtifactRepositoryLayout layout = repositoryLayouts.get(layoutId);

        checkLayout(id, layoutId, layout);

        return createArtifactRepository(id, url, layout, snapshots, releases);
    }

    public ArtifactRepository createArtifactRepository(
            String id,
            String url,
            ArtifactRepositoryLayout repositoryLayout,
            ArtifactRepositoryPolicy snapshots,
            ArtifactRepositoryPolicy releases) {<FILL_FUNCTION_BODY>}

    public void setGlobalUpdatePolicy(String updatePolicy) {
        globalUpdatePolicy = updatePolicy;
    }

    public void setGlobalChecksumPolicy(String checksumPolicy) {
        globalChecksumPolicy = checksumPolicy;
    }
}

        if (snapshots == null) {
            snapshots = new ArtifactRepositoryPolicy();
        }

        if (releases == null) {
            releases = new ArtifactRepositoryPolicy();
        }

        if (globalUpdatePolicy != null) {
            snapshots.setUpdatePolicy(globalUpdatePolicy);
            releases.setUpdatePolicy(globalUpdatePolicy);
        }

        if (globalChecksumPolicy != null) {
            snapshots.setChecksumPolicy(globalChecksumPolicy);
            releases.setChecksumPolicy(globalChecksumPolicy);
        }

        ArtifactRepository repository;
        if (repositoryLayout instanceof ArtifactRepositoryLayout2) {
            repository = ((ArtifactRepositoryLayout2) repositoryLayout)
                    .newMavenArtifactRepository(id, url, snapshots, releases);
        } else {
            repository = new MavenArtifactRepository(id, url, repositoryLayout, snapshots, releases);
        }

        return repository;
    
<no_super_class>