Skip to content

Instantly share code, notes, and snippets.

@asiletto
Created March 19, 2014 12:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asiletto/9640396 to your computer and use it in GitHub Desktop.
Save asiletto/9640396 to your computer and use it in GitHub Desktop.
sync a clearcase folder via java api
package test;
import java.io.File;
import javax.wvcm.PropertyRequestItem;
import javax.wvcm.ProviderFactory;
import javax.wvcm.WvcmException;
import javax.wvcm.ProviderFactory.Callback;
import com.ibm.rational.wvcm.stp.StpLocation;
import com.ibm.rational.wvcm.stp.StpProvider;
import com.ibm.rational.wvcm.stp.cc.CcFile;
import com.ibm.rational.wvcm.stp.cc.CcProvider;
import com.ibm.rational.wvcm.stp.cc.CcView;
public class Sync {
public static void main(String[] args) throws Exception {
StpProvider provider = (StpProvider) ProviderFactory.createProvider(
CcProvider.CC_ONLY_PROVIDER_CLASS, new Callback(){
public Authentication getAuthentication(String realm,
int retryCount) throws WvcmException {
Authentication auth = new Authentication() {
public String password() {
return "mypassword";
}
public String loginName() {
return "myusername";
}
};
return auth;
}
});
provider.setServerUrl("http://myserverulr/");
CcProvider m_provider = provider.ccProvider();
File viewRoot = new File("C:/myviewfolder/");
StpLocation viewLocation = provider.filePathLocation(StpProvider.Domain.CLEAR_CASE, viewRoot);
//Get instance of CcView that represents the CCRC view.
CcView view = m_provider.ccView(viewLocation);
//Options while updating view
CcFile.RefreshFlag[] refreshFlags = new CcFile.RefreshFlag[1];
refreshFlags[0] = CcFile.RefreshFlag.OVERWRITE_HIJACKS;
PropertyRequestItem.PropertyRequest properties = new PropertyRequestItem.PropertyRequest(CcView.DISPLAY_NAME, CcView.CONFIG_SPEC);
view.doRefresh(refreshFlags, properties);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment