Package org.osgi.framework

Examples of org.osgi.framework.BundleListener


        // capture the BundleListener registered with BundleContext to issue BundleEvents
        ArgumentCaptor<BundleListener> argument = ArgumentCaptor.forClass(BundleListener.class);
        verify(context).addBundleListener(argument.capture());

        //send events
        BundleListener listener = argument.getValue();
        listener.bundleChanged(installedEvent);
        listener.bundleChanged(resolvedEvent);

        //shutdown dispatcher via unregister callback
        bundleState.postDeregister();
        //check the BundleListener is cleaned up
        verify(context).removeBundleListener(listener);
View Full Code Here


        // capture the BundleListener registered with BundleContext
        ArgumentCaptor<BundleListener> argument = ArgumentCaptor.forClass(BundleListener.class);
        verify(context).addBundleListener(argument.capture());
        assertEquals(1, argument.getAllValues().size());

        BundleListener listener = argument.getValue();
        assertNotNull(listener);

        ExecutorService dispatcher = bundleState.getEventDispatcher();

        //do registration with another server
View Full Code Here

     */
    public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
        lock.lock();
        try {
            if (bundleListener == null) {
                bundleListener = new BundleListener() {
                    public void bundleChanged(BundleEvent event) {
                        try {
                            final Notification notification = new Notification(EVENT, OBJECTNAME,
                                    notificationSequenceNumber.getAndIncrement());
                            notification.setUserData(new BundleEventData(event).toCompositeData());
View Full Code Here

    private void rescheduleStart(Bundle bundle) {
        synchronized (pendingStartBundles) {
            pendingStartBundles.add(bundle);
            if (bundleListener == null) {
                bundleListener = new BundleListener() {
                    public void bundleChanged(BundleEvent event) {
                        if (event.getType() == BundleEvent.RESOLVED) {
                            executor.execute(new Runnable() {
                                public void run() {
                                    retryPendingStartBundles();
View Full Code Here

    private final Lock lock = new ReentrantLock();

    public BundleTracker(final BundleContext context) {
        this.context = context;
        bundleListener = new BundleListener() {
            public void bundleChanged(BundleEvent event) {
                lock.lock();
                try {
                    if (!open) {
                        return;
View Full Code Here

     */
    public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
        lock.lock();
        try {
            if (bundleListener == null) {
                bundleListener = new BundleListener() {
                    public void bundleChanged(BundleEvent event) {
                        final Notification notification = new Notification(EVENT, OBJECTNAME,
                                notificationSequenceNumber.getAndIncrement());
                        try {
                            notification.setUserData(new BundleEventData(event).toCompositeData());
View Full Code Here

            BundleContext sysContext = framework.getBundleContext();
            MBeanServer mbeanServer = injectedMBeanServer.getValue();
            sysContext.registerService(MBeanServer.class.getName(), mbeanServer, null);

            // Register a {@link SynchronousBundleListener} that removes the {@link DeploymentService}
            BundleListener uninstallListener = new SynchronousBundleListener() {

                @Override
                public void bundleChanged(BundleEvent event) {
                    if (event.getType() == BundleEvent.UNINSTALLED) {
                        AbstractUserBundle userBundle;
View Full Code Here

     */
    public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
        lock.lock();
        try {
            if (bundleListener == null) {
                bundleListener = new BundleListener() {
                    public void bundleChanged(BundleEvent event) {
                        final Notification notification = new Notification(EVENT, OBJECTNAME,
                                notificationSequenceNumber.getAndIncrement());
                        try {
                            notification.setUserData(new BundleEventData(event).toCompositeData());
View Full Code Here

            Thread.sleep(DEFAULT_TIMEOUT);

            final Set<String> installedSymbolicNames = new LinkedHashSet<String>();

            //Add a Bundle Listener
            bundleContext.addBundleListener(new BundleListener(){
                @Override
                public void bundleChanged(BundleEvent event) {
                  if (event.getType() == BundleEvent.INSTALLED) {
                      installedSymbolicNames.add(event.getBundle().getSymbolicName());
                  }
View Full Code Here

            Thread.sleep(DEFAULT_TIMEOUT);

            final Set<String> installedSymbolicNames = new LinkedHashSet<String>();

            //Add a Bundle Listener
            bundleContext.addBundleListener(new BundleListener(){
                @Override
                public void bundleChanged(BundleEvent event) {
                  if (event.getType() == BundleEvent.INSTALLED) {
                      installedSymbolicNames.add(event.getBundle().getSymbolicName());
                  }
View Full Code Here

TOP

Related Classes of org.osgi.framework.BundleListener

Copyright © 2018 www.massapicom. 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.