Examples of FrameworkMBean


Examples of org.osgi.jmx.framework.FrameworkMBean

            KarafJMXPlugin.getLogger().warning(ex);
          return null;
        }
        final Set<ObjectName> queryNames = connection.queryNames(frameworkQueryObjectName, null);
        for (ObjectName FrameworkObjectName : queryNames) {
          FrameworkMBean mbean = MBeanServerInvocationHandler.newProxyInstance(connection, FrameworkObjectName, FrameworkMBean.class, true);
          return callback.doWithFrameworkMBean(mbean);
        }
        return null;
      }
    });
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 resolveBundle(BundleHandle handle) throws BundleException, IOException
   {
      FrameworkMBean frameworkMBean = jmxSupport.getFrameworkMBean();
      frameworkMBean.resolveBundle(handle.getBundleId());
   }
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

Examples of org.osgi.jmx.framework.FrameworkMBean

    @Override
    public void undeploy(Archive<?> archive) throws DeploymentException {
        BundleHandle handle = deployedBundles.remove(archive.getName());
        if (handle != null) {
            try {
                FrameworkMBean frameworkMBean = jmxSupport.getFrameworkMBean();
                frameworkMBean.uninstallBundle(handle.getBundleId());
            } catch (IOException ex) {
                log.errorf(ex, "Cannot undeploy: %s" + archive.getName());
            }
        }
    }
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

        return options;
    }

    @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 MBeanServerConnection getMBeanServer() {
        return mbeanServer;
    }

    public FrameworkMBean getFrameworkMBean() throws IOException {
        FrameworkMBean frameworkState = null;
        ObjectName objectName = createObjectName(FrameworkMBean.OBJECTNAME);
        if (isRegisteredWithTimeout(objectName)) {
            frameworkState = getMBeanProxy(objectName, FrameworkMBean.class);
            return frameworkState;
        }
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.