It's all about the answers!

Ask a question

Use of IScmQueryService.findWorkspaces on RTC server


Geoff Alexander (18623839) | asked Feb 22 '12, 9:46 a.m.
We're using IScmQueryService.findWorkspaces on the RTC server to obtain an IWorkspace from a given stream name:

   public static IWorkspace findStream( String streamName,

SportServiceData commonData )
throws TeamRepositoryException
{
IScmQueryService scmQueryService = commonData.getScmQueryService();
IRepositoryItemService repositoryItemService = commonData
.getRepositoryItemService();
IWorkspaceSearchCriteria criteria = IWorkspaceSearchCriteria.FACTORY
.newInstance();
criteria.setKind( IWorkspaceSearchCriteria.STREAMS );
criteria.setExactName( streamName );
List<IWorkspaceHandle> workspaceHandles = scmQueryService
.findWorkspaces( criteria, Integer.MAX_VALUE, null )
.getItemHandles();
if (workspaceHandles.size() > 1)
{
throw new TeamRepositoryException( workspaceHandles.size() + " \""
+ streamName + "\" streams found" );
}
if (!workspaceHandles.isEmpty())
{
IWorkspaceHandle workspaceHandle = workspaceHandles.get( 0 );
return (workspaceHandle.hasFullState())
? (IWorkspace)(workspaceHandle.getFullState())
: (IWorkspace)(repositoryItemService.fetchItem(
workspaceHandle, IRepositoryItemService.COMPLETE ));
}
return null;
}


This work code works fine. However, IScmQueryService is an "internal" class, and its use results in numerous warnings similar to

Discouraged access: The type IScmQueryService is not accessible due to restriction on required library C:\RTC-SDK-3.0.1.2\plugins\com.ibm.team.scm.common_3.0.3.v20111123_0653.jar


Is it OK for us to use IScmQueryService to find streams on the RTC server? Or is there a "public" interface that we should be using instead. I searched the forums and didn't find an alternative for finding streams on the RTC server.

Thanks,
Geoff Alexander

5 answers



permanent link
David Van Herzele (10121) | answered Feb 22 '12, 9:55 a.m.
As far as I know from reading posts here, none of the serverside classes are officially supported and/or public. The reasoning behind this is that the serverside classes are still subject to change. API is still work in progress, so no guarantees about continuity are made.

permanent link
John Camelon (1.7k14) | answered Feb 23 '12, 10:37 a.m.
JAZZ DEVELOPER
These are correct in that they are not supported API. That being said, they are fairly frozen due to our need to maintain backwards compatibility to older clients. So some people use them anyway. It really comes down to the level of risk/support you are comfortable with.

permanent link
Fausto Lemos (16811518) | answered Apr 02 '12, 10:42 p.m.
These are correct in that they are not supported API. That being said, they are fairly frozen due to our need to maintain backwards compatibility to older clients. So some people use them anyway. It really comes down to the level of risk/support you are comfortable with.


Ok, but there is another option to find streams instead of IScmQueryService?

permanent link
Michele Pegoraro (1.8k12114101) | answered Apr 05 '12, 6:23 a.m.
In my experience this is the only way. There are a lot of internal classes that can't be substituted and are necessary in order to implement controls and operations. So I have to use them despite restrictions.

These are correct in that they are not supported API. That being said, they are fairly frozen due to our need to maintain backwards compatibility to older clients. So some people use them anyway. It really comes down to the level of risk/support you are comfortable with.


Ok, but there is another option to find streams instead of IScmQueryService?

permanent link
VK L (8177141159) | answered Aug 06 '12, 4:58 a.m.
Hi All,
           When i try this code given by geoff, I face 2 main problems:
1. SportServiceData is not recognized
2. if i add cast <SportServiceData> to the function, then it says: "The method getScmQueryService() is undefined for the type SportServiceData"

Please advise as to what could be the cause here.

Lines affected:
public static IWorkspace findStream( String streamName,SportServiceData commonData)
IScmQueryService scmQueryService = commonData.getScmQueryService();

Alternate tried:
public static <SportServiceData> IWorkspace findStream( String streamName,SportServiceData commonData )throws TeamRepositoryException

Thanks.

Your answer


Register or to post your answer.