It's all about the answers!

Ask a question

Delivering Individual Changesets with Java API


Tom Roach (2121) | asked Aug 10 '10, 10:55 a.m.
So I'm trying to create a java method which can be given a source and a target stream as well as a changeset and promote that individual changeset from one stream to the other.

I've come across the method:
sourceWorkspaceConnection.deliver(targetWorkspaceConnection, sync, Collections.EMPTY_LIST, sync.outgoingChangeSets(changeSetComponentHandle), monitor);

Now bear with me because I can find very little documentation on this method:

This method appears to deliver the entire component the changeset belongs to, is that accurate?

Is it possible to deliver an individual changeset without the rest of the changesets in the component?

Any detail (as much a possible!) would be appreciated as I'm wondering around rather blindly at the moment without much documentation.

Thanks for any help.
Tom

7 answers



permanent link
Evan Hughes (2.4k1018) | answered Aug 10 '10, 3:19 p.m.
JAZZ DEVELOPER
If you're looking at simple promotion (from a build, say), it may be easiest to use the command line interface. You can feed it UUIDs for the streams, and, so long as you can acquire the CS UUID somewhere, you should have smooth sailing. I believe that other integrators have used the 'scm compare' subcommand to get a listing of change sets to be delivered.

If you must use Java, you may want to look into using the IFilesystemRestClient interface (available from calls to Discovery2). It's higher level than the IWorkspaceConnection and is the closest thing we have to an integration layer, although it should still be considered unsupported.

e

permanent link
Tom Roach (2121) | answered Aug 11 '10, 10:00 a.m.
If you're looking at simple promotion (from a build, say), it may be easiest to use the command line interface. You can feed it UUIDs for the streams, and, so long as you can acquire the CS UUID somewhere, you should have smooth sailing. I believe that other integrators have used the 'scm compare' subcommand to get a listing of change sets to be delivered.

If you must use Java, you may want to look into using the IFilesystemRestClient interface (available from calls to Discovery2). It's higher level than the IWorkspaceConnection and is the closest thing we have to an integration layer, although it should still be considered unsupported.

e


Thanks a lot for your help,

So the REST client looks like it's pretty close to what I need to do and I've figured out how to get a hold of most of the parameters and so forth. The one thing that is still puzzling me that perhaps you could help me out with is your rather cryptic "available from calls to Discover2" remark.

What is Discovery2?

permanent link
Evan Hughes (2.4k1018) | answered Aug 11 '10, 12:15 p.m.
JAZZ DEVELOPER
The one thing that is still puzzling me that perhaps you could help me out with is your rather cryptic "available from calls to Discover2" remark.

What is Discovery2?


In a nutshell:

1. IFilesystemRestClient describes the signature of a bunch of RPC calls (each one mapping to a method in the interface).

2. The IFRC is available to callers on an HTTP server (called 'the daemon') listening to the 'lo' network interface. To keep it secure callers need to know a shared secret and the port number the daemon is listening on.

3. The grunt work of finding the daemon is handled by a class called Discovery2. Effectively, a caller just has to populate the fields of a Discovery2.DiscoveryParams object and resolve() it. A proxy object is returned that handles the (de)serialization of data, progress monitoring, etc.

4. A daemon can run in one of two modes: in-process or out-of-process. An in-process daemon shares the VM with the caller. An out-of-process daemon is a separate instance of the 'scm' process. Running in-process is normally preferable since the caller doesn't need to worry about managing the daemon's lifecycle or the location of the 'scm' binary. Running out-of-process is appropriate if the caller expects another process to be modifying the same sandbox(es) that it wishes to modify.


Are you sure you can't use the command line? The CLI is essentially UI built on the daemon's functionality, so you should be able to do the same things from either environment. We consider the output of the CLI to be API, so it's unlikely to change.

permanent link
Tom Roach (2121) | answered Aug 11 '10, 12:35 p.m.
Well if I'm honest I was settling on the RestClient because after poking around the decompiled JAR files I had I could make some sense of the RestClient more easily than I could the Command Line.

My concern is that I can write my application to remotely log in to RTC and promote individual changesets between streams/workspaces with multiple users doing so simultaneously. If the application can do so through the CLI then that's great.

As I said, the reason I picked the Rest interface is that it made a whole lot more sense to me.

If you have a moment, could you give me a skeleton (or more than a skeleton!) idea of how I would send commands through the CLI remotely?
It's probably just the time of day but I can't get my head around it.

Appreciate your time.
Tom

permanent link
Evan Hughes (2.4k1018) | answered Aug 11 '10, 1:43 p.m.
JAZZ DEVELOPER
I'm not sure what you mean by "remotely".

To deliver changes from one workspace to another you would use:

scm deliver --source sourceWorkspaceUuid --target targetWorkspaceUuid uuidOfChangeSetToDeliver -u userName -P password


To find out more about deliver, run 'scm help deliver'.

and repeat that for the permutations of users and workspaces. You can avoid putting the password on the command line by piping the password in, or by using the 'scm login' command.

e

permanent link
Mark Roberts (1205238) | answered May 25 '11, 5:27 p.m.
JAZZ DEVELOPER
Can someone please explain how to get hold of the change set ID to use in the scm list changesets command ?

Ultimately I want to be able to see what change sets are in a work-item and what files are in the change sets.

Any pointers to specific SCM command line options and switches are appreciated.

Mark

permanent link
Evan Hughes (2.4k1018) | answered May 25 '11, 5:33 p.m.
JAZZ DEVELOPER
Can someone please explain how to get hold of the change set ID to use in the scm list changesets command ?

Ultimately I want to be able to see what change sets are in a work-item and what files are in the change sets.

Any pointers to specific SCM command line options and switches are appreciated.

Mark


Try 'scm help' and look near the top. Where it says -u/--show-uuid:

<pre>
Usage: scm
subcmd - Name of the subcommand to run

Options:
--config arg - Specify the location of the configuration directory.
--no-mask - Prevent the password entry prompt from masking the user's password.
--non-interactive - Prevent the client from prompting for information.
-a arg - Specify when aliases are to be shown: &quot;y&quot;/&quot;yes&quot;, or &quot;n&quot;/&quot;no&quot;
-h - Display this message.
-n - Prevent the client from modifying resources on disk or in the filesystem.
-u arg - Specify when UUIDs are to be shown: &quot;y&quot;/&quot;yes&quot;, or &quot;n&quot;/&quot;no&quot;
-v - Display the version number and exit.
</pre>

ie, if you run 'scm -u y status' you'll get uuids.

e

Your answer


Register or to post your answer.