Rev 94 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed
/* */ package net.brutex.xservices.util;
/* */
/* */ import java.io.File;
/* */ import net.brutex.xservices.types.scm.ItemType;
/* */ import net.brutex.xservices.ws.rs.CVSInfoImpl;
/* */ import org.apache.commons.configuration.Configuration;
/* */ import org.apache.commons.configuration.ConfigurationException;
/* */ import org.apache.commons.configuration.PropertiesConfiguration;
/* */ import org.apache.log4j.Logger;
/* */ 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.GlobalOptions;
/* */ import org.netbeans.lib.cvsclient.connection.AuthenticationException;
/* */ import org.netbeans.lib.cvsclient.connection.PServerConnection;
/* */
/* */ public class CVSClient
/* */ {
/* */ private final File configfile;
/* */ private final PServerConnection connection;
/* */ private final CVSRoot root;
/* */ private final GlobalOptions globalOptions;
/* 41 */ final Logger logger = Logger.getLogger(CVSInfoImpl.class);
/* */ public final Client client;
/* */
/* */ public Client getClient()
/* */ {
/* 49 */ return this.client;
/* */ }
/* */
/* */ public CVSClient(File config) throws CommandAbortedException, AuthenticationException, ConfigurationException {
/* 53 */ System.setProperty("cvsClientLog", "c:/temp/cvs.log");
/* 54 */ if ((config == null) || (!config.exists()) || (config.isDirectory())) {
/* 55 */ throw new ConfigurationException("Config file not found");
/* */ }
/* 57 */ this.configfile = config;
/* 58 */ Configuration configuration = new PropertiesConfiguration(this.configfile);
/* */
/* 60 */ String cvsroot = configuration.getString("CVSROOT");
/* 61 */ String workdir = configuration.getString("WORKDIR");
/* 62 */ String password = configuration.getString("PASSWORD");
/* */
/* 64 */ this.root = new CVSRoot(cvsroot);
/* 65 */ this.globalOptions = new GlobalOptions();
/* 66 */ this.globalOptions.setCVSRoot(cvsroot);
/* */
/* 68 */ this.connection = new PServerConnection();
/* 69 */ this.connection.setUserName(this.root.user);
/* 70 */ if (password != null)
/* 71 */ this.connection.setEncodedPassword(CvsPassword.encode(password));
/* */ else {
/* 73 */ this.connection.setEncodedPassword(password);
/* */ }
/* */
/* 76 */ this.connection.setHostName(this.root.host);
/* 77 */ this.connection.setRepository(this.root.repository);
/* */ try {
/* 79 */ this.connection.open();
/* */ } catch (AuthenticationException ex) {
/* 81 */ this.logger.error(ex.getMessage());
/* */ }
/* */
/* 84 */ this.client = new Client(this.connection, new StandardAdminHandler());
/* 85 */ this.client.setLocalPath(workdir);
/* */ }
/* */
/* */ public File getConfigFile()
/* */ {
/* 91 */ return this.configfile;
/* */ }
/* */
/* */ public GlobalOptions getGlobalOptions() {
/* 95 */ return this.globalOptions;
/* */ }
/* */
/* */ public PServerConnection getConnection()
/* */ {
/* 101 */ return this.connection;
/* */ }
/* */
/* */ public CVSRoot getRoot()
/* */ {
/* 107 */ return this.root;
/* */ }
/* */
/* */ public static String generateID(ItemType item) {
/* 111 */ return "::[" + item.getRemotename() + "]";
/* */ }
/* */ }
/* Location: C:\Users\brosenberger\Documents\My Box Files\XBridgeNG-download\XServices-20130131 - Kopie\WEB-INF\classes\net.zip
* Qualified Name: net.brutex.xservices.util.CVSClient
* JD-Core Version: 0.6.2
*/
Generated by GNU Enscript 1.6.5.90.