Package au.com.cahaya.asas.util.cli

Examples of au.com.cahaya.asas.util.cli.PropertyFileOption


  {
    CommandLineParser parser = new GnuParser ();
    Options options = new Options ();
    options.addOption (new HelpOption ());
    options.addOption (new PersistenceOption ());
    PropertyFileOption propOption = new PropertyFileOption ();
    options.addOption (propOption);

    try {
      // parse the command line arguments
      CommandLine line = parser.parse (options, args);

      if (line.hasOption (HelpOption.cValue)) {
        HelpFormatter hf = new HelpFormatter ();
        hf.printHelp (SeedPartyTypes.class.toString (), options);
      }
      else {
        EntityManagerFactory emf = null;
        if (line.hasOption (PropertyFileOption.cValue)) {
          try {
            emf = Persistence.createEntityManagerFactory(line.getOptionValue (PersistenceOption.cValue), propOption.load ());
          }
          catch (IOException exc) {
            System.err.println ("Error reading properties from " + propOption.getValue ());
          }
        }
        else {
          emf = Persistence.createEntityManagerFactory(line.getOptionValue (PersistenceOption.cValue));
        }
View Full Code Here


  {
    CommandLineParser parser = new GnuParser ();
    Options options = new Options ();
    options.addOption (new HelpOption ());
    options.addOption (new PersistenceOption ());
    PropertyFileOption propOption = new PropertyFileOption ();
    options.addOption (propOption);

    try {
      // parse the command line arguments
      CommandLine line = parser.parse (options, args);

      if (line.hasOption (HelpOption.cValue)) {
        HelpFormatter hf = new HelpFormatter ();
        hf.printHelp (SeedUnitTypes.class.toString (), options);
      }
      else {
        EntityManagerFactory emf = null;
        if (line.hasOption (PropertyFileOption.cValue)) {
          try {
            emf = Persistence.createEntityManagerFactory(line.getOptionValue (PersistenceOption.cValue), propOption.load ());
          }
          catch (IOException exc) {
            System.err.println ("Error reading properties from " + propOption.getValue ());
          }
        }
        else {
          emf = Persistence.createEntityManagerFactory(line.getOptionValue (PersistenceOption.cValue));
        }
View Full Code Here

    CommandLineParser parser = new GnuParser ();
    Options options = new Options ();
    options.addOption (new HelpOption ());
    options.addOption (new FileOption ());
    options.addOption (new PersistenceOption ());
    PropertyFileOption propOption = new PropertyFileOption ();
    options.addOption (propOption);
    options.addOption (new PartyKeyOption ());

    try {
      // parse the command line arguments
      CommandLine line = parser.parse (options, args);

      if (line.hasOption (HelpOption.cValue)) {
        HelpFormatter hf = new HelpFormatter ();
        hf.printHelp (ImportJavaPrefs.class.toString (), options);
      }
      else {
        File f = new File (line.getOptionValue (FileOption.cValue));
        int ptyKey = Integer.parseInt (line.getOptionValue (PartyKeyOption.cValue));
        if (f.canRead ()) {
          EntityManagerFactory emf = null;
          if (line.hasOption (PropertyFileOption.cValue)) {
            try {
              emf = Persistence.createEntityManagerFactory(line.getOptionValue (PersistenceOption.cValue), propOption.load ());
            }
            catch (IOException exc) {
              System.err.println ("Error reading properties from " + propOption.getValue ());
            }
          }
          else {
            emf = Persistence.createEntityManagerFactory(line.getOptionValue (PersistenceOption.cValue));
          }
View Full Code Here

  public static void main (String[] args)
  {
    CommandLineParser parser = new GnuParser ();
    Options options = new Options ();
    options.addOption (new HelpOption ());
    PropertyFileOption propOption = new PropertyFileOption ();
    options.addOption (propOption);
    options.addOption (new PersistenceOption ());
    PartyKeyOption partyKeyOption = new PartyKeyOption ();
    options.addOption (partyKeyOption);
    options.addOption (new ContactOption ());
    options.addOption (new OldContactOption ());
   

    try {
      // parse the command line arguments
      CommandLine line = parser.parse (options, args);

      if (line.hasOption (HelpOption.cValue)) {
        HelpFormatter hf = new HelpFormatter ();
        hf.printHelp (EditPartyContact.class.toString (), options);
      }
      else {
        long ptyKey = partyKeyOption.parseAsLong();
        String newContact = line.getOptionValue (ContactOption.cValue);
        String oldContact = null;
        if (line.hasOption (OldContactOption.cValue)) {
          oldContact = line.getOptionValue (OldContactOption.cValue);
        }
       
        EntityManagerFactory emf = null;
        if (line.hasOption (PropertyFileOption.cValue)) {
          try {
            emf = Persistence.createEntityManagerFactory("asas.ds", propOption.load ());
          }
          catch (IOException exc) {
            System.err.println ("Error reading properties from " + propOption.getValue ());
          }
        }
        else {
          emf = Persistence.createEntityManagerFactory("contact");
        }
View Full Code Here

    CommandLineParser parser = new GnuParser ();
    Options options = new Options ();
    options.addOption (new HelpOption ());
    options.addOption (new FileOption ());
    options.addOption (new PersistenceOption ());
    PropertyFileOption propOption = new PropertyFileOption ();
    options.addOption (propOption);
    options.addOption (new PartyKeyOption ());

    try {
      // parse the command line arguments
      CommandLine line = parser.parse (options, args);

      if (line.hasOption (HelpOption.cValue)) {
        HelpFormatter hf = new HelpFormatter ();
        hf.printHelp (ImportJavaPrefs.class.toString (), options);
      }
      else {
        File f = new File (line.getOptionValue (FileOption.cValue));
        int ptyKey = Integer.parseInt (line.getOptionValue (PartyKeyOption.cValue));
       
        EntityManagerFactory emf = null;
        if (line.hasOption (PropertyFileOption.cValue)) {
          try {
            emf = Persistence.createEntityManagerFactory(line.getOptionValue (PersistenceOption.cValue), propOption.load ());
          }
          catch (IOException exc) {
            System.err.println ("Error reading properties from " + propOption.getValue ());
          }
        }
        else {
          emf = Persistence.createEntityManagerFactory(line.getOptionValue (PersistenceOption.cValue));
        }
View Full Code Here

  public static void main (String[] args)
  {
    CommandLineParser parser = new GnuParser ();
    Options options = new Options ();
    options.addOption (new HelpOption ());
    PropertyFileOption propOption = new PropertyFileOption ();
    options.addOption (propOption);
    options.addOption (new PersistenceOption ());
    options.addOption (new ContactOption ());
   

    try {
      // parse the command line arguments
      CommandLine line = parser.parse (options, args);

      if (line.hasOption (HelpOption.cValue)) {
        HelpFormatter hf = new HelpFormatter ();
        hf.printHelp (FindPartyWithContact.class.toString (), options);
      }
      else {
        String contact = line.getOptionValue (ContactOption.cValue);
       
        EntityManagerFactory emf = null;
        if (line.hasOption (PropertyFileOption.cValue)) {
          try {
            emf = Persistence.createEntityManagerFactory("asas.ds", propOption.load ());
          }
          catch (IOException exc) {
            System.err.println ("Error reading properties from " + propOption.getValue ());
          }
        }
        else {
          emf = Persistence.createEntityManagerFactory("contact");
        }
View Full Code Here

TOP

Related Classes of au.com.cahaya.asas.util.cli.PropertyFileOption

Copyright © 2018 www.massapicom. 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.