Package org.apache.servicemix.jbi.framework

Examples of org.apache.servicemix.jbi.framework.ComponentMBeanImpl


        List brokerLinks = new ArrayList();
        Registry registry = container.getRegistry();
        Collection components = registry.getComponents();
        for (Iterator iter = components.iterator(); iter.hasNext();) {
            ComponentMBeanImpl component = (ComponentMBeanImpl) iter.next();
            String name = component.getName();
            String id = encode(name);

            writer.print(id);
            writer.print(" [ fillcolor = gray, label = \"");
            writer.print(name);
View Full Code Here


     * @throws MessagingException
     */
    protected void doRouting(MessageExchangeImpl me) throws MessagingException {
        ComponentNameSpace id = me.getRole() == Role.PROVIDER ? me.getDestinationId() : me.getSourceId();
        //As the MessageExchange could come from another container - ensure we get the local Component
        ComponentMBeanImpl lcc = broker.getContainer().getRegistry().getComponent(id.getName());
        if (lcc != null) {
            if (lcc.getDeliveryChannel() != null) {
                lcc.getDeliveryChannel().processInBound(me);
            } else {
                throw new MessagingException("Component " + id.getName() + " is shut down");
            }
        }
        else {
View Full Code Here

     * @param exchange the exchange that will be serviced
     * @return an array of endpoints on which both consumer and provider agrees
     */
    protected ServiceEndpoint[] getMatchingEndpoints(ServiceEndpoint[] endpoints, MessageExchangeImpl exchange) {
      List filtered = new ArrayList();
        ComponentMBeanImpl consumer = getRegistry().getComponent(exchange.getSourceId());
       
      for (int i = 0; i < endpoints.length; i++) {
      ComponentNameSpace id = ((InternalEndpoint) endpoints[i]).getComponentNameSpace();
            if (id != null) {
                ComponentMBeanImpl provider = getRegistry().getComponent(id);
                if (provider != null) {
                    if (!consumer.getComponent().isExchangeWithProviderOkay(endpoints[i], exchange) ||
                        !provider.getComponent().isExchangeWithConsumerOkay(endpoints[i], exchange)) {
                     continue;
                  }
                }
            }
            filtered.add(endpoints[i]);
View Full Code Here

     *
     * @param name - the unique component ID
     * @throws JBIException
     */
    public void deactivateComponent(String name) throws JBIException {
        ComponentMBeanImpl component = registry.getComponent(name);
        if (component != null) {
            component.doShutDown();
          component.unregisterMbeans(managementContext);
            registry.deregisterComponent(component);
            environmentContext.unreregister(component);
            component.dispose();
            log.info("Deactivating component " + name);
        }
        else {
            throw new JBIException("Could not find component " + name);
        }
View Full Code Here

        ComponentNameSpace cns = new ComponentNameSpace(getName(), activationSpec.getComponentName());
        if (log.isDebugEnabled()) {
            log.info("Activating component for: " + cns + " with service: " + activationSpec.getService() + " component: "
                    + component);
        }
        ComponentMBeanImpl lcc = registry.registerComponent(cns, description, component, binding, service, sharedLibraries);
        if (lcc != null) {
            lcc.setPojo(pojo);
            ComponentEnvironment env = environmentContext.registerComponent(context.getEnvironment(),lcc);
            if (env.getInstallRoot() == null) {
                env.setInstallRoot(installationDir);
            }
            context.activate(component, env, activationSpec);
            lcc.setContext(context);
            lcc.setActivationSpec(activationSpec);
           
            if (lcc.isPojo()) {
                //non-pojo's are either started by the auto deployer
                //or manually
                lcc.init();
            } else {
                lcc.doShutDown();
            }
            result = lcc.registerMBeans(managementContext);
            // Start the component after mbeans have been registered
            // This can be usefull if listeners use them
            if (lcc.isPojo() && started.get()) {
                lcc.start();
            }
        }
        return result;
    }
View Full Code Here

                    }
                });

                // Start queue consumers for all components
                for (Iterator it = broker.getContainer().getRegistry().getComponents().iterator(); it.hasNext();) {
                    ComponentMBeanImpl cmp = (ComponentMBeanImpl) it.next();
                    if (cmp.isStarted()) {
                        onComponentStarted(new ComponentEvent(cmp, ComponentEvent.COMPONENT_STARTED));
                    }
                }
                // Start queue consumers for all endpoints
                ServiceEndpoint[] endpoints = broker.getContainer().getRegistry().getEndpointsForInterface(null);
View Full Code Here

        }
        String componentName = config.getInitParameter(COMPONENT_PROPERTY);
        if (componentName == null) {
            componentName = COMPONENT_DEFAULT;
        }
        ComponentMBeanImpl componentMBean  = container.getComponent(componentName);
        if (componentMBean == null) {
            throw new IllegalStateException("Unable to find component " + componentName);
        }
        HttpComponent component = (HttpComponent) componentMBean.getComponent();
        String mapping = config.getInitParameter(MAPPING_PROPERTY);
        if (mapping != null) {
            component.getConfiguration().setMapping(mapping);
        }
        processor = component.getMainProcessor();
View Full Code Here

                      component.getDescription(),
                      context,
                      component.getType().equals("binding-component"),
                      component.getType().equals("service-engine"),
                                    null);
        ComponentMBeanImpl cmb = container.getComponent(component.getName());
        File stateFile = cmb.getContext().getEnvironment().getStateFile();
        if (stateFile.isFile()) {
          cmb.setInitialRunningState();
        } else {
          cmb.start();
        }
    }
View Full Code Here

     *
     * @param componentName - the unique component ID
     * @throws JBIException
     */
    public void deactivateComponent(String componentName) throws JBIException {
        ComponentMBeanImpl component = registry.getComponent(componentName);
        if (component != null) {
            component.doShutDown();
            component.unregisterMbeans(managementContext);
            registry.deregisterComponent(component);
            environmentContext.unreregister(component);
            component.dispose();
            LOG.info("Deactivating component " + componentName);
        } else {
            throw new JBIException("Could not find component " + componentName);
        }
    }
View Full Code Here

        ObjectName result = null;
        ComponentNameSpace cns = new ComponentNameSpace(getName(), activationSpec.getComponentName());
        if (LOG.isDebugEnabled()) {
            LOG.info("Activating component for: " + cns + " with service: " + activationSpec.getService() + " component: " + component);
        }
        ComponentMBeanImpl lcc = registry.registerComponent(cns, description, component, binding, service, sharedLibraries);
        if (lcc != null) {
            lcc.setPojo(pojo);
            ComponentEnvironment env = environmentContext.registerComponent(context.getEnvironment(), lcc);
            if (env.getInstallRoot() == null) {
                env.setInstallRoot(installationDir);
            }
            context.activate(component, env, activationSpec);
            lcc.setContext(context);
            lcc.setActivationSpec(activationSpec);

            if (lcc.isPojo()) {
                //non-pojo's are either started by the auto deployer
                //or manually
                lcc.init();
            } else {
                lcc.doShutDown();
            }
            result = lcc.registerMBeans(managementContext);
            // Start the component after mbeans have been registered
            // This can be usefull if listeners use them
            if (lcc.isPojo() && started.get()) {
                lcc.start();
            }
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.servicemix.jbi.framework.ComponentMBeanImpl

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.