Changeset 2441


Ignore:
Timestamp:
03/14/07 11:23:39 (13 years ago)
Author:
curtis
Message:

OMEUploader should work, though events still aren't worked out.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/ome/OMEUploader.java

    r2430 r2441  
    830830   * OME server using client-side Java tools. 
    831831   */ 
    832   public static void main(String[] args) { 
     832  public static void main(String[] args) throws Exception { 
    833833    String server = null, user = null, pass = null; 
    834     Vector files = new Vector(); 
     834    String id = null; 
    835835 
    836836    // parse command-line arguments 
     
    851851          } 
    852852          else { 
    853             System.out.println("Error: unknown flag: " + param); 
    854             System.out.println(); 
     853            System.err.println("Error: unknown flag: " + param); 
     854            System.err.println(); 
    855855            doUsage = true; 
    856856            break; 
     
    859859        catch (ArrayIndexOutOfBoundsException exc) { 
    860860          if (i == args.length - 1) { 
    861             System.out.println("Error: flag " + param + 
     861            System.err.println("Error: flag " + param + 
    862862              " must be followed by a parameter value."); 
    863             System.out.println(); 
     863            System.err.println(); 
    864864            doUsage = true; 
    865865            break; 
     
    869869      } 
    870870      else { 
    871         files.add(args[i]); 
    872       } 
    873     } 
     871        if (id == null) id = args[i]; 
     872        else { 
     873          System.err.println("Error: unknown argument: " + args[i]); 
     874          System.err.println(); 
     875        } 
     876      } 
     877    } 
     878    if (id == null) doUsage = true; 
    874879    if (doUsage) { 
    875       System.out.println("Usage: omeul [-s server.address] " + 
     880      System.err.println("Usage: omeul [-s server.address] " + 
    876881        "[-u username] [-p password] filename"); 
    877       System.out.println(); 
     882      System.err.println(); 
    878883      System.exit(1); 
    879884    } 
     
    898903 
    899904    if (server == null || user == null || pass == null) { 
    900       System.out.println("Error: could not obtain server login information"); 
     905      System.err.println("Error: could not obtain server login information"); 
    901906      System.exit(2); 
    902907    } 
     
    904909 
    905910    // create image uploader 
    906 /* CTR TODO 
    907     OMEUploader uploader = new OMEUploader(); 
    908     uploader.addTaskListener(new TaskListener() { 
    909       public void taskUpdated(TaskEvent e) { 
    910         System.out.println(e.getStatusMessage()); 
    911       } 
    912     }); 
    913  
    914     for (int i=0; i<files.size(); i++) { 
    915       FilePattern fp = new FilePattern((String) files.get(i)); 
    916       int[] lengths = fp.getCount(); 
    917       if (lengths.length == 0) { 
    918         lengths = new int[1]; 
    919         lengths[0] = 1; 
    920       } 
    921        
    922       loci.visbio.data.Dataset data = new loci.visbio.data.Dataset( 
    923         (String) files.get(i), fp.getPattern(), fp.getFiles(), lengths,  
    924         new String[lengths.length]); 
    925       uploader.upload(data, server, user, pass); 
    926     } 
    927 */ 
     911    OMEUploader uploader = new OMEUploader(server, user, pass); 
     912//    uploader.addUploadListener(new UploadListener() { 
     913//      public void taskUpdated(UploadEvent e) { 
     914//        System.out.println(e.getStatusMessage()); 
     915//      } 
     916//    }); 
     917    uploader.uploadFile(id, true); 
    928918  } 
    929919 
Note: See TracChangeset for help on using the changeset viewer.