IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Java API ImportBinaryTypesDlg entry class specification Options · View
msonsini
Posted: Monday, November 27, 2017 1:36:22 PM
Rank: Newbie

Joined: 11/27/2017
Posts: 3
I am attempting to use the UModel API to automate UModel via the Java interface. Specifically, I would like to import only some classes from a set of jar files instead of all classes to minimize resulting diagram complexity. I am able to specify the jar file to import from through the API but not individual classes from within the jar. Is there a way to do this with the UModel API?

Thank you,
Mike
cor
Posted: Tuesday, November 28, 2017 9:01:05 AM
Rank: Advanced Member

Joined: 9/28/2005
Posts: 371
Location: Vienna
Hello Mike!

With the Java interface, you have the same possibilities as when using the dialogs in the application, so no, it's not possible to import distinct classes (which would also mean to lose a lot of type information).
But you can minimize the diagram complexity when not using the automatic diagram generation but create the diagram by yourself with the API.
This way you can put exactly those classes onto the diagram(s), which you would like to see and still have the full type information from other classes available.
msonsini
Posted: Tuesday, November 28, 2017 1:35:54 PM
Rank: Newbie

Joined: 11/27/2017
Posts: 3
Cor,

Thank you but I do not understand. When I manually select Project -> Import Binary Types in UModel, a dialog titled "Import Binary Types" is displayed. After clicking the "Next >" button on this dialog, its title changes to "Import Binary Selection". I can manually add jar files through this dialog and then click the plus icon next the jar files to expand them, enabling access to their individual classes. Then, I can select individual classes to import and click the dialog "Finish" button to only import the specified subset.

I would like to automate this process and have been able to configure the "Import Binary Types" dialog (through the Java API) with a jar file to import classes from. However, I am stuck at figuring out how to select individual classes because I cannot identify API functions or methods for this purpose. I understand that I will need to satisfy dependencies of imported classes for the import to succeed and have an approach to address this.

However, creating a diagram without the automatic generation functionality may be a viable alternative. I am attempting to understand a custom application written within a third party framework comprised of many jar files. Since the application only uses a fraction of the available third party framework, which contains thousands or tens of thousands of classes, I would like to attempt creating diagrams linking the custom application classes to only the used framework classes without including rest of the framework classes.

Is the UModel Import Binary Types functionality appropriate and the best UModel approach for this effort? If not, how would you recommend approaching the diagram generation?

Thank you,
Mike
cor
Posted: Tuesday, November 28, 2017 2:40:16 PM
Rank: Advanced Member

Joined: 9/28/2005
Posts: 371
Location: Vienna
Hello Mike,

Sorry, there was a misunderstanding.

What you want to do might be possible :-).
IImportBinaryTypesDlg has a member "Java_BinaryTypes" of type IBinaryTypeEntries, which holds a collection of IBinaryTypeEntry.

Think this is what you are looking for!?
msonsini
Posted: Tuesday, November 28, 2017 3:54:58 PM
Rank: Newbie

Joined: 11/27/2017
Posts: 3
Cor,

Thanks for the quick response.

I am using the com.altova.automation.UModel.BinaryTypeEntry Java class to specify a single jar file to import. I am just working with one jar file while attempting to figure out the automation approach. I use the BinaryTypeEntry.setEntry method to specify the jar path. The only other set* BinaryTypeEntry methods are setExecutable and setImportTypes. Both of these methods take a single boolean parameter so I doubt they can be used to communicate a class within a jar file to import without leveraging other methods outside of BinaryTypeEntry.

This is why I am asking if there is a way to import individual classes with the Java UModel API via ImportBinaryTypesDlg, BinaryTypeEntries, BinaryTypeEntry, and other classes. Is there or is the API limited to only supporting importing all classes of a jar file?

Thank you,
Mike
cor
Posted: Wednesday, November 29, 2017 3:32:08 PM
Rank: Advanced Member

Joined: 9/28/2005
Posts: 371
Location: Vienna
Mike,

Right - it only works when "ShowDialog=true", which is not appropriate in your case.
Specifying a list of class names is a missing functionality and we will add this as soon as possible.

Sorry for the inconvenience!

Best regards,
cor
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.