Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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?

0 votes



5 answers

Permanent link
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

0 votes


Permanent link
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

0 votes


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

0 votes


Permanent link
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

0 votes


Permanent link
Oh, and no, there isn't an event mechanism that you can hook on Item deletion. The scheduled task is the way to go.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,954

Question asked: Jul 11 '08, 12:02 p.m.

Question was seen: 7,332 times

Last updated: Jul 11 '08, 12:02 p.m.

Confirmation Cancel Confirm