Package org.switchyard

Examples of org.switchyard.ServiceMetadata


                ServiceHandler handler = activator.activateBinding(reference.getQName(), binding);
                Activation activation = new Activation(activator, reference.getQName(), binding, handler);
                ServiceInterface si = getCompositeReferenceInterface(reference);
                Binding bindingMetadata = new Binding(binding);
                validateServiceRegistration(refQName);
                ServiceMetadata metadata = ServiceMetadataBuilder.create().registrant(bindingMetadata).build();
                Service svc = getDomain().registerService(refQName, si, handler, metadata);
                activation.addService(svc);
                _referenceBindings.add(activation);

                handler.start();
View Full Code Here


                }
                processPolicyDependency(requires, requiresImpl);
                validatePolicy(requires, requiresImpl);

                ServiceInterface refIntf = getComponentReferenceInterface(reference);
                ServiceMetadata metadata = ServiceMetadataBuilder.create()
                        .security(getDomain().getServiceSecurity(reference.getSecurity()))
                        .requiredPolicies(requires).registrant(impl)
                        .build();
                ServiceReference svcRef = getDomain().registerServiceReference(refName, refIntf, null, metadata);

                boolean wired = false;
                // wire a reference if the name is different from promoted name
                compositeReferenceLoop: for (CompositeReferenceModel compositeReference : getConfig().getComposite().getReferences()) {
                    for (ComponentReferenceModel componentReference : compositeReference.getComponentReferences()) {
                        if (componentReference != null && componentReference.equals(reference)) {
                            if (!componentReference.getQName().equals(compositeReference.getQName())) {
                                svcRef.wire(compositeReference.getQName());
                                wired = true;
                                break compositeReferenceLoop;
                            }
                        }
                    }
                }
               
                // if we didn't wire to a promoted reference, then default to unqualified service name
                if (!wired) {
                    svcRef.wire(ComponentNames.unqualify(svcRef));
                }
                references.add(svcRef);
            }
           
            // register a service for each one declared in the component
            if (component.getServices().size() > 1) {
                throw BaseDeployMessages.MESSAGES.multipleServicesFound(component.getName());
            } else if (component.getServices().size() == 1) {
                ComponentServiceModel service = component.getServices().get(0);
                _log.debug("Registering service " + service.getQName()
                       + " for component " + component.getImplementation().getType() + " for deployment " + getName());

               
                // Component Service bindings not allowed, check to see if we find one and throw an exception
                List<Model> models = service.getModelChildren();
                for (Model model : models) {
                    if (BindingModel.class.isAssignableFrom(model.getClass())) {
                        throw BaseDeployMessages.MESSAGES.componentServiceBindingsNotAllowed(model.toString(), service.toString());
                    }
                }
               
               
                List<Policy> requires = null;
                try {
                    requires = getPolicyRequirements(service);
                    processPolicyDependency(requires, requiresImpl);
                    validatePolicy(requires, requiresImpl);
                } catch (Exception e) {
                    throw new SwitchYardException(e);
                }
                requires.addAll(requiresImpl);

                ServiceHandler handler = activator.activateService(service.getQName(), component);
                Activation activation = new Activation(activator, component.getQName(), null, handler);
                ServiceInterface serviceIntf = getComponentServiceInterface(service);
                ServiceMetadata metadata = ServiceMetadataBuilder.create()
                        .security(getDomain().getServiceSecurity(service.getSecurity()))
                        .requiredPolicies(requires)
                        .registrant(impl)
                        .build();
               
View Full Code Here

            return;
        }
        // activate bindings for each service
        for (CompositeServiceModel service : getConfig().getComposite().getServices()) {
            // Create the reference for the composite service
            ServiceMetadata metadata = ServiceMetadataBuilder.create()
                    .throttling(getCompositeServiceThrottling(service))
                    .registrant(new Binding(service.getBindings()))
                    .build();
            ServiceReference reference = getDomain().registerServiceReference(
                    service.getQName(), getCompositeServiceInterface(service), null, metadata);
View Full Code Here

        List<Policy> provided = new LinkedList<Policy>();
        provided.add(TransactionPolicy.PROPAGATES_TRANSACTION);
        Throttling throttling = new Throttling();
       
        // add them to service metadata
        ServiceMetadata metadata = ServiceMetadataBuilder.create()
            .providedPolicies(provided)
            .requiredPolicies(required)
            .registrant(registrant)
            .throttling(throttling)
            .build();
       
        // verify
        Assert.assertEquals(registrant, metadata.getRegistrant());
        Assert.assertEquals(throttling, metadata.getThrottling());
        Assert.assertEquals(required.get(0), metadata.getRequiredPolicies().get(0));
        Assert.assertEquals(provided.get(0), metadata.getProvidedPolicies().get(0));
    }
View Full Code Here

    }
   
    @Test
    public void testUpdate() {
        Throttling throttling1 = new Throttling().setMaxRequests(50);
        ServiceMetadata metadata = ServiceMetadataBuilder.create()
                .throttling(throttling1)
                .build();
       
        Assert.assertEquals(50, metadata.getThrottling().getMaxRequests());
       
        Throttling throttling2 = new Throttling().setMaxRequests(150);
        ServiceMetadataBuilder.update(metadata).throttling(throttling2);
        Assert.assertEquals(150, metadata.getThrottling().getMaxRequests());
    }
View Full Code Here

TOP

Related Classes of org.switchyard.ServiceMetadata

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.