Package org.apache.openjpa.lib.util

Examples of org.apache.openjpa.lib.util.Options


     *
     * @param files class file resources to enhance.
     * @throws MojoExecutionException if the enhancer encountered a failure
     */
    private void enhance(List<File> files) throws MojoExecutionException {
        Options opts = getOptions();

        // list of input files
        String[] args = getFilePaths(files);

        boolean ok = false;
View Full Code Here


     * application id, it will be backed up to a file named
     * &lt;orig file name&gt;~.
     */
    public static void main(String[] args)
        throws IOException, ClassNotFoundException {
        Options opts = new Options();
        final String[] arguments = opts.setFromCmdLine(args);
        boolean ret = Configurations.runAgainstAllAnchors(opts,
            new Configurations.Runnable() {
            public boolean run(Options opts)
                throws ClassNotFoundException, IOException {
                OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
View Full Code Here

        flags.token = opts.removeProperty("token", "t", flags.token);
        flags.name = opts.removeProperty("name", "n", flags.name);
        flags.suffix = opts.removeProperty("suffix", "s", flags.suffix);

        // separate the properties for the customizer and code format
        Options formatOpts = new Options();
        Map.Entry entry;
        String key;
        for (Iterator itr = opts.entrySet().iterator(); itr.hasNext();) {
            entry = (Map.Entry) itr.next();
            key = (String) entry.getKey();
            if (key.startsWith("codeFormat.")) {
                formatOpts.put(key.substring(11), entry.getValue());
                itr.remove();
            } else if (key.startsWith("cf.")) {
                formatOpts.put(key.substring(3), entry.getValue());
                itr.remove();
            }
        }
        if (!formatOpts.isEmpty()) {
            flags.format = new CodeFormat();
            formatOpts.setInto(flags.format);
        }

        Configurations.populateConfiguration(conf, opts);
        ClassLoader loader = conf.getClassResolverInstance().
            getClassLoader(ApplicationIdTool.class, null);
View Full Code Here

     * @throws MojoExecutionException if the MappingTool detected an error
     */
    private void mappingTool(List<File> files) throws MojoExecutionException {
        extendRealmClasspath();

        Options opts = getOptions();

        filterPersistenceCapable(files, opts);

        // list of input files
        final String[] args = getFilePaths(files);
View Full Code Here

    /**
     * @return Options filled with all necessary plugin parameters
     */
    protected Options getOptions() throws MojoExecutionException {
        // options
        Options opts = createOptions();

        // put the standard options into the list also
        opts.put(OPTION_SCHEMA_ACTION, schemaAction);

        opts.put(OPTION_SCHEMA_FILE, schemaFile.getPath());

        if (action != null) {
            opts.put(OPTION_ACTION, action);
        }
        return opts;
    }
View Full Code Here

    /**
     * @return Options filled with all necessary plugin parameters
     */
    protected Options getOptions() throws MojoExecutionException {
        // options
        Options opts = createOptions();


        if (!modifyDatabase) {

            opts.put(OPTION_SQL_FILE, sqlFile.getPath());
        } else {
            if (sqlAction.equals("build")) {
                // build is not valid if we write to the database directly
                sqlAction = "refresh";
            }
        }

        // put the standard options into the list also
        opts.put(OPTION_SQL_ACTION, sqlAction);

        return opts;
    }
View Full Code Here

     * This function will usually get called by {@link #getOptions()}
     * @return the Options filled with the initial values
     */
    protected Options createOptions() throws MojoExecutionException
    {
        Options opts = new Options();
        if ( toolProperties != null )
        {
          opts.putAll( toolProperties );
        }
       
        if ( persistenceXmlFile != null )
        {
            fixPersistenceXmlIfNeeded(Thread.currentThread().getContextClassLoader());
            opts.put( OPTION_PROPERTIES_FILE, persistenceXmlFile );
            getLog().debug("using special persistence XML file: " + persistenceXmlFile);
        }
        else if (!new File(classes, "META-INF/persistence.xml").exists())
        { // use default but try from classpath
            persistenceXmlFile = "META-INF/persistence.xml";
            if (!fixPersistenceXmlIfNeeded(Thread.currentThread().getContextClassLoader())) {
                persistenceXmlFile = null;
            } else {
                opts.put( OPTION_PROPERTIES_FILE, persistenceXmlFile );
            }
        }

        if ( connectionDriverName != null )
        {
            opts.put( OPTION_CONNECTION_DRIVER_NAME, connectionDriverName );
        }

        if ( connectionProperties != null )
        {
            opts.put( OPTION_CONNECTION_PROPERTIES, connectionProperties );
        }

        return opts;
    }
View Full Code Here

     * <li><i>drop</i>: Remove existing metadata for the given classes.</li>
     * </ul>
     */
    public static void main(String[] args)
        throws IOException {
        Options opts = new Options();
        final String[] arguments = opts.setFromCmdLine(args);
        boolean ret = (args.length > 0) &&
            Configurations.runAgainstAllAnchors(opts,
            new Configurations.Runnable() {
            public boolean run(Options opts) throws Exception {
                OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
View Full Code Here

            _fieldValues = null;
            return;
        }

        // parse string into options; this takes care of proper trimming etc
        Options values = Configurations.parseProperties(_extString);
        if (values.isEmpty())
            throw new MetaDataException(_loc.get("no-external-values", this,
                _extString));

        Map extValues = new HashMap((int) (values.size() * 1.33 + 1));
        Map fieldValues = new HashMap((int) (values.size() * 1.33 + 1));
        Map.Entry entry;
        Object extValue, fieldValue;
        for (Iterator itr = values.entrySet().iterator(); itr.hasNext();) {
            entry = (Map.Entry) itr.next();
            fieldValue = transform((String) entry.getKey(),
                getDeclaredTypeCode());
            extValue = transform((String) entry.getValue(), getTypeCode());

View Full Code Here

    private final OpenJPAConfiguration conf;
    private final boolean devpath;
    private Log log;

    public static void main(String[] args) {
        Options opts = new Options();
        args = opts.setFromCmdLine(args);
        boolean devpath = opts.getBooleanProperty("scanDevPath", "ScanDevPath",
            true);

        ConfigurationProvider cp = new MapConfigurationProvider(opts);
        BrokerFactory factory = Bootstrap.newBrokerFactory(cp, null);
        try {
View Full Code Here

TOP

Related Classes of org.apache.openjpa.lib.util.Options

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.