It's all about the answers!

Ask a question

How to add properties to repository workspace


Kushal Munir (126103) | asked Jul 11 '08, 12:02 p.m.
JAZZ DEVELOPER
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



permanent link
Dmitry Karasik (1.8k11) | answered Jul 11 '08, 12:02 p.m.
JAZZ DEVELOPER
On Fri, 11 Jul 2008 16:07:58 +0000, kmunir wrote:

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?

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

permanent link
Dmitry Karasik (1.8k11) | answered Jul 15 '08, 1:01 p.m.
JAZZ DEVELOPER
Can you please provide an example of a
scheduled task and how one would go about defining one?

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
curious...is there any event notification mechanism that could be used
as an alternative (i.e. using event handlers)?

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

permanent link
Kushal Munir (126103) | answered Jul 15 '08, 4:30 p.m.
JAZZ DEVELOPER
On Fri, 11 Jul 2008 16:07:58 +0000, kmunir wrote:

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?

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)?

permanent link
Matt Lavin (2.7k2) | answered Jul 16 '08, 8:12 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
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

permanent link
Matt Lavin (2.7k2) | answered Jul 16 '08, 8:14 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
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


Register or to post 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.