Storing plugin data

Hi,

I am developing teamCity server side plugin that analyses source code of the project and outputs some metrics for it.
That takes a lot of time for big projects, so i want to store some of collected data, and reanalyse only files that were updated.

So the question is: how can i store custom data in database or some other place from my plugin?

Thank you very much,
Nick.

7 comments
Comment actions Permalink

Hi Nick,

do you run analysis on the server or it is a stage of a build?

0
Comment actions Permalink

Hi, Dmitry.

I'm running analysis on the server.

0
Comment actions Permalink

Then you can use the getCustomDataStorage() method of SBuildType interface to acquire a key-value store for some build configuration (http://javadoc.jetbrains.net/teamcity/openapi/8.1/jetbrains/buildServer/serverSide/SBuildType.html).

0
Comment actions Permalink

Thank you!

Are there any other storages that are associated with projects (not the build types)?
Can i use database for this purpose?

0
Comment actions Permalink

Nope, the project doesn't have a data storage and TeamCity doesn't provide a direct interface to its database, sorry. You can store some files in a plugin data directory. To get the plugin directory call getPluginDataDirectory(<plugin name>) of the SProject interface. Also since analysis takes a lot of time maybe it is better to run it during the build on the agent and report statistics via teamcity service messages (http://confluence.jetbrains.com/display/TCD8/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ServiceMessages). In such a setup you don't load the server and get custom graphs and build failure conditions for your metrics for free.

0
Comment actions Permalink

Thank you for your replies!

0
Comment actions Permalink

You are welcome! If your plugin is intended for external users feel free to ping us once it is ready, we can mention it at http://confluence.jetbrains.com/display/TW/TeamCity+Plugins.

0

Please sign in to leave a comment.