Examples of BundleState


Examples of org.apache.karaf.cellar.bundle.BundleState

        // update the cluster map
        ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
        try {
            Map<String, BundleState> bundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
            BundleState state = bundles.get(symbolicName + "/" + version);
            if (state == null) {
                throw new IllegalStateException("Bundle " + symbolicName + "/" + version + " not found in cluster group " + groupName);
            }
            String location = state.getLocation();

            // check if the bundle location is allowed
            CellarSupport support = new CellarSupport();
            support.setClusterManager(this.clusterManager);
            support.setGroupManager(this.groupManager);
            support.setConfigurationAdmin(this.configurationAdmin);
            if (!support.isAllowed(group, Constants.CATEGORY, location, EventType.OUTBOUND)) {
                throw new IllegalArgumentException("Bundle location " + location + " is blocked outbound");
            }

            state.setStatus(BundleEvent.STARTED);
            bundles.put(symbolicName + "/" + version, state);
        } finally {
            Thread.currentThread().setContextClassLoader(originalClassLoader);
        }
View Full Code Here

Examples of org.apache.karaf.cellar.bundle.BundleState

        // update the cluster map
        ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
        try {
            Map<String, BundleState> bundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
            BundleState state = bundles.get(symbolicName + "/" + version);
            if (state == null) {
                throw new IllegalStateException("Bundle " + symbolicName + "/" + version + " not found in cluster group " + groupName);
            }
            String location = state.getLocation();

            // check if the bundle location is allowed
            CellarSupport support = new CellarSupport();
            support.setClusterManager(this.clusterManager);
            support.setGroupManager(this.groupManager);
            support.setConfigurationAdmin(this.configurationAdmin);
            if (!support.isAllowed(group, Constants.CATEGORY, location, EventType.OUTBOUND)) {
                throw new IllegalArgumentException("Bundle location " + location + " is blocked outbound");
            }

            state.setStatus(BundleEvent.STOPPED);
            bundles.put(symbolicName + "/" + version, state);
        } finally {
            Thread.currentThread().setContextClassLoader(originalClassLoader);
        }
View Full Code Here

Examples of org.apache.karaf.cellar.bundle.BundleState

            Map<String, BundleState> bundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
            for (String bundle : bundles.keySet()) {
                String[] tokens = bundle.split("/");
                String name = tokens[0];
                String version = tokens[1];
                BundleState state = bundles.get(bundle);
                CompositeData data = new CompositeDataSupport(compositeType,
                        new String[]{"name", "version", "status", "location"},
                        new Object[]{name, version, state.getStatus(), state.getLocation()});
                table.put(data);
            }
        } finally {
            Thread.currentThread().setContextClassLoader(originalClassLoader);
        }
View Full Code Here

Examples of org.apache.karaf.cellar.bundle.BundleState

                System.out.println(String.format(HEADER_FORMAT, "State", "Name"));
                for (String bundle : bundles.keySet()) {
                    String[] tokens = bundle.split("/");
                    String name = tokens[0];
                    String version = tokens[1];
                    BundleState state = bundles.get(bundle);
                    String status;
                    switch (state.getStatus()) {
                        case BundleEvent.INSTALLED:
                            status = "Installed";
                            break;
                        case BundleEvent.RESOLVED:
                            status = "Resolved";
                            break;
                        case BundleEvent.STARTED:
                            status = "Started";
                            break;
                        case BundleEvent.STARTING:
                            status = "Starting";
                            break;
                        case BundleEvent.STOPPED:
                            status = "Stopped";
                            break;
                        case BundleEvent.STOPPING:
                            status = "Stopping";
                            break;
                        case BundleEvent.UNINSTALLED:
                            status = "Uninstalled";
                            break;
                        default:
                            status = "";
                            break;
                    }
                    if (showLoc) {
                        System.out.println(String.format(OUTPUT_FORMAT, status, state.getLocation()));
                    } else {
                        System.out.println(String.format(OUTPUT_FORMAT, status, name + " (" + version + ")"));
                    }
                }
            } else {
View Full Code Here

Examples of org.apache.karaf.cellar.bundle.BundleState

        ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
        String location;
        try {
            Map<String, BundleState> bundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
            BundleState state = bundles.get(name + "/" + version);
            if (state == null) {
                System.err.println("Bundle " + name + "/" + version + " not found in cluster group " + groupName);
                return null;
            }
            location = state.getLocation();

            // check if the bundle is allowed
            CellarSupport support = new CellarSupport();
            support.setClusterManager(this.clusterManager);
            support.setGroupManager(this.groupManager);
View Full Code Here

Examples of org.apache.karaf.cellar.bundle.BundleState

                ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
                try {
                    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
                    // populate the cluster map
                    Map<String, BundleState> bundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
                    BundleState state = new BundleState();
                    state.setLocation(url);
                    if (start) {
                        state.setStatus(BundleEvent.STARTED);
                    } else {
                        state.setStatus(BundleEvent.INSTALLED);
                    }
                    bundles.put(name + "/" + version, state);
                } finally {
                    Thread.currentThread().setContextClassLoader(originalClassLoader);
                }
View Full Code Here

Examples of org.apache.karaf.cellar.bundle.BundleState

        ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
        String location;
        try {
            Map<String, BundleState> bundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
            BundleState state = bundles.get(name + "/" + version);
            if (state == null) {
                System.err.println("Bundle " + name + "/" + version + " not found in cluster group " + groupName);
                return null;
            }
            state.setStatus(BundleEvent.STOPPED);
            location = state.getLocation();

            // check if the bundle is allowed
            CellarSupport support = new CellarSupport();
            support.setClusterManager(this.clusterManager);
            support.setGroupManager(this.groupManager);
View Full Code Here

Examples of org.apache.karaf.cellar.bundle.BundleState

        ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
        String location;
        try {
            Map<String, BundleState> bundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
            BundleState state = bundles.get(name + "/" + version);
            if (state == null) {
                System.err.println("Bundle " + name + "/" + version + " not found in cluster group " + groupName);
                return null;
            }
            location = state.getLocation();

            // check if the bundle is allowed
            CellarSupport support = new CellarSupport();
            support.setClusterManager(this.clusterManager);
            support.setGroupManager(this.groupManager);
            support.setConfigurationAdmin(this.configurationAdmin);
            if (!support.isAllowed(group, Constants.CATEGORY, location, EventType.OUTBOUND)) {
                System.err.println("Bundle location " + location + " is blocked outbound");
                return null;
            }

            state.setStatus(BundleEvent.STARTED);
            bundles.put(name + "/" + version, state);
        } finally {
            Thread.currentThread().setContextClassLoader(originalClassLoader);
        }
View Full Code Here

Examples of org.knowhowlab.osgi.jmx.beans.framework.BundleState

        framework = new Framework();
        framework.setVisitor(this);
        framework.setLogVisitor(this);
        server.registerMBean(framework, new ObjectName(FrameworkMBean.OBJECTNAME));

        bundleState = new BundleState();
        bundleState.setVisitor(this);
        bundleState.setLogVisitor(this);
        bc.addBundleListener(bundleState);
        server.registerMBean(bundleState, new ObjectName(BundleStateMBean.OBJECTNAME));
View Full Code Here

Examples of org.osgi.impl.bundle.jmx.framework.BundleState

      log.log(Level.SEVERE,
          "Unable to create StandardMBean for Framework", e);
      return;
    }
    try {
      bundleState = new StandardMBean(new BundleState(bundleContext, sl,
          admin), BundleStateMBean.class);
    } catch (NotCompliantMBeanException e) {
      log.log(Level.SEVERE,
          "Unable to create StandardMBean for BundleState", e);
      return;
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.