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

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


            Properties serviceProperties = new Properties();
            serviceProperties.put("type", "group");
            serviceProperties.put("name", groupName);

            if (!producerRegistrations.containsKey(groupName)) {
                EventProducer producer = groupProducers.get(groupName);
                if (producer == null) {
                    producer = eventTransportFactory.getEventProducer(groupName, Boolean.TRUE);
                    groupProducers.put(groupName, producer);
                }
                ServiceRegistration producerRegistration = bundleContext.registerService(EventProducer.class.getCanonicalName(), producer, (Dictionary) serviceProperties);
View Full Code Here


     * @param listenerInfo the listener info.
     */
    private void importService(EndpointDescription endpoint, ListenerInfo listenerInfo) {
        LOGGER.debug("CELLAR DOSGI: importing remote service");

        EventProducer requestProducer = producers.get(endpoint.getId());
        if (requestProducer == null) {
            requestProducer = eventTransportFactory.getEventProducer(Constants.INTERFACE_PREFIX + Constants.SEPARATOR + endpoint.getId(), Boolean.FALSE);
            producers.put(endpoint.getId(), requestProducer);
        }

View Full Code Here

                    Object obj = method.invoke(targetService, event.getArguments().toArray());
                    RemoteServiceResult result = new RemoteServiceResult(event.getId());
                    result.setResult(obj);

                    EventProducer producer = eventTransportFactory.getEventProducer(Constants.RESULT_PREFIX + Constants.SEPARATOR + event.getSourceNode().getId() + event.getEndpointId(), false);
                    producer.produce(result);

                } catch (NoSuchMethodException e) {
                    LOGGER.error("CELLAR DOSGI: unable to find remote method for service", e);
                } catch (InvocationTargetException e) {
                    LOGGER.error("CELLAR DOSGI: unable to invoke remote method for service", e);
View Full Code Here

    String version;

    @Override
    protected Object doExecute() throws Exception {
        Group group = groupManager.findGroupByName(groupName);
        EventProducer producer = eventTransportFactory.getEventProducer(groupName, true);
        RemoteFeaturesEvent event = new RemoteFeaturesEvent(feature, version, FeatureEvent.EventType.FeatureInstalled);
        event.setForce(true);
        event.setSourceGroup(group);
        producer.produce(event);

        updateFeatureStatus(groupName, feature, version, true);
        return null;
    }
View Full Code Here

    String version;

    @Override
    protected Object doExecute() throws Exception {
        Group group = groupManager.findGroupByName(groupName);
        EventProducer producer = eventTransportFactory.getEventProducer(groupName, true);
        RemoteFeaturesEvent event = new RemoteFeaturesEvent(feature, version, FeatureEvent.EventType.FeatureUninstalled);
        event.setForce(true);
        event.setSourceGroup(group);
        producer.produce(event);

        updateFeatureStatus(groupName, feature, version, true);
        return null;
    }
View Full Code Here

    public Object doExecute() throws Exception {
        // find the group for the given name
        Group group = groupManager.findGroupByName(groupName);
        // create an event and produce it
        EventProducer producer = eventTransportFactory.getEventProducer(groupName, true);
        ObrUrlEvent event = new ObrUrlEvent(url, Constants.URL_REMOVE_EVENT_TYPE);
        event.setForce(true);
        event.setSourceGroup(group);
        producer.produce(event);
        // remove URL from the distributed map
        Set<String> urls = clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + Configurations.SEPARATOR + groupName);
        urls.remove(url);
        // remove bundles from the distributed map
        Set<ObrBundleInfo> bundles = clusterManager.getSet(Constants.BUNDLES_DISTRIBUTED_SET_NAME + Configurations.SEPARATOR + groupName);
View Full Code Here

    public Object doExecute() throws Exception {
        // find group for the given name
        Group group = groupManager.findGroupByName(groupName);
        // create an event and produce it
        EventProducer producer = eventTransportFactory.getEventProducer(groupName, true);
        ObrUrlEvent event = new ObrUrlEvent(url, Constants.URL_ADD_EVENT_TYPE);
        event.setForce(true);
        event.setSourceGroup(group);
        producer.produce(event);
        // push the OBR URL in the distributed set
        Set<String> urls = clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + Configurations.SEPARATOR + groupName);
        urls.add(url);
        // push the bundles in the OBR distributed set
        Set<ObrBundleInfo> bundles = clusterManager.getSet(Constants.BUNDLES_DISTRIBUTED_SET_NAME + Configurations.SEPARATOR + groupName);
View Full Code Here

    @Override
    protected Object doExecute() throws Exception {
        // find the group for the given name
        Group group = groupManager.findGroupByName(groupName);
        // create an event and produce it
        EventProducer producer = eventTransportFactory.getEventProducer(groupName, true);
        int type = 0;
        if (start) type = Constants.BUNDLE_START_EVENT_TYPE;
        ObrBundleEvent event = new ObrBundleEvent(bundleId, type);
        event.setForce(true);
        event.setSourceGroup(group);
        producer.produce(event);
        return null;
    }
View Full Code Here

     * @param listenerInfo
     */
    private void importService(EndpointDescription endpoint, ListenerInfo listenerInfo) {
        LOGGER.debug("CELLAR DOSGI: importing remote service");

        EventProducer requestProducer = producers.get(endpoint.getId());
        if (requestProducer == null) {
            requestProducer = eventTransportFactory.getEventProducer(Constants.INTERFACE_PREFIX + Constants.SEPARATOR + endpoint.getId(), Boolean.FALSE);
            producers.put(endpoint.getId(), requestProducer);
        }

View Full Code Here

        } finally {
            Thread.currentThread().setContextClassLoader(originalClassLoader);
        }

        // broadcast the event
        EventProducer producer = eventTransportFactory.getEventProducer(groupName, true);
        RemoteBundleEvent event = new RemoteBundleEvent(name, version, null, BundleEvent.UNINSTALLED);
        event.setForce(true);
        event.setSourceGroup(group);
        producer.produce(event);

        return null;
    }
View Full Code Here

TOP

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

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.