How to add properties to repository workspace
We need to store additional properties for a repository workspace. What would be the best way to go about doing that? I created a new type subclassing SimpleItem with a reference to IWorkspace, but I don't think its lifecycle will be governed by IWorkspace (I want the container object and properties to be deleted when an IWorkspace is for example). Is there a way that I can have these properties and whatever container object (if required) to be governed by the IWorkspace lifecycle?
|
5 answers
On Fri, 11 Jul 2008 16:07:58 +0000, kmunir wrote:
We need to store additional properties for a repository workspace. What No. You can create a scheduled task (that runs every night let's say) which will look for your items pointing at workspaces that are no longer there and delete them. - Dmitry |
Can you please provide an example of a Sure, take a look at com.ibm.team.repository.service.internal.ItemCleanupTask for an example. You will need to use the com.ibm.team.repository.service.asynchronousTask extension point. Just There are ChangeEvents published when a workspace is deleted. There is no callback however, so you will still need to have a regularly scheduled task that runs and looks for those events. It is hard to say if that will be more efficient than verifying all the workspaces. There aren't that many workspaces, but there are a lot of change events. - Dmitry |
On Fri, 11 Jul 2008 16:07:58 +0000, kmunir wrote: We need to store additional properties for a repository workspace. What No. You can create a scheduled task (that runs every night let's say) which will look for your items pointing at workspaces that are no longer there and delete them. - Dmitry Dmitry, thanks for your response. Can you please provide an example of a scheduled task and how one would go about defining one? Just curious...is there any event notification mechanism that could be used as an alternative (i.e. using event handlers)? |
The class com.ibm.team.repository.service.internal.ItemCleanupTask is a scheduled task, so you could look at that for the basic structure.
Scheduled tasks are contributed through extension points like most other things in Jazz, so you just need to subclass the AbstractAutoScheduledTask class and then contribute to your plugin.xml |
Oh, and no, there isn't an event mechanism that you can hook on Item deletion. The scheduled task is the way to go.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.