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