<commit_before>/* 
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.felix.obr.plugin;


import java.io.File;
import java.net.URI;

import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;


/**
 * Install bundle metadata to local OBR.
 * 
 * @goal install
 * @phase install
 * @requiresDependencyResolution compile
 * 
 * @author <a href="mailto:<EMAIL>">Felix Project Team</a>
 */
public class ObrInstall extends AbstractMojo
{
    /**
     * The local Maven repository.
     * 
     * @parameter expression="${localRepository}"
     * @required
     * @readonly
     */
    private ArtifactRepository m_localRepo;

    /**
     * path to the repository.xml.
     * 
     * @parameter expression="${repository-path}" alias="repository-path"
     */
    private String m_repositoryPath;

    /**
     * Project in use.
     * 
     * @parameter expression="${project}"
     * @require
     */

    private MavenProject m_project;


    /**
     * main method for this goal.
     * @implements org.apache.maven.plugin.Mojo.execute 
     * @throws MojoExecutionException if the plugin failed
     */
    public void execute() throws MojoExecutionException
    {
        // locate the obr.xml file
        URI obrXml = ObrUtils.findObrXml( m_project.getResources() );
        if ( null == obrXml )
        {
            getLog().info( "obr.xml is not present, use default" );
        }

        // get the path to local maven repository
        String mavenRepository = m_localRepo.getBasedir();

        URI repoXml = ObrUtils.findRepositoryXml( mavenRepository, m_repositoryPath );
        URI bundleJar = ObrUtils.findBundleJar( m_localRepo, m_project.getArtifact() );

        if ( !new File( bundleJar ).exists() )
        {
            getLog().error( "file not found in local repository: " + bundleJar );
            return;
        }

        // use default configuration
        Config userConfig = new Config();

        ObrUpdate update = new ObrUpdate( repoXml, obrXml, m_project, bundleJar, null, userConfig, getLog() );

        update.updateRepository();
    }
}<commit_msg>FELIX-475: update install goal to match the one from the bundleplugin<commit_after>/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.felix.obr.plugin;


import java.net.URI;

import org.apache.felix.obr.plugin.Config;
import org.apache.felix.obr.plugin.ObrUpdate;
import org.apache.felix.obr.plugin.ObrUtils;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;


/**
 * Installs bundle details in the local OBR repository
 * 
 * @goal install
 * @phase install
 * 
 * @author <a href="mailto:<EMAIL>">Felix Project Team</a>
 */
public final class ObrInstall extends AbstractMojo
{
    /**
     * OBR Repository.
     * 
     * @parameter expression="${obrRepository}"
     */
    private String obrRepository;

    /**
     * Local Repository.
     * 
     * @parameter expression="${localRepository}"
     * @required
     * @readonly
     */
    private ArtifactRepository localRepository;

    /**
     * The Maven project.
     * 
     * @parameter expression="${project}"
     * @required
     * @readonly
     */
    private MavenProject project;


    public void execute()
    {
        if ( "NONE".equalsIgnoreCase( obrRepository ) )
        {
            return;
        }

        Log log = getLog();
        ObrUpdate update;

        try
        {
            String mavenRepository = localRepository.getBasedir();

            URI repositoryXml = ObrUtils.findRepositoryXml( mavenRepository, obrRepository );
            URI obrXml = ObrUtils.findObrXml( project.getResources() );
            URI bundleJar = ObrUtils.findBundleJar( localRepository, project.getArtifact() );

            Config userConfig = new Config();

            update = new ObrUpdate( repositoryXml, obrXml, project, bundleJar, mavenRepository, userConfig, log );

            update.updateRepository();
        }
        catch ( Exception e )
        {
            log.warn( "Exception while updating OBR: " + e.getLocalizedMessage(), e );
        }
    }
}
{'fraction_non_alphanumeric': 0.09483344663494221, 'fraction_numerical': 0.0018694765465669613, 'mean_word_length': 2.8214285714285716, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 3}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2278910', 'n_tokens_mistral': 1639, 'n_tokens_neox': 1580, 'n_words': 513}