Subversion Repositories XServices

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
113 brianR 1
/*    */ package net.brutex.xservices.util;
2
/*    */
3
/*    */ import java.io.BufferedReader;
4
/*    */ import java.io.File;
5
/*    */ import java.io.FileReader;
6
/*    */ import java.io.IOException;
7
/*    */ import java.io.PrintStream;
8
/*    */
9
/*    */ public class CVSRoot
10
/*    */ {
11
/*    */   public String connectionType;
12
/*    */   public String user;
13
/*    */   public String host;
14
/*    */   public String repository;
15
/*    */
16
/*    */   public CVSRoot(String root)
17
/*    */     throws IllegalArgumentException
18
/*    */   {
19
/* 19 */     if (!root.startsWith(":")) {
20
/* 20 */       throw new IllegalArgumentException();
21
/*    */     }
22
/* 22 */     int oldColonPosition = 0;
23
/* 23 */     int colonPosition = root.indexOf(':', 1);
24
/* 24 */     if (colonPosition == -1)
25
/* 25 */       throw new IllegalArgumentException();
26
/* 26 */     this.connectionType = root.substring(oldColonPosition + 1, colonPosition);
27
/* 27 */     oldColonPosition = colonPosition;
28
/* 28 */     colonPosition = root.indexOf('@', colonPosition + 1);
29
/* 29 */     if (colonPosition == -1)
30
/* 30 */       throw new IllegalArgumentException();
31
/* 31 */     this.user = root.substring(oldColonPosition + 1, colonPosition);
32
/* 32 */     oldColonPosition = colonPosition;
33
/* 33 */     colonPosition = root.indexOf(':', colonPosition + 1);
34
/* 34 */     if (colonPosition == -1)
35
/* 35 */       throw new IllegalArgumentException();
36
/* 36 */     this.host = root.substring(oldColonPosition + 1, colonPosition);
37
/* 37 */     this.repository = root.substring(colonPosition + 1);
38
/* 38 */     if ((this.connectionType == null) || (this.user == null) || (this.host == null) ||
39
/* 39 */       (this.repository == null))
40
/* 40 */       throw new IllegalArgumentException();
41
/*    */   }
42
/*    */
43
/*    */   public String getCVSRoot(File directory) {
44
/* 44 */     String root = null;
45
/* 45 */     BufferedReader r = null;
46
/*    */     try {
47
/* 47 */       File rootFile = new File(directory, "CVS/Root");
48
/* 48 */       if (rootFile.exists()) {
49
/* 49 */         r = new BufferedReader(new FileReader(rootFile));
50
/* 50 */         root = r.readLine();
51
/*    */       }
52
/*    */     }
53
/*    */     catch (IOException localIOException1)
54
/*    */     {
55
/*    */       try {
56
/* 56 */         if (r != null)
57
/* 57 */           r.close();
58
/*    */       } catch (IOException e) {
59
/* 59 */         System.err.println("Warning: could not close CVS/Root file!");
60
/*    */       }
61
/*    */     }
62
/*    */     finally
63
/*    */     {
64
/*    */       try
65
/*    */       {
66
/* 56 */         if (r != null)
67
/* 57 */           r.close();
68
/*    */       } catch (IOException e) {
69
/* 59 */         System.err.println("Warning: could not close CVS/Root file!");
70
/*    */       }
71
/*    */     }
72
/* 62 */     if (root == null) {
73
/* 63 */       root = System.getProperty("cvs.root");
74
/*    */     }
75
/* 65 */     return root;
76
/*    */   }
77
/*    */ }
94 brianR 78
 
113 brianR 79
/* Location:           C:\Users\brosenberger\Documents\My Box Files\XBridgeNG-download\XServices-20130131 - Kopie\WEB-INF\classes\net.zip
80
 * Qualified Name:     net.brutex.xservices.util.CVSRoot
81
 * JD-Core Version:    0.6.2
82
 */