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

How to write to a file on the Workspace (server-side) ?

Hello,

We wish to update (or create) a text (xml) file on the workspace, on the server-side, upon "save" operation.

We managed to do this on the client-side sandbox and got the "unresolved" file as expected.
Our goal now is to move this functionality to the server and write the file on the user's workspace.

Given an IFileItem ift, we need to change it's content (we don't have the exact path to it, since there's no "sandbox" as was on client-side case), while creating a new version of this file (i.e. new State) and then check it into a newly created change-set.

Can anyone please provide an example that does similar thing?
If not, maybe someone can explain the needed steps to achieve that or recommend on the right practices to do this?

Thanks!

0 votes

Comments

I am not sure if that is possible. I would be very concerned with adding a file to the repository workspace of a user, if that is loaded on disk. If the file is added to the workspace without being available on disk, I would assume you will have created a situation where the local and the repository workspace is out of sync. You would have to add the file to the stream to make it available for accepting into the users workspace.

I have posted some client code here: https://rsjazz.wordpress.com/2013/10/15/extracting-an-archive-into-jazz-scm-using-the-plain-java-client-libraries/ you might be able to use some of the capabilities, but it is client code.

1 vote

Thanks Ralph. I understand your concern.

We may "relax" the need to create such file and assume the file exists and is available on the disk just as well (when the user copied the stream, he got that file along with it).
How ever, the request is to manage this file in an automatic manner, on the server side. This is a fundamental requirement of our case.

This is not exactly what we do, but I think you may imagine a log file, that logs every time a "save" occurs.
User should not bother himself with the writing such file's content - it should occur automatically, but he may want to "read" it for review.

As I explained, we managed to do this on the client side properly.
We need to move this functionality to the server side.

If this is a log of operations on the repository workspace, it seems odd to save this log to the repository workspace. I think your requirement for logging makes sense but it might not be necessary to check-in the file. It would be better if this information was stored in another way.

Rather than writing the change to a workspace, I suggest writing the update to a stream.  That avoids the problem of disrupting a workspace's relationship with a sandbox.


Be the first one to answer this question!

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,937
× 1,202

Question asked: Feb 24 '14, 5:31 a.m.

Question was seen: 4,404 times

Last updated: Feb 24 '14, 12:18 p.m.

Confirmation Cancel Confirm