It's all about the answers!

Ask a question

how to create RTC source control deliver client precondition


Raghu Hanumanthappa (114) | asked Mar 06 '19, 5:41 a.m.

   Hi Ralph,


I am developing a plugin , a precondition for Deliver Client under Source Control to run a static analysis tool while delivering a changeset.

I created a java file with below code to trigger a message when i deliver a changeset, I deplyoed the plugin under server side site folder and ini file under provision files and I am able to see the precondition under Deliver Client

I added a precondition and while delivering the changset, my plugin show under Team adivisor but it shows as my plugin name with [not installed] beside plugin like "StaticAnalysis[not installed]"

I should install the developed jar file somewhere else also?

My code is as below

public class StaticAnalysisAdvisor  implements IOperationAdvisor
{
/
  @see com.ibm.team.process.common.advice.runtime.IOperationAdvisor#run(com.ibm.team.process.common.advice.AdvisableOperation, com.ibm.team.process.common.IProcessConfigurationElement, com.ibm.team.process.common.advice.IAdvisorInfoCollector, org.eclipse.core.runtime.IProgressMonitor)
 */
public void run(AdvisableOperation operation, IProcessConfigurationElement advisorConfiguration, IAdvisorInfoCollector collector, IProgressMonitor monitor) throws TeamRepositoryException {
Object opData = operation.getOperationData();
if (!(opData instanceof DeliverOperationData)) {
IReportInfo info  = createProblem("static", "nodelviered", collector);
collector.addInfo(info);
return;
}
DeliverOperationData data = (DeliverOperationData) opData;
monitor.beginTask("", 1000); //$NON-NLS-1$
try {
IProcessArea processArea = operation.getProcessArea();
IProjectAreaHandle projectArea = processArea.getProjectArea();
if (data.getChangeSetHandles().size() > 0 || ( data.getAtomicUpdateParm() != null)) {
IReportInfo info  = createProblem("static1", "nodelviered1", collector);
collector.addInfo(info);
addProblems(data, processArea, projectArea, collector, new SubProgressMonitor(monitor, 600));
}
IReportInfo info  = createProblem("static1", "nodelviered1", collector);
collector.addInfo(info);
} catch (TeamRepositoryException e) {
collector.addInfo(collector.createExceptionInfo("", e)); //$NON-NLS-1$
} finally {
        monitor.done();
}
}
private IAdvisorInfo createProblem(String summary, String description, IAdvisorInfoCollector collector) throws TeamRepositoryException {
IAdvisorInfo problem = collector.createProblemInfo(summary, description,"static");
problem.setProblemObject(description);
problem.setData(summary);
return problem;
}
private void addProblems(DeliverOperationData data, IProcessArea processArea, final IProjectAreaHandle projectArea, IAdvisorInfoCollector collector, IProgressMonitor monitor) throws TeamRepositoryException {
if( data.getChangeSetHandles().size() == 0 )
     {
     monitor.beginTask("", 1000); //$NON-NLS-1$
     }
     else
     {
     monitor.beginTask("", 1000 * data.getChangeSetHandles().size() + 1); //$NON-NLS-1$
     }
List<IChangeSetHandle> changeSetHandles = data.getChangeSetHandles();
 for (Iterator changesIterator = changeSetHandles.iterator(); changesIterator.hasNext();)
 {
 IChangeSet changeset = (IChangeSet) changesIterator.next();   
            List changes = changeset.changes(); 
            for (Iterator changes1 = changes.iterator(); changesIterator.hasNext();)
            {
    IChange change = (IChange)changes1.next();
    
// file path, starting from the component root
String elementPath = "";
String s = data.getDestWorkspace().toString();
String s1 =changeset.getComponent().toString();
elementPath = s + s1;
IReportInfo info  = createProblem("static2", elementPath, collector);
collector.addInfo(info);
            
           }
 }
}
}


Please help me to resolve this issue
let me know if you need any more details

Regards,
Shruthi

One answer



permanent link
Ralph Schoon (63.5k33646) | answered Mar 06 '19, 6:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 Here is an example of a working precondition for source control deliver. 

Get that working on Jetty first. 

Based on that, get you own extension working.

The deployment is explained in the Extensions workshop. For a final deployment, carefully read the last lab. I updated the 6.0.3 version with a lot more details.



Comments
Ralph Schoon commented Mar 06 '19, 6:58 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Note, the example above is a SERVER extension. If you really want to create a client extension, that only runs in the RTC Eclipse client, see https://jazz.net/wiki/bin/view/Main/CustomPreconditionsTable#operations


You need to use the operation ID: com.ibm.team.scm.client.deliver in this case AND you need to install the extension in the RTC Client. See the Aspect Editor Lab in the Extensions Workshof and the deployment lab for how to deploy in the client. 

You will likely NOT see this client extension in the server as deplyoed.


Raghu Hanumanthappa commented Mar 12 '19, 6:24 a.m.

Thank you Ralph for your comments

I gone thorough that and try deploying the client feature ,it is installed but shows as not installed under Team Advisors beside the new precondition that ii have added during deliver operation.

Under Team Advisors its show as
StaticAnalyis[Not installed]

Kindly let me know the code what i attached above is correct?


Ralph Schoon commented Mar 12 '19, 7:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I am not superhuman and can see nothing in the code above. Also, the problem is likely NOT the code but the Meta-Inf and the Plugin.xml, feature.xml and other deployment related stuff. 


If this worked with Jetty and the Eclipse OSGI2 debug client, you have to get the deployment of the client part working.

Your answer


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