Package org.mule.api.service

Examples of org.mule.api.service.Service


                // Create Endpoint
                InboundEndpoint endpoint = createMessageInflowEndpoint(muleActivationSpec);

                // Create Service
                Service service = createJcaService(endpointFactory, model, endpoint);

                // Keep reference to JcaService descriptor for endpointDeactivation
                MuleEndpointKey key = new MuleEndpointKey(endpointFactory, muleActivationSpec);
                endpoints.put(key, service);
            }
View Full Code Here


    {
        if (activationSpec.getClass().equals(MuleActivationSpec.class))
        {
            MuleActivationSpec muleActivationSpec = (MuleActivationSpec) activationSpec;
            MuleEndpointKey key = new MuleEndpointKey(endpointFactory, (MuleActivationSpec) activationSpec);
            Service service = (Service) endpoints.remove(key);
            if (service == null)
            {
                logger.warn("No endpoint was registered with key: " + key);
                return;
            }

            // Resolve modelName
            String modelName = null;
            try
            {
                modelName = resolveModelName(muleActivationSpec);
            }
            catch (ResourceException e)
            {
                logger.error(e.getMessage(), e);
            }

            try
            {
                muleContext.getRegistry().unregisterService(service.getName());
            }
            catch (MuleException e)
            {
                logger.error(e.getMessage(), e);
            }
View Full Code Here

    protected Service createJcaService(MessageEndpointFactory endpointFactory,
                                       JcaModel model,
                                       InboundEndpoint endpoint) throws MuleException
    {
        String name = "JcaService#" + endpointFactory.hashCode();
        Service service = new JcaService(muleContext);
        service.setName(name);
        ((CompositeMessageSource) service.getMessageSource()).addSource(endpoint);

        // Set endpointFactory rather than endpoint here, so we can obtain a
        // new endpoint instance from factory for each incoming message in
        // JcaComponet as reccomended by JCA specification
        service.setComponent(new JcaComponent(endpointFactory, model.getEntryPointResolverSet(), service,
            new DelegateWorkManager(bootstrapContext.getWorkManager())));
        service.setModel(model);
        muleContext.getRegistry().registerService(service);
        return service;
    }
View Full Code Here

        if (!(receiver.getFlowConstruct() instanceof Service))
        {
            throw new IllegalArgumentException(
                "Only the Service flow constuct is supported by the axis transport");
        }
        Service service = (Service) receiver.getFlowConstruct();
        Class[] classes = AxisServiceProxy.getInterfacesForComponent(service);
        return AxisServiceProxy.createProxy(receiver, true, classes);
    }
View Full Code Here

    }

    protected Class getServiceClass(String s, SOAPService soapService, MessageContext messageContext)
        throws AxisFault
    {
        Service component = connector.getMuleContext().getRegistry().lookupService(soapService.getName());
        try
        {
            Class[] classes = AxisServiceProxy.getInterfacesForComponent(component);
            return Proxy.getProxyClass(Thread.currentThread().getContextClassLoader(), classes);
        }
View Full Code Here

    public void testOtherProperties() throws Exception
    {
        StdioMessageReceiver receiver = (StdioMessageReceiver) getMessageReceiver();

        Service service = getTestService("orange", Orange.class);
        assertNotNull(service);

        endpoint.getConnector().start();

        receiver.setFrequency(1001);
View Full Code Here

    public void testComponentWithoutInterfaces() throws Throwable
    {
        try
        {
            // TODO MULE-2228 Simplify this API
            Service c = MuleTestUtils.getTestService("testComponentWithoutInterfaces", ComponentWithoutInterfaces.class, null, muleContext, false);
            InboundEndpoint ep = muleContext.getEndpointFactory().getInboundEndpoint(getComponentWithoutInterfacesEndpoint());
            ((CompositeMessageSource) c.getMessageSource()).addSource(ep);
            muleContext.getRegistry().registerService(c);
            fail("Expected exception");
        }
        catch (MuleException e)
        {
View Full Code Here

        super.statistics = statistics;
    }

    public int getQueueSize()
    {
        Service c = getComponent();
        if (c instanceof SedaService)
        {
            return (int) c.getStatistics().getQueuedEvents();
        }
        else
        {
            return -1;
        }
View Full Code Here

        assertTrue(router instanceof CustomOutboundRouter);
    }

    protected MessageProcessor lookupOutboundRouterFromService(String serviceName) throws Exception
    {
        Service service = lookupService(serviceName);
        OutboundRouterCollection routerCollection =
            (OutboundRouterCollection) service.getOutboundMessageProcessor();
        return routerCollection.getRoutes().get(0);
    }
View Full Code Here

        return routerCollection.getRoutes().get(0);
    }

    protected MessageProcessor lookupInboundRouterFromService(String serviceName) throws Exception
    {
        Service service = lookupService(serviceName);
        List<MessageProcessor> routers =
            ((ServiceCompositeMessageSource) service.getMessageSource()).getMessageProcessors();
        assertEquals(1, routers.size());
        return routers.get(0);
    }
View Full Code Here

TOP

Related Classes of org.mule.api.service.Service

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.