Package org.apache.synapse.config

Examples of org.apache.synapse.config.Entry


                    String name = sequenceMediator.getName();
                    if (name != null) {
                        sequenceList.add(name);
                    }
                } else if (entryValue instanceof Entry) {
                    Entry entry = (Entry) entryValue;
                   
                    if (!entry.isDynamic() && !entry.isRemote()) { // only care pre-defined local entries
                        String key = entry.getKey();
                        if (SynapseConstants.SERVER_IP.equals(key)
                                || SynapseConstants.SERVER_HOST.equals(key)) {
                            continue;
                        }
                        entryList.add(key);
View Full Code Here


            Registry registry = synConfig.getRegistry();
            if (registry != null) {
                if (registry.getRegistryEntry(key).getType() == null) {
                    handleException("No resource is available by the key '" + key + "'");
                }
                return (OMElement) registry.getResource(new Entry(key),
                        getSynapseConfiguration().getProperties());
            } else {
                handleException("Unable to access the registry instance for the ESB");
            }
        } finally {
View Full Code Here

        if (smooks == null) {
            // this is a creation case
            return true;
        } else {
            // build transformer - if necessary
            Entry dp = synCfg.getEntryDefinition(configKey);
            // if the smooks config key refers to a dynamic resource, and if it has been expired
            // it is a recreation case
            boolean shouldRecreate = dp != null && dp.isDynamic() && (!dp.isCached() || dp.isExpired());
            if (shouldRecreate) {
                // we should clear all the existing resources
                smooks.close();
            }
            return shouldRecreate;
View Full Code Here

                if (endpoint.getFileName() == null) {
                    OMElement endpointElem = EndpointSerializer.getElementFromEndpoint(endpoint);
                    definitions.addChild(endpointElem);
                }
            } else if (o instanceof Entry) {
                Entry entry = (Entry) o;
                if (entry.getFileName() == null) {
                    if ((SynapseConstants.SERVER_HOST.equals(entry.getKey())
                            || SynapseConstants.SERVER_IP.equals(entry.getKey()))
                            || entry.getType() == Entry.REMOTE_ENTRY) {
                        continue;
                    }

                    EntrySerializer.serializeEntry(entry, definitions);
                }
View Full Code Here

        } else if (o instanceof Template) {
            return serializeTemplate((Template) o, synapseConfig, parent);
        } else if (o instanceof Endpoint) {
            return serializeEndpoint((Endpoint) o, synapseConfig, parent);
        } else if (o instanceof Entry) {
            Entry entry = (Entry) o;
            if ((SynapseConstants.SERVER_HOST.equals(entry.getKey())
                    || SynapseConstants.SERVER_IP.equals(entry.getKey()))
                    || entry.getType() == Entry.REMOTE_ENTRY) {
                return null;
            }

            File entriesDir = createDirectory(currentDirectory,
                    MultiXMLConfigurationBuilder.LOCAL_ENTRY_DIR);
            OMElement entryElem = EntrySerializer.serializeEntry(entry, null);

            String fileName = entry.getFileName();
            if (fileName != null) {
                if (currentDirectory == rootDirectory) {
                    handleDeployment(entriesDir, fileName, entry.getKey(),
                            synapseConfig.getArtifactDeploymentStore());
                }
                File entryFile  = new File(entriesDir, fileName);
                writeToFile(entryElem, entryFile);
            } else if (parent != null) {
View Full Code Here

        if (cachedTemplatesMap.isEmpty() || !cachedTemplatesMap.containsKey(generatedXsltKey)) {
            // this is a creation case
            return true;
        } else {
            // build transformer - if necessary
            Entry dp = synCtx.getConfiguration().getEntryDefinition(generatedXsltKey);
            // if the xsltKey refers to a dynamic resource, and if it has been expired
            // it is a recreation case
            return dp != null && dp.isDynamic() && (!dp.isCached() || dp.isExpired());
        }
    }
View Full Code Here

            Iterator entryDefinitions = FileUtils.iterateFiles(localEntriesDir, extensions, false);
            while (entryDefinitions.hasNext()) {
                File file = (File) entryDefinitions.next();
                OMElement document = getOMElement(file);
                Entry entry = SynapseXMLConfigurationFactory.defineEntry(synapseConfig, document,
                        properties);
                if (entry != null) {
                    entry.setFileName(file.getName());
                    synapseConfig.getArtifactDeploymentStore().addArtifact(file.getAbsolutePath(),
                            entry.getKey());
                }
             }
        }
    }
View Full Code Here

                return;
            }

            for (RegistryResourceEntry key : registryResources) {
                if (state == State.ACTIVE) {
                    Entry entry = synapseConfiguration.getEntryDefinition(key.getPath());

                    if (entry == null) {
                        log.warn("A non remote entry has being specified: " + key.getPath());
                        return;
                    }

                    if (key.getType().equals(SEQUENCE)) {
                        entry.setMapper(MediatorFactoryFinder.getInstance());
                    } else if (key.getType().equals(ENDPOINT)) {
                        entry.setMapper(XMLToEndpointMapper.getInstance());
                    }

                    fetchEntry(key.getPath());
                }
            }
View Full Code Here

    private void fetchEntry(String key) {
        Map localRegistry = synapseConfiguration.getLocalRegistry();

        Object o = localRegistry.get(key);
        if (o != null && o instanceof Entry) {
            Entry entry = (Entry) o;

            // This must be a dynamic entry whose cache has expired or which is not cached at all
            // A registry lookup is in order
            if (registry != null) {
                if (entry.isCached()) {
                    try {
                        Object resource = getResource(entry, synapseConfiguration.getProperties());
                        if (resource == null) {
                            log.warn("Failed to load the resource at the first time, " +
                                    "non-existing resource: " + key);
                        } else {
                            entry.setExpiryTime(Long.MAX_VALUE);
                        }
                        onSuccess();
                    } catch (Exception e) {
                        // Error occured while loading the resource from the registry
                        // Fall back to the cached value - Do not increase the expiry time
                        log.warn("Error while loading the resource " + key + " from the remote " +
                                "registry. Previously cached value will be used. Check the " +
                                "registry accessibility.");
                        onError();
                    }
                } else {
                    try {
                        // Resource not available in the cache - Must load from the registry
                        // No fall backs possible here!!
                        Object resource = getResource(entry, synapseConfiguration.getProperties());
                        if (resource == null) {
                            log.warn("Failed to load the resource at the first time, " +
                                    "non-existing resource: " + key);
                        } else {
                            entry.setExpiryTime(Long.MAX_VALUE);
                        }
                    } catch (Exception e) {
                        // failed to get the resource for the first time
                        log.warn("Failed to load the resource at the first time, " +
                                "non-existing resource: " + key);
                    }
                }
            } else {
                if (entry.isCached()) {
                    // Fall back to the cached value
                    log.warn("The registry is no longer available in the Synapse configuration. " +
                            "Using the previously cached value for the resource : " + key);
                } else {
                    if (log.isDebugEnabled()) {
View Full Code Here

        return proxy;
    }

    public static Entry defineEntry(SynapseConfiguration config, OMElement elem,
                                    Properties properties) {
        Entry entry = null;

        try {
            entry = EntryFactory.createEntry(elem, properties);
            if (entry != null) {
                config.addEntry(entry.getKey(), entry);
            }
        } catch (Exception e) {
            String msg = "Local entry configuration: " + elem.getAttributeValue((
                    new QName(XMLConfigConstants.NULL_NAMESPACE, "key"))) + " cannot be built";
            handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_LOCALENTRIES, msg, e);
View Full Code Here

TOP

Related Classes of org.apache.synapse.config.Entry

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.