Android Open Source - NexusData Startup






From Project

Back to project page NexusData.

License

The source code is released under:

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCT...

If you think the Android project NexusData listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.github.dkharrat.nexusdata.modelgen;
/*from   ww  w.  j a  v a2  s  .co  m*/
import org.apache.commons.cli.*;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class Startup {
    public static void main(String[] args) throws IOException {

        CommandLine line = parseCommandLineOptions(args);
        if (line != null) {
            String modelPath = line.getOptionValue(Cli.file.getOpt());
            File outputPath = new File(line.getOptionValue(Cli.output.getOpt(), "./out"));

            new ModelGenerator().generateModels(modelPath, outputPath);
        }
    }

    private static class Cli {
        private static Option help = OptionBuilder
                .hasArgs(0)
                .withLongOpt("help")
                .withDescription("print this message")
                .isRequired(false)
                .create("h");

        private static Option version = OptionBuilder
                .hasArgs(0)
                .withLongOpt("version")
                .withDescription("version number of modelgen")
                .isRequired(false)
                .create("v");

        private static Option file = OptionBuilder
                .hasArg()
                .withLongOpt("file")
                .withDescription("the model file")
                .isRequired(true)
                .create("f");

        private static Option output = OptionBuilder
                .hasArg()
                .withArgName("output")
                .withDescription("the output directory")
                .isRequired(false)
                .create("O");

        static Options getMainOptions() {
            Options options = new Options();
            options.addOption(Cli.file);
            options.addOption(Cli.output);
            options.addOption(Cli.version);
            options.addOption(Cli.help);
            return options;
        }

        static Options getHelpOptions() {
            Options options = new Options();
            options.addOption(Cli.help);
            options.addOption(Cli.version);
            return options;
        }
    }

    private static CommandLine parseCommandLineOptions(String[] args) {

        Options helpOptions = Cli.getHelpOptions();
        Options mainOptions = Cli.getMainOptions();

        try {
            CommandLine cmdLine = new BasicParser().parse(helpOptions, args);
            if (cmdLine.hasOption(Cli.help.getOpt())) {
                printHelpMessage(mainOptions);
                return null;
            } else if (cmdLine.hasOption(Cli.version.getOpt())) {
                printVersion();
                return null;
            }
        } catch( ParseException exp ) {
            // ignore
        }

        try {
            CommandLine cmdLine = new BasicParser().parse(mainOptions, args);
            return cmdLine;
        } catch( ParseException exp ) {
            System.err.println("Error parsing command-line: " + exp.getMessage());
            return null;
        }
    }

    private static void printHelpMessage(Options mainOptions) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("java modelgen.jar", mainOptions);
    }

    private static void printVersion() {
        System.out.println("modelgen version " + getVersion());
    }

    private static String getVersion() {
        InputStream stream = Startup.class.getResourceAsStream("/version.properties");
        if (stream == null) {
            return "<UNKNOWN>";
        }

        Properties props = new Properties();
        try {
            props.load(stream);
            stream.close();
            return (String) props.get("version");
        } catch (IOException e) {
            return "<UNKNOWN>";
        }
    }
}




Java Source Code List

com.github.dkharrat.nexusdata.core.AtomicStore.java
com.github.dkharrat.nexusdata.core.ChangedObjectsSet.java
com.github.dkharrat.nexusdata.core.FaultingSet.java
com.github.dkharrat.nexusdata.core.FetchRequest.java
com.github.dkharrat.nexusdata.core.IncrementalStore.java
com.github.dkharrat.nexusdata.core.ManagedObject.java
com.github.dkharrat.nexusdata.core.NoSuchPropertyException.java
com.github.dkharrat.nexusdata.core.ObjectContextNotifier.java
com.github.dkharrat.nexusdata.core.ObjectContext.java
com.github.dkharrat.nexusdata.core.ObjectID.java
com.github.dkharrat.nexusdata.core.ObjectsChangedNotification.java
com.github.dkharrat.nexusdata.core.PersistentStoreCoordinator.java
com.github.dkharrat.nexusdata.core.PersistentStoreRequest.java
com.github.dkharrat.nexusdata.core.PersistentStore.java
com.github.dkharrat.nexusdata.core.SaveChangesRequest.java
com.github.dkharrat.nexusdata.core.SortDescriptor.java
com.github.dkharrat.nexusdata.core.StoreCacheNode.java
com.github.dkharrat.nexusdata.metamodel.Attribute.java
com.github.dkharrat.nexusdata.metamodel.Entity.java
com.github.dkharrat.nexusdata.metamodel.ObjectModelJsonParser.java
com.github.dkharrat.nexusdata.metamodel.ObjectModel.java
com.github.dkharrat.nexusdata.metamodel.Property.java
com.github.dkharrat.nexusdata.metamodel.Relationship.java
com.github.dkharrat.nexusdata.modelgen.ModelGenerator.java
com.github.dkharrat.nexusdata.modelgen.Startup.java
com.github.dkharrat.nexusdata.modelgen.metamodel.Attribute.java
com.github.dkharrat.nexusdata.modelgen.metamodel.Entity.java
com.github.dkharrat.nexusdata.modelgen.metamodel.EnumProperty.java
com.github.dkharrat.nexusdata.modelgen.metamodel.ModelWrapper.java
com.github.dkharrat.nexusdata.modelgen.metamodel.Model.java
com.github.dkharrat.nexusdata.modelgen.metamodel.Property.java
com.github.dkharrat.nexusdata.modelgen.metamodel.Relationship.java
com.github.dkharrat.nexusdata.predicate.ComparisonPredicate.java
com.github.dkharrat.nexusdata.predicate.CompoundPredicate.java
com.github.dkharrat.nexusdata.predicate.ConstantExpression.java
com.github.dkharrat.nexusdata.predicate.ExpressionBuilder.java
com.github.dkharrat.nexusdata.predicate.ExpressionVisitor.java
com.github.dkharrat.nexusdata.predicate.Expression.java
com.github.dkharrat.nexusdata.predicate.FieldPathExpression.java
com.github.dkharrat.nexusdata.predicate.NotPredicate.java
com.github.dkharrat.nexusdata.predicate.PredicateBuilder.java
com.github.dkharrat.nexusdata.predicate.Predicate.java
com.github.dkharrat.nexusdata.predicate.ThisExpression.java
com.github.dkharrat.nexusdata.predicate.parser.ComparisonParselet.java
com.github.dkharrat.nexusdata.predicate.parser.ConstantParselet.java
com.github.dkharrat.nexusdata.predicate.parser.ExpressionNode.java
com.github.dkharrat.nexusdata.predicate.parser.GroupParselet.java
com.github.dkharrat.nexusdata.predicate.parser.InfixParselet.java
com.github.dkharrat.nexusdata.predicate.parser.LexerGrammar.java
com.github.dkharrat.nexusdata.predicate.parser.Lexer.java
com.github.dkharrat.nexusdata.predicate.parser.LogicalParselet.java
com.github.dkharrat.nexusdata.predicate.parser.NameParselet.java
com.github.dkharrat.nexusdata.predicate.parser.ParseException.java
com.github.dkharrat.nexusdata.predicate.parser.Parser.java
com.github.dkharrat.nexusdata.predicate.parser.PredicateParser.java
com.github.dkharrat.nexusdata.predicate.parser.PrefixParselet.java
com.github.dkharrat.nexusdata.predicate.parser.Token.java
com.github.dkharrat.nexusdata.store.AndroidSqlPersistentStore.java
com.github.dkharrat.nexusdata.store.DatabaseHelper.java
com.github.dkharrat.nexusdata.store.InMemoryPersistentStore.java
com.github.dkharrat.nexusdata.store.PredicateToSQL.java
com.github.dkharrat.nexusdata.utils.DateUtil.java
com.github.dkharrat.nexusdata.utils.ObjectUtil.java
com.github.dkharrat.nexusdata.utils.SqlTableBuilder.java
com.github.dkharrat.nexusdata.utils.StreamUtil.java
com.github.dkharrat.nexusdata.utils.StringUtil.java
com.github.dkharrat.nexusdata.utils.android.CursorUtil.java
com.github.dkharrat.nexusdata.utils.android.SQLiteDatabaseHelper.java
org.example.todo.MainActivity.java
org.example.todo.NewTaskActivity.java
org.example.todo.Task.java
org.example.todo.TodoApp.java
org.example.todo.User.java
org.example.todo._Task.java
org.example.todo._User.java