Package edu.scripps.genewiki.sync

Source Code of edu.scripps.genewiki.sync.App

package edu.scripps.genewiki.sync;


import java.io.IOException;
import javax.security.auth.login.FailedLoginException;

import joptsimple.OptionParser;
import joptsimple.OptionSet;

import edu.scripps.mwsync.Sync;


public class App
{
    public static void main( String[] args ) throws IOException, FailedLoginException
    {
      OptionParser parser = new OptionParser();
      parser.accepts("r", "home directory").withRequiredArg().ofType(String.class);
      parser.accepts("p", "sync one page").withRequiredArg().ofType(String.class);
      parser.accepts("h", "changes since x hours ago").withRequiredArg().ofType(Integer.class);
      OptionSet options = parser.parse(args);
      String root = "/usr/local/bin/gwsync/";
      root =  (String) (options.hasArgument("r") ? options.valueOf("r") : root);
      Sync sync = Sync.newFromConfigFile(root+"sync.conf");
      String ncboAPIKey   = sync.getProperties().getProperty("ncbo.api.key");
      String doidFile    = sync.getProperties().getProperty("doid.file");
      sync.addRewriter(new GeneWikiEditor(root, ncboAPIKey, doidFile));
      if (options.hasArgument("p")) {
        sync.runForPages((String) options.valueOf("p"));
      } else if (options.hasArgument("h")) {
        sync.runChangesFromHoursAgo((Integer)options.valueOf("h"));
      } else {
        sync.run();
      }
    } 
}
TOP

Related Classes of edu.scripps.genewiki.sync.App

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.