View Javadoc

1   package com.aragost.javahg.internals;
2   
3   import java.io.File;
4   import java.io.IOException;
5   
6   import com.aragost.javahg.MercurialExtension;
7   
8   /**
9    * Extension class to load the JavaHg specific Mercurial extension
10   */
11  public class JavaHgMercurialExtension extends MercurialExtension {
12  
13      private File pythonFile;
14  
15      @Override
16      public String getName() {
17          return "javahg";
18      }
19  
20      public String getResourceName() {
21          return "/" + getName() + ".py";
22      }
23  
24      @Override
25      public String getPath() {
26          return this.pythonFile.getAbsolutePath();
27      }
28  
29      @Override
30      public void initialize() throws IOException {
31          if (this.pythonFile == null || !this.pythonFile.exists()) {
32              this.pythonFile = Utils.resourceAsFile(getResourceName());
33          }
34      }
35  
36  }