ContextMapper / context-mapper-dsl

ContextMapper DSL: A Domain-specific Language for Context Mapping & Service Decomposition
https://contextmapper.org/
Apache License 2.0
216 stars 28 forks source link

FileSystemHelper isn't included in library? #243

Closed schusterbenjamin closed 3 years ago

schusterbenjamin commented 4 years ago

I included the library in my project via gradle with: implementation 'org.contextmapper:context-mapper-dsl:5.15.0'

My goal is to generate PlantUML files from a cml-File. Therefor I tried it like the provided code example.

But the FileSystemHelper can't be found in the library. Is there somthing I am missing?

stefan-ka commented 4 years ago

Hi @Syseat,

thanks for creating the issue!

First; just a hint: I saw that you linked the MDSL generator example... If you want to generate PlantUML, use the corresponding generator, as shown in this example.

Now, to your issue: This is a good point, the class is actually not included in the context-mapper-dsl library. We should include it in a future release to make this easier for standalone users. Thanks for reporting this. The class is currently here in the standalone example. Maybe you can just copy the class for now? Or simply create a JavaIoFileSystemAccess instance in your client code, as the method in the class does it: (its not that much code)

public static JavaIoFileSystemAccess getFileSystemAccess() {
  JavaIoFileSystemAccess fsa = new JavaIoFileSystemAccess();
  Guice.createInjector(new AbstractGenericModule() {
    public Class<? extends IEncodingProvider> bindIEncodingProvider() {
      return IEncodingProvider.Runtime.class;
    }
  }).injectMembers(fsa);
  return fsa;
}

But I agree that we should include this into the library.

Best regards, Stefan

stefan-ka commented 4 years ago

I transfered this issue to the dsl repo now. We should include the class FileSystemHelper of the standalone sample to the library, so that users don't have to copy that code.

schusterbenjamin commented 4 years ago

Thank you for your fast reply @stefan-ka !

Thanks for the hint ;) I accidently copied the wrong link when creating the issue.. Alright I will copy the code of FileSystemHelper for now :)

stefan-ka commented 4 years ago

No problem @Syseat ;)

Sorry that I don't have a better answer for now...

If you are interested in sharing more feedback it would be highly appreciated. You can also get in touch with me by mail (stefan@kapferer.ch). I'm always interested in feedback and hear about how people use @ContextMapper to learn what could be improved.

Best regards, Stefan

stefan-ka commented 3 years ago

Hi @Syseat

With Context Mapper v6.0.0 (released today) we improved the API for standalone usage. You don't have to copy the FileSystemHelper anymore.

Checkout how to use Context Mapper standalone in the release notes (just a few simple examples) or directly in our standalone example project: https://github.com/ContextMapper/context-mapper-standalone-example (I adjusted all examples to the new API).

I hope this solves the issue for you. I.e. generating PlantUML diagrams is quite simple now:

public class PlantUMLGeneratorExample {
    public static void main(String[] args) {
        StandaloneContextMapperAPI contextMapper = ContextMapperStandaloneSetup.getStandaloneAPI();
        CMLResource resource = contextMapper.loadCML(INSURANCE_EXAMPLE_URI);

        contextMapper.callGenerator(resource, new PlantUMLGenerator());
    }
}

Best regards, Stefan