Package org.apache.synapse.registry

Examples of org.apache.synapse.registry.RegistryEntryImpl


                log.debug("Cannot create a URLConnection for given URL : " + url);
            }
            return null;
        }

        RegistryEntryImpl wre = new RegistryEntryImpl();
        wre.setKey(key);
        wre.setName(url.getFile());
        wre.setType(connection.getContentType());
        wre.setDescription("Resource at : " + url.toString());
        wre.setLastModified(connection.getLastModified());
        wre.setVersion(connection.getLastModified());
        if (connection.getExpiration() > 0) {
            wre.setCachableDuration(
                    connection.getExpiration() - System.currentTimeMillis());
        } else {
            wre.setCachableDuration(getCachableDuration());
        }
        return wre;
    }
View Full Code Here


    }

    public RegistryEntry[] getChildren(RegistryEntry entry) {
        URL url;
        if (entry == null) {
            RegistryEntryImpl entryImpl = new RegistryEntryImpl();
            entryImpl.setKey("");
            entry = entryImpl;
        }
        url = SynapseConfigUtils.getURLFromPath(root + entry.getKey(), properties.get(
                SynapseConstants.SYNAPSE_HOME) != null ?
                properties.get(SynapseConstants.SYNAPSE_HOME).toString() : "");
        if (url == null) {
            return null;
        }
        if (url.getProtocol().equals("file")) {

            File file = new File(url.getFile());
            if (!file.isDirectory()) {
                return null;
            }
            BufferedReader reader = null;
            try {
                reader = new BufferedReader(new InputStreamReader((InputStream) url.getContent()));
                ArrayList<RegistryEntry> entryList = new ArrayList<RegistryEntry>();
                String key;
                while ((key = reader.readLine()) != null) {
                    RegistryEntryImpl registryEntryImpl = new RegistryEntryImpl();
                    if (entry.getKey().equals("")) {
                        registryEntryImpl.setKey(key);
                    } else {
                        if (entry.getKey().endsWith("/")) {
                            registryEntryImpl.setKey(entry.getKey() + key);
                        } else {
                            registryEntryImpl.setKey(entry.getKey() + "/" + key);
                        }
                    }

                    entryList.add(registryEntryImpl);
                }
View Full Code Here

                log.debug("Cannot create a URLConnection for given URL : " + url);
            }
            return null;
        }

        RegistryEntryImpl wre = new RegistryEntryImpl();
        wre.setKey(key);
        wre.setName(url.getFile());
        wre.setType(connection.getContentType());
        wre.setDescription("Resource at : " + url.toString());
        wre.setLastModified(connection.getLastModified());
        wre.setVersion(connection.getLastModified());
        if (connection.getExpiration() > 0) {
            wre.setCachableDuration(
                    connection.getExpiration() - System.currentTimeMillis());
        } else {
            wre.setCachableDuration(getCachableDuration());
        }
        return wre;
    }
View Full Code Here

    }

    public RegistryEntry[] getChildren(RegistryEntry entry) {
        URL url;
        if (entry == null) {
            RegistryEntryImpl entryImpl = new RegistryEntryImpl();
            entryImpl.setKey("");
            entry = entryImpl;
        }
        url = SynapseConfigUtils.getURLFromPath(root + entry.getKey(), properties.get(
                SynapseConstants.SYNAPSE_HOME) != null ?
                properties.get(SynapseConstants.SYNAPSE_HOME).toString() : "");
        if (url == null) {
            return null;
        }
        if (url.getProtocol().equals("file")) {

            File file = new File(url.getFile());
            if (!file.isDirectory()) {
                return null;
            }
            BufferedReader reader = null;
            try {
                reader = new BufferedReader(new InputStreamReader((InputStream) url.getContent()));
                ArrayList<RegistryEntry> entryList = new ArrayList<RegistryEntry>();
                String key;
                while ((key = reader.readLine()) != null) {
                    RegistryEntryImpl registryEntryImpl = new RegistryEntryImpl();
                    if (entry.getKey().equals("")) {
                        registryEntryImpl.setKey(key);
                    } else {
                        if (entry.getKey().endsWith("/")) {
                            registryEntryImpl.setKey(entry.getKey() + key);
                        } else {
                            registryEntryImpl.setKey(entry.getKey() + "/" + key);
                        }
                    }

                    entryList.add(registryEntryImpl);
                }
View Full Code Here

            }
            URLConnection urlc = url.openConnection();
            urlc.setReadTimeout(30000);
            urlc.setRequestProperty("Connection", "Close");

            RegistryEntryImpl wre = new RegistryEntryImpl();
            wre.setKey(key);
            wre.setName(url.getFile());
            wre.setType(new URI(urlc.getContentType()));
            wre.setDescription("Resource at : " + url.toString());
            wre.setLastModified(urlc.getLastModified());
            wre.setVersion(urlc.getLastModified());
            if (urlc.getExpiration() > 0) {
                wre.setCachableDuration(
                        urlc.getExpiration() - System.currentTimeMillis());
            } else {
                wre.setCachableDuration(getCachableDuration(key));
            }
            return wre;

        } catch (MalformedURLException e) {
            handleException("Invalid URL reference " + root + key, e);
View Full Code Here

    }

    public RegistryEntry[] getChildren(RegistryEntry entry) {
        URL url;
        if (entry == null) {
            RegistryEntryImpl entryImpl = new RegistryEntryImpl();
            entryImpl.setKey("");
            entry = entryImpl;
        }
        url = SynapseConfigUtils.getURLFromPath(root + entry.getKey());
        if (url == null) {
            return null;
        }
        if (url.getProtocol().equals("file")) {

            File file = new File(url.getFile());
            if (!file.isDirectory()) {
                return null;
            }
            InputStream inStream = null;
            try {
                inStream = (InputStream) url.getContent();

                BufferedReader reader = new BufferedReader(new InputStreamReader(inStream));
                ArrayList entryList = new ArrayList();
                String key = "";
                while ((key = reader.readLine()) != null) {
                    RegistryEntryImpl registryEntryImpl = new RegistryEntryImpl();
                    if (entry.getKey().equals("")) {
                        registryEntryImpl.setKey(key);
                    } else {
                        if (entry.getKey().endsWith("/")) {
                            registryEntryImpl.setKey(entry.getKey() + key);
                        } else {
                            registryEntryImpl.setKey(entry.getKey() + "/" + key);
                        }
                    }

                    entryList.add(registryEntryImpl);
                }
View Full Code Here

TOP

Related Classes of org.apache.synapse.registry.RegistryEntryImpl

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.