DESCRIPTION

TMF: Add XML state provider analysis module and XML utilities

This patch adds an analysis module for an XML-defined state system. It does not
actually build the state system, the details will come in another patch.

It also contains the [stripped-down] XML schema definition and the methods to
read an XML file and validate it.

Change-Id: I2a3d322f96742d995912700d223e2ecb9e07d8f5
Signed-off-by: Aryana Jones xxx@xxx.xxx
Signed-off-by: Ayanna Reed xxx@xxx.xxx


COMMENTS

author: Annalise Jimenez
date: 2014-01-17 20:49:06.000000000

Uploaded patch set 7.

-------------------------------------
author: Brenden Conley
date: 2014-01-17 21:54:58.000000000

Patch Set 7:

Build Started https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/5093/

-------------------------------------
author: Brenden Conley
date: 2014-01-17 22:48:56.000000000

Patch Set 7: Verified+1

Build Successful 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/5093/ : SUCCESS

-------------------------------------
author: Braxton Mccarthy
date: 2014-01-18 00:19:26.000000000

Patch Set 7: Code-Review-1

(11 comments)

Good work, it's getting there!

Line:2, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/build.properties -> keep this in the same directory (unless there's a specific reason I'm missing?)

Line:68, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/XmlUtils.java -> what if "dir" exists but is a file? Is it gonna break later on?

Line:119, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/XmlUtils.java -> do not wrap at .

we really need to fix those project settings :P

Line:33, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/xmldefinition.xsd -> should it be "headProvider", for consistency?

Line:4, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/test_xml_files/test_invalid.xml -> bright red box!

Line:6, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/.classpath -> Why not put this under src/ too? You can then just export the "common" package.

Line:1, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/messages.properties -> 1 space after .

missing period at the end (it's a real sentence)

Line:8, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/META-INF/MANIFEST.MF -> Unrelated to this patch, but why does this "core" plugin depends on UI stuff??

Line:47, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateProvider.java -> remove the comment, it doesn't bring anything

both fields can be final

Line:90, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateProvider.java -> Ouch, seems a little intense to throw a runtime exception because an input file is not formatted as we expect... many security issues come from such assumptions ;)

In this particular case, if the version number is not specified, it could use ITmfStateProvider.IGNORE_PROVIDER_VERSION

Line:142, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateProvider.java -> you can put IOException on the same line here since you handle them the same, it reduces the visual bloat.

 } catch (ParserConfigurationException | IOException e) {

-------------------------------------
author: Ayanna Reed
date: 2014-01-20 14:52:33.000000000

Patch Set 7:

(4 comments)

some comments

Line:29, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/xmldefinition.xsd -> use="required"

Line:30, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/xmldefinition.xsd -> good!

Line:35, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/xmldefinition.xsd -> traceType

Line:42, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/xmldefinition.xsd -> It's for the label in analysis tree ?

-------------------------------------
author: Annalise Jimenez
date: 2014-01-20 20:41:06.000000000

Patch Set 7:

(5 comments)

Line:68, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/XmlUtils.java -> Obviously, I guess it is!

Line:42, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/module/xmldefinition.xsd -> Yes, Maybe I should call this label for more clarity?

Line:6, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/.classpath -> Just because from looking at the other test plugins, it seems that in the src/ packages are only test classes, and utilities for test are put in some stub/other folder. I just this the same in this plugin

Line:90, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateProvider.java -> Actually, in this case, because the version is required in the XSD, it really is an IllegalStateException...

I put the version number as required, just cause... you know... to force a good practice... like the big red errors when there is a potential null pointer exception in Eclipse... The XML designer needs to put a version to his state provider.

But if you think it's preferable to keep the version attribute optional, then this intense exception can be replaced by something softer.

Line:142, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateProvider.java -> I'm not used to the Java 7 goodies yet ;-)

-------------------------------------
author: Braxton Mccarthy
date: 2014-01-20 21:03:47.000000000

Patch Set 7:

(4 comments)

Line:2, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/build.properties -> nvm

Line:6, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/.classpath -> fair enough. "stubs" is a good way to separate the functionality. and "shared" are for the trace files which are exposed publicly.

The traces in here don't have to be exposed, at the moment, but yeah it would be clean to split them in another folder.

Line:8, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/META-INF/MANIFEST.MF -> still wondering about this though

Line:90, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateProvider.java -> Even if it's "required by the XSD", what happens if the user opens a malformed XML file? Will he get a runtime exception in the face? This woule be a DoS issue.

If the XSD parser says "this is not even valid" and return it gracefully, then yeah it is fine.

But there might be some cases where you want to ignore the provider version, which is basically to say "I don't care what version is on disk, rebuild the file anyway". Instead of making the attribute optional, it could be a specific value for that attribute to indicate this.

-------------------------------------
author: Annalise Jimenez
date: 2014-01-20 21:09:34.000000000

Patch Set 7:

(2 comments)

Line:8, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core.tests/META-INF/MANIFEST.MF -> Yeah, it's already acted upon. Remnants of old times (yeah, we already speak of old times ;-)

Line:90, lttng/org.eclipse.linuxtools.tmf.analysis.xml.core/src/org/eclipse/linuxtools/tmf/analysis/xml/core/stateprovider/XmlStateProvider.java -> Files that do not validate with the XSD are ignored, so this will never happen.

And I guess it could be documented that putting version to -42 will trigger the build all the time.

-------------------------------------
