Examples of BundleState


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

        return new BundleSelectorImpl(bundleContext).selectBundles(ids, defaultAllBundles);
    }

    @Override
    public BundleInfo getInfo(Bundle bundle) {
        BundleState combinedState = BundleState.Unknown;
        for (BundleStateService stateService : this.stateServices) {
            BundleState extState = stateService.getState(bundle);
            if (extState != BundleState.Unknown) {
                combinedState = extState;
            }
        }
        return  new BundleInfoImpl(bundle, combinedState);
View Full Code Here

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

    }

    @Override
    public BundleState getState(Bundle bundle) {
        BlueprintEvent event = states.get(bundle.getBundleId());
        BundleState state = getState(event);
        return (bundle.getState() != Bundle.ACTIVE) ? BundleState.Unknown : state;
    }
View Full Code Here

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

    }

    @Override
    public void blueprintEvent(BlueprintEvent blueprintEvent) {
        if (LOG.isDebugEnabled()) {
            BundleState state = getState(blueprintEvent);
            LOG.debug("Blueprint app state changed to " + state + " for bundle "
                      + blueprintEvent.getBundle().getBundleId());
        }
        states.put(blueprintEvent.getBundle().getBundleId(), blueprintEvent);
    }
View Full Code Here

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

        return doGetBundle(doGetBundleContext(context), id);
    }

    @Override
    public BundleInfo getInfo(Bundle bundle) {
        BundleState combinedState = BundleState.Unknown;
        for (BundleStateService stateService : this.stateServices) {
            BundleState extState = stateService.getState(bundle);
            if (extState != BundleState.Unknown) {
                combinedState = extState;
            }
        }
        return  new BundleInfoImpl(bundle, combinedState);
View Full Code Here

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

        return BundleStateService.NAME_SPRING_DM;
    }

    public BundleState getState(Bundle bundle) {
        OsgiBundleApplicationContextEvent event = states.get(bundle.getBundleId());
        BundleState state = mapEventToState(event);
        return (bundle.getState() != Bundle.ACTIVE) ? BundleState.Unknown : state;
    }
View Full Code Here

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

      return failureEvent.getFailureCause();
    }

    public void onOsgiApplicationEvent(OsgiBundleApplicationContextEvent event) {
        if (LOG.isDebugEnabled()) {
            BundleState state = mapEventToState(event);
            LOG.debug("Spring app state changed to " + state + " for bundle " + event.getBundle().getBundleId());
        }
        states.put(event.getBundle().getBundleId(), event);
    }
View Full Code Here

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

                // add regex support
                Pattern namePattern = Pattern.compile(name);

                // looking for bundle using only the name
                for (String bundle : clusterBundles.keySet()) {
                    BundleState state = clusterBundles.get(bundle);
                    if (state.getName() != null) {
                        // bundle name is populated, check if it matches the regex
                        Matcher matcher = namePattern.matcher(state.getName());
                        if (matcher.find()) {
                            key = bundle;
                            break;
                        } else {
                            // not matched on bundle name, fall back to symbolic name and check if it matches the regex
                            String split[] = bundle.split("/");
                            matcher = namePattern.matcher(split[0]);
                            if (matcher.find()) {
                                key = bundle;
                                break;
                            }
                        }
                    } else {
                        // no bundle name, fall back to symbolic name and check if it matches the regex
                        String split[] = bundle.split("/");
                        System.out.println("Bundle-SymbolicName: " + split[0]);
                        Matcher matcher = namePattern.matcher(split[0]);
                        if (matcher.find()) {
                            key = bundle;
                            break;
                        }
                    }
                }
            }
        } else {
            // looking for the bundle using name and version

            // add regex support of the name
            Pattern namePattern = Pattern.compile(name);

            for (String bundle : clusterBundles.keySet()) {
                String[] split = bundle.split("/");
                BundleState state = clusterBundles.get(bundle);
                if (split[1].equals(version)) {
                    if (state.getName() != null) {
                        // bundle name is populated, check if it matches the regex
                        Matcher matcher = namePattern.matcher(state.getName());
                        if (matcher.find()) {
                            key = bundle;
                            break;
                        } else {
                            // no match on bundle name, fall back to symbolic name and check if it matches the regex
View Full Code Here

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

                        version = tokens[1];
                    } else {
                        symbolicName = bundle;
                        version = "";
                    }
                    BundleState state = clusterBundles.get(bundle);

                    String status;
                    switch (state.getStatus()) {
                        case BundleEvent.INSTALLED:
                            status = "Installed";
                            break;
                        case BundleEvent.RESOLVED:
                            status = "Resolved";
                            break;
                        case BundleEvent.STARTED:
                            status = "Active";
                            break;
                        case BundleEvent.STARTING:
                            status = "Starting";
                            break;
                        case BundleEvent.STOPPED:
                            status = "Resolved";
                            break;
                        case BundleEvent.STOPPING:
                            status = "Stopping";
                            break;
                        case BundleEvent.UNINSTALLED:
                            status = "Uninstalled";
                            break;
                        default:
                            status = "";
                            break;
                    }
                    if (showLocation) {
                        System.out.println(String.format(OUTPUT_FORMAT, id, status, state.getLocation()));
                    } else {
                        if (showSymbolicName) {
                            System.out.println(String.format(OUTPUT_FORMAT, id, status, symbolicName + " (" + version + ")"));
                        } else {
                            System.out.println(String.format(OUTPUT_FORMAT, id, status, state.getName() + " (" + version + ")"));
                        }
                    }
                    id++;
                }
            } else {
View Full Code Here

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

            if (key == null) {
                System.err.println("Bundle " + key + " not found in cluster group " + groupName);
                return null;
            }

            BundleState state = clusterBundles.get(key);
            if (state == null) {
                System.err.println("Bundle " + key + " 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

                Thread.currentThread().setContextClassLoader(getClass().getClassLoader());

                try {
                    // update the bundles in the cluster group
                    Map<String, BundleState> clusterBundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
                    BundleState state = new BundleState();
                    state.setName(name);
                    state.setLocation(url);
                    if (start) {
                        state.setStatus(BundleEvent.STARTED);
                    } else {
                        state.setStatus(BundleEvent.INSTALLED);
                    }
                    clusterBundles.put(symbolicName + "/" + version, state);
                } finally {
                    Thread.currentThread().setContextClassLoader(originalClassLoader);
                }
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.