Package org.apache.servicemix.jbi.framework

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


     */
    public String startComponent(String componentName) throws JBIException {
        String result = "NOT FOUND: " + componentName;
        ObjectName objName = getComponentByName(componentName);
        if (objName != null) {
            ComponentMBeanImpl mbean = (ComponentMBeanImpl) beanMap.get(objName);
            if (mbean != null) {
                mbean.start();
                result = mbean.getCurrentState();
            }
        }
        return result;
    }
View Full Code Here


     */
    public String stopComponent(String componentName) throws JBIException {
        String result = "NOT FOUND: " + componentName;
        ObjectName objName = getComponentByName(componentName);
        if (objName != null) {
            ComponentMBeanImpl mbean = (ComponentMBeanImpl) beanMap.get(objName);
            if (mbean != null) {
                mbean.stop();
                result = mbean.getCurrentState();
            }
        }
        return result;
    }
View Full Code Here

     */
    public String shutDownComponent(String componentName) throws JBIException {
        String result = "NOT FOUND: " + componentName;
        ObjectName objName = getComponentByName(componentName);
        if (objName != null) {
            ComponentMBeanImpl mbean = (ComponentMBeanImpl) beanMap.get(objName);
            if (mbean != null) {
                mbean.shutDown();
                result = mbean.getCurrentState();
            }
        }
        return result;
    }
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();
            LOGGER.info("Deactivating component {}", componentName);
        } else {
            throw new JBIException("Could not find component " + componentName);
        }
    }
View Full Code Here

                                        ActivationSpec activationSpec, boolean pojo,
                                        boolean binding, boolean service, String[] sharedLibraries) throws JBIException {
        ObjectName result = null;
        ComponentNameSpace cns = new ComponentNameSpace(getName(), activationSpec.getComponentName());
        LOGGER.info("Activating component {}", cns);
        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

     *            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<ServiceEndpoint> filtered = new ArrayList<ServiceEndpoint>();
        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
                        && (!consumer.getComponent().isExchangeWithProviderOkay(endpoints[i], exchange)
                                || !provider.getComponent().isExchangeWithConsumerOkay(endpoints[i], exchange))) {
                    continue;
                }
            }
            filtered.add(endpoints[i]);
        }
View Full Code Here

     // Retrieve a delivery channel
        TestComponent component = new TestComponent(new QName("service"), "endpoint");
        container.activateComponent(new ActivationSpec("component", component));
        final DeliveryChannel channel = component.getChannel();
        // test
        ComponentMBeanImpl componentMbeanImpl = container.getRegistry().getComponent("component");
        assertNotNull(componentMbeanImpl);
        componentMbeanImpl.setExchangeThrottling(true);
        componentMbeanImpl.setThrottlingTimeout(4000);
       

        class ProviderThread extends Thread {
            private int counter;
            private DeliveryChannel channel;
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

                                    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

        container.addListener(endpointListener);
        super.init(container);
    }
   
    protected void onComponentInitialized(ComponentEvent event) {
        ComponentMBeanImpl component = event.getComponent();
        String key = component.getName();
        ComponentStats stats = new ComponentStats(component);
        componentStats.putIfAbsent(key, stats);
        // Register MBean
        ManagementContext context = container.getManagementContext();
        try {
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.