Subversion Repositories XServices

Rev

Rev 113 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 113 Rev 185
1
/*     */ package net.brutex.xservices.util;
1
/*     */ package net.brutex.xservices.util;
2
/*     */ 
2
/*     */ 
3
/*     */ import java.io.File;
3
/*     */ import java.io.File;
4
/*     */ import net.brutex.xservices.types.scm.ItemType;
4
/*     */ import net.brutex.xservices.types.scm.ItemType;
5
/*     */ import net.brutex.xservices.ws.rs.CVSInfoImpl;
5
			import net.brutex.xservices.util.CVSRoot;
-
 
6
 
6
/*     */ import org.apache.commons.configuration.Configuration;
7
import org.apache.commons.configuration2.PropertiesConfiguration;
7
/*     */ import org.apache.commons.configuration.ConfigurationException;
8
import org.apache.commons.configuration2.builder.fluent.Configurations;
8
/*     */ import org.apache.commons.configuration.PropertiesConfiguration;
9
import org.apache.commons.configuration2.ex.ConfigurationException;
-
 
10
import org.apache.logging.log4j.LogManager;
9
/*     */ import org.apache.log4j.Logger;
11
import org.apache.logging.log4j.Logger;
10
/*     */ import org.netbeans.lib.cvsclient.Client;
12
/*     */ import org.netbeans.lib.cvsclient.Client;
11
/*     */ import org.netbeans.lib.cvsclient.admin.StandardAdminHandler;
13
/*     */ import org.netbeans.lib.cvsclient.admin.StandardAdminHandler;
12
/*     */ import org.netbeans.lib.cvsclient.command.CommandAbortedException;
14
/*     */ import org.netbeans.lib.cvsclient.command.CommandAbortedException;
13
/*     */ import org.netbeans.lib.cvsclient.command.GlobalOptions;
15
/*     */ import org.netbeans.lib.cvsclient.command.GlobalOptions;
14
/*     */ import org.netbeans.lib.cvsclient.connection.AuthenticationException;
16
/*     */ import org.netbeans.lib.cvsclient.connection.AuthenticationException;
15
/*     */ import org.netbeans.lib.cvsclient.connection.PServerConnection;
17
/*     */ import org.netbeans.lib.cvsclient.connection.PServerConnection;
16
/*     */ 
18
/*     */ 
17
/*     */ public class CVSClient
19
/*     */ public class CVSClient
18
/*     */ {
20
/*     */ {
19
/*     */   private final File configfile;
21
/*     */   private final File configfile;
20
/*     */   private final PServerConnection connection;
22
/*     */   private final PServerConnection connection;
21
/*     */   private final CVSRoot root;
23
/*     */   private final CVSRoot root;
22
/*     */   private final GlobalOptions globalOptions;
24
/*     */   private final GlobalOptions globalOptions;
23
/*  41 */   final Logger logger = Logger.getLogger(CVSInfoImpl.class);
25
/*  41 */   final Logger logger = LogManager.getLogger();
24
/*     */   public final Client client;
26
/*     */   public final Client client;
25
/*     */ 
27
/*     */ 
26
/*     */   public Client getClient()
28
/*     */   public Client getClient()
27
/*     */   {
29
/*     */   {
28
/*  49 */     return this.client;
30
/*  49 */     return this.client;
29
/*     */   }
31
/*     */   }
30
/*     */ 
32
/*     */ 
31
/*     */   public CVSClient(File config) throws CommandAbortedException, AuthenticationException, ConfigurationException {
33
/*     */   public CVSClient(File config) throws CommandAbortedException, AuthenticationException, ConfigurationException {
32
/*  53 */     System.setProperty("cvsClientLog", "c:/temp/cvs.log");
34
/*  53 */     System.setProperty("cvsClientLog", "c:/temp/cvs.log");
33
/*  54 */     if ((config == null) || (!config.exists()) || (config.isDirectory())) {
35
/*  54 */     if ((config == null) || (!config.exists()) || (config.isDirectory())) {
34
/*  55 */       throw new ConfigurationException("Config file not found");
36
/*  55 */       throw new ConfigurationException("Config file not found");
35
/*     */     }
37
/*     */     }
36
/*  57 */     this.configfile = config;
38
/*  57 */     this.configfile = config;
-
 
39
				Configurations configs = new Configurations();
-
 
40
				
37
/*  58 */     Configuration configuration = new PropertiesConfiguration(this.configfile);
41
/*  58 */     PropertiesConfiguration configuration = configs.properties(this.configfile);
38
/*     */ 
42
/*     */ 
39
/*  60 */     String cvsroot = configuration.getString("CVSROOT");
43
/*  60 */     String cvsroot = configuration.getString("CVSROOT");
40
/*  61 */     String workdir = configuration.getString("WORKDIR");
44
/*  61 */     String workdir = configuration.getString("WORKDIR");
41
/*  62 */     String password = configuration.getString("PASSWORD");
45
/*  62 */     String password = configuration.getString("PASSWORD");
42
/*     */ 
46
/*     */ 
43
/*  64 */     this.root = new CVSRoot(cvsroot);
47
/*  64 */     this.root = new CVSRoot(cvsroot);
44
/*  65 */     this.globalOptions = new GlobalOptions();
48
/*  65 */     this.globalOptions = new GlobalOptions();
45
/*  66 */     this.globalOptions.setCVSRoot(cvsroot);
49
/*  66 */     this.globalOptions.setCVSRoot(cvsroot);
46
/*     */ 
50
/*     */ 
47
/*  68 */     this.connection = new PServerConnection();
51
/*  68 */     this.connection = new PServerConnection();
48
/*  69 */     this.connection.setUserName(this.root.user);
52
/*  69 */     this.connection.setUserName(this.root.user);
49
/*  70 */     if (password != null)
53
/*  70 */     if (password != null)
50
/*  71 */       this.connection.setEncodedPassword(CvsPassword.encode(password));
54
/*  71 */       this.connection.setEncodedPassword(CvsPassword.encode(password));
51
/*     */     else {
55
/*     */     else {
52
/*  73 */       this.connection.setEncodedPassword(password);
56
/*  73 */       this.connection.setEncodedPassword(password);
53
/*     */     }
57
/*     */     }
54
/*     */ 
58
/*     */ 
55
/*  76 */     this.connection.setHostName(this.root.host);
59
/*  76 */     this.connection.setHostName(this.root.host);
56
/*  77 */     this.connection.setRepository(this.root.repository);
60
/*  77 */     this.connection.setRepository(this.root.repository);
57
/*     */     try {
61
/*     */     try {
58
/*  79 */       this.connection.open();
62
/*  79 */       this.connection.open();
59
/*     */     } catch (AuthenticationException ex) {
63
/*     */     } catch (AuthenticationException ex) {
60
/*  81 */       this.logger.error(ex.getMessage());
64
/*  81 */       this.logger.error(ex.getMessage());
61
/*     */     }
65
/*     */     }
62
/*     */ 
66
/*     */ 
63
/*  84 */     this.client = new Client(this.connection, new StandardAdminHandler());
67
/*  84 */     this.client = new Client(this.connection, new StandardAdminHandler());
64
/*  85 */     this.client.setLocalPath(workdir);
68
/*  85 */     this.client.setLocalPath(workdir);
65
/*     */   }
69
/*     */   }
66
/*     */ 
70
/*     */ 
67
/*     */   public File getConfigFile()
71
/*     */   public File getConfigFile()
68
/*     */   {
72
/*     */   {
69
/*  91 */     return this.configfile;
73
/*  91 */     return this.configfile;
70
/*     */   }
74
/*     */   }
71
/*     */ 
75
/*     */ 
72
/*     */   public GlobalOptions getGlobalOptions() {
76
/*     */   public GlobalOptions getGlobalOptions() {
73
/*  95 */     return this.globalOptions;
77
/*  95 */     return this.globalOptions;
74
/*     */   }
78
/*     */   }
75
/*     */ 
79
/*     */ 
76
/*     */   public PServerConnection getConnection()
80
/*     */   public PServerConnection getConnection()
77
/*     */   {
81
/*     */   {
78
/* 101 */     return this.connection;
82
/* 101 */     return this.connection;
79
/*     */   }
83
/*     */   }
80
/*     */ 
84
/*     */ 
81
/*     */   public CVSRoot getRoot()
85
/*     */   public CVSRoot getRoot()
82
/*     */   {
86
/*     */   {
83
/* 107 */     return this.root;
87
/* 107 */     return this.root;
84
/*     */   }
88
/*     */   }
85
/*     */ 
89
/*     */ 
86
/*     */   public static String generateID(ItemType item) {
90
/*     */   public static String generateID(ItemType item) {
87
/* 111 */     return "::[" + item.getRemotename() + "]";
91
/* 111 */     return "::[" + item.getRemotename() + "]";
88
/*     */   }
92
/*     */   }
89
/*     */ }
93
/*     */ }
90
 
94
 
91
/* Location:           C:\Users\brosenberger\Documents\My Box Files\XBridgeNG-download\XServices-20130131 - Kopie\WEB-INF\classes\net.zip
95
/* Location:           C:\Users\brosenberger\Documents\My Box Files\XBridgeNG-download\XServices-20130131 - Kopie\WEB-INF\classes\net.zip
92
 * Qualified Name:     net.brutex.xservices.util.CVSClient
96
 * Qualified Name:     net.brutex.xservices.util.CVSClient
93
 * JD-Core Version:    0.6.2
97
 * JD-Core Version:    0.6.2
94
 */
98
 */
95
 
99
 
96
Generated by GNU Enscript 1.6.5.90.
100
Generated by GNU Enscript 1.6.5.90.
97
 
101
 
98
 
102