Package org.apache.karaf.features

Examples of org.apache.karaf.features.Repository


    @Before
    public void init() throws Exception {
        this.featuresService = EasyMock.createMock(FeaturesService.class);
        EasyMock.expect(this.featuresService.isInstalled(EasyMock.anyObject(Feature.class))).andReturn(true).anyTimes();

        Repository r1 = EasyMock.createMock(Repository.class);
        Repository r2 = EasyMock.createMock(Repository.class);
        EasyMock.expect(r1.getName()).andReturn("r1").anyTimes();
        EasyMock.expect(r2.getName()).andReturn("r2").anyTimes();
        EasyMock.expect(this.featuresService.listRepositories()).andReturn(new Repository[] { r1, r2 });

        EasyMock.expect(r1.getFeatures()).andReturn(new Feature[] {
                new FeatureImpl("f2", "v2")
        });
        EasyMock.expect(r2.getFeatures()).andReturn(new Feature[] {
                new FeatureImpl("f1", "v1")
        });

        EasyMock.replay(this.featuresService, r1, r2);
    }
View Full Code Here


     * The Mojo's main method
     */
    public void execute() throws MojoExecutionException, MojoFailureException {
        try {
            prepare();
            Repository repository = new RepositoryImpl(file.toURI());
            analyze(repository);
            validate(repository);
        } catch (Exception e) {
            e.printStackTrace();
            throw new MojoExecutionException(String.format("Unable to validate %s: %s", file.getAbsolutePath(), e.getMessage()), e);
View Full Code Here

       
        // add the repositories from the plugin configuration
        if (repositories != null) {
          for (String uri : repositories) {
            getLog().info(String.format(" - adding repository from %s", uri));
            Repository dependency = new RepositoryImpl(URI.create(translateFromMaven(uri)));
            features.add(dependency.getFeatures());
            validateBundlesAvailable(dependency);
            analyzeExports(dependency);
          }
        }

        for (URI uri : repository.getRepositories()) {
            Artifact artifact = resolve(uri.toString());
            Repository dependency  = new RepositoryImpl(new File(localRepo.getBasedir(), localRepo.pathOf(artifact)).toURI());
            getLog().info(String.format(" - adding %d known features from %s", dependency.getFeatures().length, uri));
            features.add(dependency.getFeatures());
            // we need to do this to get all the information ready for further processing
            validateBundlesAvailable(dependency);
            analyzeExports(dependency);
        }
View Full Code Here

            saveState();
        }
    }

    public void internalRemoveRepository(URI uri) {
        Repository repo = repositories.remove(uri);
        this.repo.set(repo);
        callListeners(new RepositoryEvent(repo, RepositoryEvent.EventType.RepositoryRemoved, false));
        features = null;
    }
View Full Code Here

     * @param install if true, install all features contained in the features repository.
     * @throws Exception in case of adding failure.
     */
    public void addRepository(URI uri, boolean install) throws Exception {
        if (!repositories.containsKey(uri)) {
            Repository repositoryImpl = this.internalAddRepository(uri);
            saveState();
            if (install) {
                for (Feature feature : repositoryImpl.getFeatures()) {
                    installFeature(feature, EnumSet.noneOf(Option.class));
                }
            }
        } else {
            refreshRepository(uri, install);
View Full Code Here

     * @throws Exception in case of remove failure.
     */
    public void removeRepository(URI uri, boolean uninstall) throws Exception {
        if (repositories.containsKey(uri)) {
            if (uninstall) {
                Repository repositoryImpl = repositories.get(uri);
                for (Feature feature : repositoryImpl.getFeatures()) {
                    this.uninstallFeature(feature.getName(), feature.getVersion());
                }
            }
            internalRemoveRepository(uri);
            saveState();
View Full Code Here

     * Remove a features repository from the internal container.
     *
     * @param uri the features repository URI.
     */
    protected void internalRemoveRepository(URI uri) {
        Repository repo = repositories.remove(uri);
        this.repo.set(repo);
        callListeners(new RepositoryEvent(repo, RepositoryEvent.EventType.RepositoryRemoved, false));
        features = null;
    }
View Full Code Here

            saveState();
        }
    }

    public void internalRemoveRepository(URI uri) {
        Repository repo = repositories.remove(uri);
        this.repo.set(repo);
        callListeners(new RepositoryEvent(repo, RepositoryEvent.EventType.RepositoryRemoved, false));
        features = null;
    }
View Full Code Here

     * The Mojo's main method
     */
    public void execute() throws MojoExecutionException, MojoFailureException {
        try {
            prepare();
            Repository repository = new RepositoryImpl(file.toURI());
            analyze(repository);
            validate(repository);
        } catch (Exception e) {
            e.printStackTrace();
            throw new MojoExecutionException(String.format("Unable to validate %s: %s", file.getAbsolutePath(), e.getMessage()), e);
View Full Code Here

       
        // add the repositories from the plugin configuration
        if (repositories != null) {
          for (String uri : repositories) {
            getLog().info(String.format(" - adding repository from %s", uri));
            Repository dependency = new RepositoryImpl(URI.create(translateFromMaven(uri)));
            features.add(dependency.getFeatures());
            validateBundlesAvailable(dependency);
            analyzeExports(dependency);
          }
        }

        for (URI uri : repository.getRepositories()) {
            Artifact artifact = (Artifact) resolve(uri.toString());
            Repository dependency  = new RepositoryImpl(new File(localRepo.getBasedir(), localRepo.pathOf(artifact)).toURI());
            getLog().info(String.format(" - adding %d known features from %s", dependency.getFeatures().length, uri));
            features.add(dependency.getFeatures());
            // we need to do this to get all the information ready for further processing
            validateBundlesAvailable(dependency);
            analyzeExports(dependency);
        }
View Full Code Here

TOP

Related Classes of org.apache.karaf.features.Repository

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.