Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IIDM extension design issue #828

Closed
geofjamg opened this issue Jun 11, 2019 · 8 comments
Closed

IIDM extension design issue #828

geofjamg opened this issue Jun 11, 2019 · 8 comments
Assignees

Comments

@geofjamg
Copy link
Member

geofjamg commented Jun 11, 2019

  • Do you want to request a feature or report a bug?
    A bug or at least a design flaw

  • What is the current behavior?
    Network model has been split in API and implementation part so that we can have different implementations for different purposes but a single API. So processing on top of network api like merging, import, export, simulation could be reused for any implementation.

Unfortunately this has not been done for extensions.

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

Example to add an XNode extension to a dangling line:

DanglingLine l = ...
l.addExtension(Xnode.class, new Xnode(l, "FR"));

So here we directly instantiate the extension and add it the dangling line.
What about if DanglingLine is not coming from in memory default implementation but from a persistent connected to a db one?

  • What is the expected behavior?
    As for network API extension could be split into API and implementations and provide a builder like way to create it in order to hide the instantiation.
DanglingLine l = ...
Xnode xNode = l.newExtensionAdder(XnodeAdder.class)
   .withCode("FR")
   .add();

And depending of impl, correct Adder will be used. For this we could imagine a plugin archi like

interface ExtensionAdder<E extends Extension> {

   E add();
}

interface ExtensionAdderFactory<A extends ExtensionAdder> {

   // infos to link with correct Network impl ????

    A createAdder();
}
  • What is the motivation / use case for changing the behavior?

To allow alternative IIDM implementation to use extensions.

  • Please tell us about your environment:

    • PowSyBl Version: 2.5.0-SNAPSHOT
    • OS Version: -
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, spectrum, etc)

(if a question doesn't apply, you can delete it)

@geofjamg geofjamg added the bug label Jun 11, 2019
@miovd miovd added the IIDM label Jun 12, 2019
@miovd
Copy link
Contributor

miovd commented Jan 15, 2020

Maybe ExtensionAdderFactory can be more understandable than ExtensionAdderProvider?

@geofjamg
Copy link
Member Author

Maybe ExtensionAdderFactory can be more understandable than ExtensionAdderProvider?

Ok for ExtensionAdderFactory

@jonenst
Copy link
Contributor

jonenst commented Jan 20, 2020

What's the relationship between l.newExtensionAdder and ExtensionAdderFactory.createAdder ?

@jonenst
Copy link
Contributor

jonenst commented Jan 20, 2020

is the newExtensionAdder added to the Extandable interface ?

@geofjamg
Copy link
Member Author

What's the relationship between l.newExtensionAdder and ExtensionAdderFactory.createAdder ?

newExtensionAdder() impl will look for a ExtensionAdderFactory plugin matching criteria and then call ExtensionAdderFactory.createAdder.

@geofjamg
Copy link
Member Author

is the newExtensionAdder added to the Extandable interface ?

yes

@geofjamg
Copy link
Member Author

A similar design has been done in AFS, for instance:

ImportedCase importedCase = folder.fileBuilder(ImportedCaseBuilder.class)
                .withCase(aCase)
                .withParameter("param1", "true")
                .withParameters(ImmutableMap.of("param2", "1"))
                .build();

@miovd
Copy link
Contributor

miovd commented Feb 25, 2020

Resolved by #1152

@miovd miovd closed this as completed Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants