Package org.switchyard

Examples of org.switchyard.SwitchYardException


            _qpidConnectionFactory = _properties.getProperty(AMQP_PROPS_QPID_CONNECTIONFACTORY);
        } finally {
            is.close();
        }
        if (_qpidConnectionFactory == null) {
            throw new SwitchYardException("No connection factory configured. Please set "+ AMQP_PROPS_QPID_CONNECTIONFACTORY
                + " in the "+AMQP_PROPERTIES_FILE+" file found in the class path of your application");
        }

        _qpidQueueExchange = _properties.getProperty(AMQP_PROPS_QUEUE_EXCHANGE);
        _qpidTopicExchange = _properties.getProperty(AMPQ_PROPS_TOPIC_EXCHANGE);

        if (_qpidQueueExchange == null && _qpidTopicExchange == null) {
            throw new SwitchYardException("No topic or queue configured. Please set either one by using "
                + AMQP_PROPS_QUEUE_EXCHANGE + " or " + AMPQ_PROPS_TOPIC_EXCHANGE + " in your " + AMQP_PROPERTIES_FILE + " properties file.");
        }
    }
View Full Code Here


            }
            if (_qpidTopicExchange != null) {
                context.bind(DEFAULT_TOPIC_JNDI_LOCATION, AMQDestination.createDestination(_qpidTopicExchange));
            }
        } catch (Exception e) {
            throw new SwitchYardException(e);
        }
    }
View Full Code Here

                    for (TestMixIn dependency : optionalDependencies) {
                        if (dependency instanceof CDIMixInParticipant) {
                           try {
                               ((CDIMixInParticipant) dependency).participate(deployment);
                            } catch (Exception e) {
                                throw new SwitchYardException("Can not initialize Weld due CDIMixIn initialization error", e);
                            }
                        }
                    }
                }
                return deployment;
View Full Code Here

                    if (hasComponentReferenceInterface(componentRefModel)) {
                        serviceInterface = loadServiceInterface(componentRefModel.getInterface());
                    }
                    break;
                default:
                    throw new SwitchYardException("A composite reference interface must be defined if promoting more than one component reference.");
            }
        }
        return serviceInterface;
    }
View Full Code Here

                serviceInterface = JavaService.fromClass(serviceInterfaceType);
            } else if (InterfaceModel.WSDL.equals(intfModel.getType())) {
                try {
                    serviceInterface = WSDLService.fromWSDL(intfModel.getInterface());
                } catch (WSDLReaderException wsdlre) {
                    throw new SwitchYardException(wsdlre);
                }
            } else if (EsbInterfaceModel.ESB.equals(intfModel.getType())) {
                EsbInterfaceModel esbIntf = (EsbInterfaceModel)intfModel;
                validateEsbInterface(esbIntf);
                if (esbIntf.getOutputType() == null) {
View Full Code Here

            List<Policy> requiresImpl = null;
            try {
                requiresImpl = getPolicyRequirements(component.getImplementation());
            } catch (Exception e) {
                throw new SwitchYardException(e);
            }
           
            Implementation impl = new Implementation(component.getImplementation());
            List<ServiceReference> references = new LinkedList<ServiceReference>();
           
            // register a reference for each one declared in the component
            for (ComponentReferenceModel reference : component.getReferences()) {
                // Create the reference name qualified with component name to ensure uniqueness
                QName refName = ComponentNames.qualify(component.getQName(),  reference.getQName());
                              
                _log.debug("Registering reference " + refName + " for component "
                        + component.getImplementation().getType() + " for deployment " + getName());
           
                // Component Reference bindings not allowed, check to see if we find one and throw an exception
                List<Model> models = reference.getModelChildren();
                for (Model model : models) {
                    if (BindingModel.class.isAssignableFrom(model.getClass())) {
                        throw BaseDeployMessages.MESSAGES.componentReferenceBindingsNotAllowed(model.toString(), reference.toString());
                    }
                }
                List<Policy> requires = null;
                try {
                    requires = getPolicyRequirements(reference);
                } catch (Exception e) {
                    throw BaseDeployMessages.MESSAGES.unableCollectRequirements(reference.toString(), e);
                }
                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);
View Full Code Here

        try {
            KeyGenerator keyGenerator = KeyGenerator.getInstance(_sealAlgorithm);
            keyGenerator.init(sealKeySize);
            _secretKey = keyGenerator.generateKey();
        } catch (NoSuchAlgorithmException nsae) {
            throw new SwitchYardException(nsae);
        }
    }
View Full Code Here

        try {
            Cipher cipher = Cipher.getInstance(_sealAlgorithm);
            cipher.init(Cipher.ENCRYPT_MODE, _secretKey);
            return new SealedObject(object, cipher);
        } catch (Exception e) {
            throw new SwitchYardException(e);
        }
    }
View Full Code Here

        try {
            Cipher cipher = Cipher.getInstance(_sealAlgorithm);
            cipher.init(Cipher.DECRYPT_MODE, _secretKey);
            return (Serializable)object.getObject(cipher);
        } catch (Exception e) {
            throw new SwitchYardException(e);
        }
    }
View Full Code Here

        try {
            Certificate certificate = keyStore.getCertificate(keyAlias);
            _publicKey = certificate.getPublicKey();
            _keyTransformation = keyTransformation != null ? keyTransformation : _publicKey.getAlgorithm();
        } catch (KeyStoreException kse) {
            throw new SwitchYardException(kse);
        }
    }
View Full Code Here

TOP

Related Classes of org.switchyard.SwitchYardException

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.