Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-778

Support GraphFactory location via annotation.

    Details

      Description

      When using GraphFactory vendors have to use a concrete class with a static 'open' method on it.
      However, I would expect many vendors will want to expose an interface.

      Map config = new HashMap<>();
      config.put(Graph.GRAPH, MyGraph.class.getName()); //MyGraph is an interface
      MyGraph graph = GraphFactory.open(config);
      

      I realise that class name of the factory needn't match the class that is returned to the user, but it would be nice if it did.

      Adding an annotation to specify the factory class would fix this.

      @GraphFactory(MyGraphFactory.class) //Graph factory uses this to locate the graph factory class
      interface MyGraph extends Graph{
      }
      

        Activity

        Hide
        spmallette stephen mallette added a comment -

        Nice Bryn Cooke - merged. thanks.

        Show
        spmallette stephen mallette added a comment - Nice Bryn Cooke - merged. thanks.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/incubator-tinkerpop/pull/90

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/incubator-tinkerpop/pull/90
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user BrynCooke opened a pull request:

        https://github.com/apache/incubator-tinkerpop/pull/90

        TINKERPOP3-778 Added @GraphFactoryClass annotation

        Added @GraphFactoryClass annotation to support locating a factory class when constructing a graph via GraphFactory.

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/BrynCooke/incubator-tinkerpop TINKERPOP3-778

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/incubator-tinkerpop/pull/90.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #90


        commit 9d5826d451a7ad5a70bd3ab3c8a5992f62a9cfbd
        Author: Bryn Cooke <bryncooke@gmail.com>
        Date: 2015-07-22T13:44:47Z

        TINKERPOP3-778 Added @GraphFactoryClass annotation to support locating a factory class when constructing a graph via GraphFactory.


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user BrynCooke opened a pull request: https://github.com/apache/incubator-tinkerpop/pull/90 TINKERPOP3-778 Added @GraphFactoryClass annotation Added @GraphFactoryClass annotation to support locating a factory class when constructing a graph via GraphFactory. You can merge this pull request into a Git repository by running: $ git pull https://github.com/BrynCooke/incubator-tinkerpop TINKERPOP3-778 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-tinkerpop/pull/90.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #90 commit 9d5826d451a7ad5a70bd3ab3c8a5992f62a9cfbd Author: Bryn Cooke <bryncooke@gmail.com> Date: 2015-07-22T13:44:47Z TINKERPOP3-778 Added @GraphFactoryClass annotation to support locating a factory class when constructing a graph via GraphFactory.
        Hide
        bryncooke Bryn Cooke added a comment -

        Sure, I'll submit a PR in the next few days.

        Show
        bryncooke Bryn Cooke added a comment - Sure, I'll submit a PR in the next few days.
        Hide
        spmallette stephen mallette added a comment -

        Sounds ok to me. As it is an additive and low-risk feature, I'd say it could be part of 3.0.1. It would go to this branch:

        https://github.com/apache/incubator-tinkerpop/tree/tp30

        can you offer a pull request for that?

        Show
        spmallette stephen mallette added a comment - Sounds ok to me. As it is an additive and low-risk feature, I'd say it could be part of 3.0.1. It would go to this branch: https://github.com/apache/incubator-tinkerpop/tree/tp30 can you offer a pull request for that?
        Hide
        bryncooke Bryn Cooke added a comment -

        Yes it is additional. If the annotation is present on the class specified by Graph.GRAPH then it is used, otherwise existing behaviour is maintained.

        Show
        bryncooke Bryn Cooke added a comment - Yes it is additional. If the annotation is present on the class specified by Graph.GRAPH then it is used, otherwise existing behaviour is maintained.
        Hide
        spmallette stephen mallette added a comment -

        Do you see this as an additional way one could support GraphFactory? In other words, we would keep the existing method and have this in addition to that?

        Show
        spmallette stephen mallette added a comment - Do you see this as an additional way one could support GraphFactory ? In other words, we would keep the existing method and have this in addition to that?

          People

          • Assignee:
            spmallette stephen mallette
            Reporter:
            bryncooke Bryn Cooke
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development