Package org.apache.synapse

Examples of org.apache.synapse.SynapseException


            OMElement includeElem = (OMElement) itr.next();
            OMAttribute key = includeElem.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE,
                    "key"));

            if (key == null) {
                throw new SynapseException("Cannot use 'include' element without 'key'" +
                        " attribute for a script mediator");
            }

            String keyText = key.getAttributeValue();
            includeKeysMap.put(keyText, null);
View Full Code Here


        if (function != null) {
            this.function = function;
        }
        initScriptEngine();
        if (!(scriptEngine instanceof Invocable)) {
            throw new SynapseException("Script engine is not an Invocable" +
                    " engine for language: " + language);
        }
        invocableScript = (Invocable) scriptEngine;
    }
View Full Code Here

                            "in-lined script would be evaluated on each invocation..");
                }
            }

        } catch (ScriptException e) {
            throw new SynapseException("Exception initializing inline script", e);
        }
    }
View Full Code Here

        return scriptSourceCode;
    }

    private void handleException(String msg) {
        log.error(msg);
        throw new SynapseException(msg);
    }
View Full Code Here

                log.debug("Content type :" + type);
            }
            this.type = type;
        } catch (ParseException e) {
            String msg = "Invalid content-type ' " + type + " '";
            throw new SynapseException(msg, e);
        }
    }
View Full Code Here

        File synapseConfigLocation = new File(configFile);
        if (!synapseConfigLocation.exists()) {
            String message = "Unable to load the Synapse configuration from : "
                    + configFile + ". Specified file not found";
            log.fatal(message);
            throw new SynapseException(message);
        }

        SynapseConfiguration synCfg = null;
        if (synapseConfigLocation.isFile()) {
            // build the Synapse configuration parsing the XML config file
            try {
                synCfg = XMLConfigurationBuilder.getConfiguration(
                        new FileInputStream(configFile), properties);
                log.info("Loaded Synapse configuration from : " + configFile);
            } catch (Exception e) {
                handleException("Could not initialize Synapse : " + e.getMessage(), e);
            }

        } else if (synapseConfigLocation.isDirectory()) {
            // build the Synapse configuration by processing given directory hierarchy
            try {
                synCfg = MultiXMLConfigurationBuilder.getConfiguration(configFile, properties);
                log.info("Loaded Synapse configuration from the artifact " +
                        "repository at : " + configFile);
            } catch (XMLStreamException e) {
                handleException("Could not initialize Synapse : " + e.getMessage(), e);
            }
        }

        assert synCfg != null;
        synCfg.setPathToConfigFile(new File(configFile).getAbsolutePath());
        Registry localConfigReg = synCfg.getRegistry();
        if (synCfg.getLocalRegistry().isEmpty() && synCfg.getProxyServices().isEmpty()
                && localConfigReg != null) {
            if (log.isDebugEnabled()) {
                log.debug("Only the registry is defined in the synapse configuration, trying " +
                        "to fetch a configuration from the registry");
            }
            // TODO: support a artifact repo for registry as well instead of just the synapse.xml
            OMNode remoteConfigNode = localConfigReg.lookup("synapse.xml");
            if (remoteConfigNode != null) {
                try {
                    synCfg = XMLConfigurationBuilder.getConfiguration(SynapseConfigUtils
                            .getStreamSource(remoteConfigNode).getInputStream(), properties);
                    // TODO: when you fetch the configuration and serialize the config in any case
                    // TODO: the remote config is serialized to the synapse.xml we should prevent
                    // TODO: that, and should serialize the config to the registry
                    if (synCfg.getRegistry() == null) {
                        synCfg.setRegistry(localConfigReg);
                    } else {
                        log.warn("Registry declaration has been overwriten by the registry " +
                                "declaration found at the remote configuration");
                    }
                } catch (XMLStreamException xse) {
                    throw new SynapseException("Problem loading remote synapse.xml ", xse);
                }
            } else if (log.isDebugEnabled()) {
                log.debug("Couldn't find a synapse configuration on the registry");
            }
        }
View Full Code Here

        return synCfg;
    }

    private static void handleException(String msg, Exception e) {
        log.error(msg, e);
        throw new SynapseException(msg, e);
    }
View Full Code Here

        return type == REMOTE_ENTRY;
    }

    private void handleException(String msg) {
        log.error(msg);
        throw new SynapseException(msg);
    }
View Full Code Here

        }

        if (connectionsMap == null) {
            String msg = "Connections map not found.";
            log.error(msg);
            throw new SynapseException(msg);
        }

        for (WeightedState state : list) {
            String key = state.getKeyToConnectionCount();
            AtomicInteger integer = (AtomicInteger) connectionsMap.get(key);
View Full Code Here

     *
     * @param msg The error message
     */
    private static void handleException(String msg) {
        log.error(msg);
        throw new SynapseException(msg);
    }
View Full Code Here

TOP

Related Classes of org.apache.synapse.SynapseException

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.