How to parse Java code to generate class diagram? - java

I have to generate class diagrams from the java files such that the parser must be executable on the command line with the following format:
umlparser classpath output_file_name
umlparser is my .java file name
classpath is a folder name where all the .java source files will be
output file name is the name of the output image file you program will generate ( .jpg, .png or .pdf format)
Tools for parsing Java Source and generating UML diagrams can be used.
I was looking at http://yuml.me/diagram/class/draw and found that that is a good way to generate the class diagram.
However, I can't get the idea how can I get the code in the form of
[Customer|forname:string;surname:string|doPost();doGet()]<>-orders*>[Order]
[Order]++-0..*>[LineItem]
[Order]-[note:Aggregate root{bg:wheat}]
Any insight on how to generate this code?
Any other suggestions are also welcomed.

Maybe you need to take a look at doxygraph. Its maintainers define the tool as follows:
It relies on Doxygen to parse your source code and create an intermediate XML representation of the information it collects, so it supports all the same programming languages that Doxygen supports: C, C++, C#, Objective C, Java, Python, PHP, Tcl, D, IDL, VHDL, and Fortran.
Reverse-engineering functionality is also present in IntelliJ IDEA and Visual Paradigm editors, but it is a paid feature as far as I can remember.

Related

Generate DXF drawing in Java

Is there some sort of a good library with documentation to perform the drawings? Something like DWG or DXF files. I need to generate some drawings on the basis of these data. They will be used mainly lines, and dimensioning drawings. You do not necessarily have to be a DWG or DXF. Important for me to do the drawings. Something like that
Try this CAD java jar package, called Ycad, right now just support DXF drawing...
Download here

Can I get assembly code of an exe file using java?

Hi I need to view code of an .exe file which has to be loaded dynamically. So, is there any method of obtaining source code of an exe file in Java or do I need another language to do that?
Standard Java will presumably not be able to do this because what you want to do is platform specific.
I don't know any library that is able to do this.
What you could do is take the exe, extract its code segments and compare their content to a list of opcodes. You could then for example simply iterrate over the bytes and create a list how often hex 0x90 is found, which is an indication for a nop.
Perhaps it is a better solution to simply disassemble the file (into "sourcecode") and count the occurences based on their text representation.

Word2Fo Java PlugIn

I'm using Word2Fo to generate XSL-FO code so that my Java application can generate a PDF instead of a Doc. This is all well and good, and I've gotten the raw XSL-FO code now, but there's over a thousand lines of FO instructions, and it would be a pain to go over every single line to format it for Java output in w.write.
Is there any plugin for Word2Fo that can do this automatically on conversion? Directing me to a Word2Fo Plugin library would be help in and of itself as well, since I can't seem to find one naturally existing anywhere.

Create a readable report (PDF) from XML output in Java

I'm trying to make a tool that's able to import XML output files from a certain tool and 'convert' them into nice a nice PDF report that sums things up in understandable language for normal people.
Output files always contain specific data, but I just want my appliciation to automatically create a report that's not hard to read for someone who's not very familiar with technology.
I know it's impossible to do completely automated, so I guess I'll have to use some kind of pre-defined templates or something, but I'm not sure what the best solution is.
Importing and reading the XML files isn't hard, but how do I convert them to a readable PDF document?
Apache FOP may help. This is a print formatter. Uses XSL-FO (XSL Formatting Objects) as template, and supports pdf as output. XSL-FO is a language for formatting XML data.

how can I detect farsi web pages by tika?

I need a sample code to help me detect farsi language web pages by apache tika toolkit.
LanguageIdentifier identifier = new LanguageIdentifier("فارسی");
String language = identifier.getLanguage();
I have download apache.tika jar files and add them to the classpath. but this code gives error for Farsi language but it works for english.
how can I add Farsi to languageIdentifier package of tika?
Tika doesn't ship with a language profile for the Farsi language yet. As of version 1.0 27 languages are supported out of the box:
languages=be,ca,da,de,eo,et,el,en,es,fi,fr,gl,hu,is,it,lt,nl,no,pl,pt,ro,ru,sk,sl,sv,th,uk
In your example the input is misdetected as li(Lithuanian) with a distance of 0.41, which is above the certainty threshold of 0.022. See the source code for more information on the inner works of LanguageIdentifier.
The Farsi language (Persian, ISO 639-1 2-letter code fa) is not recognized by default.
If you want Tika to recognize another language, you have to create a language profile first.
For this the following steps are necessary:
Find a text corpus for your language. I found the Hamshahri Collection. This should be sufficient. Download the corpus or parts of it and create a plain text file out of the XML.
Create an ngram file for the language identifier. This can be done using TikaCLI:
java -jar tika-app-1.0.jar --create-profile=fa -eUTF-8 fa-corpus.txt
This will a file called fa.ngp which contains the n-grams.
Configure Tika so that it recognizes the new language. Either do this programmatically using LanguageIdentifier.initProfiles() or put a property file with the name tika.language.override.properties into the classpath. Make sure the ngram file is in the classpath as well.
If you now run Tika, it should correctly detect your language.
Update:
Detailed the steps necessary to create a language profile.

Categories

Resources