Examples of FrameworkMBean


Examples of org.osgi.jmx.framework.FrameworkMBean

        waitForMBean(new ObjectName(FrameworkMBean.OBJECTNAME));
    }
   
    @Test
    public void testMBeanInterface() throws IOException {
        FrameworkMBean framework = getMBean(FrameworkMBean.OBJECTNAME, FrameworkMBean.class);
        assertNotNull(framework);
       
        long[] bundleIds = new long[]{1,2};
        int[] newlevels = new int[]{1,1};
        CompositeData compData = framework.setBundleStartLevels(bundleIds, newlevels);
        assertNotNull(compData);
       
        BatchActionResult batch2 = BatchActionResult.from(compData);
        assertNotNull(batch2.getCompleted());
        assertTrue(batch2.isSuccess());
        assertNull(batch2.getError());
        assertNull(batch2.getRemainingItems());
               
        File file = File.createTempFile("bundletest", ".jar");
        file.deleteOnExit();       
        Manifest man = new Manifest();
        man.getMainAttributes().putValue("Manifest-Version", "1.0");
        JarOutputStream jaros = new JarOutputStream(new FileOutputStream(file), man);
        jaros.flush();
        jaros.close();
       
        long bundleId = 0;
        try {
            bundleId = framework.installBundleFromURL(file.getAbsolutePath(), file.toURI().toString());
        } catch (Exception e) {
            fail("Installation of test bundle shouldn't fail");
        }
       
        try{
            framework.uninstallBundle(bundleId);
        } catch (Exception e) {
            fail("Uninstallation of test bundle shouldn't fail");
        }
    }
View Full Code Here

Examples of org.osgi.jmx.framework.FrameworkMBean

        waitForMBean(new ObjectName(FrameworkMBean.OBJECTNAME));
    }
   
    @Test
    public void testMBeanInterface() throws IOException {
        FrameworkMBean framework = getMBean(FrameworkMBean.OBJECTNAME, FrameworkMBean.class);
        assertNotNull(framework);
       
        long[] bundleIds = new long[]{1,2};
        int[] newlevels = new int[]{1,1};
        CompositeData compData = framework.setBundleStartLevels(bundleIds, newlevels);
        assertNotNull(compData);
       
        BatchActionResult batch2 = BatchActionResult.from(compData);
        assertNotNull(batch2.getCompleted());
        assertTrue(batch2.isSuccess());
        assertNull(batch2.getError());
        assertNull(batch2.getRemainingItems());
               
        File file = File.createTempFile("bundletest", ".jar");
        file.deleteOnExit();       
        Manifest man = new Manifest();
        man.getMainAttributes().putValue("Manifest-Version", "1.0");
        JarOutputStream jaros = new JarOutputStream(new FileOutputStream(file), man);
        jaros.flush();
        jaros.close();
       
        long bundleId = 0;
        try {
            bundleId = framework.installBundleFromURL(file.getAbsolutePath(), file.toURI().toString());
        } catch (Exception e) {
            fail("Installation of test bundle shouldn't fail");
        }
       
        try{
            framework.uninstallBundle(bundleId);
        } catch (Exception e) {
            fail("Uninstallation of test bundle shouldn't fail");
        }
    }
View Full Code Here

Examples of org.osgi.jmx.framework.FrameworkMBean

                       
                        if (start){
                            if(mgr instanceof RemoteDeploymentManager) {
                                MBeanServerConnection mbsc = ((RemoteDeploymentManager) mgr).getJMXConnector().getMBeanServerConnection();
                                try {
                                    FrameworkMBean frameworkMBean = getFrameworkMBean(mbsc);
                                    frameworkMBean.startBundle(bundleId);
                                    consoleReader.printString(DeployUtils.reformat("Started bundle: " + bundleId, 4, 72));
                                } catch (Exception e) {
                                    throw new DeploymentException("Unable to start bundle.", e);
                                }
                               
View Full Code Here

Examples of org.osgi.jmx.framework.FrameworkMBean

                       
                        if (start){
                            if(mgr instanceof RemoteDeploymentManager) {
                                MBeanServerConnection mbsc = ((RemoteDeploymentManager) mgr).getJMXConnector().getMBeanServerConnection();
                                try {
                                    FrameworkMBean frameworkMBean = getFrameworkMBean(mbsc);
                                    frameworkMBean.startBundle(bundleId);
                                    consoleReader.printString(DeployUtils.reformat("Started bundle: " + bundleId, 4, 72));
                                } catch (Exception e) {
                                    throw new DeploymentException("Unable to start bundle.", e);
                                }
                               
View Full Code Here

Examples of org.osgi.jmx.framework.FrameworkMBean

        waitForMBean(new ObjectName(FrameworkMBean.OBJECTNAME));
    }
   
    @Test
    public void testMBeanInterface() throws IOException {
        FrameworkMBean framework = getMBean(FrameworkMBean.OBJECTNAME, FrameworkMBean.class);
        assertNotNull(framework);
       
        long[] bundleIds = new long[]{1,2};
        int[] newlevels = new int[]{1,1};
        CompositeData compData = framework.setBundleStartLevels(bundleIds, newlevels);
        assertNotNull(compData);
       
        BatchActionResult batch2 = BatchActionResult.from(compData);
        assertNotNull(batch2.getCompleted());
        assertTrue(batch2.isSuccess());
        assertNull(batch2.getError());
        assertNull(batch2.getRemainingItems());
               
        File file = File.createTempFile("bundletest", ".jar");
        file.deleteOnExit();       
        Manifest man = new Manifest();
        man.getMainAttributes().putValue("Manifest-Version", "1.0");
        JarOutputStream jaros = new JarOutputStream(new FileOutputStream(file), man);
        jaros.flush();
        jaros.close();
       
        long bundleId = 0;
        try {
            bundleId = framework.installBundleFromURL(file.getAbsolutePath(), file.toURI().toString());
        } catch (Exception e) {
            fail("Installation of test bundle shouldn't fail");
        }
       
        try{
            framework.uninstallBundle(bundleId);
        } catch (Exception e) {
            fail("Uninstallation of test bundle shouldn't fail");
        }
    }
View Full Code Here

Examples of org.osgi.jmx.framework.FrameworkMBean

    public void open() {
        ServiceReference adminRef = context.getServiceReference(PackageAdmin.class.getCanonicalName());
        PackageAdmin packageAdmin = (PackageAdmin) context.getService(adminRef);
        ServiceReference startLevelRef = context.getServiceReference(StartLevel.class.getCanonicalName());
        StartLevel startLevel = (StartLevel) context.getService(startLevelRef);
        FrameworkMBean framework = new Framework(context, startLevel, packageAdmin);
        try {
            mbean = new StandardMBean(framework, FrameworkMBean.class);
        } catch (NotCompliantMBeanException e) {
            logger.log(LogService.LOG_ERROR, "Not compliant MBean", e);
        }
View Full Code Here

Examples of org.osgi.jmx.framework.FrameworkMBean

   private BundleHandle installBundle(VirtualFile virtualFile) throws BundleException, IOException
   {
      BundleInfo info = BundleInfo.createBundleInfo(virtualFile);
      String streamURL = info.getRoot().getStreamURL().toExternalForm();
      FrameworkMBean frameworkMBean = jmxSupport.getFrameworkMBean();
      long bundleId = frameworkMBean.installBundleFromURL(info.getLocation(), streamURL);
      return new BundleHandle(bundleId, info.getSymbolicName());
   }
View Full Code Here

Examples of org.osgi.jmx.framework.FrameworkMBean

   }

   @Override
   public void uninstallBundle(BundleHandle handle) throws BundleException, IOException
   {
      FrameworkMBean frameworkMBean = jmxSupport.getFrameworkMBean();
      frameworkMBean.uninstallBundle(handle.getBundleId());
   }
View Full Code Here

Examples of org.osgi.jmx.framework.FrameworkMBean

   @Override
   public void startBundle(BundleHandle handle) throws BundleException
   {
      try
      {
         FrameworkMBean frameworkMBean = jmxSupport.getFrameworkMBean();
         frameworkMBean.startBundle(handle.getBundleId());
      }
      catch (IOException ex)
      {
         throw new BundleException("Cannot start bundle: " + handle, ex);
      }
View Full Code Here

Examples of org.osgi.jmx.framework.FrameworkMBean

   @Override
   public void stopBundle(BundleHandle handle) throws BundleException
   {
      try
      {
         FrameworkMBean frameworkMBean = jmxSupport.getFrameworkMBean();
         frameworkMBean.stopBundle(handle.getBundleId());
      }
      catch (IOException ex)
      {
         throw new BundleException("Cannot start bundle: " + handle, ex);
      }
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.