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

 接下来的任务就非常简单了,就是编写各种各样的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包的应用了
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值