Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jira Plugin storing files

Sebastian Braun June 4, 2012

Hi,

i have a Jira-Plugin, which provides the functionality to upload and access jar-files. Now im not really sure where to store this files.

- "java.io.tmpdir"?

- Blob@Database?

- ...

Whats the best practice for this?

Thanks in advance

Sebastian

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 4, 2012

Well, starting with what's not possible:

You can't use AO because it doesn't support byte[] and base64'ing JAR's is silly.

Storing Blobs is generally bad practice because the XML backup will not cover it. JIRA admins are not going to thank you for increasing the complexity of their restores.

What is possible:

Storing files in java.io.tmpdir may not exist longer term, if you want to persist data use JIRA_HOME/data, this is where attachments live and is where I also dump jemh/ data. This folder as part of JIRA_HOME is likely to receive backup attention by default. Creating a 'yourplugin/' folder would seem sensible, though, you need to consider management of those resources. Retaining a path reference in an AO table perhaps would be all that was needed.

To get a handle on JIRA_HOME, inject the type 'JiraHome', a new File pointing to that place can be gained with:

public MyDataService(JiraHome home) {
 fDataHome=new  
   File(home.getDataDirectory(),File.separatorChar+"myplugin");
 if (!fDataHome.exists())
 {
  fDataHome.mkdir();
 }
}

I suppose, like java resources, any resource folder should exist in a namespace folder tree, but I think on balance, the chances of collision in that location are slim.

Sebastian Braun June 4, 2012

Hi Andy,

thanks for your Reply. That really helped me out! :)

Greetings Sebastian

TAGS
AUG Leaders

Atlassian Community Events