package com.cadrlife.devsearch.cvsnavigator; import java.util.List; import org.netbeans.lib.cvsclient.Client; import org.netbeans.lib.cvsclient.admin.AdminHandler; import org.netbeans.lib.cvsclient.admin.StandardAdminHandler; import org.netbeans.lib.cvsclient.command.CommandAbortedException; import org.netbeans.lib.cvsclient.command.CommandException; import org.netbeans.lib.cvsclient.command.GlobalOptions; import org.netbeans.lib.cvsclient.command.update.UpdateCommand; import org.netbeans.lib.cvsclient.connection.AuthenticationException; import org.netbeans.lib.cvsclient.event.EventManager; public class CvsModuleList { GlobalOptions globalOptions; public List<String> getModules(CvsCredentials cvsCredentials, String localPath) throws CommandException, CommandAbortedException, AuthenticationException { try { Client client = CvsConnection.openClient(cvsCredentials.getCvsRoot(), cvsCredentials.getPassword(), localPath); globalOptions = new GlobalOptions(); globalOptions.setCVSRoot(cvsCredentials.getCvsRoot()); globalOptions.setDoNoChanges(true); UpdateCommand updateCommand = new UpdateCommand(); updateCommand.setBuildDirectories(true); AdminHandler handler = new StandardAdminHandler(); client.setAdminHandler(handler); EventManager eventManager = client.getEventManager(); ModuleCollectingListener moduleCollectingListener = new ModuleCollectingListener(); eventManager.addCVSListener(moduleCollectingListener); client.executeCommand(updateCommand, globalOptions); return moduleCollectingListener.getModules(); } finally { // closeConnection(connection); } } }