您的位置:首页 > 运维架构

利用JNI监控CVS仓库变动,自动更新到相应目录——简化WEB小组开发(三、cvs篇)

2007-12-28 03:46 741 查看
接下来的任务就非常简单了,就是编写各种各样的Action

这里我们更新cvs用javacvs开源包


import org.junit.Test;


import org.netbeans.lib.cvsclient.Client;


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.connection.PServerConnection;








public class ClientCVS ...{




@Test




public void fileSystemChanged() ...{




CVSRoot cvsRoot = new CVSRoot(":pserver:wxy@192.168.10.231:/data/cvsroot/projects");


cvsRoot.setPassword("wxy2007");




PServerConnection c = new PServerConnection(cvsRoot);




Client client = new Client(c, new StandardAdminHandler());


client.setLocalPath("D:/aaa");




client.getEventManager().addCVSListener(new BaseListener());




//CheckoutCommand command = new CheckoutCommand(true,"Team-Tool");




UpdateCommand command = new UpdateCommand();


command.setBuildDirectories(true);


command.setPruneDirectories(true);








try ...{


client.executeCommand(command, new GlobalOptions());




} catch (CommandAbortedException e) ...{


e.printStackTrace();




} catch (CommandException e) ...{


e.printStackTrace();




} catch (AuthenticationException e) ...{


e.printStackTrace();


}




}




}



其他还应该写一些action来相互配合,比如第一次发现新的模块,则先签出,之后就更新,这些就是对这个cvs包的应用了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐