Package org.apache.oodt.cas.pushpull.filerestrictions

Examples of org.apache.oodt.cas.pushpull.filerestrictions.VirtualFile


        // modify vfs to be root based if HOME directory based
        if (!vfs.isRootBased()) {
            String homeDirPath = frs.getHomeDir(remoteSite).getProtocolPath()
                    .getPathString();
            VirtualFile root = new VirtualFile(homeDirPath, true);
            root.addChild(vfs.getRootVirtualFile());
            vfs = new VirtualFileStructure(homeDirPath + "/"
                    + vfs.getPathToRoot(), root.getRootDir());
            frs.changeToHOME(remoteSite);
        }

        // initialize variables
        final String initialCdPath = vfs.getPathToRoot();
        final VirtualFile vf = vfs.getRootVirtualFile();

        // change to initial directory (takes care of Linux auto-mounting)
        frs.changeToDir(initialCdPath, remoteSite);

        // add starting directory to stack
View Full Code Here


    public VirtualFileStructure parse(FileInputStream xmlFile)
            throws ParserException {
        try {
            String initialCdDir = "/";
            VirtualFile root = null;
            NodeList list = (DocumentBuilderFactory.newInstance()
                    .newDocumentBuilder().parse(new InputSource(xmlFile)))
                    .getDocumentElement().getChildNodes();
            VirtualFile currentFile = null;
            for (int i = 0; i < list.getLength(); i++) {
                Node node = list.item(i);
                if (node.getNodeName().equals("dirstruct")) {

                    // parse out starting path
                    String startingPath = ((Element) node)
                            .getAttribute("starting_path");
                    if (startingPath != null) {
                        root = (currentFile = new VirtualFile(
                                initialCdDir = startingPath, true))
                                .getRootDir();
                        VirtualFile temp = currentFile.getParentFile();
                        while (temp != null) {
                            temp.setNoDirs(true);
                            temp.setNoFiles(true);
                            temp = temp.getParentFile();
                        }
                    } else {
                        currentFile = root = VirtualFile.createRootDir();
                    }
View Full Code Here

        for (int i = 0; i < list.getLength(); i++) {
            Node dir = list.item(i);
            if (dir.getNodeName().equals("dir")) {
                String dirName = replaceVariablesAndMethods(((Element) dir)
                        .getAttribute("name"));
                currentLoadFile.addChild(new VirtualFile(dirName, true));
                NodeList children;
                if ((children = dir.getChildNodes()).getLength() > 0) {
                    parseDirstructXML(children, currentLoadFile.getChild(
                            dirName, true));
                }
            } else if (dir.getNodeName().equals("nodirs")) {
                currentLoadFile.setNoDirs(true);
            } else if (dir.getNodeName().equals("nofiles")) {
                currentLoadFile.setNoFiles(true);
            } else if (dir.getNodeName().equals("file")) {
                VirtualFile vf = new VirtualFile(
                        replaceVariablesAndMethods(((Element) dir)
                                .getAttribute("name")), false);
                vf.setNoDirs(true);
                currentLoadFile.addChild(vf);
            }
        }
    }
View Full Code Here

  public FileListParser() {}
 
    public VirtualFileStructure parse(FileInputStream inputFile)
            throws ParserException {
        Scanner scanner = new Scanner(inputFile);
        VirtualFile root = VirtualFile.createRootDir();
        String initialCdDir = "/";
        if (scanner.hasNextLine()) {
            initialCdDir = scanner.nextLine();
            while (scanner.hasNextLine()) {
                new VirtualFile(root, initialCdDir + "/" + scanner.nextLine(),
                        false);
            }
        }
        return new VirtualFileStructure(initialCdDir, root);
    }
View Full Code Here

    public ClassNoaaEmailParser() {}

    public VirtualFileStructure parse(FileInputStream emailFile)
            throws ParserException {
        try {
            VirtualFile root = VirtualFile.createRootDir();
            Scanner s = new Scanner(emailFile);
            StringBuffer sb = new StringBuffer("");
            while (s.hasNextLine())
                sb.append(s.nextLine() + "\n");

            if (!validEmail(sb.toString()))
                throw new ParserException(
                        "Email not a IASI data processed notification email");

            Pattern cdPattern = Pattern.compile("\\s*cd\\s{1,}.{1,}?(?:\\s|$)");
            Matcher cdMatcher = cdPattern.matcher(sb);
            Pattern getPattern = Pattern.compile("\\s*get\\s{1,}.{1,}?(?:\\s|$)");
            Matcher getMatcher = getPattern.matcher(sb);
           
            VirtualFile vf = null;
            while (cdMatcher.find() && getMatcher.find()) {
                String cdCommand = sb.substring(cdMatcher.start(), cdMatcher.end());
                String directory = cdCommand.trim().split(" ")[1];

                vf = new VirtualFile(root, directory, true);
                vf.setNoDirs(true);

                String getCommand = sb.substring(getMatcher.start(), getMatcher.end());
                String file = getCommand.trim().split(" ")[1];

                if (file.endsWith("*")) {
                    vf.addChild(new VirtualFile(file.substring(0,
                            file.length() - 1), false));
                    vf.addChild(new VirtualFile(file.substring(0,
                            file.length() - 1)
                            + ".sig", false));
                } else {
                    vf.addChild(new VirtualFile(file, false));
                }
            }

            Pattern ftpPattern = Pattern.compile("\\sftp\\..*?\\s");
            Matcher ftpMatcher = ftpPattern.matcher(sb);
View Full Code Here

  @Override
  public VirtualFileStructure parse(FileInputStream emailFile) throws ParserException {
    log.info("GenericEmailParser is parsing email: " + emailFile);

    VirtualFile root = VirtualFile.createRootDir();

    String emailText = readEmail(emailFile);
    if (!isValidEmail(emailText)) {
      throw new ParserException("Failed to find check for pattern in email: " + checkForPattern);
    }
    List<String> filePaths = generateFilePaths(emailText);

    for (String filePath : filePaths) {
      new VirtualFile(root, pathToRoot + filePath, false);
    }

    return new VirtualFileStructure("/", root);
  }
View Full Code Here

            remoteSite = di.getRemoteSite();

        // modify vfs to be root based if HOME directory based
        if (!vfs.isRootBased()) {
            String homeDirPath = frs.getHomeDir(remoteSite).getPath();
            VirtualFile root = new VirtualFile(homeDirPath, true);
            root.addChild(vfs.getRootVirtualFile());
            vfs = new VirtualFileStructure(homeDirPath + "/"
                    + vfs.getPathToRoot(), root.getRootDir());
            frs.changeToHOME(remoteSite);
        }

        // initialize variables
        final String initialCdPath = vfs.getPathToRoot();
        final VirtualFile vf = vfs.getRootVirtualFile();

        // change to initial directory (takes care of Linux auto-mounting)
        frs.changeToDir(initialCdPath, remoteSite);

        // add starting directory to stack
View Full Code Here

    public VirtualFileStructure parse(FileInputStream xmlFile)
            throws ParserException {
        try {
            String initialCdDir = "/";
            VirtualFile root = null;
            NodeList list = (DocumentBuilderFactory.newInstance()
                    .newDocumentBuilder().parse(new InputSource(xmlFile)))
                    .getDocumentElement().getChildNodes();
            VirtualFile currentFile = null;
            for (int i = 0; i < list.getLength(); i++) {
                Node node = list.item(i);
                if (node.getNodeName().equals("dirstruct")) {

                    // parse out starting path
                    String startingPath = ((Element) node)
                            .getAttribute("starting_path");
                    if (startingPath != null) {
                        root = (currentFile = new VirtualFile(
                                initialCdDir = startingPath, true))
                                .getRootDir();
                        VirtualFile temp = currentFile.getParentFile();
                        while (temp != null) {
                            temp.setNoDirs(true);
                            temp.setNoFiles(true);
                            temp = temp.getParentFile();
                        }
                    } else {
                        currentFile = root = VirtualFile.createRootDir();
                    }
View Full Code Here

        for (int i = 0; i < list.getLength(); i++) {
            Node dir = list.item(i);
            if (dir.getNodeName().equals("dir")) {
                String dirName = replaceVariablesAndMethods(((Element) dir)
                        .getAttribute("name"));
                currentLoadFile.addChild(new VirtualFile(dirName, true));
                NodeList children;
                if ((children = dir.getChildNodes()).getLength() > 0) {
                    parseDirstructXML(children, currentLoadFile.getChild(
                            dirName, true));
                }
            } else if (dir.getNodeName().equals("nodirs")) {
                currentLoadFile.setNoDirs(true);
            } else if (dir.getNodeName().equals("nofiles")) {
                currentLoadFile.setNoFiles(true);
            } else if (dir.getNodeName().equals("file")) {
                VirtualFile vf = new VirtualFile(
                        replaceVariablesAndMethods(((Element) dir)
                                .getAttribute("name")), false);
                vf.setNoDirs(true);
                currentLoadFile.addChild(vf);
            }
        }
    }
View Full Code Here

            remoteSite = di.getRemoteSite();

        // modify vfs to be root based if HOME directory based
        if (!vfs.isRootBased()) {
            String homeDirPath = frs.getHomeDir(remoteSite).getPath();
            VirtualFile root = new VirtualFile(homeDirPath, true);
            root.addChild(vfs.getRootVirtualFile());
            vfs = new VirtualFileStructure(homeDirPath + "/"
                    + vfs.getPathToRoot(), root.getRootDir());
            frs.changeToHOME(remoteSite);
        }

        // initialize variables
        final String initialCdPath = vfs.getPathToRoot();
        final VirtualFile vf = vfs.getRootVirtualFile();

        // change to initial directory (takes care of Linux auto-mounting)
        frs.changeToDir(initialCdPath, remoteSite);

        // add starting directory to stack
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.pushpull.filerestrictions.VirtualFile

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.