Use of IScmQueryService.findWorkspaces on RTC server
We're using IScmQueryService.findWorkspaces on the RTC server to obtain an IWorkspace from a given stream name:
This work code works fine. However, IScmQueryService is an "internal" class, and its use results in numerous warnings similar to
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
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
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?
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.
Ok, but there is another option to find streams instead of IScmQueryService?
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?
Hi All,
When i try this code given by geoff, I face 2 main problems:
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.