Package org.apache.oodt.cas.pushpull.protocol

Examples of org.apache.oodt.cas.pushpull.protocol.RemoteSite


    // ***************DaemonInfo******************

    // ***************DataFilesInfo*******************
    public String getDataFilesRemoteSite() {
        RemoteSite remoteSite = this.daemonInfo.getDataFilesInfo()
                .getDownloadInfo().getRemoteSite();
        return (remoteSite == null) ? "" : remoteSite.toString();
    }
View Full Code Here


    // **************DataFilesInfo********************

    // **************PropFilesInfo********************
    public String getPropertyFilesRemoteSite() {
        RemoteSite remoteSite = this.daemonInfo.getPropFilesInfo()
                .getDownloadInfo().getRemoteSite();
        return (remoteSite == null) ? "" : remoteSite.toString();
    }
View Full Code Here

    public LinkedList<RemoteSite> getPossibleRemoteSites(String alias, URL url,
            String username, String password) {
        LinkedList<RemoteSite> remoteSites = new LinkedList<RemoteSite>();
        if (alias != null) {
            RemoteSite rs = this.aliasAndRemoteSite.get(alias);
            if (rs != null)
                remoteSites.add(rs);
            else if (url != null && username != null & password != null)
                remoteSites.add(new RemoteSite(alias, url, username, password));
        } else if (url != null) {
            Set<Entry<String, RemoteSite>> set = this.aliasAndRemoteSite
                    .entrySet();
            for (Entry<String, RemoteSite> entry : set) {
                RemoteSite rs = entry.getValue();
                if (rs.getURL().equals(url)
                        && (username == null || rs.getUsername().equals(
                                username))
                        && (password == null || rs.getPassword().equals(
                                password)))
                    remoteSites.add(rs);
            }
            if (remoteSites.size() == 0) {
                if (url != null && username != null && password != null)
                    remoteSites.add(new RemoteSite(url.toString(), url,
                            username, password));
            }
        } else if (username != null) {
            Set<Entry<String, RemoteSite>> set = this.aliasAndRemoteSite
                    .entrySet();
            for (Entry<String, RemoteSite> entry : set) {
                RemoteSite rs = entry.getValue();
                if (rs.getUsername().equals(username)
                        && (password == null || rs.getPassword().equals(
                                password)))
                    remoteSites.add(rs);
            }
        } else if (password != null) {
            Set<Entry<String, RemoteSite>> set = this.aliasAndRemoteSite
                    .entrySet();
            for (Entry<String, RemoteSite> entry : set) {
                RemoteSite rs = entry.getValue();
                if (rs.getPassword().equals(password))
                    remoteSites.add(rs);
            }
        }
        return remoteSites;
    }
View Full Code Here

            .getName());

    public void processPropFile(FileRetrievalSystem frs, Parser propFileParser,
            File propFile, DataFilesInfo dfi, DataFileToPropFileLinker linker)
            throws Exception {
        RemoteSite remoteSite = null;

        // parse property file
        VirtualFileStructure vfs = propFileParser.parse(new FileInputStream(
                propFile));
        DownloadInfo di = dfi.getDownloadInfo();
View Full Code Here

     * @throws ProtocolFileException
     */
    public void processPropFile(FileRetrievalSystem frs, Parser propFileParser,
            File propFile, DataFilesInfo dfi, DataFileToPropFileLinker linker)
            throws Exception {
        RemoteSite remoteSite;

        // parse property file
        VirtualFileStructure vfs = propFileParser.parse(new FileInputStream(
                propFile));

View Full Code Here

                // get site alias
                String siteAlias = PathUtils
                        .replaceEnvVariables(((Element) daemonNode)
                                .getAttribute(ALIAS_ATTR));
                RemoteSite dataFilesRemoteSite = this.siteInfo
                        .getSiteByAlias(siteAlias);
                if (dataFilesRemoteSite == null)
                    throw new ConfigException("Alias '" + siteAlias
                            + "' in SiteInfo file '"
                            + remoteSpecsFile.getAbsolutePath()
                            + "' has not been defined");

                // get RUNINFO element
                NodeList runInfoList = ((Element) daemonNode)
                        .getElementsByTagName(RUN_INFO_TAG);
                String firstRunDateTimeString = null, period = null, epsilon = null;
                boolean runOnReboot = false;
                if (runInfoList.getLength() > 0) {
                    Element runInfo = (Element) runInfoList.item(0);
                    firstRunDateTimeString = runInfo
                            .getAttribute(FIRSTRUN_DATETIME_ATTR);
                    period = runInfo.getAttribute(PERIOD_ATTR);
                    runOnReboot = (runInfo.getAttribute(RUNONREBOOT_ATTR)
                            .toLowerCase().equals("yes")) ? true : false;
                    epsilon = runInfo.getAttribute(EPSILON_ATTR);
                    if (epsilon.equals(""))
                        epsilon = "0s";
                }

                // get PROPINFO elements
                NodeList propInfoList = ((Element) daemonNode)
                        .getElementsByTagName(PROP_INFO_TAG);
                LinkedList<PropFilesInfo> pfiList = new LinkedList<PropFilesInfo>();
                PropFilesInfo pfi = null;
                if (propInfoList.getLength() > 0) {
                    Node propInfoNode = propInfoList.item(0);

                    // get directory where the property files are
                    File propertyFilesDir = new File(PathUtils
                            .replaceEnvVariables(((Element) propInfoNode)
                                    .getAttribute(DIR_ATTR)));

                    pfi = new PropFilesInfo(propertyFilesDir);

                    // get PROPFILES elements
                    NodeList propFilesList = ((Element) propInfoNode)
                            .getElementsByTagName(PROP_FILES_TAG);
                    String propFilesRegExp = null;
                    if (propFilesList.getLength() > 0) {
                        for (int k = 0; k < propFilesList.getLength(); k++) {
                            Node propFilesNode = propFilesList.item(k);
                            propFilesRegExp = ((Element) propFilesNode)
                                    .getAttribute(REG_EXP_ATTR);
                            pfi
                                    .addPropFiles(
                                            propFilesRegExp,
                                            PushPullObjectFactory
                                                    .createNewInstance((Class<Parser>) Class
                                                            .forName(PathUtils
                                                                    .replaceEnvVariables(((Element) propFilesNode)
                                                                            .getAttribute(PARSER_ATTR)))));
                        }
                    } else
                        throw new ConfigException(
                                "No propFiles element specified for deamon with alias '"
                                        + siteAlias + "' in RemoteSpecs file '"
                                        + remoteSpecsFile.getAbsolutePath()
                                        + "'");

                    // get DOWNLOADINFO element if given
                    NodeList downloadInfoList = ((Element) propInfoNode)
                            .getElementsByTagName(DOWNLOAD_INFO_TAG);
                    if (downloadInfoList.getLength() > 0) {
                        Node downloadInfo = downloadInfoList.item(0);
                        String propFilesAlias = PathUtils
                                .replaceEnvVariables(((Element) downloadInfo)
                                        .getAttribute(ALIAS_ATTR));
                        String propFilesRenamingConv = ((Element) downloadInfo)
                                .getAttribute(RENAMING_CONV_ATTR);
                        boolean allowAliasOverride = PathUtils
                                .replaceEnvVariables(
                                        ((Element) downloadInfo)
                                                .getAttribute(ALLOW_ALIAS_OVERRIDE_ATTR))
                                .equals("yes");
                        boolean deleteFromServer = PathUtils
                                .replaceEnvVariables(
                                        ((Element) downloadInfo)
                                                .getAttribute(DELETE_FROM_SERVER_ATTR))
                                .equals("yes");
                        RemoteSite propFilesRemoteSite = this.siteInfo
                                .getSiteByAlias(propFilesAlias);
                        if (propFilesRemoteSite == null)
                            throw new ConfigException("Alias '"
                                    + propFilesAlias
                                    + "' in RemoteSpecs file '"
View Full Code Here

                            cdTestDir = PathUtils.replaceEnvVariables(node
                                    .getTextContent());
                        }
                    }

                    this.siteInfo.addSite(new RemoteSite(alias, new URL(type
                            + "://" + host), username, password, cdTestDir));
                }
            }
        } catch (Exception e) {
            throw new ConfigException("Failed to load external source info : "
View Full Code Here

            throw new ProtocolException("Not a valid remote site " + remoteSite);
    }

    public void changeToDir(ProtocolFile pFile) throws ProtocolException,
            MalformedURLException {
        RemoteSite remoteSite = pFile.getRemoteSite();
        if (validate(remoteSite))
            protocolHandler.cd(protocolHandler.getAppropriateProtocolBySite(
                    remoteSite, true), pFile);
        else
            throw new ProtocolException("Not a valid remote site " + remoteSite);
View Full Code Here

        LinkedList<RemoteSite> remoteSites = this.siteInfo
                .getPossibleRemoteSites(remoteSite.getAlias(), remoteSite
                        .getURL(), remoteSite.getUsername(), remoteSite
                        .getPassword());
        if (remoteSites.size() == 1) {
            RemoteSite rs = remoteSites.get(0);
            remoteSite.copy(rs);
            return true;
        }
        return false;
    }
View Full Code Here

                }
            }

            Pattern ftpPattern = Pattern.compile("\\sftp\\..*?\\s");
            Matcher ftpMatcher = ftpPattern.matcher(sb);
            RemoteSite remoteSite = null;
            if (ftpMatcher.find()) {
                String ftpSite = sb.substring(ftpMatcher.start(), ftpMatcher.end()).trim();
                remoteSite = new RemoteSite(null, new URL("ftp://"
                        + ftpSite), "anonymous", System
                        .getenv("user.name")
                        + "@jpl.nasa.gov");
            }

View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.pushpull.protocol.RemoteSite

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.