Examples of BundleRevision


Examples of org.osgi.framework.wiring.BundleRevision

                BundleRevision.PACKAGE_NAMESPACE, (Object) pkgName);
            BundleRequirementImpl req = new BundleRequirementImpl(
                revision, BundleRevision.PACKAGE_NAMESPACE, dirs, attrs);
            List<BundleCapability> exporters = resolver.findProviders(req, false);

            BundleRevision provider = null;
            try
            {
                provider = resolver.resolve(revision, pkgName);
            }
            catch (Exception ex)
View Full Code Here

Examples of org.osgi.framework.wiring.BundleRevision

        m_stale = false;
        m_activator = null;
        m_context = null;
        m_installingBundle = installingBundle;

        BundleRevision revision = createRevision(false);
        addRevision(revision);
    }
View Full Code Here

Examples of org.osgi.framework.wiring.BundleRevision

    {
        // This operation will increase the revision count for the bundle.
        m_archive.revise(location, is);
        try
        {
            BundleRevision revision = createRevision(true);
            addRevision(revision);
        }
        catch (Exception ex)
        {
            m_archive.rollbackRevise();
View Full Code Here

Examples of org.osgi.framework.wiring.BundleRevision

    }

    synchronized boolean rollbackRevise() throws Exception
    {
        boolean isExtension = isExtension();
        BundleRevision br = m_revisions.remove(0);
        if (!isExtension)
        {
            // Since revising a bundle adds a revision to the global
            // state, we must remove it from the global state on rollback.
            getFramework().getResolver().removeRevision(br);
View Full Code Here

Examples of org.osgi.framework.wiring.BundleRevision


    public void testIsFragment() throws Exception
    {
        mockBundleContext.addBundleListener((BundleListener) org.easymock.EasyMock.anyObject());
        BundleRevision mockBundleRevision = EasyMock.createNiceMock(BundleRevision.class);
        EasyMock.expect(mockBundle.adapt(BundleRevision.class)).andReturn(mockBundleRevision);
        EasyMock.expect(mockBundleRevision.getTypes())
                .andReturn(BundleRevision.TYPE_FRAGMENT);
       EasyMock.replay(mockBundleContext, mockBundle, mockBundleRevision);

        dw = new DirectoryWatcher( new FileInstall(), props, mockBundleContext );
View Full Code Here

Examples of org.osgi.framework.wiring.BundleRevision

            mockBundleContext.addBundleListener((BundleListener) org.easymock.EasyMock.anyObject());
            EasyMock.expect(mockBundleContext.createFilter((String) EasyMock.anyObject()))
                    .andReturn(null);

            BundleRevision mockBundleRevision = EasyMock.createNiceMock(BundleRevision.class);
            EasyMock.expect(mockBundle.adapt(BundleRevision.class)).andReturn(mockBundleRevision);
            EasyMock.expect(mockBundleRevision.getTypes())
                    .andReturn(BundleRevision.TYPE_FRAGMENT);
            EasyMock.replay(mockBundleContext, mockBundle, mockBundleRevision);
   
            try
            {
View Full Code Here

Examples of org.osgi.framework.wiring.BundleRevision

                    addCapability(cap);
                }
            }

            // Add all the OSGi capabilities from the system bundle as repo capabilities
            BundleRevision br = m_bundle.adapt(BundleRevision.class);
            for (org.osgi.resource.Capability cap : br.getCapabilities(null))
            {
                CapabilityImpl bcap = new CapabilityImpl(cap.getNamespace());
                for (Map.Entry<String, Object> entry : cap.getAttributes().entrySet())
                {
                    bcap.addProperty(new FelixPropertyAdapter(entry));
View Full Code Here

Examples of org.osgi.framework.wiring.BundleRevision

    private RepositoryAdminImpl createRepositoryAdmin() throws Exception
    {
        Bundle sysBundle = Mockito.mock(Bundle.class);
        Mockito.when(sysBundle.getHeaders()).thenReturn(new Hashtable<String, String>());

        BundleRevision br = Mockito.mock(BundleRevision.class);
        Mockito.when(sysBundle.adapt(BundleRevision.class)).thenReturn(br);
        Capability cap1 = new OSGiCapabilityImpl("some.system.cap",
                Collections.<String, Object>singletonMap("sys.cap", "something"),
                Collections.singletonMap("x", "y"));
        Capability cap2 = new OSGiCapabilityImpl("some.system.cap",
                Collections.<String, Object>singletonMap("sys.cap", "somethingelse"),
                Collections.<String, String>emptyMap());
        Mockito.when(br.getCapabilities(null)).thenReturn(Arrays.asList(cap1, cap2));

        BundleContext bc = Mockito.mock(BundleContext.class);
        Mockito.when(bc.getBundle(0)).thenReturn(sysBundle);
        Mockito.when(sysBundle.getBundleContext()).thenReturn(bc);
View Full Code Here

Examples of org.osgi.framework.wiring.BundleRevision

    private RepositoryAdminImpl createRepositoryAdmin() throws Exception
    {
        Bundle sysBundle = Mockito.mock(Bundle.class);
        Mockito.when(sysBundle.getHeaders()).thenReturn(new Hashtable<String, String>());
        BundleRevision br = Mockito.mock(BundleRevision.class);
        Mockito.when(sysBundle.adapt(BundleRevision.class)).thenReturn(br);

        BundleContext bc = Mockito.mock(BundleContext.class);
        Mockito.when(bc.getBundle(0)).thenReturn(sysBundle);
        Mockito.when(sysBundle.getBundleContext()).thenReturn(bc);
View Full Code Here

Examples of org.osgi.framework.wiring.BundleRevision

    private RepositoryAdminImpl createRepositoryAdmin(Class repositoryParser) throws Exception
    {
        BundleContext bundleContext = EasyMock.createMock(BundleContext.class);
        Bundle systemBundle = EasyMock.createMock(Bundle.class);
        BundleRevision systemBundleRevision = EasyMock.createMock(BundleRevision.class);

        Activator.setContext(bundleContext);
        EasyMock.expect(bundleContext.getProperty(RepositoryAdminImpl.REPOSITORY_URL_PROP))
                    .andReturn(getClass().getResource("/referral1_repository.xml").toExternalForm());
        EasyMock.expect(bundleContext.getProperty(RepositoryParser.OBR_PARSER_CLASS))
                    .andReturn(repositoryParser.getName());
        EasyMock.expect(bundleContext.getProperty((String) EasyMock.anyObject())).andReturn(null).anyTimes();
        EasyMock.expect(bundleContext.getBundle(0)).andReturn(systemBundle);
        EasyMock.expect(systemBundle.getHeaders()).andReturn(new Hashtable());
        EasyMock.expect(systemBundle.getRegisteredServices()).andReturn(null);
        EasyMock.expect(new Long(systemBundle.getBundleId())).andReturn(new Long(0)).anyTimes();
        EasyMock.expect(systemBundle.getBundleContext()).andReturn(bundleContext);
        EasyMock.expect(systemBundleRevision.getCapabilities(null)).andReturn(Collections.<Capability>emptyList());
        EasyMock.expect(systemBundle.adapt(BundleRevision.class)).andReturn(systemBundleRevision);
        bundleContext.addBundleListener((BundleListener) EasyMock.anyObject());
        bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject());
        EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle });
        final Capture c = new Capture();
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.