Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

DescriptorRepository scans precise paths #331

Open
marcingrzejszczak opened this issue Mar 12, 2015 · 0 comments
Open

DescriptorRepository scans precise paths #331

marcingrzejszczak opened this issue Mar 12, 2015 · 0 comments

Comments

@marcingrzejszczak
Copy link
Contributor

com.ofg.stub.mapping.DescriptorRepository checks for global and realm-specific stubs.

List<MappingDescriptor> getProjectDescriptors(ProjectMetadata project) {
        List<MappingDescriptor> mappingDescriptors = []
        mappingDescriptors.addAll(globalContextDescriptorsFrom(project))
        mappingDescriptors.addAll(realmContextDescriptorsFrom(project))
        return mappingDescriptors
    }

    private List<MappingDescriptor> globalContextDescriptorsFrom(ProjectMetadata project) {
        File descriptorsDirectory = new File(path, project.projectRelativePath)
        return descriptorsDirectory.exists()? collectMappingDescriptors(descriptorsDirectory, GLOBAL) : []
    }

    private List<MappingDescriptor> realmContextDescriptorsFrom(ProjectMetadata project) {
        File descriptorsDirectory = new File(path, project.pathWithContext)
        return descriptorsDirectory.exists() ? collectMappingDescriptors(descriptorsDirectory, REALM_SPECIFIC) : []
    }

That was created like this due to the fact that we supported in the stub-definitions repository global and realm specific approaches.

With the new approach we need to ensure that either

  • paths in the jar with stubs are also supported properly (e.g. for a microservice foo with group com.ofg and realm pl we can support both /com/ofg/foo/somestubs.json and /pl/com/ofg/foo/someplstubs.json)
  • paths in the jar with stubs can be set up in whatever way the user wants to - here we would break the backwards compatibility.

IMO we should remain backwards compatible as long as possible and after a couple of releases and migrations to the new approach then we can remove this constraint.

WDYT?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant