Package org.apache.servicemix.jbi.framework

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


     *
     * @param packet
     * @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 {
            throw new MessagingException("No component named " + id.getName() + " - Couldn't route MessageExchange " + me);
        }
    }
View Full Code Here


     */
    public boolean matches(Registry registry, MessageExchangeImpl exchange) {
        boolean result = false;

        ExchangePacket packet = exchange.getPacket();
        ComponentNameSpace sourceId = packet.getSourceId();
        if (sourceId != null) {
            // get the list of services
            if (service != null) {
                ServiceEndpoint[] ses = registry.getEndpointsForService(service);
                if (ses != null) {
View Full Code Here

     * @return the ObjectName of the MBean for the Component
     * @throws JBIException
     */
    public ObjectName activateComponent(Component component, String name) throws JBIException {
        ActivationSpec activationSpec = new ActivationSpec();
        ComponentNameSpace cns = new ComponentNameSpace(getName(), name);
        activationSpec.setComponent(component);
        activationSpec.setComponentName(cns.getName());
        return activateComponent(component, activationSpec);
    }
View Full Code Here

     * @throws JBIException
     */
    public ObjectName activateComponent(File installDir, Component component, String description,
                                        ComponentContextImpl context, boolean binding, boolean service,
                                        String[] sharedLibraries) throws JBIException {
        ComponentNameSpace cns = context.getComponentNameSpace();
        ActivationSpec activationSpec = new ActivationSpec();
        activationSpec.setComponent(component);
        activationSpec.setComponentName(cns.getName());
        return activateComponent(installDir, component, description, context, activationSpec, false, binding, service, sharedLibraries);
    }
View Full Code Here

     * @throws JBIException
     */
    public ObjectName activateComponent(Component component, String description, ActivationSpec activationSpec,
                                        boolean pojo, boolean binding, boolean service,
                                        String[] sharedLibraries) throws JBIException {
        ComponentNameSpace cns = new ComponentNameSpace(getName(), activationSpec.getComponentName());
        if (registry.getComponent(cns) != null) {
            throw new JBIException("A component is already registered for " + cns);
        }
        ComponentContextImpl context = new ComponentContextImpl(this, cns);
        return activateComponent(new File("."), component, description, context, activationSpec, pojo, binding, service, sharedLibraries);
View Full Code Here

                                        ComponentContextImpl context, ActivationSpec activationSpec,
                                        boolean pojo, boolean binding, boolean service,
                                        String[] sharedLibraries)
            throws JBIException {
        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);
View Full Code Here

        container.setMonitorDeploymentDirectory(false);
        return container;
    }
   
    public void register(Component component) throws Exception {
        ComponentNameSpace cns = new ComponentNameSpace(container.getName(), component.getName());
        ComponentContextImpl context = new ComponentContextImpl(container, cns);
        ComponentEnvironment env = new ComponentEnvironment();
        env.setComponentRoot(new File(component.getRootDir()));
        env.setInstallRoot(new File(component.getInstallDir()));
        env.setWorkspaceRoot(new File(component.getWorkDir()));
View Full Code Here

    /*
     * Test method for 'org.apache.servicemix.jbi.framework.ComponentNameSpace.getComponentId()'
     */
    public void testAccessors() {
        ComponentNameSpace cns = new ComponentNameSpace();
        assertNull(cns.getContainerName());
        assertNull(cns.getName());
        cns.setContainerName("container");
        assertEquals("container", cns.getContainerName());
        cns.setName("name");
        assertEquals("name", cns.getName());
    }
View Full Code Here

    /*
     * Test method for 'org.apache.servicemix.jbi.framework.ComponentNameSpace.equals(Object)'
     * Test method for 'org.apache.servicemix.jbi.framework.ComponentNameSpace.hashCode()'
     */
    public void testHashCodeEqualsObject() {
        ComponentNameSpace cns1 = new ComponentNameSpace("container", "name");
        ComponentNameSpace cns2 = new ComponentNameSpace("container", "name");
        assertTrue(cns1.equals(cns2));
        assertTrue(cns1.hashCode() == cns2.hashCode());

        ComponentNameSpace cns3 = new ComponentNameSpace("container1", "name");
        ComponentNameSpace cns4 = new ComponentNameSpace("container2", "name");
        assertFalse(cns3.equals(cns4));
        assertFalse(cns3.hashCode() == cns4.hashCode());

        ComponentNameSpace cns5 = new ComponentNameSpace("container", "name1");
        ComponentNameSpace cns6 = new ComponentNameSpace("container", "name2");
        assertFalse(cns5.equals(cns6));
        assertFalse(cns5.hashCode() == cns6.hashCode());
    }
View Full Code Here

    /*
     * Test method for 'org.apache.servicemix.jbi.framework.ComponentNameSpace.writeExternal(ObjectOutput)'
     * Test method for 'org.apache.servicemix.jbi.framework.ComponentNameSpace.readExternal(ObjectInput)'
     */
    public void testSerialize() throws Exception {
        ComponentNameSpace cns = new ComponentNameSpace("container", "name");
       
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(cns);
        oos.close();
       
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bais);
        Object out = ois.readObject();
       
        assertNotNull(out);
        assertTrue(out instanceof ComponentNameSpace);
        ComponentNameSpace cnsOut = (ComponentNameSpace) out;
        assertEquals(cns, cnsOut);
        assertEquals(cns.getName(), cnsOut.getName());
    }
View Full Code Here

TOP

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

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.