Examples of RepositoryAdminImpl


Examples of org.apache.felix.bundlerepository.RepositoryAdminImpl

            // prepare the repository resolver
            DummyBundleContext bc = new DummyBundleContext(this.ctx.getBundleContext());
            bc.setProperty(RepositoryAdminImpl.REPOSITORY_URL_PROP,
                repoFile.toURI().toURL().toExternalForm());
            RepositoryAdmin ra = new RepositoryAdminImpl(bc);
            Set resources = new HashSet();

            // add the servlet container bundles first
            for (int i = 0; i < REQUIRED_BUNDLES.length; i++) {
                String filter = "(symbolicName=" + REQUIRED_BUNDLES[i]
                    + ")";
                this.resolveResource(ra, filter, resources);
            }

            // find all resources in the repository
            for (int i=0; i < bundleNames.length; i++) {
                Resource res = this.repository.getResource(bundleNames[i]);
                if (res != null) {
                    VersionRange vr = new VersionRange(res.getVersion());
                    String filter = "(&(symbolicName=" + res.getSymbolicName()
                        + ")" + vr.getFilter() + ")";
                    this.resolveResource(ra, filter, resources);
                }
            }

            // prepare the resolver
            Resolver resolver = ra.resolver();
            for (Iterator ri=resources.iterator(); ri.hasNext(); ) {
                resolver.add((org.osgi.service.obr.Resource) ri.next());
            }

            // resolve the resources
View Full Code Here

Examples of org.apache.felix.bundlerepository.impl.RepositoryAdminImpl

        when(systemBundle.getBundleContext()).thenReturn(bundleContext);
        bundleContext.addBundleListener((BundleListener) anyObject());
        bundleContext.addServiceListener((ServiceListener) anyObject());
        when(bundleContext.getBundles()).thenReturn(new Bundle[]{systemBundle});

        RepositoryAdminImpl repoAdmin = new RepositoryAdminImpl(bundleContext, new Logger(bundleContext));

        // force initialization && remove all initial repositories
        org.apache.felix.bundlerepository.Repository[] repos = repoAdmin.listRepositories();
        for (int i = 0; repos != null && i < repos.length; i++) {
            repoAdmin.removeRepository(repos[i].getURI());
        }

        return repoAdmin;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.