Package org.apache.servicemix.jbi.servicedesc

Examples of org.apache.servicemix.jbi.servicedesc.InternalEndpoint


     *
     * @param remote
     */
    public void unregisterRemoteEndpoint(InternalEndpoint remote) {
        String key = getKey(remote);
        InternalEndpoint endpoint = (InternalEndpoint) internalEndpoints.get(key);
        if (endpoint != null) {
            endpoint.removeRemoteEndpoint(remote);
            if (!endpoint.isClustered() && !endpoint.isLocal()) {
                internalEndpoints.remove(key);
                unregisterEndpoint(endpoint);
            }
            fireEvent(remote, EndpointEvent.REMOTE_ENDPOINT_UNREGISTERED);
        }
View Full Code Here


    protected boolean isContainerEmbedded() {
        return container.isEmbedded();
    }

    protected InternalEndpoint matchEndpointByName(ServiceEndpoint[] endpoints, String endpointName) {
        InternalEndpoint result = null;
        if (endpoints != null && endpointName != null && endpointName.length() > 0) {
            for (int i = 0; i < endpoints.length; i++) {
                if (endpoints[i].getEndpointName().equals(endpointName)) {
                    result = (InternalEndpoint) endpoints[i];
                    break;
View Full Code Here

     * @param as
     */
    public void registerSubscriptions(ComponentContextImpl context, ActivationSpec as) {
        QName service = as.getService();
        String endpointName = as.getEndpoint();
        InternalEndpoint endpoint = new InternalEndpoint(context.getComponentNameSpace(), endpointName, service);
        SubscriptionSpec[] specs = as.getSubscriptions();
        if (specs != null) {
            for (int i = 0; i < specs.length; i++) {
                registerSubscription(context, specs[i], endpoint);
            }
View Full Code Here

     * @param context
     * @param subscription
     * @param endpoint
     */
    public void registerSubscription(ComponentContextImpl context, SubscriptionSpec subscription, ServiceEndpoint endpoint) {
        InternalEndpoint sei = (InternalEndpoint)endpoint;
        subscription.setName(context.getComponentNameSpace());
        subscriptionRegistry.registerSubscription(subscription, sei);
    }
View Full Code Here

            SubscriptionSpec subscription = (SubscriptionSpec) entry.getKey();
            if (subscription.matches(registry, exchange)) {
                if (result == null) {
                    result = new ArrayList<InternalEndpoint>();
                }
                InternalEndpoint endpoint = (InternalEndpoint) entry.getValue();
                result.add(endpoint);
            }
        }
        return result;
    }
View Full Code Here

    }
   
    public ServiceEndpoint[] getEndpointsForComponent(ComponentNameSpace cns) {
        Collection<ServiceEndpoint> endpoints = new ArrayList<ServiceEndpoint>();
        for (Iterator<ServiceEndpoint> iter = getInternalEndpoints().iterator(); iter.hasNext();) {
            InternalEndpoint endpoint = (InternalEndpoint) iter.next();
            if (cns.equals(endpoint.getComponentNameSpace())) {
                endpoints.add(endpoint);
            }
        }
        return asEndpointArray(endpoints);
    }
View Full Code Here

    }
   
    public ServiceEndpoint[] getAllEndpointsForComponent(ComponentNameSpace cns) {
        Collection<ServiceEndpoint> endpoints = new ArrayList<ServiceEndpoint>();
        for (Iterator<ServiceEndpoint> iter = getInternalEndpoints().iterator(); iter.hasNext();) {
            InternalEndpoint endpoint = (InternalEndpoint) iter.next();
            if (cns.equals(endpoint.getComponentNameSpace())) {
                endpoints.add(endpoint);
            }
        }
        for (Iterator<ServiceEndpoint> iter = getExternalEndpoints().iterator(); iter.hasNext();) {
            ExternalEndpoint endpoint = (ExternalEndpoint) iter.next();
            if (cns.equals(endpoint.getComponentNameSpace())) {
                endpoints.add(endpoint);
            }
        }
        return asEndpointArray(endpoints);
    }
View Full Code Here

    public InternalEndpoint registerInternalEndpoint(ComponentContextImpl provider,
                                                     QName serviceName,
                                                     String endpointName) throws JBIException {
        // Create endpoint
        String key = getKey(serviceName, endpointName);
        InternalEndpoint registered = (InternalEndpoint) internalEndpoints.get(key);
        // Check if the endpoint has already been activated by another component
        if (registered != null && registered.isLocal()) {
            throw new JBIException("An internal endpoint for service " + serviceName
                                        + " and endpoint " + endpointName + " is already registered");
        }       
        // Create a new endpoint
        InternalEndpoint serviceEndpoint = new InternalEndpoint(provider.getComponentNameSpace(), endpointName, serviceName);
        // Get interface from activationSpec
        if (provider.getActivationSpec().getInterfaceName() != null) {
            serviceEndpoint.addInterface(provider.getActivationSpec().getInterfaceName());
        }
        // Get interfaces
        for (Iterator<EndpointProcessor> it = endpointProcessors.iterator(); it.hasNext();) {
            EndpointProcessor p = it.next();
            p.process(serviceEndpoint);
        }
        // Set remote namespaces
        if (registered != null) {
            InternalEndpoint[] remote = registered.getRemoteEndpoints();
            for (int i = 0; i < remote.length; i++) {
                serviceEndpoint.addRemoteEndpoint(remote[i]);
            }
        }
        // Register endpoint
        internalEndpoints.put(key, serviceEndpoint);
        registerEndpoint(serviceEndpoint);
View Full Code Here

     * Registers a remote endpoint
     *
     * @param remote
     */
    public void registerRemoteEndpoint(InternalEndpoint remote) {
        InternalEndpoint endpoint = (InternalEndpoint) internalEndpoints.get(getKey(remote));
        // Create endpoint if not already existing
        if (endpoint == null) {
            endpoint = new InternalEndpoint(null, remote.getEndpointName(), remote.getServiceName());
            internalEndpoints.put(getKey(endpoint), endpoint);
        }
        // Add remote endpoint
        endpoint.addRemoteEndpoint(remote);
        fireEvent(remote, EndpointEvent.REMOTE_ENDPOINT_REGISTERED);
    }
View Full Code Here

     *
     * @param remote
     */
    public void unregisterRemoteEndpoint(InternalEndpoint remote) {
        String key = getKey(remote);
        InternalEndpoint endpoint = (InternalEndpoint) internalEndpoints.get(key);
        if (endpoint != null) {
            endpoint.removeRemoteEndpoint(remote);
            if (!endpoint.isClustered() && !endpoint.isLocal()) {
                internalEndpoints.remove(key);
                unregisterEndpoint(endpoint);
            }
            fireEvent(remote, EndpointEvent.REMOTE_ENDPOINT_UNREGISTERED);
        }
View Full Code Here

TOP

Related Classes of org.apache.servicemix.jbi.servicedesc.InternalEndpoint

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.