Package org.apache.karaf.cellar.core.event

Examples of org.apache.karaf.cellar.core.event.EventHandler


        ServiceReference[] references = new ServiceReference[0];
        try {
            references = bundleContext.getServiceReferences(EventHandler.class.getName(), EventHandler.MANAGED_FILTER);
            if (references != null && references.length > 0) {
                for (ServiceReference ref : references) {
                    EventHandler handler = (EventHandler) bundleContext.getService(ref);

                    if (command.getHandlerName() == null) {
                        result.getHandlers().put(handler.getClass().getName(), handler.getSwitch().getStatus().name());
                    } else {
                        if (command.getHandlerName().equals(handler.getClass().getName())) {
                            if (command.getStatus() != null) {
                                if (command.getStatus()) {
                                    // persist the handler switch status to configuration admin
                                    persist(handler.getClass().getName(), SwitchStatus.ON);
                                    handler.getSwitch().turnOn();
                                } else {
                                    // persist the handler switch status to configuration admin
                                    persist(handler.getClass().getName(), SwitchStatus.OFF);
                                    handler.getSwitch().turnOff();
                                }
                            }
                            result.getHandlers().put(handler.getClass().getName(), handler.getSwitch().getStatus().name());
                            break;
                        }
                    }
                }
            }
View Full Code Here


        ServiceReference[] references = new ServiceReference[0];
        try {
            references = bundleContext.getServiceReferences(EventHandler.class.getName(), EventHandler.MANAGED_FILTER);
            if (references != null && references.length > 0) {
                for (ServiceReference ref : references) {
                    EventHandler handler = (EventHandler) bundleContext.getService(ref);
                    if (command.getHandlesName() != null && command.getHandlesName().equals(handler.getClass().getName())) {

                        if (command.getStatus()) {
                            handler.getSwitch().turnOn();
                        } else handler.getSwitch().turnOff();
                    }
                    result.getHandlers().put(handler.getClass().getName(), handler.getSwitch().getStatus().name());
                }
            }
        } catch (InvalidSyntaxException e) {
            LOGGER.error("Syntax error looking up service {} using filter {}", EventHandler.class.getName(), EventHandler.MANAGED_FILTER);
        } finally {
View Full Code Here

        ServiceReference[] references = new ServiceReference[0];
        try {
            references = bundleContext.getServiceReferences(EventHandler.class.getName(), EventHandler.MANAGED_FILTER);
            if (references != null && references.length > 0) {
                for (ServiceReference ref : references) {
                    EventHandler handler = (EventHandler) bundleContext.getService(ref);
                    if (command.getHandlesName() != null && command.getHandlesName().equals(handler.getClass().getName())) {

                        if (command.getStatus()) {
                            handler.getSwitch().turnOn();
                        } else handler.getSwitch().turnOff();
                    }
                    result.getHandlers().put(handler.getClass().getName(), handler.getSwitch().getStatus().name());
                }
            }
        } catch (InvalidSyntaxException e) {
            logger.error("Syntax error looking up service {} using filter {}", EventHandler.class.getName(), EventHandler.MANAGED_FILTER);
        } finally {
View Full Code Here

        ServiceReference[] references = new ServiceReference[0];
        try {
            references = bundleContext.getServiceReferences(EventHandler.class.getName(), EventHandler.MANAGED_FILTER);
            if (references != null && references.length > 0) {
                for (ServiceReference ref : references) {
                    EventHandler handler = (EventHandler) bundleContext.getService(ref);

                    if (command.getHandlerName() == null) {
                        result.getHandlers().put(handler.getClass().getName(), handler.getSwitch().getStatus().name());
                    } else {
                        if (command.getHandlerName().equals(handler.getClass().getName())) {
                            if (command.getStatus() != null) {
                                if (command.getStatus()) {
                                    handler.getSwitch().turnOn();
                                } else {
                                    handler.getSwitch().turnOff();
                                }
                            }
                            result.getHandlers().put(handler.getClass().getName(), handler.getSwitch().getStatus().name());
                            break;
                        }
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.karaf.cellar.core.event.EventHandler

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.