Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-3541

Make repository creation safer by forbidding the use of resources without URI

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: bundlerepository-1.6.6
    • Fix Version/s: None
    • Environment:
      Felix Framework 4.0.2

      Description

      Make the API safer by generating an error if someone tries to create an invalid repository.
      In current implementation, somebody could create an invalid bundle repository (particularly, a repository in which the resources have no URI associated) through the bundlerepository API.
      This can be accomplished throught the use of the methods:
      1- DataModelHelper#createResource(Bundle)
      For creating a Resource from a Bundle (note that, then, the Resources won't have an associated URI)

      2- DataModelHelper#repository(Resource[])
      For creating a (invalid) Repository from the Resources just created

      3- DataModelHelper#writeRepository(..) //any of the writeRepository variants will work
      For writing the just created Repository
      ------------
      It may be useful if the DataModelHelper could "prevent" the writing of such an invalid Repository by validating it has all the "mandatory" fields.
      However, because the use of the Repository created (in memory) from Bundles may be useful, the validation may/should be done only when trying to generate an "external" representation of it (i.e. when trying to write it as XML).

      The afore mentioned "validation" may simply be a check followed by an exception if the mandatory fields are not present. This way, the execution will fail and not silently ignore the invalid repository just created (possibly leading to a worse inconsistency).

        Attachments

        1. badrepo_1.0.0.jar
          3 kB
          Matías San Martín

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              matias sm Matías San Martín
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: