Ignore:
Timestamp:
02/20/11 00:09:57 (9 years ago)
Author:
curtis
Message:

Ostensibly working version of cppwrap-maven-plugin.

Location:
trunk/projects/jar2lib/src/main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/projects/jar2lib/src/main/java/loci/jar2lib/Jar2Lib.java

    r6926 r7626  
    176176  public void checkInputs() { 
    177177    // check project ID 
    178     if (projectId == null || !projectId.matches("^(\\w)+$")) { 
     178    if (projectId == null || !projectId.matches("^(\\w)([\\w\\-])*$")) { 
    179179      throw new IllegalStateException("Invalid project ID: " + projectId); 
    180180    } 
     
    313313  // -- Helper methods -- 
    314314 
    315   private void log(String message) { 
     315  protected void log(String message) { 
    316316    // TODO - improving logging mechanism? 
    317317    System.out.println(message); 
    318318  } 
    319319 
    320   private void die(String message) { 
     320  protected void die(String message) { 
    321321    throw new IllegalArgumentException(message); 
    322322  } 
     
    329329  } 
    330330 
    331   /** Builds a classpath corresponding to the given list of JAR files. */ 
    332   private String classpath(List<String> jarPaths) 
    333     throws UnsupportedEncodingException 
    334   { 
    335     final StringBuilder sb = new StringBuilder(); 
    336     final String jrePath = findRuntime(); 
    337     sb.append(jrePath); 
    338     for (String jarPath : jarPaths) { 
    339       sb.append(File.pathSeparator); 
    340       sb.append(jarPath); 
    341     } 
    342     final String classPath = System.getProperty("java.class.path"); 
    343     if (classPath != null && !classPath.equals("")) { 
    344       sb.append(File.pathSeparator); 
    345       sb.append(classPath); 
    346     } 
    347     final String bootClassPath = System.getProperty("sun.boot.class.path"); 
    348     if (bootClassPath != null && !bootClassPath.equals("")) { 
    349       sb.append(File.pathSeparator); 
    350       sb.append(bootClassPath); 
    351     } 
    352     return sb.toString(); 
    353   } 
    354  
    355   /** Locates the JAR file containing this JVM's classes. */ 
    356   private String findRuntime() throws UnsupportedEncodingException { 
    357     return findEnclosingJar(Object.class); 
    358   } 
    359  
    360331  /** Scans the enclosing JAR file for all resources beneath the given path. */ 
    361332  private List<String> findResources(String resourceDir) throws IOException { 
    362333    final List<String> resources = new ArrayList<String>(); 
    363     final String jarPath = findEnclosingJar(getClass()); 
     334    final String jarPath = findEnclosingJar(Jar2Lib.class); 
    364335    final JarFile jarFile = new JarFile(jarPath); 
    365336    final Enumeration<JarEntry> jarEntries = jarFile.entries(); 
     
    389360    else { 
    390361      // resource is a file 
    391       final InputStream in = getClass().getResourceAsStream("/" + resource); 
     362      final InputStream in = Jar2Lib.class.getResourceAsStream("/" + resource); 
    392363      final OutputStream out = new FileOutputStream(outputFile); 
    393364      final byte[] buf = new byte[512 * 1024]; // 512K buffer 
     
    427398  } 
    428399 
     400  /** Builds a classpath corresponding to the given list of JAR files. */ 
     401  private static String classpath(List<String> jarPaths) 
     402    throws UnsupportedEncodingException 
     403  { 
     404    final StringBuilder sb = new StringBuilder(); 
     405    final String jrePath = findRuntime(); 
     406    sb.append(jrePath); 
     407    for (String jarPath : jarPaths) { 
     408      sb.append(File.pathSeparator); 
     409      sb.append(jarPath); 
     410    } 
     411    final String classPath = System.getProperty("java.class.path"); 
     412    if (classPath != null && !classPath.equals("")) { 
     413      sb.append(File.pathSeparator); 
     414      sb.append(classPath); 
     415    } 
     416    final String bootClassPath = System.getProperty("sun.boot.class.path"); 
     417    if (bootClassPath != null && !bootClassPath.equals("")) { 
     418      sb.append(File.pathSeparator); 
     419      sb.append(bootClassPath); 
     420    } 
     421    return sb.toString(); 
     422  } 
     423 
     424  /** Locates the JAR file containing this JVM's classes. */ 
     425  private static String findRuntime() throws UnsupportedEncodingException { 
     426    return findEnclosingJar(Object.class); 
     427  } 
     428 
    429429} 
  • trunk/projects/jar2lib/src/main/resources/jace-header.vm

    r6806 r7626  
    66 * 
    77 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY. 
    8  * Created by $user via JaceHeaderAutogen on $timestamp 
     8 * Created by $user via Jar2Lib on $timestamp 
    99 * 
    1010 *----------------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.