Subversion Repositories XServices

Rev

Rev 94 | Blame | Last modification | View Log | Download | RSS feed

/*    */ package net.brutex.xservices.util;
/*    */ 
/*    */ import java.io.BufferedReader;
/*    */ import java.io.File;
/*    */ import java.io.FileReader;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintStream;
/*    */ 
/*    */ public class CVSRoot
/*    */ {
/*    */   public String connectionType;
/*    */   public String user;
/*    */   public String host;
/*    */   public String repository;
/*    */ 
/*    */   public CVSRoot(String root)
/*    */     throws IllegalArgumentException
/*    */   {
/* 19 */     if (!root.startsWith(":")) {
/* 20 */       throw new IllegalArgumentException();
/*    */     }
/* 22 */     int oldColonPosition = 0;
/* 23 */     int colonPosition = root.indexOf(':', 1);
/* 24 */     if (colonPosition == -1)
/* 25 */       throw new IllegalArgumentException();
/* 26 */     this.connectionType = root.substring(oldColonPosition + 1, colonPosition);
/* 27 */     oldColonPosition = colonPosition;
/* 28 */     colonPosition = root.indexOf('@', colonPosition + 1);
/* 29 */     if (colonPosition == -1)
/* 30 */       throw new IllegalArgumentException();
/* 31 */     this.user = root.substring(oldColonPosition + 1, colonPosition);
/* 32 */     oldColonPosition = colonPosition;
/* 33 */     colonPosition = root.indexOf(':', colonPosition + 1);
/* 34 */     if (colonPosition == -1)
/* 35 */       throw new IllegalArgumentException();
/* 36 */     this.host = root.substring(oldColonPosition + 1, colonPosition);
/* 37 */     this.repository = root.substring(colonPosition + 1);
/* 38 */     if ((this.connectionType == null) || (this.user == null) || (this.host == null) || 
/* 39 */       (this.repository == null))
/* 40 */       throw new IllegalArgumentException();
/*    */   }
/*    */ 
/*    */   public String getCVSRoot(File directory) {
/* 44 */     String root = null;
/* 45 */     BufferedReader r = null;
/*    */     try {
/* 47 */       File rootFile = new File(directory, "CVS/Root");
/* 48 */       if (rootFile.exists()) {
/* 49 */         r = new BufferedReader(new FileReader(rootFile));
/* 50 */         root = r.readLine();
/*    */       }
/*    */     }
/*    */     catch (IOException localIOException1)
/*    */     {
/*    */       try {
/* 56 */         if (r != null)
/* 57 */           r.close();
/*    */       } catch (IOException e) {
/* 59 */         System.err.println("Warning: could not close CVS/Root file!");
/*    */       }
/*    */     }
/*    */     finally
/*    */     {
/*    */       try
/*    */       {
/* 56 */         if (r != null)
/* 57 */           r.close();
/*    */       } catch (IOException e) {
/* 59 */         System.err.println("Warning: could not close CVS/Root file!");
/*    */       }
/*    */     }
/* 62 */     if (root == null) {
/* 63 */       root = System.getProperty("cvs.root");
/*    */     }
/* 65 */     return root;
/*    */   }
/*    */ }

/* Location:           C:\Users\brosenberger\Documents\My Box Files\XBridgeNG-download\XServices-20130131 - Kopie\WEB-INF\classes\net.zip
 * Qualified Name:     net.brutex.xservices.util.CVSRoot
 * JD-Core Version:    0.6.2
 */

Generated by GNU Enscript 1.6.5.90.