Package org.osgi.framework

Examples of org.osgi.framework.BundleContext.installBundle()


                if (bundleInfo == null) {
                    throw new ManagementException("Cound not find bundles: " + bundleSymbolicName + "_" + bundleVersion);
                }

                Bundle bundle = bundleContext.installBundle(bundleInfo.getLocation());

                applicationBundles.add(bundle);
            }
        } catch (BundleException be) {
            for (Bundle bundle : applicationBundles) {
View Full Code Here


       
        for (BundleInfo info : startList) {
            InputStream in = new FileInputStream(info.location);
            Bundle bundle = null;
            try {
                bundle = context.installBundle(info.mvnLocation, in);
            } finally {
                try { in.close(); } catch (Exception e) {}
            }
            if (info.startLevel > 0) {
                sl.setBundleStartLevel(bundle, info.startLevel);
View Full Code Here

        try {
            Kernel kernel = getKernel();
            BundleContext bundleContext = kernel.getBundleFor(kernel.getKernelName()).getBundleContext();
            //TODO Figure out who should be responsible for uninstalling it, and whether we need to start the bundle
            //Currently, this method is only used for resource reading, seems no need to start the bundle.
            return bundleContext.installBundle("mvn:" + uri.getGroupId() + "/" + uri.getArtifactId() + "/" + uri.getVersion() + ("jar".equals(uri.getType()) ? "" : "/" + uri.getType()));
        } catch (Exception e) {
            return null;
        }
    }
View Full Code Here

        verify(bundleContext, installedBundle);

        reset(bundleContext, installedBundle);

        expect(bundleContext.getBundles()).andReturn(new Bundle[0]);
        expect(bundleContext.installBundle(isA(String.class),
                                           isA(InputStream.class))).andReturn(installedBundle);
        expect(installedBundle.getBundleId()).andReturn(12345L);
        expect(installedBundle.getBundleId()).andReturn(12345L);
        expect(installedBundle.getBundleId()).andReturn(12345L);
        expect(bundleContext.getBundle(12345L)).andReturn(installedBundle);
View Full Code Here

        reset(bundleContext, installedBundle);

        // Installs f1 and 0.1
        expect(bundleContext.getBundles()).andReturn(new Bundle[0]);
        expect(bundleContext.installBundle(isA(String.class),
                                           isA(InputStream.class))).andReturn(installedBundle);
        expect(installedBundle.getBundleId()).andReturn(12345L);
        expect(installedBundle.getBundleId()).andReturn(12345L);
        expect(installedBundle.getBundleId()).andReturn(12345L);
        expect(bundleContext.getBundle(12345L)).andReturn(installedBundle);
View Full Code Here

        expect(installedBundle.getHeaders()).andReturn(new Hashtable());
        installedBundle.start();

        // Installs f1 and 0.2
        expect(bundleContext.getBundles()).andReturn(new Bundle[0]);
        expect(bundleContext.installBundle(isA(String.class),
                                           isA(InputStream.class))).andReturn(installedBundle);
        expect(installedBundle.getBundleId()).andReturn(123456L);
        expect(installedBundle.getBundleId()).andReturn(123456L);
        expect(installedBundle.getBundleId()).andReturn(123456L);
        expect(bundleContext.getBundle(123456L)).andReturn(installedBundle);
View Full Code Here

        Bundle installedBundle = EasyMock.createMock(Bundle.class);

        // Installs feature f1 with dependency on f2
        // so will install f2 first
        expect(bundleContext.getBundles()).andReturn(new Bundle[0]);
        expect(bundleContext.installBundle(isA(String.class),
                                           isA(InputStream.class))).andReturn(installedBundle);
        expect(installedBundle.getBundleId()).andReturn(12345L);
        expect(installedBundle.getBundleId()).andReturn(12345L);
        expect(installedBundle.getBundleId()).andReturn(12345L);
        expect(bundleContext.getBundle(12345L)).andReturn(installedBundle);
View Full Code Here

        expect(installedBundle.getHeaders()).andReturn(new Hashtable());
        installedBundle.start();

        // Then installs f1
        expect(bundleContext.getBundles()).andReturn(new Bundle[0]);
        expect(bundleContext.installBundle(isA(String.class),
                                           isA(InputStream.class))).andReturn(installedBundle);
        expect(installedBundle.getBundleId()).andReturn(1234L);
        expect(installedBundle.getBundleId()).andReturn(1234L);
        expect(installedBundle.getBundleId()).andReturn(1234L);
        expect(bundleContext.getBundle(1234L)).andReturn(installedBundle);
View Full Code Here

        BundleContext bundleContext = EasyMock.createMock(BundleContext.class);
        Bundle installedBundle = EasyMock.createMock(Bundle.class);

        // Installs feature f1 with dependency on f2
        expect(bundleContext.getBundles()).andReturn(new Bundle[0]);
        expect(bundleContext.installBundle(isA(String.class),
                                           isA(InputStream.class))).andReturn(installedBundle);
        expect(installedBundle.getBundleId()).andReturn(12345L).anyTimes();
        expect(bundleContext.getBundle(12345L)).andReturn(installedBundle).anyTimes();
        expect(installedBundle.getHeaders()).andReturn(new Hashtable()).anyTimes();
        installedBundle.start();
View Full Code Here

        expect(installedBundle.getHeaders()).andReturn(new Hashtable()).anyTimes();
        installedBundle.start();

        expect(bundleContext.getBundles()).andReturn(new Bundle[] { installedBundle });
        expect(installedBundle.getSymbolicName()).andReturn(name).anyTimes();
        expect(bundleContext.installBundle(isA(String.class),
                                           isA(InputStream.class))).andReturn(installedBundle);
        installedBundle.start();

        // uninstalls first feature name = f2, version = 0.1
        installedBundle.uninstall();
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.